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>
This commit is contained in:
Jason A. Donenfeld 2020-03-24 14:04:13 -06:00
parent 93f80cdc50
commit 585257c995
2 changed files with 7 additions and 1 deletions

View File

@ -82,6 +82,10 @@ class SettingsActivity : ThemeChangeAwareActivity() {
darkTheme?.parent?.removePreference(darkTheme) darkTheme?.parent?.removePreference(darkTheme)
--preferenceScreen.initialExpandedChildrenCount --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( val wgQuickOnlyPrefs = arrayOf(
preferenceManager.findPreference("tools_installer"), preferenceManager.findPreference("tools_installer"),
preferenceManager.findPreference("restore_on_boot"), preferenceManager.findPreference("restore_on_boot"),

View File

@ -9,6 +9,7 @@ import android.annotation.SuppressLint;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Build;
import com.wireguard.android.Application; import com.wireguard.android.Application;
import com.wireguard.android.BR; import com.wireguard.android.BR;
@ -278,7 +279,8 @@ public final class TunnelManager extends BaseObservable {
return; 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; return;
final State state; final State state;