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

[tor-commits] [orbot/master] Fixed some random compiler warnings, while reading through the code.



commit 80e92e9d4e0bb55a986b4dff63d225cc4a0e4134
Author: Benjamin Erhart <berhart@xxxxxxxxxxxxxxxxxxx>
Date:   Tue Nov 16 13:09:21 2021 +0100

    Fixed some random compiler warnings, while reading through the code.
---
 app/src/main/AndroidManifest.xml                            | 13 +++++++++----
 .../java/org/torproject/android/service/OrbotService.java   |  8 ++++++--
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3779e386..9e8a452a 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -44,7 +44,8 @@
         <activity
             android:name=".OrbotMainActivity"
             android:excludeFromRecents="false"
-            android:launchMode="singleTop">
+            android:launchMode="singleTop"
+            android:exported="true">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />
@@ -70,8 +71,9 @@
 
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
-        </activity> <!-- This is for ensuring the background service still runs when/if the app is swiped away -->
+        </activity>
 
+        <!-- This is for ensuring the background service still runs when/if the app is swiped away -->
         <activity
             android:name=".service.util.DummyActivity"
             android:allowTaskReparenting="true"
@@ -160,7 +162,9 @@
             android:name=".core.OnBootReceiver"
             android:enabled="true"
             android:exported="true">
-            <intent-filter android:directBootAware="true">
+
+            <intent-filter android:directBootAware="true"
+                tools:targetApi="n">
                 <action android:name="android.intent.action.BOOT_COMPLETED" />
                 <action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
                 <action android:name="android.intent.action.QUICKBOOT_POWERON" />
@@ -172,7 +176,8 @@
             android:name=".service.OrbotService"
             android:enabled="true"
             android:permission="android.permission.BIND_VPN_SERVICE"
-            android:stopWithTask="false">
+            android:stopWithTask="false"
+            android:exported="true">
             <intent-filter>
                 <action android:name="android.net.VpnService" />
             </intent-filter>
diff --git a/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java b/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java
index 280d26e3..2f189a08 100644
--- a/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java
+++ b/orbotservice/src/main/java/org/torproject/android/service/OrbotService.java
@@ -74,6 +74,8 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.TimeoutException;
 
 import IPtProxy.IPtProxy;
+
+import androidx.annotation.ChecksSdkIntAtLeast;
 import androidx.annotation.RequiresApi;
 import androidx.core.app.NotificationCompat;
 import androidx.localbroadcastmanager.content.LocalBroadcastManager;
@@ -110,6 +112,7 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
     public static File appBinHome;
     public static File appCacheHome;
     private final ExecutorService mExecutor = Executors.newCachedThreadPool();
+    @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.LOLLIPOP)
     boolean mIsLollipop = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
     TorEventHandler mEventHandler;
     OrbotVpnManager mVpnManager;
@@ -425,6 +428,7 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
         }
     }
 
+    @SuppressWarnings("ResultOfMethodCallIgnored")
     @Override
     public void onCreate() {
         super.onCreate();
@@ -632,7 +636,7 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
         return portString;
     }
 
-    public boolean updateTorConfigCustom(File fileTorRcCustom, String extraLines) throws IOException, TimeoutException {
+    public boolean updateTorConfigCustom(File fileTorRcCustom, String extraLines) throws IOException {
         FileWriter fos = new FileWriter(fileTorRcCustom, false);
         PrintWriter ps = new PrintWriter(fos);
         ps.print(extraLines);
@@ -1328,7 +1332,7 @@ public class OrbotService extends VpnService implements TorServiceConstants, Orb
                     Bridge b = new Bridge();
                     b.type = st.nextToken();
 
-                    StringBuffer sbConfig = new StringBuffer();
+                    StringBuilder sbConfig = new StringBuilder();
 
                     while (st.hasMoreTokens())
                         sbConfig.append(st.nextToken()).append(' ');



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