Skip to content

fix: Grayscale feature crashing when reading the extra dim state - #171

Merged
flxapps merged 1 commit into
masterfrom
fix/grayscale-crash-hidden-settings
Jul 19, 2026
Merged

fix: Grayscale feature crashing when reading the extra dim state#171
flxapps merged 1 commit into
masterfrom
fix/grayscale-crash-hidden-settings

Conversation

@flxapps

@flxapps flxapps commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Fixes #170.

v2.5.0 started reading the extra dim state (reduce_bright_colors_activated) in GrayscaleAppsFeature.onStart() to initialize the cached filter state. That key is a hidden setting without @Readable, and since Android 12 reading those throws a SecurityException for third-party apps. GrapheneOS enforces this, so the app crashed the moment the grayscale feature started, for one reporter even directly on app open, since onStart() runs as soon as the accessibility service connects.

Reads of secure settings now go through a small helper that falls back to the default value when the key is not readable. Worst case we don't detect that extra dim was already on before DetoxDroid started, which is harmless. Writing the setting still works fine with WRITE_SECURE_SETTINGS, so the feature itself is unaffected.

…den settings

Since Android 12, hidden settings keys that are not marked @readable
(like reduce_bright_colors_activated) throw a SecurityException when a
third-party app reads them. GrapheneOS enforces this, so initializing
the extra dim state in onStart() crashed the app as soon as the
grayscale feature started. Reads now fall back to the default value if
the key is not readable. Writing via WRITE_SECURE_SETTINGS is not
affected.

Fixes #170
@flxapps flxapps self-assigned this Jul 19, 2026
@flxapps
flxapps merged commit 5c640eb into master Jul 19, 2026
1 check passed
@flxapps
flxapps deleted the fix/grayscale-crash-hidden-settings branch July 19, 2026 20:34
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.

[BUG] Automatic grayscale won't work and causes app to crash

1 participant