Big update

- Try to fix bootloop issue on Android 11 MIUI
- Do not hook for app data isolation if not enabled
- Do not enforce pre-30 data isolation for system apps
- Add theme colors again
- Fix some layout problems
- Update translations
- Other fixes and improvements
This commit is contained in:
frknkrc44 2025-10-03 03:18:04 +03:00
commit ffe87884f6
No known key found for this signature in database
GPG key ID: 784AE1CC0DCFD34F
19 changed files with 240 additions and 106 deletions

View file

@ -13,6 +13,42 @@ plugins {
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.ksp)
alias(libs.plugins.nav.safeargs.kotlin)
alias(libs.plugins.naterialthemebuilder)
}
materialThemeBuilder {
themes {
for ((name, color) in listOf(
"Red" to "F44336",
"Pink" to "E91E63",
"Purple" to "9C27B0",
"DeepPurple" to "673AB7",
"Indigo" to "3F51B5",
"Blue" to "2196F3",
"LightBlue" to "03A9F4",
"Cyan" to "00BCD4",
"Teal" to "009688",
"Green" to "4FAF50",
"LightGreen" to "8BC3A4",
"Lime" to "CDDC39",
"Yellow" to "FFEB3B",
"Amber" to "FFC107",
"Orange" to "FF9800",
"DeepOrange" to "FF5722",
"Brown" to "795548",
"BlueGrey" to "607D8F",
"Sakura" to "FF9CA8"
)) {
create("Material$name") {
lightThemeFormat = "ThemeOverlay.Light.%s"
darkThemeFormat = "ThemeOverlay.Dark.%s"
primaryColor = "#$color"
}
}
}
// Add Material Design 3 color tokens (such as palettePrimary100) in generated theme
// rikka.material >= 2.0.0 provides such attributes
generatePalette = false
}
val appPackageName: String by rootProject.extra
@ -55,9 +91,14 @@ afterEvaluate {
val translatorJson = JSONObject(translatorsMap).toJSONString()
val srcDir = android.sourceSets["main"].assets.srcDirs.first()
logger.lifecycle("Src dir: $srcDir")
logger.lifecycle("Asset dir: $srcDir")
if (!srcDir.exists()) srcDir.mkdirs()
File(srcDir, "translators.json").writeText(translatorJson)
} else {
val srcDir = android.sourceSets["main"].assets.srcDirs.first()
logger.lifecycle("Asset dir: $srcDir")
if (!srcDir.exists()) srcDir.mkdirs()
File(srcDir, "translators.json").writeText("{}")
}
}

View file

@ -7,6 +7,7 @@ import android.text.TextUtils
import android.view.View
import android.view.WindowInsets
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.net.toUri
import androidx.fragment.app.Fragment
import androidx.preference.ListPreference
import androidx.preference.Preference
@ -14,8 +15,10 @@ import androidx.preference.PreferenceDataStore
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreferenceCompat
import by.kirich1409.viewbindingdelegate.viewBinding
import com.google.android.material.color.DynamicColors
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import icu.nullptr.hidemyapplist.common.CommonUtils
import icu.nullptr.hidemyapplist.common.Constants
import icu.nullptr.hidemyapplist.hmaApp
import icu.nullptr.hidemyapplist.service.ConfigManager
import icu.nullptr.hidemyapplist.service.PrefManager
@ -236,6 +239,32 @@ class SettingsFragment : Fragment(R.layout.fragment_settings), PreferenceFragmen
}
}
findPreference<Preference>("translation")?.let {
it.summary = getString(R.string.settings_translate_summary, getString(R.string.app_name))
it.setOnPreferenceClickListener {
startActivity(Intent(Intent.ACTION_VIEW, Constants.TRANSLATE_URL.toUri()))
true
}
}
findPreference<SwitchPreferenceCompat>("followSystemAccent")?.also {
it.isVisible = DynamicColors.isDynamicColorAvailable()
it.setOnPreferenceChangeListener { _, _ ->
activity?.recreate()
true
}
}
findPreference<ListPreference>("themeColor")?.also {
if (!DynamicColors.isDynamicColorAvailable()) it.dependency = null
it.setOnPreferenceChangeListener { _, _ ->
activity?.recreate()
true
}
}
findPreference<ListPreference>("darkTheme")?.setOnPreferenceChangeListener { _, newValue ->
val newMode = (newValue as String).toInt()
if (PrefManager.darkTheme != newMode) {
@ -252,11 +281,6 @@ class SettingsFragment : Fragment(R.layout.fragment_settings), PreferenceFragmen
configureDataIsolation()
findPreference<SwitchPreferenceCompat>("bypassRiskyPackageWarning")?.setOnPreferenceChangeListener { _, newValue ->
activity?.recreate()
true
}
findPreference<Preference>("stopSystemService")?.setOnPreferenceClickListener {
if (ServiceClient.serviceVersion != 0) {
MaterialAlertDialogBuilder(requireContext())

View file

@ -9,13 +9,60 @@ import androidx.annotation.ColorInt
import androidx.annotation.ColorRes
import androidx.annotation.StyleRes
import androidx.fragment.app.Fragment
import com.google.android.material.color.DynamicColors
import icu.nullptr.hidemyapplist.service.PrefManager
import org.frknkrc44.hma_oss.R
object ThemeUtils {
private val colorThemeMap = mapOf(
"SAKURA" to R.style.ThemeOverlay_Light_MaterialSakura,
"MATERIAL_RED" to R.style.ThemeOverlay_Light_MaterialRed,
"MATERIAL_PINK" to R.style.ThemeOverlay_Light_MaterialPink,
"MATERIAL_PURPLE" to R.style.ThemeOverlay_Light_MaterialPurple,
"MATERIAL_DEEP_PURPLE" to R.style.ThemeOverlay_Light_MaterialDeepPurple,
"MATERIAL_INDIGO" to R.style.ThemeOverlay_Light_MaterialIndigo,
"MATERIAL_BLUE" to R.style.ThemeOverlay_Light_MaterialBlue,
"MATERIAL_LIGHT_BLUE" to R.style.ThemeOverlay_Light_MaterialLightBlue,
"MATERIAL_CYAN" to R.style.ThemeOverlay_Light_MaterialCyan,
"MATERIAL_TEAL" to R.style.ThemeOverlay_Light_MaterialTeal,
"MATERIAL_GREEN" to R.style.ThemeOverlay_Light_MaterialGreen,
"MATERIAL_LIGHT_GREEN" to R.style.ThemeOverlay_Light_MaterialLightGreen,
"MATERIAL_LIME" to R.style.ThemeOverlay_Light_MaterialLime,
"MATERIAL_YELLOW" to R.style.ThemeOverlay_Light_MaterialYellow,
"MATERIAL_AMBER" to R.style.ThemeOverlay_Light_MaterialAmber,
"MATERIAL_ORANGE" to R.style.ThemeOverlay_Light_MaterialOrange,
"MATERIAL_DEEP_ORANGE" to R.style.ThemeOverlay_Light_MaterialDeepOrange,
"MATERIAL_BROWN" to R.style.ThemeOverlay_Light_MaterialBrown,
"MATERIAL_BLUE_GREY" to R.style.ThemeOverlay_Light_MaterialBlueGrey
)
private val darkColorThemeMap = mapOf(
"SAKURA" to R.style.ThemeOverlay_Dark_MaterialSakura,
"MATERIAL_RED" to R.style.ThemeOverlay_Dark_MaterialRed,
"MATERIAL_PINK" to R.style.ThemeOverlay_Dark_MaterialPink,
"MATERIAL_PURPLE" to R.style.ThemeOverlay_Dark_MaterialPurple,
"MATERIAL_DEEP_PURPLE" to R.style.ThemeOverlay_Dark_MaterialDeepPurple,
"MATERIAL_INDIGO" to R.style.ThemeOverlay_Dark_MaterialIndigo,
"MATERIAL_BLUE" to R.style.ThemeOverlay_Dark_MaterialBlue,
"MATERIAL_LIGHT_BLUE" to R.style.ThemeOverlay_Dark_MaterialLightBlue,
"MATERIAL_CYAN" to R.style.ThemeOverlay_Dark_MaterialCyan,
"MATERIAL_TEAL" to R.style.ThemeOverlay_Dark_MaterialTeal,
"MATERIAL_GREEN" to R.style.ThemeOverlay_Dark_MaterialGreen,
"MATERIAL_LIGHT_GREEN" to R.style.ThemeOverlay_Dark_MaterialLightGreen,
"MATERIAL_LIME" to R.style.ThemeOverlay_Dark_MaterialLime,
"MATERIAL_YELLOW" to R.style.ThemeOverlay_Dark_MaterialYellow,
"MATERIAL_AMBER" to R.style.ThemeOverlay_Dark_MaterialAmber,
"MATERIAL_ORANGE" to R.style.ThemeOverlay_Dark_MaterialOrange,
"MATERIAL_DEEP_ORANGE" to R.style.ThemeOverlay_Dark_MaterialDeepOrange,
"MATERIAL_BROWN" to R.style.ThemeOverlay_Dark_MaterialBrown,
"MATERIAL_BLUE_GREY" to R.style.ThemeOverlay_Dark_MaterialBlueGrey
)
private const val THEME_DEFAULT = "DEFAULT"
private const val THEME_BLACK = "BLACK"
val isSystemAccent get() = DynamicColors.isDynamicColorAvailable() && PrefManager.followSystemAccent
fun isNightMode(context: Context) = (context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES
fun isUsingBlackTheme(context: Context) = PrefManager.blackDarkTheme && isNightMode(context)
@ -31,6 +78,17 @@ object ThemeUtils {
R.style.ThemeOverlay_Black else R.style.ThemeOverlay
}
val colorTheme get() = if (isSystemAccent) "SYSTEM" else PrefManager.themeColor
@StyleRes
fun getColorThemeStyleRes(context: Context): Int {
return if (isNightMode(context)) {
darkColorThemeMap[colorTheme] ?: R.style.ThemeOverlay_Dark_MaterialBlue
} else {
colorThemeMap[colorTheme] ?: R.style.ThemeOverlay_Light_MaterialBlue
}
}
/**
* Retrieve a color from the current [android.content.res.Resources.Theme].
*/

View file

@ -1,14 +1,17 @@
package icu.nullptr.hidemyapplist.util
import android.content.res.Resources
import icu.nullptr.hidemyapplist.service.PrefManager
import java.util.Locale
class ConfigUtils private constructor() {
companion object {
fun getSystemLocale(): Locale = Resources.getSystem().configuration.getLocales().get(0)
fun getLocale(): Locale {
val tag = PrefManager.locale
return if (tag == "SYSTEM") Locale.getDefault()
return if (tag == "SYSTEM") getSystemLocale()
else Locale.forLanguageTag(tag)
}
}
}
}

View file

@ -1,24 +1,16 @@
package org.frknkrc44.hma_oss.ui.activity
import android.content.Context
import android.content.Intent
import android.content.res.ColorStateList
import android.content.res.Resources
import android.os.Build
import android.os.Bundle
import android.view.View
import android.view.WindowInsets
import android.widget.LinearLayout
import androidx.activity.enableEdgeToEdge
import androidx.annotation.DrawableRes
import androidx.appcompat.app.AppCompatActivity
import androidx.core.net.toUri
import com.bumptech.glide.Glide
import com.google.android.material.color.DynamicColors
import icu.nullptr.hidemyapplist.hmaApp
import icu.nullptr.hidemyapplist.ui.util.ThemeUtils
import icu.nullptr.hidemyapplist.ui.util.ThemeUtils.homeItemBackgroundColor
import icu.nullptr.hidemyapplist.util.ConfigUtils.Companion.getLocale
import org.frknkrc44.hma_oss.R
import org.frknkrc44.hma_oss.common.BuildConfig
import org.frknkrc44.hma_oss.databinding.ActivityAboutBinding
@ -26,7 +18,7 @@ import org.frknkrc44.hma_oss.databinding.ActivityAboutListItemBinding
import org.json.JSONObject
@Suppress("deprecation")
class AboutActivity : AppCompatActivity() {
class AboutActivity : BaseActivity() {
private lateinit var binding: ActivityAboutBinding
override fun onCreate(savedInstanceState: Bundle?) {
@ -34,10 +26,6 @@ class AboutActivity : AppCompatActivity() {
binding = ActivityAboutBinding.inflate(layoutInflater)
setContentView(binding.root)
DynamicColors.applyToActivityIfAvailable(this)
enableEdgeToEdge()
binding.root.setOnApplyWindowInsetsListener { v, insets ->
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
val barInsets = insets.getInsets(WindowInsets.Type.systemBars())
@ -72,7 +60,11 @@ class AboutActivity : AppCompatActivity() {
backgroundTintList = tint
}
appIcon.setImageResource(R.mipmap.ic_launcher_round)
Glide.with(this@AboutActivity)
.load(R.mipmap.ic_launcher_round)
.circleCrop()
.into(appIcon)
appName.setText(R.string.app_name)
appVersion.text = BuildConfig.APP_VERSION_NAME
@ -127,14 +119,10 @@ class AboutActivity : AppCompatActivity() {
val newLayout = ActivityAboutListItemBinding.inflate(layoutInflater)
setOnClickUrl(newLayout.root, url)
newLayout.aboutPersonIcon.setImageResource(avatarResId)
with(newLayout.aboutPersonIcon) {
shapeAppearanceModel = shapeAppearanceModel
.toBuilder()
.setAllCornerSizes { 48.0f }
.build()
}
Glide.with(this)
.load(avatarResId)
.circleCrop()
.into(newLayout.aboutPersonIcon)
newLayout.text1.text = name
newLayout.text2.text = desc
@ -146,15 +134,9 @@ class AboutActivity : AppCompatActivity() {
Glide.with(this)
.load(avatarUrl)
.placeholder(R.drawable.outline_info_24)
.circleCrop()
.into(newLayout.aboutPersonIcon)
with(newLayout.aboutPersonIcon) {
shapeAppearanceModel = shapeAppearanceModel
.toBuilder()
.setAllCornerSizes { 48.0f }
.build()
}
newLayout.text1.text = name
newLayout.text2.visibility = View.GONE
layout.addView(newLayout.root)
@ -167,20 +149,4 @@ class AboutActivity : AppCompatActivity() {
startActivity(intent)
}
}
override fun onApplyThemeResource(theme: Resources.Theme, resid: Int, first: Boolean) {
super.onApplyThemeResource(theme, resid, first)
theme.applyStyle(ThemeUtils.getNightThemeStyleRes(this), true)
}
override fun attachBaseContext(newBase: Context?) {
super.attachBaseContext(getLocaleAppliedContext(newBase))
}
fun getLocaleAppliedContext(context: Context?): Context? {
val config = hmaApp.resources.configuration
config.setLocale(getLocale())
return context?.createConfigurationContext(config)
}
}

View file

@ -0,0 +1,48 @@
package org.frknkrc44.hma_oss.ui.activity
import android.content.Context
import android.content.res.Resources
import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.color.DynamicColors
import com.google.android.material.color.DynamicColorsOptions
import icu.nullptr.hidemyapplist.hmaApp
import icu.nullptr.hidemyapplist.ui.util.ThemeUtils
import icu.nullptr.hidemyapplist.util.ConfigUtils.Companion.getLocale
open class BaseActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
DynamicColors.applyToActivityIfAvailable(
this,
DynamicColorsOptions.Builder().also {
if (!ThemeUtils.isSystemAccent)
it.setThemeOverlay(ThemeUtils.getColorThemeStyleRes(this))
}.build()
)
}
override fun onApplyThemeResource(theme: Resources.Theme, resid: Int, first: Boolean) {
super.onApplyThemeResource(theme, resid, first)
if (!DynamicColors.isDynamicColorAvailable()) {
theme.applyStyle(ThemeUtils.getColorThemeStyleRes(this), true)
}
theme.applyStyle(ThemeUtils.getNightThemeStyleRes(this), true)
}
override fun attachBaseContext(newBase: Context?) {
super.attachBaseContext(getLocaleAppliedContext(newBase))
}
fun getLocaleAppliedContext(context: Context?): Context? {
val config = hmaApp.resources.configuration
config.setLocale(getLocale())
return context?.createConfigurationContext(config)
}
}

View file

@ -1,48 +1,20 @@
package org.frknkrc44.hma_oss.ui.activity
import android.content.Context
import android.content.res.Resources
import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.findNavController
import com.google.android.material.color.DynamicColors
import icu.nullptr.hidemyapplist.hmaApp
import icu.nullptr.hidemyapplist.ui.util.ThemeUtils
import icu.nullptr.hidemyapplist.util.ConfigUtils.Companion.getLocale
import org.frknkrc44.hma_oss.R
import org.frknkrc44.hma_oss.databinding.ActivityMainBinding
class MainActivity : AppCompatActivity() {
class MainActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
val binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
DynamicColors.applyToActivityIfAvailable(this)
}
override fun onApplyThemeResource(theme: Resources.Theme, resid: Int, first: Boolean) {
super.onApplyThemeResource(theme, resid, first)
theme.applyStyle(ThemeUtils.getNightThemeStyleRes(this), true)
}
override fun onSupportNavigateUp(): Boolean {
val navController = this.findNavController(R.id.nav_host_fragment)
return navController.navigateUp() || super.onSupportNavigateUp()
}
override fun attachBaseContext(newBase: Context?) {
super.attachBaseContext(getLocaleAppliedContext(newBase))
}
fun getLocaleAppliedContext(context: Context?): Context? {
val config = hmaApp.resources.configuration
config.setLocale(getLocale())
return context?.createConfigurationContext(config)
}
}

View file

@ -3,9 +3,5 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="?colorOnSecondary" />
<corners
android:topLeftRadius="24dp"
android:topRightRadius="24dip"
android:bottomLeftRadius="24dp"
android:bottomRightRadius="24dip" />
<corners android:radius="24dp" />
</shape>

View file

@ -37,6 +37,8 @@
<TextView
android:layout_marginVertical="16dp"
android:text="@string/about_developer"
android:textStyle="bold"
android:textColor="?colorPrimary"
android:paddingHorizontal="@dimen/item_padding_vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
@ -51,6 +53,8 @@
<TextView
android:layout_marginVertical="16dp"
android:text="@string/about_translator"
android:textStyle="bold"
android:textColor="?colorPrimary"
android:paddingHorizontal="@dimen/item_padding_vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

View file

@ -74,14 +74,14 @@
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/app_name"
android:gravity="center"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/app_version"
android:gravity="center"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

View file

@ -7,10 +7,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.imageview.ShapeableImageView
<ImageView
android:id="@+id/about_person_icon"
android:layout_width="48dp"
android:layout_height="48dp" />
android:layout_height="48dp"
android:importantForAccessibility="no" />
<LinearLayout
android:paddingStart="@dimen/item_padding_vertical"
@ -22,13 +23,13 @@
<TextView
android:id="@android:id/text1"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textAppearance="@style/TextAppearance.Material3.BodyLarge"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@android:id/text2"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

View file

@ -6,6 +6,8 @@
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/content_title"
android:textStyle="bold"
android:textColor="?colorPrimary"
android:paddingHorizontal="@dimen/item_padding_vertical"
android:layout_marginBottom="@dimen/item_padding_vertical"
android:layout_width="match_parent"
@ -15,7 +17,7 @@
android:id="@+id/content_description"
android:background="@drawable/about_content_bg"
android:padding="@dimen/item_padding_vertical"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

View file

@ -74,8 +74,7 @@
<com.google.android.material.button.MaterialButtonGroup
style="@style/Widget.Material3.MaterialButtonGroup.Connected"
android:layout_marginTop="16dp"
android:layout_marginHorizontal="16dp"
android:layout_margin="16dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">

View file

@ -32,11 +32,6 @@
<style name="Theme" parent="Base.AppTheme" />
<style name="AppTheme.About" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="colorPrimary">#154A74</item>
<item name="colorPrimaryDark">#154A74</item>
</style>
<style name="AppTheme.SideImage">
<item name="android:layout_width">@dimen/vector_icon_size</item>
<item name="android:layout_height">@dimen/vector_icon_size</item>

View file

@ -8,15 +8,28 @@
android:key="language"
android:summary="%s"
android:title="@string/settings_language" />
<!--
<Preference
android:icon="@drawable/outline_translate_24"
android:key="translation"
android:title="@string/settings_translate" />
-->
</PreferenceCategory>
<PreferenceCategory android:title="@string/settings_theme">
<SwitchPreferenceCompat
android:defaultValue="true"
android:disableDependentsState="true"
android:icon="@drawable/outline_palette_24"
android:key="followSystemAccent"
android:title="@string/settings_system_theme_color" />
<ListPreference
android:defaultValue="MATERIAL_BLUE"
android:dependency="followSystemAccent"
android:entries="@array/color_texts"
android:entryValues="@array/color_values"
android:icon="@drawable/outline_format_color_fill_24"
android:key="themeColor"
android:summary="%s"
android:title="@string/settings_theme_color" />
<ListPreference
android:defaultValue="-1"
android:entries="@array/theme_texts"

View file

@ -10,6 +10,7 @@ public class Constants {
public static final String GMS_PACKAGE_NAME = "com.google.android.gms";
public static final String GSF_PACKAGE_NAME = "com.google.android.gsf";
public static final String VENDING_PACKAGE_NAME = "com.android.vending";
public static final String TRANSLATE_URL = "https://crowdin.com/project/frknkrc44-hma-oss";
public static final String ANDROID_APP_DATA_ISOLATION_ENABLED_PROPERTY = "persist.zygote.app_data_isolation";
public static final String ANDROID_VOLD_APP_DATA_ISOLATION_ENABLED_PROPERTY = "persist.sys.vold_app_data_isolation_enabled";

View file

@ -14,6 +14,7 @@ ksp = { id = "com.google.devtools.ksp", version = "2.1.10-1.0.31" }
nav-safeargs-kotlin = { id = "androidx.navigation.safeargs.kotlin", version = "2.8.8" }
autoresconfig = { id = "dev.rikka.tools.autoresconfig", version = "1.2.2" }
refine = { id = "dev.rikka.tools.refine", version = "4.4.0" }
naterialthemebuilder = { id = "dev.rikka.tools.materialthemebuilder", version = "1.5.1" }
[libraries]
androidx-appcompat-appcompat = { group = "androidx.appcompat", name = "appcompat", version = "1.7.1" }

View file

@ -29,6 +29,7 @@ class AppDataIsolationHook(private val service: HMAService): IFrameworkHook {
private var voldHookSkipped = false
override fun load() {
if (!(service.config.altAppDataIsolation || service.config.altVoldAppDataIsolation)) return
logI(TAG, "Load hook")
findMethodOrNull(

View file

@ -9,6 +9,7 @@ import de.robv.android.xposed.XC_MethodHook
import icu.nullptr.hidemyapplist.common.CommonUtils
import icu.nullptr.hidemyapplist.common.Utils
import icu.nullptr.hidemyapplist.xposed.HMAService
import icu.nullptr.hidemyapplist.xposed.logD
import icu.nullptr.hidemyapplist.xposed.logE
import icu.nullptr.hidemyapplist.xposed.logI
@ -17,7 +18,10 @@ class PlatformCompatHook(private val service: HMAService) : IFrameworkHook {
companion object {
private const val TAG = "PlatformCompatHook"
private val sAppDataIsolationEnabled = CommonUtils.isAppDataIsolationEnabled
}
private val sAppDataIsolationEnabled by lazy {
CommonUtils.isAppDataIsolationEnabled || service.config.altAppDataIsolation
}
private var hook: XC_MethodHook.Unhook? = null
@ -33,13 +37,18 @@ class PlatformCompatHook(private val service: HMAService) : IFrameworkHook {
val changeId = param.args[0] as Long
val appInfo = param.args[1] as ApplicationInfo
if (changeId.toInt() != 143937733) return@hookBefore
if (appInfo.packageName in service.systemApps) return@hookBefore
val apps = Utils.binderLocalScope {
service.pms.getPackagesForUid(appInfo.uid)
} ?: return@hookBefore
for (app in apps) {
if (service.isHookEnabled(app)) {
if (sAppDataIsolationEnabled) param.result = true
logI(TAG, "force mount data: ${appInfo.uid} $app")
if (sAppDataIsolationEnabled) {
param.result = true
service.filterCount++
logD(TAG, "force mount data: ${appInfo.uid} $app")
}
return@hookBefore
}
}