Compare commits

..

1 Commits

Author SHA1 Message Date
Wang Han
5b25cb4a4e Refine useLocaleManager with intent check for locales
This fixes https://github.com/topjohnwu/Magisk/issues/9628.
2026-01-15 23:08:42 +08:00
2 changed files with 7 additions and 5 deletions

View File

@@ -4,9 +4,12 @@ import android.annotation.SuppressLint
import android.app.LocaleConfig
import android.app.LocaleManager
import android.content.ContextWrapper
import android.content.Intent
import android.content.res.Resources
import android.net.Uri
import android.os.Build
import android.os.LocaleList
import android.provider.Settings
import androidx.annotation.RequiresApi
import com.topjohnwu.magisk.core.AppApkPath
import com.topjohnwu.magisk.core.AppContext
@@ -165,8 +168,9 @@ interface LocaleSetting {
}
val useLocaleManager get() =
if (isRunningAsStub) Build.VERSION.SDK_INT >= 34
else Build.VERSION.SDK_INT >= 33
(if (isRunningAsStub) Build.VERSION.SDK_INT >= 34 else Build.VERSION.SDK_INT >= 33) &&
Intent(Settings.ACTION_APP_LOCALE_SETTINGS, Uri.fromParts("package", AppContext.packageName, null))
.resolveActivity(AppContext.packageManager) != null
val instance: LocaleSetting by lazy {
// Initialize available locale list

View File

@@ -137,9 +137,7 @@ case "$1" in
# Back up PREINITDEVICE from existing partition before OTA on A-only devices
if ! $backuptool_ab; then
initialize
# Suppress ui_print for this stage
ui_print() { return; }
get_flags
RECOVERYMODE=false
find_boot_image
$MAGISKBIN/magiskboot unpack "$BOOTIMAGE"
$MAGISKBIN/magiskboot cpio ramdisk.cpio "extract .backup/.magisk config.orig"