diff --git a/app/src/main/java/com/wireguard/android/BootShutdownReceiver.java b/app/src/main/java/com/wireguard/android/BootShutdownReceiver.java index 1a8c96a0..3b9f852d 100644 --- a/app/src/main/java/com/wireguard/android/BootShutdownReceiver.java +++ b/app/src/main/java/com/wireguard/android/BootShutdownReceiver.java @@ -21,7 +21,7 @@ public class BootShutdownReceiver extends BroadcastReceiver { @Override public void onReceive(final Context context, final Intent intent) { Application.onHaveBackend(backend -> { - if (backend.getClass() != WgQuickBackend.class) + if (!(backend instanceof WgQuickBackend)) return; final String action = intent.getAction(); if (action == null) diff --git a/app/src/main/java/com/wireguard/android/activity/BaseActivity.java b/app/src/main/java/com/wireguard/android/activity/BaseActivity.java index b7aee1e3..e5aaadf2 100644 --- a/app/src/main/java/com/wireguard/android/activity/BaseActivity.java +++ b/app/src/main/java/com/wireguard/android/activity/BaseActivity.java @@ -54,7 +54,7 @@ public abstract class BaseActivity extends ThemeChangeAwareActivity { super.onCreate(savedInstanceState); Application.onHaveBackend(backend -> { - if (backend.getClass() == GoBackend.class) { + if (backend instanceof GoBackend) { final Intent intent = GoBackend.VpnService.prepare(this); if (intent != null) startActivityForResult(intent, 0); diff --git a/app/src/main/java/com/wireguard/android/activity/SettingsActivity.java b/app/src/main/java/com/wireguard/android/activity/SettingsActivity.java index a8d58e6e..ed2da4dc 100644 --- a/app/src/main/java/com/wireguard/android/activity/SettingsActivity.java +++ b/app/src/main/java/com/wireguard/android/activity/SettingsActivity.java @@ -102,7 +102,7 @@ public class SettingsActivity extends ThemeChangeAwareActivity { final PreferenceScreen screen = getPreferenceScreen(); Application.onHaveBackend(backend -> { for (final Preference pref : wgQuickOnlyPrefs) { - if (backend.getClass() == WgQuickBackend.class) + if (backend instanceof WgQuickBackend) pref.setVisible(true); else screen.removePreference(pref);