Skip to content

Listing settings for modify setting action should use settings list for expert mode users#2159

Merged
sds100 merged 3 commits into
developfrom
claude/issue-2157-settings-list-expert-mode
Jun 9, 2026
Merged

Listing settings for modify setting action should use settings list for expert mode users#2159
sds100 merged 3 commits into
developfrom
claude/issue-2157-settings-list-expert-mode

Conversation

@keymapper-ai

Copy link
Copy Markdown
Collaborator

Closes #2157

Summary

  • Added a new getAllSettings(String namespace) method to ISystemBridge.aidl (transaction ID 26) that queries the Settings ContentProvider directly from within the system bridge process.
  • Implemented getAllSettings() in SystemBridge.kt using ActivityManagerApis.getContentProviderExternal("settings", ...) + IContentProviderUtils.queryCompat() to retrieve all settings rows with the elevated shell/root privileges the system bridge already holds.
  • Added queryCompat() to IContentProviderUtils to handle the version-dependent IContentProvider.query() signatures across API 29 (Android 10), 30 (Android 11), and 31+ (Android 12+, AttributionSource-based).
  • Updated ChooseSettingViewModel to inject SystemBridgeConnectionManager and, when the system bridge is connected, call bridge.getAllSettings(namespace) instead of settingsAdapter.getAll(type). Falls back to the existing ContentResolver-based query when the system bridge is not connected.

The system bridge runs as shell (or root), giving it unrestricted access to all Settings rows that the app process normally cannot read. No shell subprocess is spawned.

Known limitations / areas for human review

  • queryCompat() assumes the IContentProvider.query() transaction IDs match the expected AOSP layout for API 29/30/31+. If a device ships a heavily patched SettingsProvider that changes these signatures, the query may fail — in which case the code silently falls back to settingsAdapter.getAll().
  • Null setting values are encoded as an empty string after = in the returned array (key=), which parseKeyValuePairs decodes back to null. Empty-string values and null values are therefore indistinguishable; this matches the behaviour of the existing ContentResolver path.
  • ChooseSettingViewModel does not re-fetch when the system bridge connects/disconnects mid-session — the user would need to navigate back and reopen the screen. This is acceptable for now as it mirrors other system-bridge-dependent UI.

Test plan

  • Build and install a debug APK on a stock Android device with the system bridge running
  • Open a key map → Add action → Modify Setting → Choose Existing Setting
  • Verify that the list shows significantly more settings than without expert mode (especially for secure and global namespaces)
  • Verify fallback: stop the system bridge and reopen the screen — the list should still populate (from ContentResolver)
  • Verify no regression on the existing ContentResolver path (non-expert-mode device)

Generated by Claude Code


Generated by Claude Code

claude and others added 3 commits June 9, 2026 09:09
… setting screen

When the system bridge is connected (expert mode), the choose setting
screen now queries the Settings ContentProvider directly through a new
getAllSettings() AIDL method instead of falling back to the restricted
ContentProvider query from the app process.

The system bridge runs with shell/root privileges, giving it access to
all settings rows that the app process cannot see. A queryCompat helper
is added to IContentProviderUtils to handle the version-dependent
IContentProvider.query() signatures across API 29–34+. When the system
bridge is not connected, the existing ContentResolver query is used as
a fallback.
@sds100 sds100 merged commit 9c6aeb2 into develop Jun 9, 2026
4 checks passed
@sds100 sds100 deleted the claude/issue-2157-settings-list-expert-mode branch June 9, 2026 15:25
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.

Listing settings for modify setting action should use settings list for expert mode users

3 participants