diff --git a/android/app/src/main/java/tv/orbit/classic/MainActivity.kt b/android/app/src/main/java/tv/orbit/classic/MainActivity.kt index a49f7303..2e2fcc92 100644 --- a/android/app/src/main/java/tv/orbit/classic/MainActivity.kt +++ b/android/app/src/main/java/tv/orbit/classic/MainActivity.kt @@ -66,10 +66,6 @@ class MainActivity : ComponentActivity() { * opens as one copy (singleTask, 8 November 2026), also when adb sends them to an Orbit already open. */ private fun readAdbRequests(intent: android.content.Intent?) = Edition.readAdbRequests(this, intent) - override fun dispatchKeyEvent(event: android.view.KeyEvent): Boolean { - if (event.action == android.view.KeyEvent.ACTION_DOWN && event.repeatCount == 0) OrbitTiming.key(event.keyCode) - return super.dispatchKeyEvent(event) - } override fun onNewIntent(intent: android.content.Intent) { super.onNewIntent(intent); setIntent(intent); readAdbRequests(intent) } override fun onCreate(savedInstanceState: Bundle?) { // A restore confirmed on the phone's backup is put in place first, before anything here reads the data. @@ -192,6 +188,8 @@ private fun OrbitApp() { val activity = androidx.activity.compose.LocalActivity.current LaunchedEffect(Unit) { while (true) { delay(1000); if (SleepTimer.tick(System.currentTimeMillis())) { SleepTimer.clear(); activity?.finish() } } } Box(Modifier.fillMaxSize().background(Navy).onPreviewKeyEvent { event -> + // Timings (0.129 stage 0): when the press came, for the next frame drawn after it. Off unless switched on. + if (event.nativeKeyEvent.action == android.view.KeyEvent.ACTION_DOWN && event.nativeKeyEvent.repeatCount == 0) OrbitTiming.key(event.nativeKeyEvent.keyCode) // The first press after two hours without one asks who's watching, and does nothing else (WatchCheck). if (event.nativeKeyEvent.action == android.view.KeyEvent.ACTION_DOWN && WatchCheck.key()) { WatchCheck.swallowUp = true; return@onPreviewKeyEvent true } if (event.nativeKeyEvent.action == android.view.KeyEvent.ACTION_UP && WatchCheck.swallowUp) { WatchCheck.swallowUp = false; return@onPreviewKeyEvent true } diff --git a/android/gradle.properties b/android/gradle.properties index bd39374c..b1bcaf40 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,3 +1,5 @@ -org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8 +# 0.129: the Kotlin compiler ran out of its 2 GB building both editions at once (and packaging failed now and then). +org.gradle.jvmargs=-Xmx3g -Dfile.encoding=UTF-8 +kotlin.daemon.jvmargs=-Xmx3g org.gradle.workers.max=2 android.useAndroidX=true diff --git a/docs/audit-0.129/STAGE1-REPORT.md b/docs/audit-0.129/STAGE1-REPORT.md new file mode 100644 index 00000000..d2f5cafc --- /dev/null +++ b/docs/audit-0.129/STAGE1-REPORT.md @@ -0,0 +1,197 @@ +# 0.129 stage 1: the broken interactions, fixed and checked (10 November 2026) + +Branch `ux-0.129`, version 0.129.0 (build 42: household 420, Play 422). Development only. + +- Nothing was installed on either TV, and no real key was used or touched. +- The emulator (Android TV 14) ran builds signed with a throwaway key, against the Silo test server with fictional media. +- I added two fictional test films to Silo for the subtitle tests. +- Screenshots, the timing file and the navigation maps sit beside this file. The baseline is in `STAGE0-BASELINE.md`. + +## Summary + +| # | Issue | Cause | Fixed in | Checked on the emulator | +| --- | --- | --- | --- | --- | +| 1 | Password read aloud by TalkBack | Compose's secure field gives accessibility the real text | `PasswordField.kt`, `EmbyConnectionScreen.kt` | Accessibility now sees dots. TalkBack says "Characters 1 to 14", not the password. Sign-in still works (Play and household) | +| 2 | Who's watching: screen behind shows through; silent carry-on | Drawn as a box over the main screen; a five-second auto-continue | `Modal.kt`, `Profiles.kt`, `MainActivity.kt`, `AfterDarkLock.kt` (PIN) | Fully covered. No carry-on after 12 s. Back at launch → TV home. Back from inside → back, profile kept. TalkBack starts on the question and can't reach behind | +| 3 | Director's Chair: focus on Home, one Left loses it | The card the remote was on disappears; Android hands focus to the first item it finds; the Settings list opens whatever section it lands on | `Settings.kt` (`SettingsSubPage`, focus return) | OK → focus inside the Chair. Down/Left stay inside. Back → the Chair card (with TalkBack: the Channels item in the list, see risks) | +| 4 | Connect a phone, Add a room | Same cause | `Settings.kt` | Focus on Done/Close. Arrows stay. Back → the button that opened it | +| 5 | Quiz Night: OK doesn't answer | The answer was recorded, but the screen wasn't redrawn (same game object; the compiler skipped it) | `QuizNightScreen.kt` | OK shows ✓/✗, the score and Next. Next brings round 2 | +| 6 | High Scores out of line | Two side-by-side tables with different headings; rows with a Normal/Classic switch split the spare width | `ArcadePages.kt` | One table, columns shared by heading and rows, numbers right-aligned in equal-width figures. Before/after screenshots | +| 7 | Subtitles with the setting off | "Off" only meant "don't choose any", so the player took a track the file marked default | `WatchingControls.kt`, `EmbyPlaybackDialog.kt`, `Settings.kt`, `PhoneLink.kt`, `companion.html` | Off / On / Automatic matrix below. Also checked: a change applies straight away, it's the same on the phone, and it survives a restart | +| 8 | Up/Down stuck in text boxes | A text box kept the remote's Up/Down | `EmbyConnectionScreen.kt` | Down: address → username → password → Sign in; Up returns | +| — | Two bugs in my own first attempts, caught here | Password box showed plain text (single-line set after the password type); the quiz's first fix didn't redraw | — | Both fixed and checked again | + +## Details + +### 1. Password field + +**Before.** With TalkBack's "Speak passwords" on (this TV image's default), focusing the box said "Fictional-Pa55, End of field". +Any accessibility service could read it in full. + +**Now.** Android's own `EditText` (password type) sits inside the Compose form. + +- On screen it shows dots, in Orbit's font. +- Accessibility reads `••••••••••••••` (password=true). +- TalkBack, with "Speak passwords" on, says "Characters 1 to 14, End of field". + +The remote moves Down into it from the username, and Up and Down out of it. Typing and Done work. A real sign-in to Silo succeeded +on both editions. + +**Tests:** emulator only. A Compose UI test would need an instrumented test set-up, which Orbit doesn't have yet. + +### 2. Who's watching and the PIN + +- **The screen.** `OrbitModal` is its own window with a full backdrop. Nothing behind it can take keys, clicks or TalkBack focus. + It is used by Who's watching and by every PIN entry, which also stays out of screenshots. +- **No silent choice.** The five-second carry-on is removed. Nobody is chosen without OK. +- **Back, as you set it:** + + | Opened | Back does | + | --- | --- | + | As Orbit opens, or comes back after 10 minutes away | Leaves to the TV's home screen. The words say "Back leaves Orbit." | + | From inside Orbit: the profile picture, or after two idle hours | Goes back, keeping who's watching | + +- **Starting focus.** The last person watching, retried until the window is ready (it used to land on Kids). +- **The profile picture.** It no longer clears the profile (which made Back close Orbit). It asks from inside instead. +- **TalkBack.** Starts on "Who's watching?" (a heading). Left and Right move between Kids and Adult. OK goes to Home on All + Channels. The logo is now decoration. +- **Not built:** an opt-in automatic choice. There is none, as you asked. Adult still goes straight in when there is no Kids + profile and only one adult (unchanged; nobody is being chosen for). + +### 3 and 4. Pages that open in Settings + +`SettingsSubPage` is used for Director's Chair, New in your library, Create your own, Add a room and Connect a phone. + +- **While it loads**, an invisible holder inside the page keeps the remote. TalkBack hears "Loading". Focus moves into the page + when its first item appears. +- **No arrow leaves the page.** Down at the Chair's foot used to reach the Settings list and switch to On screen. +- **Back** parks the remote on the section's own list item, closes the page, then puts focus back on the card or button that opened + it. + +**Before** (`navmap-before*.md`): + +- Card OK → focus on Home in the top bar. +- Down → the Channels item in the list. +- Back → main menu. + +**After:** + +| Step | Without TalkBack | With TalkBack | +| --- | --- | --- | +| Card OK | BALANCED (inside the Chair) | Inside the Chair (TalkBack read the Settings heading first) | +| Down | Stays inside | Stays inside | +| Left | FAMILIAR, then stays | FAMILIAR | +| Back | The Director's Chair card | The Channels item in the list (one Right reaches the cards) | + +### 5. Quiz Night + +The first fix (handing the screen a counter) wasn't enough. The screen is now rebuilt for each answer and question +(`key(tick)`). Debug logs confirmed it redraws, then were removed. + +- **Before:** OK did nothing visible (the score was 100 underneath). +- **After:** ✓ on Mercury, ✗ on Mars, "Not quite: it's Mercury", then Next → Round 2. + +### 6. High Scores + +- **One table:** Game, Your best, House best, Played, Household, with the column widths in `ScoreColumns`. +- **Spacing:** the game name and its Normal/Classic switch share one cell. +- **Top 10:** fixed columns, with scores right-aligned. +- **Not checked yet:** rows filled with scores of every length and long names. The emulator had no scores. I'd add a screenshot + test with fixture scores when an instrumented test set-up exists. + +### 7. Subtitles + +**Your rules, in code** (`SubtitleMode`): + +- **Off:** forced tracks only. A programme with no separate forced track gets none, even when the file marks one track default. +- **On:** the TV's language, then English. +- **Automatic:** like Off, plus the viewer's language when all the sound is in another language. + +**In the player:** + +- Every player starts with "forced only" rules (`forcedSubtitlesOnly`), so Media3 never picks a default-flagged track before Orbit + has chosen. +- "None chosen" now applies those rules, instead of doing nothing. +- The player's listeners read the setting as it is now, not as it was. +- A change while a programme plays applies straight away. + +**The setting:** + +- Settings › On screen shows Off / On / Automatic, with what each does. +- The Companion has a Subtitles line (More › Settings) and `POST /api/subtitles`. `/api/now` reports the mode. +- Upgrade: the old switch "off" becomes Off, and "on" becomes On. + +**Results.** Two fictional test films, each with subtitle tracks that repeat every 2 seconds (`subtitles-matrix.png`): + +| Film | Off | Automatic | On | +| --- | --- | --- | --- | +| English sound: an ordinary English track marked default, plus a forced English track | FORCED SIGN TEXT only ✓ | FORCED SIGN TEXT only ✓ | ORDINARY SUBTITLE ✓ | +| Japanese sound: English (marked default) and Portuguese, nothing forced | None ✓ | English ✓ | English ✓ | + +Also checked: + +- A change from the phone applied straight away (Off → Automatic → Off → On) on a programme already playing. +- The setting survived a restart (the playback test reads it fresh). + +Not separately checked on the emulator: + +- **Catch Up:** uses the same player and code path. +- **A profile change:** the setting is the household's, not per profile. + +**Unit tests:** + +- `SubtitleModesTest` (5): the mapping from the old switch, Off never turns a whole track on, On's language order, Automatic only + for foreign sound, and Off's player rules. +- `AutoSubtitlesTest` (5, unchanged): still passes. + +**Test media:** two fictional films added to Silo, "Orbit Fixture Subtitles (2002)" and "Orbit Fixture Anime (2003)". They are +generated test patterns with tones and text tracks. + +### 8. Text boxes + +`textFieldKeys`: + +- OK opens the keyboard. +- Up and Down move to the box or button above or below. +- Down into the password (Android's own box) is asked for by name, because moving by direction doesn't reach into it. + +The backup code box already worked this way. + +## Release gate + +- **Passed:** household 1,177 tests and Play 1,166, with 0 failures and 0 lint errors. The editions check also passed: Play + isolated (`orbit_timing` is now refused in Play too), household intact, all unsigned. +- SHA-256: household `8cd44ab6…978d`, Play APK `90d60dce805de77e…`, Play bundle `124c2f77cbfaa6f2…`. +- **The build's memory is raised** (Gradle and Kotlin 3 GB each, in `gradle.properties`). The Kotlin compiler ran out of its + 2 GB building both editions at once, which also explains the earlier on-and-off packaging failures. + +## Timing build (for your approval later; nothing installed) + +The timing log from stage 0 is in this build, off unless switched on (household only, `--es orbit_timing on`). It is local only: +`timing/timing.jsonl` and log lines, nothing sent anywhere. On the Play build the switch doesn't exist; the check refuses it. + +**Blocker before any TV install:** the TVs only accept APKs signed with Orbit's current (debug) key. Release builds are unsigned by +your rule, and you asked me not to touch that key. So installing the timing build on one TV needs both of these from you: + +- your OK to sign this one APK with the current key; +- your OK to install it. + +Once installed, the TV is on build 420 and can't go back to 0.125.0 (322) without an uninstall. The rollback plan is +install-tv.sh's snapshot, then (only if needed) uninstall, reinstall 0.125.0 and `restore-tv.sh`. That route was rehearsed on 9 +November. I'll put the exact APK, its SHA-256, the changes and these steps in front of you before asking. + +## Remaining risks + +1. **Real boxes.** Everything here ran on the emulator (Android TV 14). Focus behaviour, TalkBack and the subtitle renderer can + differ on the Xiaomi boxes. The timing build would show it. +2. **TalkBack with Back from a page:** focus lands on the section's list item, not the card. It's safe (no section change, nothing + lost) but one step short of your "previous item focused" rule. +3. **Who's watching from the profile picture:** Back returns to the screen you were on, but focus lands on its first item, not + the picture. +4. **Not every page uses the sub-page rules yet.** Smart Setup's steps, the Titles suggestions and other dialogs inside the + Chair (event ideas, lessons) already use their own windows. The Create your own steps are inside the sub-page. +5. **Subtitles in real files.** Most anime releases mark English "default"; Off now ignores that, which is the rule. A file whose + forced track isn't marked forced shows nothing under Off. +6. **Default for new installs:** Off. Automatic would be closer to how Orbit behaved before for anime; say if you'd prefer it. +7. **High Scores** with long names and big numbers isn't seen on screen yet (no scores on the emulator). +8. **First run** still ends in Settings with a small library. That's stage 2, and your acceptance test, not changed here. diff --git a/docs/audit-0.129/password-after.png b/docs/audit-0.129/password-after.png new file mode 100644 index 00000000..7ca3b7d0 Binary files /dev/null and b/docs/audit-0.129/password-after.png differ diff --git a/docs/audit-0.129/password-talkback-after.png b/docs/audit-0.129/password-talkback-after.png new file mode 100644 index 00000000..1703e855 Binary files /dev/null and b/docs/audit-0.129/password-talkback-after.png differ diff --git a/docs/audit-0.129/password-talkback-before.png b/docs/audit-0.129/password-talkback-before.png new file mode 100644 index 00000000..43cd486e Binary files /dev/null and b/docs/audit-0.129/password-talkback-before.png differ diff --git a/docs/audit-0.129/quiz-after.png b/docs/audit-0.129/quiz-after.png new file mode 100644 index 00000000..0d1ccfa7 Binary files /dev/null and b/docs/audit-0.129/quiz-after.png differ diff --git a/docs/audit-0.129/quiz-before.png b/docs/audit-0.129/quiz-before.png new file mode 100644 index 00000000..85a6dbcd Binary files /dev/null and b/docs/audit-0.129/quiz-before.png differ diff --git a/docs/audit-0.129/subtitles-matrix.png b/docs/audit-0.129/subtitles-matrix.png new file mode 100644 index 00000000..7dadc288 Binary files /dev/null and b/docs/audit-0.129/subtitles-matrix.png differ diff --git a/docs/audit-0.129/whos-watching-after.png b/docs/audit-0.129/whos-watching-after.png new file mode 100644 index 00000000..3ab38149 Binary files /dev/null and b/docs/audit-0.129/whos-watching-after.png differ diff --git a/docs/audit-0.129/whos-watching-before.png b/docs/audit-0.129/whos-watching-before.png new file mode 100644 index 00000000..20ce8cf0 Binary files /dev/null and b/docs/audit-0.129/whos-watching-before.png differ diff --git a/docs/audit-0.129/whos-watching-talkback.png b/docs/audit-0.129/whos-watching-talkback.png new file mode 100644 index 00000000..d307f3cf Binary files /dev/null and b/docs/audit-0.129/whos-watching-talkback.png differ