Skip to content

Add "Return to Home" feature via Shizuku#53

Open
Xitee1 wants to merge 1 commit into
mainfrom
claude/timer-auto-return-home-1wgr8g
Open

Add "Return to Home" feature via Shizuku#53
Xitee1 wants to merge 1 commit into
mainfrom
claude/timer-auto-return-home-1wgr8g

Conversation

@Xitee1

@Xitee1 Xitee1 commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a new optional timer action that returns the device to the home screen when the timer ends, implemented via Shizuku's shell execution to work around Android 10+ background activity launch restrictions.

Changes

  • New Shizuku controller: ShizukuHomeController executes input keyevent 3 (KEYCODE_HOME) to simulate a home button press
  • Service integration: SleepTimerService calls goHome() before screen-off if the setting is enabled and Shizuku is ready; only executes while the screen is interactive to avoid waking a sleeping device
  • Settings model & persistence: Added returnToHome boolean to UserSettings and SettingsRepository with DataStore backing
  • UI: New toggle in Settings screen with Home icon, title, and description; integrated into startup permission check dialog
  • Localization: Added English and German strings for the feature explanation, setting title/description, and startup dialog label
  • Enum update: Added RETURN_HOME to ShizukuFeature enum for permission validation in TimerViewModel

Implementation Details

  • The home key press is sent before the screen-off step so the launcher (not the media app) is what greets the user at the next unlock
  • Respects the interactive screen state to avoid unintended device wake-ups
  • Follows the same Shizuku permission request pattern as Wi-Fi and Bluetooth toggles
  • Properly integrated into the startup permission check flow to warn users if Shizuku is missing

https://claude.ai/code/session_01BVM4Gpx6wa9fwwXUoP8PNh

New opt-in Shizuku-backed setting: when the timer expires, the service
simulates a home key press (KEYCODE_HOME via the shell user service) so
the launcher replaces the media app on screen. Runs only while the
screen is interactive — KEYCODE_HOME would otherwise wake a sleeping
device — and before the screen-off step so the launcher is what greets
the user at the next unlock.

Goes through Shizuku like the Wi-Fi/Bluetooth toggles because Android
10+ blocks background activity launches, so a plain startActivity with
ACTION_MAIN/CATEGORY_HOME from the service would be silently dropped.
The toggle is gated behind the Shizuku dialog in Settings and included
in the startup permission check for enabled-but-unpermitted features.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BVM4Gpx6wa9fwwXUoP8PNh
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.

2 participants