Android 17 Fixes - App List and Privacy Settings Crash - #3
Open
Saloframes wants to merge 4 commits into
Open
Conversation
On Android 17 (API 37) the hidden IPackageManager.getInstalledPackages/ getInstalledApplications return type changes, so the ParceledListSlice descriptor compiled into our bytecode no longer resolves and the direct call fails with a NoSuchMethodError. This left the installed-app list empty and crashed Settings > About device (DeviceInfo2#getPackageStats catches Exception, not Error). The accessors now catch the linkage error, re-dispatch the call reflectively (method resolution ignores the return type), and normalize the result via a new extractList() helper that handles ParceledListSlice, a plain List, an unknown getList()-exposing wrapper, and null. Current Android versions keep using the fast direct path. Co-authored-by: Saloframes <Saloframes@users.noreply.github.com>
…ckageManagerCompat.java Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…apps-0ec4 fix: tolerate Android 17 getInstalled* return-type change
Opening Settings > Privacy crashed because three SwitchPreferenceCompat rows used app:key values that SettingsDataStore cannot resolve in AppPref: permission_change_monitor signing_cert_change_monitor app_change_auditor Inflating the screen calls SettingsDataStore.getBoolean() for each persistent switch, which throws IllegalArgumentException for unknown keys. Rename the keys to the registered enable_* names and add a parity unit test so future privacy toggles cannot regress. Co-authored-by: Saloframes <Saloframes@users.noreply.github.com>
SysAdminDoc
pushed a commit
that referenced
this pull request
Aug 25, 2026
On Android 17 (API 37) the hidden IPackageManager.getInstalledPackages/ getInstalledApplications return type changes, so the ParceledListSlice descriptor compiled into our bytecode no longer resolves and the direct call fails with a NoSuchMethodError. This left the installed-app list empty and crashed Settings > About device (DeviceInfo2#getPackageStats catches Exception, not Error). The accessors now catch the linkage error, re-dispatch the call reflectively (method resolution ignores the return type), and normalize the result via a new extractList() helper that handles ParceledListSlice, a plain List, an unknown getList()-exposing wrapper, and null. Current Android versions keep using the fast direct path, including the existing IPackageManagerV37 PackageInfoList route for getInstalledPackages, which now also falls back reflectively instead of throwing if a build's descriptor differs. Ported from the fix Saloframes carried in their fork (PR #3), rebased onto the current enumeration layer. Fixes #6
SysAdminDoc
added a commit
that referenced
this pull request
Aug 25, 2026
Settings > Privacy crashed in v0.6.12 with IllegalArgumentException "Invalid key: permission_change_monitor": three SwitchPreferenceCompat rows used app:key values that SettingsDataStore cannot resolve in AppPref, and every persistent switch reads its value through that store while the screen inflates. The key rename that fixes the crash (enable_* names) already landed in 95731f5; Saloframes independently diagnosed and fixed the same mismatch in their fork (PR #3). The follow-up SecurityException from reading device_idle_constants on Android 12+ (reported by kreza6173-pixel on the same issue) was guarded in the same commit. What was still missing is a net over the pattern itself: any settings screen can reintroduce the crash by adding one persistent preference with an unregistered key. SettingsPreferenceKeyParityTest now walks every preferences_*.xml and asserts each persistent value-backed preference key resolves in AppPref. The profile configuration screen is excluded because it persists through its own profile-scoped ConfDataStore, and a companion assertion pins that exclusion to the actual ConfPreferences wiring. The sweep found no other live offenders. Fixes #8
Owner
|
Landed with your authorship kept. The privacy key half had already gone into main during the v0.6.17 work (95731f5), and the getInstalled* compat piece is now in 74fc7ae under your name, rebased onto the newer enumeration layer. Main grew a direct IPackageManagerV37 path for getInstalledPackages since June, so your reflective fallback now backs that up and covers getInstalledApplications, which had no API 37 handling at all. Your extraction tests came along too. Thanks for carrying this in your fork, the test coverage especially. Leaving the PR itself to you since it will show conflicts against main now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Worked on some solutions to problems created by Android 17. Should fix the App List issue (same solution works on upstream AM too, tested to verify) and the app should no longer crash after trying to open Privacy options. Generated summary below:
This pull request addresses two major issues: fixing crashes in the Settings > Privacy screen due to preference key mismatches, and restoring compatibility with Android 17 (API 37) for loading the installed applications list. It also adds comprehensive tests to prevent regressions and ensure forward compatibility as Android evolves.
Settings stability and key registration fixes:
SwitchPreferenceCompatkeys inpreferences_privacy.xmland corresponding usages inPrivacyPreferences.javato use the registeredenable_*names, preventingIllegalArgumentExceptioncrashes when opening Settings > Privacy. [1] [2] [3] [4] [5]PrivacyPreferencesKeyParityTestto verify that all persistent privacy preference keys are registered inAppPref, ensuring future changes do not break the settings screen.Android 17 (API 37) compatibility for installed app list:
PackageManagerCompatto tolerate Android 17’s hidden return type change forgetInstalledPackagesandgetInstalledApplicationsby catching linkage errors, retrying reflectively, and normalizing results via a newextractListmethod. This prevents crashes and ensures the installed app list and About device screen work on new Android versions. [1] [2]PackageManagerCompatListExtractionTestto verify thatextractListcorrectly handles all possible return types (ParceledListSlice,List, null, or unknown wrappers), ensuring forward compatibility.Android17BehaviorContractTestto assert that the installed list accessor methods continue to guard against return type changes and use the normalization shim.Documentation:
CHANGELOG.mdto reflect the fixes for Settings > Privacy crashes and Android 17 compatibility.