Skip to content

Commit

Permalink
Let PMS parse target app name
Browse files Browse the repository at this point in the history
  • Loading branch information
aviraxp committed Oct 3, 2024
1 parent a9fa392 commit 15d464f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
14 changes: 7 additions & 7 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.4.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,7 +32,7 @@ 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" }
Expand Down
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

0 comments on commit 15d464f

Please sign in to comment.