From 040fd51765c09e6bc8310d716e68866f0548ace1 Mon Sep 17 00:00:00 2001 From: frknkrc44 Date: Thu, 4 Sep 2025 02:55:40 +0300 Subject: [PATCH] Add new option to exclude the target app installation source spoofing, ignore invalid requests --- .../hidemyapplist/ui/fragment/AppSettingsFragment.kt | 7 +++++++ app/src/main/res/values/strings.xml | 4 +++- app/src/main/res/xml/app_settings.xml | 10 +++++++++- .../icu/nullptr/hidemyapplist/common/JsonConfig.kt | 1 + .../icu/nullptr/hidemyapplist/xposed/HMAService.kt | 11 +++++++++++ 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/icu/nullptr/hidemyapplist/ui/fragment/AppSettingsFragment.kt b/app/src/main/java/icu/nullptr/hidemyapplist/ui/fragment/AppSettingsFragment.kt index ccb318f..ed91962 100644 --- a/app/src/main/java/icu/nullptr/hidemyapplist/ui/fragment/AppSettingsFragment.kt +++ b/app/src/main/java/icu/nullptr/hidemyapplist/ui/fragment/AppSettingsFragment.kt @@ -108,6 +108,7 @@ class AppSettingsFragment : Fragment(R.layout.fragment_settings) { "useWhiteList" -> pack.config.useWhitelist "excludeSystemApps" -> pack.config.excludeSystemApps "hideInstallationSource" -> pack.config.hideInstallationSource + "excludeTargetInstallationSource" -> pack.config.excludeTargetInstallationSource else -> throw IllegalArgumentException("Invalid key: $key") } } @@ -118,6 +119,7 @@ class AppSettingsFragment : Fragment(R.layout.fragment_settings) { "useWhiteList" -> pack.config.useWhitelist = value "excludeSystemApps" -> pack.config.excludeSystemApps = value "hideInstallationSource" -> pack.config.hideInstallationSource = value + "excludeTargetInstallationSource" -> pack.config.excludeTargetInstallationSource = value else -> throw IllegalArgumentException("Invalid key: $key") } } @@ -163,6 +165,11 @@ class AppSettingsFragment : Fragment(R.layout.fragment_settings) { R.string.app_force_stop_warning, Toast.LENGTH_LONG).show() true } + findPreference("excludeTargetInstallationSource")?.setOnPreferenceChangeListener { _, newValue -> + Toast.makeText(requireContext(), + R.string.app_force_stop_warning, Toast.LENGTH_LONG).show() + true + } findPreference("useWhiteList")?.setOnPreferenceChangeListener { _, newValue -> pack.config.applyTemplates.clear() pack.config.extraAppList.clear() diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ffc7741..51fab41 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -93,8 +93,10 @@ %d additional apps invisible Risky package This package is marked as risky and you can cause issues on hidden apps. Do you want to continue? - Spoof installation sources to Play Store + Spoofing + Spoof installation sources All of user apps will be spoofed as installed over Play Store for this application + Exclude the target app Don\'t forget to force stop the target app after saving the configuration diff --git a/app/src/main/res/xml/app_settings.xml b/app/src/main/res/xml/app_settings.xml index 661dd0c..2656bed 100644 --- a/app/src/main/res/xml/app_settings.xml +++ b/app/src/main/res/xml/app_settings.xml @@ -11,12 +11,20 @@ + android:title="@string/app_spoof"> + + + + = mutableSetOf(), var applyPresets: MutableSet = mutableSetOf(), var applySettingsPresets: MutableSet = mutableSetOf(), diff --git a/xposed/src/main/java/icu/nullptr/hidemyapplist/xposed/HMAService.kt b/xposed/src/main/java/icu/nullptr/hidemyapplist/xposed/HMAService.kt index 4e77840..42c4c62 100644 --- a/xposed/src/main/java/icu/nullptr/hidemyapplist/xposed/HMAService.kt +++ b/xposed/src/main/java/icu/nullptr/hidemyapplist/xposed/HMAService.kt @@ -194,6 +194,17 @@ class HMAService(val pms: IPackageManager) : IHMAService.Stub() { if (caller == null || query == null) return false val appConfig = config.scope[caller] ?: return false if (query in systemApps) return false + logD(TAG, "@shouldHideInstallationSource $caller -> $query") + if (caller == query && appConfig.excludeTargetInstallationSource) return false + + try { + val uid = Utils.getPackageUidCompat(pms, query, 0L, 0) + if (uid < 0) return false // invalid package installation source request + // logD(TAG, "@shouldHideInstallationSource UID for $query: $uid") + } catch (e: Throwable) { + // logD(TAG, "@shouldHideInstallationSource UID error", e) + return false + } return appConfig.hideInstallationSource }