Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import android.content.Intent;
import android.text.format.Formatter;

import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat;

public class ServiceWatcherUtil {
Expand Down Expand Up @@ -194,15 +195,15 @@ public void stopWatch() {
* closed as there are higher chances for android system to GC the thread when it is running low
* on memory
*/
public static synchronized void runService(final Context context, final Intent intent) {
public static synchronized void runService(@Nullable final Context context, final Intent intent) {
switch (pendingIntents.size()) {
case 0:
context.startService(intent);
if (context != null) context.startService(intent);
break;
case 1:
// initialize waiting handlers
pendingIntents.add(intent);
postWaiting(context);
if (context != null) postWaiting(context);
break;
case 2:
// to avoid notifying repeatedly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static void decryptFile(
(dialog, which) -> {
AppCompatEditText editText = dialog.getView().findViewById(R.id.singleedittext_input);
decryptIntent.putExtra(EncryptService.TAG_PASSWORD, editText.getText().toString());
ServiceWatcherUtil.runService(main.getContext(), decryptIntent);
ServiceWatcherUtil.runService(c, decryptIntent);
dialog.dismiss();
},
null);
Expand All @@ -142,7 +142,7 @@ public static void decryptFile(
new DecryptButtonCallbackInterface() {
@Override
public void confirm(Intent intent) {
ServiceWatcherUtil.runService(main.getContext(), intent);
ServiceWatcherUtil.runService(c, intent);
}

@Override
Expand Down