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>
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.