Skip to content

Develop - shut up bug fix, translations#455

Merged
sameerasw merged 45 commits into
mainfrom
develop
May 21, 2026
Merged

Develop - shut up bug fix, translations#455
sameerasw merged 45 commits into
mainfrom
develop

Conversation

@sameerasw
Copy link
Copy Markdown
Owner

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:

  • Bumped versionCode to 46 and versionName to 15.2 in build.gradle.kts.

Stability improvements (Settings access):

  • Introduced a safeReadSetting helper in ShutUpShortcutActivity.kt to safely read system, secure, and global settings, handling potential SecurityException on Android 12+ and logging unreadable settings. All direct Settings.*.getString calls in this activity are now replaced with this safer method. [1] [2] [3] [4] [5]

Localization:

  • Added new translation keys for the "Screen Off" widget and related features in multiple languages (strings.xml for ach, af, ar, ca, cs, da, de). [1] [2] [3] [4] [5] [6] [7]
  • Improved and expanded German translations for feature descriptions and UI elements. [1] [2] [3] [4] [5] [6] [7]

sameerasw added 30 commits May 20, 2026 18:32
sameerasw and others added 15 commits May 20, 2026 18:36
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.
#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
@sameerasw sameerasw self-assigned this May 21, 2026
@sameerasw sameerasw added the bug Something isn't working label May 21, 2026
@sameerasw sameerasw added the translations For Translations and related tasks label May 21, 2026
@sameerasw sameerasw merged commit 58f567e into main May 21, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Essentials Progress May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working translations For Translations and related tasks

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants