[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [orbot/master] make sure we handle foreground notifications properly



commit fa017cf3759fee2405288c6d529eceee60be632c
Author: n8fr8 <nathan@xxxxxxxxxxx>
Date:   Sat May 12 00:25:45 2018 -0400

    make sure we handle foreground notifications properly
---
 .../java/org/torproject/android/service/TorService.java   | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/orbotservice/src/main/java/org/torproject/android/service/TorService.java b/orbotservice/src/main/java/org/torproject/android/service/TorService.java
index 5ad9955c..f63eb255 100644
--- a/orbotservice/src/main/java/org/torproject/android/service/TorService.java
+++ b/orbotservice/src/main/java/org/torproject/android/service/TorService.java
@@ -368,8 +368,12 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
             expandedView.setOnClickPendingIntent(R.id.action_refresh,pendingIntent);
             mNotification.bigContentView = expandedView;
         }
-        
-        if (Prefs.persistNotifications() && (!mNotificationShowing))
+
+
+         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+             startForeground(NOTIFY_ID, mNotification);
+         }
+         else if (Prefs.persistNotifications() && (!mNotificationShowing))
         {
             startForeground(NOTIFY_ID, mNotification);
             logNotice("Set background service to FOREGROUND");
@@ -644,13 +648,12 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
             boolean success = installer.installResources();
             
             if (success)
-                prefs.edit().putString(PREF_BINARY_TOR_VERSION_INSTALLED,BINARY_TOR_VERSION).commit();
-
+                prefs.edit().putString(PREF_BINARY_TOR_VERSION_INSTALLED,BINARY_TOR_VERSION).apply();
 
-            OtherResourceInstaller oInstaller = new OtherResourceInstaller(this, appBinHome);
-            oInstaller.installResources();
         }
 
+        OtherResourceInstaller oInstaller = new OtherResourceInstaller(this, appBinHome);
+        oInstaller.installResources();
 
         updateTorConfigFile ();
         isTorUpgradeAndConfigComplete = true;



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits