From 788aa7fc07833db1650ffc2e598496f48937b5ba Mon Sep 17 00:00:00 2001 From: RikkaW Date: Mon, 30 Mar 2020 23:45:58 +0800 Subject: [PATCH] legacy Shizuku actually won't run on Android 10+ due to the getUsers change --- .../main/java/moe/shizuku/manager/ShizukuManagerSettings.java | 2 +- .../src/main/java/moe/shizuku/manager/home/HomeViewModel.kt | 2 +- .../java/moe/shizuku/manager/legacy/AuthorizationActivity.kt | 4 ++-- .../main/java/moe/shizuku/manager/management/AppsViewModel.kt | 2 +- .../java/moe/shizuku/manager/settings/SettingsFragment.kt | 4 ++-- manager/src/main/res/values-zh-rCN/strings.xml | 2 +- manager/src/main/res/values-zh-rTW/strings.xml | 2 +- manager/src/main/res/values/strings.xml | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/manager/src/main/java/moe/shizuku/manager/ShizukuManagerSettings.java b/manager/src/main/java/moe/shizuku/manager/ShizukuManagerSettings.java index e513257da..14912b391 100644 --- a/manager/src/main/java/moe/shizuku/manager/ShizukuManagerSettings.java +++ b/manager/src/main/java/moe/shizuku/manager/ShizukuManagerSettings.java @@ -99,7 +99,7 @@ public static Locale getLocale() { } public static boolean isStartServiceV2() { - return !BuildUtils.atLeastR() && !getPreferences().getBoolean(NO_V2, false); + return !BuildUtils.atLeastQ() && !getPreferences().getBoolean(NO_V2, false); } public static boolean isKeepSuContext() { diff --git a/manager/src/main/java/moe/shizuku/manager/home/HomeViewModel.kt b/manager/src/main/java/moe/shizuku/manager/home/HomeViewModel.kt index 82be35665..7a8c11fea 100644 --- a/manager/src/main/java/moe/shizuku/manager/home/HomeViewModel.kt +++ b/manager/src/main/java/moe/shizuku/manager/home/HomeViewModel.kt @@ -23,7 +23,7 @@ class HomeViewModel : ViewModel() { private fun load(): ServiceStatus { var v2Status: ShizukuState = ShizukuState.createUnknown() val status = ServiceStatus() - if (!BuildUtils.atLeastR()) { + if (!BuildUtils.atLeastQ()) { status.v2Status = ShizukuLegacy.ShizukuClient.getState().also { v2Status = it } } if (ShizukuService.getBinder() == null) diff --git a/manager/src/main/java/moe/shizuku/manager/legacy/AuthorizationActivity.kt b/manager/src/main/java/moe/shizuku/manager/legacy/AuthorizationActivity.kt index 612027840..1ef36178e 100644 --- a/manager/src/main/java/moe/shizuku/manager/legacy/AuthorizationActivity.kt +++ b/manager/src/main/java/moe/shizuku/manager/legacy/AuthorizationActivity.kt @@ -28,7 +28,7 @@ abstract class AuthorizationActivity : AppActivity() { } fun getLegacyServerState(): ShizukuLegacy.ShizukuState { - if (BuildUtils.atLeastR()) { + if (BuildUtils.atLeastQ()) { return ShizukuLegacy.ShizukuState.createUnknown() } @@ -42,7 +42,7 @@ abstract class AuthorizationActivity : AppActivity() { } fun checkNotLegacyOnApi30(): Boolean { - if (!isV3 && BuildUtils.atLeastR()) { + if (!isV3 && BuildUtils.atLeastQ()) { val componentName = callingActivity ?: return false val label = try { packageManager.getApplicationInfo(componentName.packageName, 0).loadLabel(packageManager) diff --git a/manager/src/main/java/moe/shizuku/manager/management/AppsViewModel.kt b/manager/src/main/java/moe/shizuku/manager/management/AppsViewModel.kt index 5ebac9aeb..17c7ec639 100644 --- a/manager/src/main/java/moe/shizuku/manager/management/AppsViewModel.kt +++ b/manager/src/main/java/moe/shizuku/manager/management/AppsViewModel.kt @@ -25,7 +25,7 @@ class AppsViewModel : SharedViewModel() { var count = 0 for (pi in AuthorizationManager.getPackages(PackageManager.GET_META_DATA)) { if (BuildConfig.APPLICATION_ID == pi.packageName) continue - if (BuildUtils.atLeastR() && pi?.applicationInfo?.metaData?.getBoolean("moe.shizuku.client.V3_SUPPORT") != true) continue + if (BuildUtils.atLeastQ() && pi?.applicationInfo?.metaData?.getBoolean("moe.shizuku.client.V3_SUPPORT") != true) continue list.add(pi) if (AuthorizationManager.granted(pi.packageName, pi.applicationInfo.uid)) count++ } diff --git a/manager/src/main/java/moe/shizuku/manager/settings/SettingsFragment.kt b/manager/src/main/java/moe/shizuku/manager/settings/SettingsFragment.kt index e6b1fa3e4..6b3ffc4e2 100644 --- a/manager/src/main/java/moe/shizuku/manager/settings/SettingsFragment.kt +++ b/manager/src/main/java/moe/shizuku/manager/settings/SettingsFragment.kt @@ -57,9 +57,9 @@ class SettingsFragment : PreferenceFragment() { keepSuContextPreference = findPreference(KEY_KEEP_SU_CONTEXT) as SwitchPreference startupPreference = findPreference("startup") as PreferenceCategory - noV2Preference.isVisible = !BuildUtils.atLeastR() + noV2Preference.isVisible = !BuildUtils.atLeastQ() keepSuContextPreference.isVisible = false - startupPreference.isVisible = !BuildUtils.atLeastR() + startupPreference.isVisible = !BuildUtils.atLeastQ() val viewModel = SharedViewModelProviders.of(this).get(AppsViewModel::class.java) viewModel.packages.observe(this) { diff --git a/manager/src/main/res/values-zh-rCN/strings.xml b/manager/src/main/res/values-zh-rCN/strings.xml index 0ce9b63f9..ea7bb19d5 100644 --- a/manager/src/main/res/values-zh-rCN/strings.xml +++ b/manager/src/main/res/values-zh-rCN/strings.xml @@ -39,7 +39,7 @@ 无法连接至核心服务,请确认其正在运行。 %1$s 不支持现代 Shizuku 请要求 %1$s 的开发者进行更新。 + 旧式 Shizuku 已于 2019 年 3 月被弃用。此外,它无法在 Android 10 及更高版本运行。

请要求 %1$s 的开发者进行更新。 ]]> 应用管理 diff --git a/manager/src/main/res/values-zh-rTW/strings.xml b/manager/src/main/res/values-zh-rTW/strings.xml index 8d0a05db6..0ffbb08f2 100644 --- a/manager/src/main/res/values-zh-rTW/strings.xml +++ b/manager/src/main/res/values-zh-rTW/strings.xml @@ -39,7 +39,7 @@ 無法連線至核心服務,請確認其正在執行。 %1$s 不支援現代 Shizuku 請要求 %1$s 的開發者進行更新。 + 舊式 Shizuku 已於 2019 年 3 月被棄用。此外,它無法在 Android 10 及更高版本執行。

請要求 %1$s 的開發者進行更新。 ]]> 應用程式管理 diff --git a/manager/src/main/res/values/strings.xml b/manager/src/main/res/values/strings.xml index c45a11486..d698723e9 100644 --- a/manager/src/main/res/values/strings.xml +++ b/manager/src/main/res/values/strings.xml @@ -41,7 +41,7 @@ Can\'t connect to core service, please check if it is running. %1$s does not support modern Shizuku Please ask the developer of %1$s to update. + Legacy Shizuku has been deprecated since March 2019. Also, it won\'t run on Android 10 and above.

Please ask the developer of %1$s to update. ]]> Application management