Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let PMS parse target app name #300

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
agp = "8.6.1"
agp = "8.7.0"
kotlin = "2.0.20"
rxhttp = "3.3.0"
hidden-api = "4.3.3"
Expand All @@ -11,14 +11,14 @@ kotlin = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version = "2.0.20-1.0.25" }
gms = { id = "com.google.gms.google-services", version = "4.4.2" }
nav-safeargs-kotlin = { id = "androidx.navigation.safeargs.kotlin", version = "2.8.1" }
nav-safeargs-kotlin = { id = "androidx.navigation.safeargs.kotlin", version = "2.8.2" }
autoresconfig = { id = "dev.rikka.tools.autoresconfig", version = "1.2.2" }
materialthemebuilder = { id = "dev.rikka.tools.materialthemebuilder", version = "1.3.3" }
refine = { id = "dev.rikka.tools.refine", version = "4.3.0" }
materialthemebuilder = { id = "dev.rikka.tools.materialthemebuilder", version = "1.5.1" }
refine = { id = "dev.rikka.tools.refine", version = "4.4.0" }

[libraries]
androidx-navigation-fragment-ktx = { module = "androidx.navigation:navigation-fragment-ktx", version = "2.8.1" }
androidx-navigation-ui-ktx = { module = "androidx.navigation:navigation-ui-ktx", version = "2.8.1" }
androidx-navigation-fragment-ktx = { module = "androidx.navigation:navigation-fragment-ktx", version = "2.8.2" }
androidx-navigation-ui-ktx = { module = "androidx.navigation:navigation-ui-ktx", version = "2.8.2" }
androidx-preference-ktx = { module = "androidx.preference:preference-ktx", version = "1.2.1" }
androidx-swiperefreshlayout = { module = "androidx.swiperefreshlayout:swiperefreshlayout", version = "1.1.0" }
com-android-tools-build-apksig = { module = "com.android.tools.build:apksig", version.ref = "agp" }
Expand All @@ -32,13 +32,13 @@ com-github-liujingxing-rxhttp-converter-serialization = { module = "com.github.l
com-github-topjohnwu-libsu-core = { module = "com.github.topjohnwu.libsu:core", version = "6.0.0" }
com-google-android-material = { module = "com.google.android.material:material", version = "1.12.0" }
com-google-android-gms-play-services-ads = { module = "com.google.android.gms:play-services-ads", version = "23.4.0" }
com-google-firebase-bom = { module = "com.google.firebase:firebase-bom", version = "33.3.0" }
com-google-firebase-bom = { module = "com.google.firebase:firebase-bom", version = "33.4.0" }
com-google-firebase-analytics-ktx = { module = "com.google.firebase:firebase-analytics-ktx" }
com-squareup-okhttp3 = { module = "com.squareup.okhttp3:okhttp", version = "4.12.0" }
de-robv-android-xposed-api = { module = "de.robv.android.xposed:api", version = "82" }
dev-rikka-hidden-compat = { module = "dev.rikka.hidden:compat", version.ref = "hidden-api" }
dev-rikka-hidden-stub = { module = "dev.rikka.hidden:stub", version.ref = "hidden-api" }
dev-rikka-rikkax-material = { module = "dev.rikka.rikkax.material:material", version = "2.7.0" }
dev-rikka-rikkax-material = { module = "dev.rikka.rikkax.material:material", version = "2.7.2" }
dev-rikka-rikkax-material-preference = { module = "dev.rikka.rikkax.material:material-preference", version = "2.0.0" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version = "1.7.1" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version = "1.7.3" }
me-zhanghai-android-appiconloader = { module = "me.zhanghai.android.appiconloader:appiconloader", version = "1.5.0" }
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class HMAService(val pms: IPackageManager) : IHMAService.Stub() {
if (caller == null || query == null) return false
if (caller in Constants.packagesShouldNotHide || query in Constants.packagesShouldNotHide) return false
if ((caller == Constants.GMS_PACKAGE_NAME || caller == Constants.GSF_PACKAGE_NAME) && query == Constants.APP_PACKAGE_NAME) return false // If apply hide on gms, hma app will crash 😓
if (caller in query) return false
if (caller == query) return false
val appConfig = config.scope[caller] ?: return false
if (appConfig.useWhitelist && appConfig.excludeSystemApps && query in systemApps) return false

Expand Down
11 changes: 7 additions & 4 deletions xposed/src/main/java/icu/nullptr/hidemyapplist/xposed/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@ object Utils {
return result
}

fun getPackageNameFromPackageSettings(packageSettings: Any): String {
return with(packageSettings.toString()) {
substring(lastIndexOf(' ') + 1, lastIndexOf('/'))
}
fun getPackageNameFromPackageSettings(packageSettings: Any): String? {
return runCatching {
val fieldName = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) "mName" else "name"
val field = packageSettings::class.java.getDeclaredField(fieldName)
field.isAccessible = true
field.get(packageSettings) as? String
}.getOrNull()
}

fun getInstalledApplicationsCompat(pms: IPackageManager, flags: Long, userId: Int): List<ApplicationInfo> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class PlatformCompatHook(private val service: HMAService) : IFrameworkHook {
for (app in apps) {
if (service.isHookEnabled(app)) {
if (sAppDataIsolationEnabled) param.result = true
logI(TAG, "@startViaZygote force mount data: ${appInfo.uid} $app")
logI(TAG, "force mount data: ${appInfo.uid} $app")
return@hookBefore
}
}
Expand Down
Loading