Skip to content

Android 17 Fixes - App List and Privacy Settings Crash#3

Open
Saloframes wants to merge 4 commits into
SysAdminDoc:mainfrom
Saloframes:cursor/fix-privacy-settings-crash-0ec4
Open

Android 17 Fixes - App List and Privacy Settings Crash#3
Saloframes wants to merge 4 commits into
SysAdminDoc:mainfrom
Saloframes:cursor/fix-privacy-settings-crash-0ec4

Conversation

@Saloframes

Copy link
Copy Markdown

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:

  • Updated all SwitchPreferenceCompat keys in preferences_privacy.xml and corresponding usages in PrivacyPreferences.java to use the registered enable_* names, preventing IllegalArgumentException crashes when opening Settings > Privacy. [1] [2] [3] [4] [5]
  • Added PrivacyPreferencesKeyParityTest to verify that all persistent privacy preference keys are registered in AppPref, ensuring future changes do not break the settings screen.

Android 17 (API 37) compatibility for installed app list:

  • Refactored PackageManagerCompat to tolerate Android 17’s hidden return type change for getInstalledPackages and getInstalledApplications by catching linkage errors, retrying reflectively, and normalizing results via a new extractList method. This prevents crashes and ensures the installed app list and About device screen work on new Android versions. [1] [2]
  • Added PackageManagerCompatListExtractionTest to verify that extractList correctly handles all possible return types (ParceledListSlice, List, null, or unknown wrappers), ensuring forward compatibility.
  • Added a contract test in Android17BehaviorContractTest to assert that the installed list accessor methods continue to guard against return type changes and use the normalization shim.

Documentation:

  • Updated CHANGELOG.md to reflect the fixes for Settings > Privacy crashes and Android 17 compatibility.

cursoragent and others added 4 commits June 27, 2026 08:34
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>
Copilot AI review requested due to automatic review settings June 27, 2026 20:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants