Commit Graph

15 Commits

Author SHA1 Message Date
subochev 59069a741e phone: keep-alive foreground service + notification perm; glasses: clear NoConnection on reconnect
- ConnectionKeepAliveService (foreground, PARTIAL_WAKE_LOCK + WIFI_MODE_FULL_HIGH_PERF,
  started in PhoneVmApp.onCreate): without it HONOR deep-sleeps the phone process on
  screen-off and the glasses lose the WebSocket link. Same mechanic as view-mate.
- MainActivity: request POST_NOTIFICATIONS so the FGS notification is visible.
- VmGlassesController.onPhoneConnected(): drop a stuck NoConnection state when the
  phone (re)connects; returns to Running if a guest is active, else NoAppSelected.
- VmService: call it from onConnected.
- stopGuest/switch: force-stop the previous guest before releasing its display
  (releasing first migrates the guest task to display 0 full-screen); VirtualDisplay
  frame source now destroys its UserService on release.
- Mercury status: retry the first pullGeneralStatus until it lands, refresh every 15s
  and on tab open; GlassesStatusScreen shows 'Ждём статус от очков…' instead of fake zeros.
- MainActivity(glasses): HOME candidate flag + finish() on a non-default display (recursion guard).
- README: Home-launcher setup/rollback section.
- BOOTSTRAP_TEST.md: post-reboot Shizuku bootstrap investigation log.
2026-09-26 13:59:54 +03:00
subochev 94f0ed28fc glasses: ignore scroll drags shorter than 96px (guest counts them as item clicks); phone: skip centroid jump on finger-count change 2026-09-25 20:27:26 +03:00
subochev 05daf3fc7b phone: delay touchpad tap click by 100 ms; second finger cancels it 2026-09-25 20:20:39 +03:00
subochev fe95d249e9 glasses: start Mercury kill guard with service; batch scroll deltas into one drag per tick 2026-09-25 20:07:42 +03:00
subochev c69e8a2e80 glasses: hold Mercury kill switch on hidden VirtualDisplay; phone: brightness/WiFi panel, two-finger touchpad scroll 2026-09-25 19:49:25 +03:00
subochev 3fce3eb3ca phone: third «Пульт» tab with on-glasses cursor; atomic click injection
- shared: VmDisplay (guest 640x480 coordinate space), CursorMove and
  CursorClick messages (CursorClick replaces the DOWN/UP pair — see below).
- glasses: cursor state + Canvas overlay drawn in both eyes, clickCursor
  injects one atomic tap at the cursor, sendKey for Back/Play/Pause.
- phone: RemoteScreen — touchpad (relative drag moves the cursor, tap
  clicks), «Назад»/«Плей»/«Пауза» buttons, «Клавиатура» stub (TODO).
- The old CursorButton(DOWN)/CursorButton(UP) pair was removed: the two
  messages were injected concurrently and could arrive out of order,
  breaking the guest's touch stream so clicks worked only once.
- tests: CursorMove/CursorClick roundtrips.
2026-09-25 18:20:56 +03:00
subochev 03f1d7dcc7 glasses: launch guest on Shizuku VirtualDisplay + binocular render
- VmShizukuService is a Shizuku UserService only; remove its <service> manifest entry (ServiceStarter instantiates it reflectively, an Android service entry causes ClassCastException)
- VirtualDisplayFrameSource: await binder via ShizukuVdClient.bindForResult(5s), expose virtualDisplayId + shizukuBinder, stop the UserService on release
- VmGlassesController: serialize acquire via Mutex, use double-buffered SurfaceTexture (DisplayManagerService rejects single-buffer), launch the guest on the VD with ShizukuVdBinder.launchActivity
- GlassesScreen: render controller.frameSource (Running) directly; drop the LaunchedEffect acquire
- DebugTestReceiver: register at runtime from MainActivity (background manifest receivers are blocked on Android 12+)
2026-09-25 17:19:49 +03:00
subochev 5afdde70e1 build: add .gitignore (build, .gradle, .idea, .cortexkit) 2026-09-25 15:22:43 +03:00
subochev 42f117796a glasses: ShizukuBootstrap rewrite per docs (sticky listener + activity context)
Rewrite the Shizuku integration to follow https://github.com/RikkaApps/Shizuku-API:

- attach(activity) instead of attach(): requestPermission() must run from
  an Activity context (Manager's RequestPermissionActivity is a normal
  Activity started from ours).
- addBinderReceivedListenerSticky: ensures our listener fires even if the
  binder was already received before we attached (race against the
  ShizukuProvider init).
- addRequestPermissionResultListener: routes the dialog's allow/deny
  back into the StateFlow.
- onRequestPermissionResult(requestCode, grant): helper for the Activity
  to forward the system callback.
- pingBinder / checkSelfPermission / requestPermission gates follow the
  state machine from the docs (Waiting → NeedsPermission → Granted).

Move attach() out of GlassesVmApp.onCreate (no Activity context there)
into MainActivity.onCreate after super.onCreate.
2026-09-25 15:21:34 +03:00
subochev 86bffed6ec phone: dynamic app list from glasses + two-channel GlassesStatusScreen
Phone app:
- VmPhoneController: collect appsOnGlasses from glasses (state flow), and
  requestAppList() sends VmMessage.GetAppList over WebSocket.
- AppsListScreen: rename to dynamic list from glasses, verticalScroll,
  tap → LaunchAppCommand(packageName). Tap calls onAppClick for parent
  nav (Glasses tab on the bottom NavigationBar).
- Shared VM message types (VmMessage.GetAppList / AppListResponse /
  AppEntry) move into :shared module so both phone and glasses can
  serialize/deserialize them through the existing VmMessage.Json

Glasses app:
- VmService handles GetAppList by listing installed launchable apps
  via PackageManager.queryIntentActivities (combined with Android 11+
  <queries> fix in the previous commit so 3rd-party apps appear) and
  replies with AppListResponse.
- GlassesScreen drives state from controller.state; no longer hardcodes
  any apps in the UI.

Tested end-to-end on A06B4AB933C4103: phone taps app on
AppsListScreen → glasses' VmService receives LaunchAppCommand →
controller.launchGuest(pkg) launches the activity via
PackageManager.getLaunchIntentForPackage + FLAG_ACTIVITY_NEW_TASK.
2026-09-25 15:21:14 +03:00
subochev cc5866b373 glasses: list all installed launchable apps on phone (Android 11+ queries)
- Add <intent MAIN+LAUNCHER> to <queries> so queryIntentActivities on the
  glasses side returns third-party apps (free.zona etc), not only system /
  RayNeo system apps. Without this entry Android 11+ package visibility
  filter strips apps whose package is not explicitly named.
- Pass MATCH_ALL | GET_RESOLVED_FILTER to queryIntentActivities as a
  belt-and-suspenders measure (no visible effect with queries above, but
  safe on Android 12+ where the platform may still filter).
- Default VmGlassesController state is NoAppSelected instead of Starting,
  so we don't show 'Подготавливаем очки...' on first launch when no
  LaunchAppCommand has been received yet.
- DriveShizukuState leaves Running state alone on re-check (don't drop
  a running guest back to ShizukuMissing just because Shizuku was
  re-polled).
2026-09-25 15:19:57 +03:00
subochev ca01a7b918 docs: SPEC §5.3.1 — document Shizuku v12+ integration on RayNeo X3 Pro
- Replace obsolete moe.shizuku.permission.SHIZUKU (v11) with the v12+
  moe.shizuku.manager.permission.API_V23 in the GlassesApp permission list.
- Document the rikka.shizuku.ShizukuProvider provider block required by
  the Shizuku-API guide; without it the binder never arrives.
- Add §5.3.1 'Интеграция с Shizuku' explaining:
  * why dev.rikka.shizuku:provider is required (ContentProvider.onCreate
    pulls the binder via IPC);
  * the activity-side listener pattern (addBinderReceivedListenerSticky +
    addRequestPermissionResultListener);
  * the RayNeo system launcher race condition (PID 24482
    com.ffalconxr.mercury.launcher, UID system, forceStopPackage on
    RequestPermissionActivity within ~14ms).
2026-09-25 14:47:12 +03:00
subochev e01fafd5a9 glasses: switch to rikka.shizuku.ShizukuProvider, fix binder acquisition
- Add dev.rikka.shizuku:provider:13.1.5 dependency.
- Replace custom ShizukuInitProvider with rikka.shizuku.ShizukuProvider
  from the upstream library; configured per Shizuku v12+ docs with
  android:permission='android.permission.INTERACT_ACROSS_USERS_FULL'
  to protect the provider from ordinary apps.
- Move ShizukuBootstrap.attach() from GlassesVmApp.onCreate to
  MainActivity.onCreate (requestPermission needs an Activity context).
- MainActivity now overrides onRequestPermissionsResult and forwards
  the grant to ShizukuBootstrap.
- Rewrite ShizukuBootstrap strictly per the Shizuku-API guide:
  addBinderReceivedListenerSticky + addRequestPermissionResultListener
  in attach(); pingBinder / checkSelfPermission / requestPermission
  in refresh().
- Drop ShizukuInitProvider.kt — its job is now done by
  rikka.shizuku.ShizukuProvider.onCreate (verified in logcat:
  'ShizukuProvider: binder received').

Verified on device ARGF20 (A06B4AB933C4103, API 32): Shizuku dialog
'Allow rayneo-vm to use Shizuku?' opens correctly; binder received
via ShizukuProvider; launcher icon now visible (meta-data fix).
2026-09-25 14:44:52 +03:00
subochev 987f9e5547 init 2026-09-25 13:24:56 +03:00
subochev 45066a65a1 Initial commit 2026-09-25 01:36:46 +00:00