summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-03-24 14:04:13 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2020-03-24 14:17:15 -0600
commit585257c995e2a76d693903edc30d65f9e5d48a98 (patch)
treea35a69752a263adf69aef8c4e6ef9400c6987a86
parent93f80cdc50777b12424c63a2a4bd1ede5462e3f3 (diff)
TunnelManager: disallow remote apps for L
I don't trust old Android versions to have gotten this right. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--ui/src/main/java/com/wireguard/android/activity/SettingsActivity.kt4
-rw-r--r--ui/src/main/java/com/wireguard/android/model/TunnelManager.java4
2 files changed, 7 insertions, 1 deletions
diff --git a/ui/src/main/java/com/wireguard/android/activity/SettingsActivity.kt b/ui/src/main/java/com/wireguard/android/activity/SettingsActivity.kt
index 10f74f55..8bd27d00 100644
--- a/ui/src/main/java/com/wireguard/android/activity/SettingsActivity.kt
+++ b/ui/src/main/java/com/wireguard/android/activity/SettingsActivity.kt
@@ -82,6 +82,10 @@ class SettingsActivity : ThemeChangeAwareActivity() {
darkTheme?.parent?.removePreference(darkTheme)
--preferenceScreen.initialExpandedChildrenCount
}
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
+ val remoteApps = preferenceManager.findPreference<Preference>("allow_remote_control_intents")
+ remoteApps?.parent?.removePreference(remoteApps)
+ }
val wgQuickOnlyPrefs = arrayOf(
preferenceManager.findPreference("tools_installer"),
preferenceManager.findPreference("restore_on_boot"),
diff --git a/ui/src/main/java/com/wireguard/android/model/TunnelManager.java b/ui/src/main/java/com/wireguard/android/model/TunnelManager.java
index 9fe9bfb3..547c9344 100644
--- a/ui/src/main/java/com/wireguard/android/model/TunnelManager.java
+++ b/ui/src/main/java/com/wireguard/android/model/TunnelManager.java
@@ -9,6 +9,7 @@ import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
+import android.os.Build;
import com.wireguard.android.Application;
import com.wireguard.android.BR;
@@ -278,7 +279,8 @@ public final class TunnelManager extends BaseObservable {
return;
}
- if (!Application.getSharedPreferences().getBoolean("allow_remote_control_intents", false))
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M ||
+ !Application.getSharedPreferences().getBoolean("allow_remote_control_intents", false))
return;
final State state;