Skip to content

feat(screen-off): prompt for missing permissions on startup#24

Merged
Xitee1 merged 4 commits into
feat/in-app-rotationfrom
feat/screen-off-permission-prompt
Apr 18, 2026
Merged

feat(screen-off): prompt for missing permissions on startup#24
Xitee1 merged 4 commits into
feat/in-app-rotationfrom
feat/screen-off-permission-prompt

Conversation

@Xitee1
Copy link
Copy Markdown
Owner

@Xitee1 Xitee1 commented Apr 18, 2026

Summary

  • Simplifies the Screen row description to "Turn off display - Device admin" / "Turn off display - Shizuku" and drops the embedded permission-hint text.
  • On app start, shows a dialog if a feature that needs device admin or Shizuku is enabled but the permission is missing. User can grant or cancel; cancelling leaves toggles untouched and the dialog returns on the next launch.
  • Shizuku-based features (soft screen-off, Wi-Fi-off, Bluetooth-off) are bundled into a single dialog with a bullet list.

Notes

  • Stacked on feat/in-app-rotation (feat(timer): handle rotation in-app without relaunching activity #23).
  • ShizukuRequiredDialog accepts either a single explanation (existing call sites unchanged) or a list + optional intro text (new startup flow).
  • Startup check runs once per process via a flag on TimerViewModel; navigation back from Settings does not re-trigger it.
  • Removed the unused screen_admin_required string in feature/timer (the legacy app/src/main/res/values*/strings.xml copy was left alone).

Test plan

  • Fresh install, enable "Turn off display" → Device admin method; kill app → next launch shows admin dialog; Grant → lockscreen works; Cancel → toggle stays on, dialog reappears on next launch.
  • Soft screen-off + Wi-Fi-off + Bluetooth-off all enabled without Shizuku → single Shizuku dialog lists all three; granting permission closes the dialog.
  • With all permissions granted, no dialog appears at startup.
  • Disabling the toggle silences the dialog on next launch.
  • Existing Settings-screen flows (method picker, per-toggle Shizuku prompts) still work.

🤖 Generated with Claude Code

Xitee1 and others added 4 commits April 18, 2026 22:42
Simplifies the Screen toggle's row description to "Turn off display -
Device admin" / "Turn off display - Shizuku" and drops the embedded
permission-hint text.

On app start, checks enabled features against the current permission
state. If device admin is required for the hard lock method but not
granted, or Shizuku is required for soft screen-off / Wi-Fi-off /
Bluetooth-off but not ready, a dialog appears letting the user grant
or cancel. Cancelling leaves the toggles untouched; the dialog returns
on the next launch until the user either disables the option or grants
the permission.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a semantic icon above the title on all three dialogs (device
admin, Shizuku, screen-lock method), bumps the Shizuku body spacing to
16 dp and wraps the content in a vertical scroll for long feature
lists. Promotes the method-picker descriptions from bodySmall to
bodyMedium and drops an ad-hoc 4 dp horizontal padding.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Startup permission prompts (device admin + Shizuku) dismiss with
"Ignore" instead of "Cancel"; the user isn't cancelling an action, the
dialog just reappears next launch. Settings flows keep "Cancel" since
they abort enabling the toggle.

The admin dialog title now reads "Device admin permission required" /
"Geräteadministrator-Berechtigung erforderlich" so it clearly refers
to a permission rather than a person.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
On cold start the Shizuku binder may not have connected yet when the
TimerScreen's LaunchedEffect runs. In that window `pingBinder()`
returns false, so the startup check reported NotRunning even when
Shizuku was actually up and the real state was PermissionRequired.
Result: no dialog when the user had previously denied permission.

Tracks the first binder-received callback in ShizukuManager and
exposes `awaitInitialState(timeoutMs)` that suspends until the binder
connects (or the timeout elapses). The startup check in
TimerViewModel now awaits this before deciding, so NotRunning is only
reported when Shizuku genuinely isn't running.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Xitee1 Xitee1 merged commit a239806 into feat/in-app-rotation Apr 18, 2026
@Xitee1 Xitee1 deleted the feat/screen-off-permission-prompt branch April 19, 2026 07:26
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.

1 participant