Conversation
[ci skip]
[ci skip]
[ci skip]
[ci skip]
[ci skip]
[ci skip]
[ci skip]
[ci skip]
[ci skip]
[ci skip]
[ci skip]
[ci skip]
[ci skip]
[ci skip]
[ci skip]
show_key_presses and other @hide keys aren't @readable on Android 12+, so the backup pass in ShutUpShortcutActivity crashes before launchApp runs. WRITE_SECURE_SETTINGS only covers writes, which is why having Shizuku doesn't help. Reads now go through a try/catch helper that returns null on failure. Closes #443
SecurityException is the only failure we know how to handle here. Other exceptions are real bugs and shouldn't fail silently.
[ci skip]
#454) ## Summary Fixes the `SecurityException: Settings key: <show_key_presses> is not readable` crash on Android 12+ when launching a Shut Up shortcut. Reported in #443 on Pixel 7, Pixel 10 Pro, and a Samsung device, all running Android 16. ## Root cause `ShutUpShortcutActivity.applyShutUpSettings()` reads a list of dev-options keys via `Settings.{System,Secure,Global}.getString()` to back them up before flipping `DEVELOPMENT_SETTINGS_ENABLED` off. Since Android 12 (API 31), reading any `@hide` settings key that isn't annotated `@Readable` throws `SecurityException`: > Settings key: <show_key_presses> is not readable. From S+, settings keys annotated with @hide are restricted to system_server and system apps only, unless they are annotated with @readable. `WRITE_SECURE_SETTINGS` (granted via Shizuku) covers writes, not reads, so the Shizuku permission doesn't help. `show_key_presses` happens to be one of those non-`@Readable` hidden keys, and which keys get the annotation varies by OEM/build. That's why the crash reproduces on some Android 16 devices but not the maintainer's. Other keys in the same backup lists would crash the same way: `anr_show_background`, `secure_overlay_settings`, `mock_location`, `display_density_forced`, `disable_window_blurs`, `force_desktop_mode_on_external_displays`, and others. ## Fix Route every `Settings.*.getString` read in `ShutUpShortcutActivity` through a `safeReadSetting()` helper that catches `SecurityException` and returns `null`. The existing `?.let { … }` callers then skip unreadable keys. `DEVELOPMENT_SETTINGS_ENABLED` still gets flipped off, `launchApp(packageName)` still runs, and behavior is unchanged for any key that *is* readable. Skipping the backup is harmless in practice: flipping `DEVELOPMENT_SETTINGS_ENABLED` already resets the dev toggles, and those keys are system-managed defaults that couldn't have been restored anyway. `AppFlowHandler.restoreShutUpSettings()` already wraps each iteration in `try/catch`, so the restore path was never affected. ## Test plan - [x] Builds cleanly with AGP 9.2.1 / JDK 21 (`./gradlew :app:assembleDebug`). - [x] Tested on Pixel 7 (Android 16): the Shut Up shortcut now launches the target app instead of crashing. Closes #443
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.
This pull request updates the app version and introduces a safer method for reading Android system settings, improving stability on newer Android versions. It also adds new translation strings for the "Screen Off" widget and improves the German translations for various features.
Key changes:
Version update:
versionCodeto 46 andversionNameto 15.2 inbuild.gradle.kts.Stability improvements (Settings access):
safeReadSettinghelper inShutUpShortcutActivity.ktto safely read system, secure, and global settings, handling potentialSecurityExceptionon Android 12+ and logging unreadable settings. All directSettings.*.getStringcalls in this activity are now replaced with this safer method. [1] [2] [3] [4] [5]Localization:
strings.xmlfor ach, af, ar, ca, cs, da, de). [1] [2] [3] [4] [5] [6] [7]