Skip to content
This repository was archived by the owner on Jul 29, 2026. It is now read-only.

Shizuku hybrid power mode + Computer Use retry + sharper agent prompt - #2

Closed
jackspiece wants to merge 4 commits into
viktor/cu-hardeningfrom
viktor/shizuku-power-mode
Closed

jackspiece wants to merge 4 commits into
viktor/cu-hardeningfrom
viktor/shizuku-power-mode

Conversation

@jackspiece

Copy link
Copy Markdown
Owner

Shizuku hybrid power mode + Computer Use retry + sharper agent prompt

Stacked on top of #1 (base = viktor/cu-hardening). Retarget to main once #1 merges.

1. Shizuku "power mode" (hybrid control)

  • Master toggle in Scene Model settings → "Shizuku Control (Power Mode)".
    • OFF → Accessibility only (original behavior).
    • ON → hybrid: taps / long-press / text / keys go through Shizuku (shell-level input, reaches tougher surfaces); scrolling stays on Accessibility for smoother flings.
  • Every action auto-falls back to Accessibility if Shizuku fails, and only uses Shizuku when it's actually granted.
  • Live indicator: the floating operation window prefixes each step with 🛡 Shizuku / 👆 Accessibility so you can see, per action, which one is driving the phone.

2. Computer Use retry

  • HttpController.postGeminiComputerUseInteraction now retries transient upstream failures (504/503/502/500/429/408 + network IO) with 0.8s / 2s / 4s backoff. One 504 "deadline expired" no longer aborts the whole task. Covers both phone and browser CU.

3. English UI

  • Existing Phone Computer Use card is now bilingual (English for English locale). New Shizuku card is English-first.

4. Sharper main-agent (Brain 1) prompt

  • Clearer guidance for summoning/handing off to the on-device computer-use agent: one clear outcome-focused goal, context_apps_query + packageName first, one task per call, handle FINISHED/takeover, retry once on transient failure, don't micromanage taps. (EN + ZH.)

Notes

  • Shizuku must be re-started after each reboot (surfaced in the card).
  • New file: baselib/.../shizuku/ShizukuControlState.kt.

Viktor Ai added 4 commits June 25, 2026 20:28
Device control (the "hand" layer):
- New ShizukuControlState (baselib): persists a "prefer Shizuku control"
  toggle (mirrored with Flutter shared_preferences) and tracks, at runtime,
  which technique last drove the phone for a live UI indicator.
- ShizukuCapabilityManager: add tap/swipe/longPress via shell-level `input`.
- AndroidDeviceOperator: hybrid routing. When power mode is ON and Shizuku is
  granted, taps/long-press/text/keys go through Shizuku (reaches tougher
  surfaces); scrolling stays on Accessibility for smooth flings. Every action
  falls back to Accessibility on failure and reports the technique used.
- ExecutionUIImpl: floating operation window now prefixes each step with a
  live badge (🛡 Shizuku / 👆 Accessibility) and clears it when the task ends.

Reliability:
- HttpController: retry Gemini Computer Use interactions on transient upstream
  failures (504/503/502/500/429/408 + network IO) with 0.8s/2s/4s backoff,
  rebuilding the request body each attempt. Covers both phone and browser CU.

UI (Flutter, English-first):
- scene_model_setting: existing Phone Computer Use card converted to bilingual
  (English for English users). New "Shizuku Control (Power Mode)" card with an
  On/Off master toggle (OFF = Accessibility only, ON = hybrid), live Shizuku
  grant status, grant button when needed, and a note about reboot re-activation
  and the in-task live indicator.

Agent brain:
- AgentSystemPrompt: sharper guidance for summoning/handing off to the on-device
  computer-use agent — one clear outcome-focused goal, context_apps_query +
  packageName first, one task per call, handle FINISHED/takeover, retry once on
  transient failure, don't micromanage taps. (EN + ZH.)
The on-screen status phrases shown while the agent controls the phone
("getting ready", "accepted the task", "Running", "you've taken over",
"Opening app...", "action complete") were hardcoded Chinese. Route them
through LocalizedText/AppLocaleManager so English users see English. The
live \u0001f6e1/\u0001f446 control-method badge was already English.
…er mode

Shizuku 'input text' can't type non-ASCII, fires char-by-char keyevents
that drop on stubborn fields, and reports success even when nothing lands
in the box. Route typing through accessibility first (atomic, any unicode),
Shizuku only as exception fallback. Power mode still uses Shizuku for
taps/long-press/keys/scroll. Removed now-unused shizukuType helper.
Symptom: in power mode the CU agent kept re-tapping a text box instead of
typing. Cause: raw Shizuku 'input tap' doesn't reliably focus EditTexts /
raise the IME the way an accessibility gesture-tap does, so the model never
sees focus in the next screenshot and loops. Make taps + long-press
accessibility-first (proper down/up gesture = reliable focus), Shizuku only
as a reach fallback when the accessibility gesture throws. Keys (HOME/BACK/
ENTER) stay Shizuku-preferred. Updated power-mode card description to match.
@jackspiece

Copy link
Copy Markdown
Owner Author

Closing this inactive experiment because I am narrowing my public contribution work to maintained upstream areas. The branch remains available.

@jackspiece jackspiece closed this Jul 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant