From 361b514f9a42e55e36c86e25bc327a86cfb02b4c Mon Sep 17 00:00:00 2001 From: James Babcock Date: Sun, 25 Oct 2026 15:38:23 -0700 Subject: [PATCH] Fix an iOS issue where depth would be incorrect on first frame of fade-in on wake; also refine the keyboard input dialog --- .../main/res/drawable/ic_input_history.xml | 13 ++ .../src/main/res/drawable/ic_show_glasses.xml | 17 +++ .../src/main/res/drawable/ic_show_phone.xml | 13 ++ .../ic_input_history.imageset/Contents.json | 13 ++ .../ic_input_history@3x.png | Bin 0 -> 2091 bytes .../ic_show_glasses.imageset/Contents.json | 13 ++ .../ic_show_glasses@3x.png | Bin 0 -> 1067 bytes .../ic_show_phone.imageset/Contents.json | 13 ++ .../ic_show_phone@3x.png | Bin 0 -> 715 bytes CHANGELOG | 1 + app/app.css | 54 +++++++++ app/app.ios.css | 12 ++ app/g2/dashboard-controller.ts | 27 +---- app/g2/ios-preview-controller.ts | 27 ++++- app/phone-ui/keyboard-input-panel.xml | 34 +++++- app/phone-ui/keyboard-input-view-model.ts | 107 ++++++++++++++-- app/phone-ui/main-page.xml | 5 +- app/phone-ui/main-view-model.ts | 83 ++----------- app/ui/shell/keyboard-input.ts | 94 ++++++++++++++- app/ui/shell/shell.ts | 44 +++++-- tests/keyboard-input-panel.test.cjs | 114 ++++++++++++++++-- 21 files changed, 546 insertions(+), 138 deletions(-) create mode 100644 App_Resources/Android/src/main/res/drawable/ic_input_history.xml create mode 100644 App_Resources/Android/src/main/res/drawable/ic_show_glasses.xml create mode 100644 App_Resources/Android/src/main/res/drawable/ic_show_phone.xml create mode 100644 App_Resources/iOS/Assets.xcassets/ic_input_history.imageset/Contents.json create mode 100644 App_Resources/iOS/Assets.xcassets/ic_input_history.imageset/ic_input_history@3x.png create mode 100644 App_Resources/iOS/Assets.xcassets/ic_show_glasses.imageset/Contents.json create mode 100644 App_Resources/iOS/Assets.xcassets/ic_show_glasses.imageset/ic_show_glasses@3x.png create mode 100644 App_Resources/iOS/Assets.xcassets/ic_show_phone.imageset/Contents.json create mode 100644 App_Resources/iOS/Assets.xcassets/ic_show_phone.imageset/ic_show_phone@3x.png diff --git a/App_Resources/Android/src/main/res/drawable/ic_input_history.xml b/App_Resources/Android/src/main/res/drawable/ic_input_history.xml new file mode 100644 index 00000000..fac2b0c3 --- /dev/null +++ b/App_Resources/Android/src/main/res/drawable/ic_input_history.xml @@ -0,0 +1,13 @@ + + + + + diff --git a/App_Resources/Android/src/main/res/drawable/ic_show_glasses.xml b/App_Resources/Android/src/main/res/drawable/ic_show_glasses.xml new file mode 100644 index 00000000..885a3245 --- /dev/null +++ b/App_Resources/Android/src/main/res/drawable/ic_show_glasses.xml @@ -0,0 +1,17 @@ + + + + + + diff --git a/App_Resources/Android/src/main/res/drawable/ic_show_phone.xml b/App_Resources/Android/src/main/res/drawable/ic_show_phone.xml new file mode 100644 index 00000000..c4c24609 --- /dev/null +++ b/App_Resources/Android/src/main/res/drawable/ic_show_phone.xml @@ -0,0 +1,13 @@ + + + + + diff --git a/App_Resources/iOS/Assets.xcassets/ic_input_history.imageset/Contents.json b/App_Resources/iOS/Assets.xcassets/ic_input_history.imageset/Contents.json new file mode 100644 index 00000000..78660545 --- /dev/null +++ b/App_Resources/iOS/Assets.xcassets/ic_input_history.imageset/Contents.json @@ -0,0 +1,13 @@ +{ + "images": [ + { + "idiom": "universal", + "filename": "ic_input_history@3x.png", + "scale": "3x" + } + ], + "info": { + "author": "xcode", + "version": 1 + } +} diff --git a/App_Resources/iOS/Assets.xcassets/ic_input_history.imageset/ic_input_history@3x.png b/App_Resources/iOS/Assets.xcassets/ic_input_history.imageset/ic_input_history@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..3fdd7b0a8fbdfe05c5174561c4636a49497ed3ec GIT binary patch literal 2091 zcmZ{lXEYm%8^%M8*6c7!n@&P0jS=%2RfNXKHCmBSB1mc{p-54b)@mD~2r3sbLX281 z)woq!1hr>_Yqd00sZxn=iEYD)xhJb75sE;*g>t6M4VVB6K!Lg|5_|Pae0prkOq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WtGgL)B8WVhOB!m_FF@hUwvImyy4cE#gSLIkKOMM2|Kj- z`vsoL3<(xGz~7pwHVvU+#9qtvdLVZY&mJGPy_FYurH ze0P)DnW-kb(iHuW=ZY2vf-3U{XE)7O>#6_=zKi}E3^pFq_NswJ)wB`Jv|saDBFsX&Us$iT=<*U&)M z$TY;r$jZRP%Ggxfz`)AD;34B?TNDks`6-!cmAExbh~aJoYS4h&P?DLOT3nKtTYy{7 zaZjx{1_s7so-U3d8Ta1aGW2e8lsW$K{bDg2zNQXGrHfOXbI zmsZrR?qwPr)7d(wEeb3WTx8-sVfjK9)!n<_^~rVq&#(FMx^`Z5U-gmy2j{3>m_B7M zU&ULtSqD-$_ODvJa?*?2?P;-+pN#gcQ`2;epX0hJL}Q}rg@n38tY3CKZc3h4qGFpd zlX)9w;rWi>Z<#ASJ$ch7I+sO!IMB$Fy{6cSUryBZRmjb6O_J%8XZfx5J9_%?tbfPW z*lIYRG-mG-dE>b7SKgXQWiuBZNO}B4`mWTk&m11prxd0hkybt($mDc6+MIpwM(@*E zZpuX_5np+wE`mT~);yNkpw*fa0_{HpedVr}&W; evenAppConflictMessage: string; evenAppConflictWarningVisible: boolean; firmwareWarningMessage: string; @@ -1122,7 +1120,6 @@ class DashboardController { activeTextEditorToggleValue: this.activeTextEditorToggle?.setting.get() ?? false, activeTextEditorToggleVisible: this.activeTextEditorToggle !== null, keyboardInputActive: this.keyboardInput !== null, - keyboardInputTargets: this.keyboardInput?.targets ?? [], evenAppConflictMessage: this.evenAppConflictMessage, evenAppConflictWarningVisible: this.evenAppConflictMessage.length > 0, firmwareWarningMessage: this.firmwareWarningMessage, @@ -1321,23 +1318,9 @@ class DashboardController { shell.startKeyboardInput(); } - /** The phone's typing panel changed: mirror the text on the glasses. */ - setKeyboardInputText(text: string): void { - shell.noteUserActivity(); - this.keyboardInput?.setText(text); - } - - /** Send to one destination, or (no id: the IME's send key) the one highlighted on the glasses. */ - sendKeyboardInput(targetId?: string): void { - if (targetId) { - this.keyboardInput?.sendTo(targetId); - } else { - this.keyboardInput?.send(); - } - } - - discardKeyboardInput(): void { - this.keyboardInput?.discard(); + /** The open keyboard dialog, for the phone's typing panel (KeyboardInputViewModel). */ + get keyboardInputSession(): KeyboardInputSession | null { + return this.keyboardInput; } setActiveTextEditorToggleValue(value: boolean): void { diff --git a/app/g2/ios-preview-controller.ts b/app/g2/ios-preview-controller.ts index 04ea57df..249b648d 100644 --- a/app/g2/ios-preview-controller.ts +++ b/app/g2/ios-preview-controller.ts @@ -131,6 +131,8 @@ export class IosPreviewController { private clockMinute = -1 private shellRenderInProgress = false private shellRenderQueued = false + /** The shell woke; the next shell render unblanks the compositor after submitting. */ + private unblankAfterShellRender = false private nextFrameId = 1 private nextWorkerFrame = 0 private inputQueue: Promise = Promise.resolve() @@ -199,6 +201,9 @@ export class IosPreviewController { send: () => { if (this.active && !this.glassesLocked) session.send() }, sendTo: id => { if (this.active && !this.glassesLocked) session.sendTo(id) }, discard: () => session.discard(), + get visibility() { return session.visibility }, + setVisibility: visibility => { if (this.active && !this.glassesLocked) session.setVisibility(visibility) }, + get history() { return session.history }, } : null), prepareVoiceCapture: () => this.prepareVoiceCapture(), getScreenTimeoutMs: () => null, @@ -211,7 +216,12 @@ export class IosPreviewController { }, onScreenStateChanged: on => { if (on) this.glance.dismiss() - void this.display?.setScreenBlanked(!on).catch(error => this.fail(error)) + // A wake unblanks only once the next shell render has staged an awake + // scene: unblanking composites the retained one, painted while asleep + // with no chrome and depth 0, and that first frame is the one the + // brightness fade-in starts on. + this.unblankAfterShellRender = on + if (!on) void this.display?.setScreenBlanked(true).catch(error => this.fail(error)) this.requestShellRender() }, }) @@ -521,10 +531,19 @@ export class IosPreviewController { await this.displayReady const display = this.display if (!display) return - const startedAt = Date.now() - const bytes = shell.paintScene() + // Taken with the paint, so a render that painted before the wake can't unblank. + const unblank = this.unblankAfterShellRender + this.unblankAfterShellRender = false const frameId = this.allocateFrameId() - await display.submitShellScene(bytes, Date.now() - startedAt, frameId) + try { + const startedAt = Date.now() + const bytes = shell.paintScene() + await display.submitShellScene(bytes, Date.now() - startedAt, frameId) + } finally { + // Even if the render failed, so the screen doesn't stay dark; not if it + // went back to sleep meanwhile (that sleep re-blanked). + if (unblank && shell.isScreenOn()) await display.setScreenBlanked(false) + } // Backpressure: the next shell render waits for this one to reach the // glasses (the preview target resolves immediately; nothing transmits). await display.waitForFrameFinished(frameId, FRAME_TRANSMIT_BACKPRESSURE_TIMEOUT_MS) diff --git a/app/phone-ui/keyboard-input-panel.xml b/app/phone-ui/keyboard-input-panel.xml index bd36734d..412f383f 100644 --- a/app/phone-ui/keyboard-input-panel.xml +++ b/app/phone-ui/keyboard-input-panel.xml @@ -1,18 +1,40 @@ -