commit 2a5eec5dfa291a760870ea410c67c679cbe58f7d Author: Hans-Christoph Steiner hans@eds.org Date: Fri Oct 25 11:25:38 2019 +0200
do not startForegroundService() if persistNotifications is false --- .../java/org/torproject/android/service/StartTorReceiver.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/orbotservice/src/main/java/org/torproject/android/service/StartTorReceiver.java b/orbotservice/src/main/java/org/torproject/android/service/StartTorReceiver.java index b6f96789..b10c97b6 100644 --- a/orbotservice/src/main/java/org/torproject/android/service/StartTorReceiver.java +++ b/orbotservice/src/main/java/org/torproject/android/service/StartTorReceiver.java @@ -21,13 +21,12 @@ public class StartTorReceiver extends BroadcastReceiver implements TorServiceCon if (Prefs.allowBackgroundStarts()) { Intent startTorIntent = new Intent(context, TorService.class); startTorIntent.setAction(action); - if (packageName != null) - startTorIntent.putExtra(EXTRA_PACKAGE_NAME, packageName); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - context.startForegroundService(startTorIntent); + if (packageName != null) { + startTorIntent.putExtra(TorService.EXTRA_PACKAGE_NAME, packageName); } - else - { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && Prefs.persistNotifications()) { + context.startForegroundService(startTorIntent); + } else { context.startService(startTorIntent); } } else if (!TextUtils.isEmpty(packageName)) {