@mentra/engine 0.1.0-beta.0 → 0.1.0-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -1
- package/build/engine.d.ts +11 -3
- package/build/engine.d.ts.map +1 -1
- package/build/engine.js +7 -2
- package/build/engine.js.map +1 -1
- package/build/facades/dev.d.ts.map +1 -1
- package/build/facades/dev.js +9 -5
- package/build/facades/dev.js.map +1 -1
- package/build/facades/gallery.js +1 -1
- package/build/facades/gallery.js.map +1 -1
- package/build/facades/glasses.d.ts +1 -0
- package/build/facades/glasses.d.ts.map +1 -1
- package/build/facades/glasses.js +19 -4
- package/build/facades/glasses.js.map +1 -1
- package/build/facades/glassesSettings.d.ts.map +1 -1
- package/build/facades/glassesSettings.js +1 -0
- package/build/facades/glassesSettings.js.map +1 -1
- package/build/facades/miniapps.d.ts +4 -0
- package/build/facades/miniapps.d.ts.map +1 -1
- package/build/facades/miniapps.js +5 -0
- package/build/facades/miniapps.js.map +1 -1
- package/build/facades/ota.d.ts +11 -2
- package/build/facades/ota.d.ts.map +1 -1
- package/build/facades/ota.js +19 -4
- package/build/facades/ota.js.map +1 -1
- package/build/facades/pairing.d.ts +4 -0
- package/build/facades/pairing.d.ts.map +1 -1
- package/build/facades/pairing.js +10 -8
- package/build/facades/pairing.js.map +1 -1
- package/build/facades/phoneNotifications.d.ts +0 -4
- package/build/facades/phoneNotifications.d.ts.map +1 -1
- package/build/facades/phoneNotifications.js +4 -14
- package/build/facades/phoneNotifications.js.map +1 -1
- package/build/index.d.ts +6 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -2
- package/build/index.js.map +1 -1
- package/build/internal.d.ts +2 -2
- package/build/internal.d.ts.map +1 -1
- package/build/internal.js +1 -1
- package/build/internal.js.map +1 -1
- package/build/react/MentraLiveOtaFlow.d.ts +38 -0
- package/build/react/MentraLiveOtaFlow.d.ts.map +1 -0
- package/build/react/MentraLiveOtaFlow.js +528 -0
- package/build/react/MentraLiveOtaFlow.js.map +1 -0
- package/build/react/index.d.ts +2 -0
- package/build/react/index.d.ts.map +1 -0
- package/build/react/index.js +2 -0
- package/build/react/index.js.map +1 -0
- package/build/react/useEngineSnapshot.d.ts +2 -0
- package/build/react/useEngineSnapshot.d.ts.map +1 -0
- package/build/react/useEngineSnapshot.js +14 -0
- package/build/react/useEngineSnapshot.js.map +1 -0
- package/build/runtime/bootstrap.d.ts +24 -1
- package/build/runtime/bootstrap.d.ts.map +1 -1
- package/build/runtime/bootstrap.js +17 -0
- package/build/runtime/bootstrap.js.map +1 -1
- package/build/runtime/scanQrSeam.d.ts +7 -0
- package/build/runtime/scanQrSeam.d.ts.map +1 -0
- package/build/runtime/scanQrSeam.js +16 -0
- package/build/runtime/scanQrSeam.js.map +1 -0
- package/build/services/AppRegistry.d.ts +18 -8
- package/build/services/AppRegistry.d.ts.map +1 -1
- package/build/services/AppRegistry.js +44 -45
- package/build/services/AppRegistry.js.map +1 -1
- package/build/services/AudioCloudUplink.d.ts +9 -3
- package/build/services/AudioCloudUplink.d.ts.map +1 -1
- package/build/services/AudioCloudUplink.js +9 -3
- package/build/services/AudioCloudUplink.js.map +1 -1
- package/build/services/AudioPlaybackService.d.ts +9 -1
- package/build/services/AudioPlaybackService.d.ts.map +1 -1
- package/build/services/AudioPlaybackService.js +77 -32
- package/build/services/AudioPlaybackService.js.map +1 -1
- package/build/services/BlobStore.d.ts +2 -1
- package/build/services/BlobStore.d.ts.map +1 -1
- package/build/services/BlobStore.js +17 -9
- package/build/services/BlobStore.js.map +1 -1
- package/build/services/CloudAudioSubscriptionSync.d.ts.map +1 -1
- package/build/services/CloudAudioSubscriptionSync.js +13 -1
- package/build/services/CloudAudioSubscriptionSync.js.map +1 -1
- package/build/services/CloudClientService.d.ts +15 -0
- package/build/services/CloudClientService.d.ts.map +1 -1
- package/build/services/CloudClientService.js +75 -0
- package/build/services/CloudClientService.js.map +1 -1
- package/build/services/ForegroundLocationPermission.d.ts +13 -0
- package/build/services/ForegroundLocationPermission.d.ts.map +1 -0
- package/build/services/ForegroundLocationPermission.js +12 -0
- package/build/services/ForegroundLocationPermission.js.map +1 -0
- package/build/services/GlassesSettingsSync.d.ts.map +1 -1
- package/build/services/GlassesSettingsSync.js +9 -3
- package/build/services/GlassesSettingsSync.js.map +1 -1
- package/build/services/GlassesStatusProjection.d.ts +2 -1
- package/build/services/GlassesStatusProjection.d.ts.map +1 -1
- package/build/services/GlassesStatusProjection.js +15 -8
- package/build/services/GlassesStatusProjection.js.map +1 -1
- package/build/services/HotspotOtaTransport.d.ts +29 -0
- package/build/services/HotspotOtaTransport.d.ts.map +1 -0
- package/build/services/HotspotOtaTransport.js +146 -0
- package/build/services/HotspotOtaTransport.js.map +1 -0
- package/build/services/HotspotShutdown.d.ts +17 -0
- package/build/services/HotspotShutdown.d.ts.map +1 -0
- package/build/services/HotspotShutdown.js +29 -0
- package/build/services/HotspotShutdown.js.map +1 -0
- package/build/services/LocalDisplayManager.d.ts +15 -0
- package/build/services/LocalDisplayManager.d.ts.map +1 -1
- package/build/services/LocalDisplayManager.js +106 -20
- package/build/services/LocalDisplayManager.js.map +1 -1
- package/build/services/LocalMiniappRuntime.d.ts +67 -1
- package/build/services/LocalMiniappRuntime.d.ts.map +1 -1
- package/build/services/LocalMiniappRuntime.js +486 -126
- package/build/services/LocalMiniappRuntime.js.map +1 -1
- package/build/services/LocalMiniappStorage.d.ts +32 -0
- package/build/services/LocalMiniappStorage.d.ts.map +1 -0
- package/build/services/LocalMiniappStorage.js +66 -0
- package/build/services/LocalMiniappStorage.js.map +1 -0
- package/build/services/LocalMiniappUserIdentity.d.ts +20 -0
- package/build/services/LocalMiniappUserIdentity.d.ts.map +1 -0
- package/build/services/LocalMiniappUserIdentity.js +43 -0
- package/build/services/LocalMiniappUserIdentity.js.map +1 -0
- package/build/services/MicStateCoordinator.d.ts +42 -1
- package/build/services/MicStateCoordinator.d.ts.map +1 -1
- package/build/services/MicStateCoordinator.js +141 -3
- package/build/services/MicStateCoordinator.js.map +1 -1
- package/build/services/MiniappLauncher.d.ts.map +1 -1
- package/build/services/MiniappLauncher.js +23 -3
- package/build/services/MiniappLauncher.js.map +1 -1
- package/build/services/MiniappLiveness.d.ts +12 -0
- package/build/services/MiniappLiveness.d.ts.map +1 -0
- package/build/services/MiniappLiveness.js +16 -0
- package/build/services/MiniappLiveness.js.map +1 -0
- package/build/services/OtaArtifactDownloader.d.ts +65 -0
- package/build/services/OtaArtifactDownloader.d.ts.map +1 -0
- package/build/services/OtaArtifactDownloader.js +226 -0
- package/build/services/OtaArtifactDownloader.js.map +1 -0
- package/build/services/OtaAutoChain.d.ts +34 -0
- package/build/services/OtaAutoChain.d.ts.map +1 -0
- package/build/services/OtaAutoChain.js +83 -0
- package/build/services/OtaAutoChain.js.map +1 -0
- package/build/services/OtaErrorMapping.d.ts +18 -0
- package/build/services/OtaErrorMapping.d.ts.map +1 -0
- package/build/services/OtaErrorMapping.js +63 -0
- package/build/services/OtaErrorMapping.js.map +1 -0
- package/build/services/OtaInstallCoordinator.d.ts +94 -14
- package/build/services/OtaInstallCoordinator.d.ts.map +1 -1
- package/build/services/OtaInstallCoordinator.js +574 -130
- package/build/services/OtaInstallCoordinator.js.map +1 -1
- package/build/services/OtaService.d.ts.map +1 -1
- package/build/services/OtaService.js +8 -1
- package/build/services/OtaService.js.map +1 -1
- package/build/services/OtaUpdateCheckService.d.ts +38 -3
- package/build/services/OtaUpdateCheckService.d.ts.map +1 -1
- package/build/services/OtaUpdateCheckService.js +142 -22
- package/build/services/OtaUpdateCheckService.js.map +1 -1
- package/build/services/PhoneCalendarService.d.ts.map +1 -1
- package/build/services/PhoneCalendarService.js +22 -1
- package/build/services/PhoneCalendarService.js.map +1 -1
- package/build/services/PhoneCameraFovCoordinator.d.ts +2 -0
- package/build/services/PhoneCameraFovCoordinator.d.ts.map +1 -1
- package/build/services/PhoneCameraFovCoordinator.js +14 -0
- package/build/services/PhoneCameraFovCoordinator.js.map +1 -1
- package/build/services/PhoneNotificationsSync.d.ts.map +1 -1
- package/build/services/PhoneNotificationsSync.js +12 -10
- package/build/services/PhoneNotificationsSync.js.map +1 -1
- package/build/services/PhonePhotoCoordinator.d.ts +10 -3
- package/build/services/PhonePhotoCoordinator.d.ts.map +1 -1
- package/build/services/PhonePhotoCoordinator.js +21 -3
- package/build/services/PhonePhotoCoordinator.js.map +1 -1
- package/build/services/PhoneStreamCoordinator.d.ts +8 -1
- package/build/services/PhoneStreamCoordinator.d.ts.map +1 -1
- package/build/services/PhoneStreamCoordinator.js +125 -13
- package/build/services/PhoneStreamCoordinator.js.map +1 -1
- package/build/services/PhoneVideoCoordinator.d.ts +2 -0
- package/build/services/PhoneVideoCoordinator.d.ts.map +1 -1
- package/build/services/PhoneVideoCoordinator.js +10 -0
- package/build/services/PhoneVideoCoordinator.js.map +1 -1
- package/build/services/SceneRenderer.d.ts.map +1 -1
- package/build/services/SceneRenderer.js +15 -0
- package/build/services/SceneRenderer.js.map +1 -1
- package/build/services/SupportProfileSync.d.ts +22 -0
- package/build/services/SupportProfileSync.d.ts.map +1 -0
- package/build/services/SupportProfileSync.js +213 -0
- package/build/services/SupportProfileSync.js.map +1 -0
- package/build/services/TtsTextSanitizer.d.ts +5 -0
- package/build/services/TtsTextSanitizer.d.ts.map +1 -0
- package/build/services/TtsTextSanitizer.js +61 -0
- package/build/services/TtsTextSanitizer.js.map +1 -0
- package/build/services/WifiAdbRequest.d.ts +17 -0
- package/build/services/WifiAdbRequest.d.ts.map +1 -0
- package/build/services/WifiAdbRequest.js +35 -0
- package/build/services/WifiAdbRequest.js.map +1 -0
- package/build/services/asg/asgCameraApi.d.ts +3 -0
- package/build/services/asg/asgCameraApi.d.ts.map +1 -1
- package/build/services/asg/asgCameraApi.js +72 -2
- package/build/services/asg/asgCameraApi.js.map +1 -1
- package/build/services/asg/gallerySyncService.d.ts.map +1 -1
- package/build/services/asg/gallerySyncService.js +26 -14
- package/build/services/asg/gallerySyncService.js.map +1 -1
- package/build/services/asg/localNetworkTransport.d.ts +2 -2
- package/build/services/asg/localNetworkTransport.d.ts.map +1 -1
- package/build/services/asg/localNetworkTransport.js +6 -6
- package/build/services/asg/localNetworkTransport.js.map +1 -1
- package/build/services/audioPlaybackAssets.d.ts +8 -0
- package/build/services/audioPlaybackAssets.d.ts.map +1 -0
- package/build/services/audioPlaybackAssets.js +7 -0
- package/build/services/audioPlaybackAssets.js.map +1 -0
- package/build/services/glassesClockSync.js +2 -2
- package/build/services/glassesClockSync.js.map +1 -1
- package/build/services/manifestActions.d.ts +7 -0
- package/build/services/manifestActions.d.ts.map +1 -0
- package/build/services/manifestActions.js +25 -0
- package/build/services/manifestActions.js.map +1 -0
- package/build/services/otaDisplayState.d.ts +22 -11
- package/build/services/otaDisplayState.d.ts.map +1 -1
- package/build/services/otaDisplayState.js +36 -14
- package/build/services/otaDisplayState.js.map +1 -1
- package/build/services/otaInstallPolicy.d.ts +15 -3
- package/build/services/otaInstallPolicy.d.ts.map +1 -1
- package/build/services/otaInstallPolicy.js +24 -3
- package/build/services/otaInstallPolicy.js.map +1 -1
- package/build/services/otaManifestUrl.d.ts +2 -0
- package/build/services/otaManifestUrl.d.ts.map +1 -0
- package/build/services/{asgOtaVersionUrl.js → otaManifestUrl.js} +15 -5
- package/build/services/otaManifestUrl.js.map +1 -0
- package/build/services/slimStreamStatus.d.ts +11 -0
- package/build/services/slimStreamStatus.d.ts.map +1 -1
- package/build/services/slimStreamStatus.js +14 -4
- package/build/services/slimStreamStatus.js.map +1 -1
- package/build/stores/apps.d.ts.map +1 -1
- package/build/stores/apps.js +11 -0
- package/build/stores/apps.js.map +1 -1
- package/build/stores/bluetoothSettingKeys.d.ts.map +1 -1
- package/build/stores/bluetoothSettingKeys.js +2 -0
- package/build/stores/bluetoothSettingKeys.js.map +1 -1
- package/build/stores/gallerySync.d.ts +2 -0
- package/build/stores/gallerySync.d.ts.map +1 -1
- package/build/stores/gallerySync.js +2 -0
- package/build/stores/gallerySync.js.map +1 -1
- package/build/stores/glasses.d.ts.map +1 -1
- package/build/stores/glasses.js +3 -0
- package/build/stores/glasses.js.map +1 -1
- package/build/stores/settings.d.ts +17 -0
- package/build/stores/settings.d.ts.map +1 -1
- package/build/stores/settings.js +152 -19
- package/build/stores/settings.js.map +1 -1
- package/build/types/applet.d.ts +2 -0
- package/build/types/applet.d.ts.map +1 -1
- package/build/types/applet.js.map +1 -1
- package/build/types/enums.d.ts +1 -0
- package/build/types/enums.d.ts.map +1 -1
- package/build/types/enums.js +1 -0
- package/build/types/enums.js.map +1 -1
- package/build/types/hardware.d.ts +1 -0
- package/build/types/hardware.d.ts.map +1 -1
- package/build/types/hardware.js +14 -0
- package/build/types/hardware.js.map +1 -1
- package/build/utils/configuredDevHost.d.ts +6 -0
- package/build/utils/configuredDevHost.d.ts.map +1 -0
- package/build/utils/configuredDevHost.js +19 -0
- package/build/utils/configuredDevHost.js.map +1 -0
- package/build/utils/devMiniappLaunch.d.ts +19 -8
- package/build/utils/devMiniappLaunch.d.ts.map +1 -1
- package/build/utils/devMiniappLaunch.js +144 -21
- package/build/utils/devMiniappLaunch.js.map +1 -1
- package/build/utils/diagnosticContext.d.ts.map +1 -1
- package/build/utils/diagnosticContext.js +15 -17
- package/build/utils/diagnosticContext.js.map +1 -1
- package/build/utils/hardware/hardware.d.ts.map +1 -1
- package/build/utils/hardware/hardware.js +7 -3
- package/build/utils/hardware/hardware.js.map +1 -1
- package/build/utils/miniappDiagnostics.d.ts +64 -0
- package/build/utils/miniappDiagnostics.d.ts.map +1 -0
- package/build/utils/miniappDiagnostics.js +173 -0
- package/build/utils/miniappDiagnostics.js.map +1 -0
- package/build/utils/timers/timers.d.ts.map +1 -1
- package/build/utils/timers/timers.js +55 -18
- package/build/utils/timers/timers.js.map +1 -1
- package/package.json +27 -18
- package/src/assets/silence.wav +0 -0
- package/src/engine.ts +7 -2
- package/src/facades/dev.ts +9 -5
- package/src/facades/gallery.ts +1 -1
- package/src/facades/glasses.ts +17 -4
- package/src/facades/glassesSettings.ts +5 -0
- package/src/facades/miniapps.ts +7 -0
- package/src/facades/ota.ts +19 -4
- package/src/facades/pairing.ts +11 -7
- package/src/facades/phoneNotifications.ts +4 -13
- package/src/index.ts +26 -2
- package/src/internal.ts +2 -1
- package/src/react/MentraLiveOtaFlow.tsx +856 -0
- package/src/react/index.ts +7 -0
- package/src/react/useEngineSnapshot.ts +16 -0
- package/src/runtime/bootstrap.ts +33 -1
- package/src/runtime/scanQrSeam.ts +20 -0
- package/src/services/AppRegistry.ts +72 -48
- package/src/services/AudioCloudUplink.ts +9 -3
- package/src/services/AudioPlaybackService.ts +94 -34
- package/src/services/BlobStore.ts +22 -9
- package/src/services/CloudAudioSubscriptionSync.ts +13 -1
- package/src/services/CloudClientService.ts +74 -0
- package/src/services/ForegroundLocationPermission.ts +24 -0
- package/src/services/GlassesSettingsSync.ts +9 -3
- package/src/services/GlassesStatusProjection.ts +16 -8
- package/src/services/HotspotOtaTransport.ts +184 -0
- package/src/services/HotspotShutdown.ts +41 -0
- package/src/services/LocalDisplayManager.ts +112 -21
- package/src/services/LocalMiniappRuntime.ts +576 -130
- package/src/services/LocalMiniappStorage.ts +82 -0
- package/src/services/LocalMiniappUserIdentity.ts +46 -0
- package/src/services/MicStateCoordinator.ts +169 -4
- package/src/services/MiniappLauncher.ts +30 -3
- package/src/services/MiniappLiveness.ts +24 -0
- package/src/services/OtaArtifactDownloader.ts +312 -0
- package/src/services/OtaAutoChain.ts +106 -0
- package/src/services/OtaErrorMapping.ts +80 -0
- package/src/services/OtaInstallCoordinator.ts +645 -143
- package/src/services/OtaService.ts +11 -5
- package/src/services/OtaUpdateCheckService.ts +180 -20
- package/src/services/PhoneCalendarService.ts +27 -4
- package/src/services/PhoneCameraFovCoordinator.ts +15 -0
- package/src/services/PhoneNotificationsSync.ts +12 -10
- package/src/services/PhonePhotoCoordinator.ts +33 -7
- package/src/services/PhoneStreamCoordinator.ts +139 -25
- package/src/services/PhoneVideoCoordinator.ts +11 -0
- package/src/services/SceneRenderer.ts +16 -0
- package/src/services/SupportProfileSync.ts +218 -0
- package/src/services/TtsTextSanitizer.ts +66 -0
- package/src/services/WifiAdbRequest.ts +53 -0
- package/src/services/asg/asgCameraApi.ts +99 -8
- package/src/services/asg/gallerySyncService.ts +28 -19
- package/src/services/asg/localNetworkTransport.ts +7 -11
- package/src/services/audioPlaybackAssets.ts +8 -0
- package/src/services/glassesClockSync.ts +2 -2
- package/src/services/manifestActions.ts +30 -0
- package/src/services/otaDisplayState.ts +57 -16
- package/src/services/otaInstallPolicy.ts +29 -3
- package/src/services/{asgOtaVersionUrl.ts → otaManifestUrl.ts} +16 -4
- package/src/services/slimStreamStatus.ts +16 -5
- package/src/stores/apps.ts +12 -0
- package/src/stores/bluetoothSettingKeys.ts +2 -0
- package/src/stores/gallerySync.ts +4 -0
- package/src/stores/glasses.ts +3 -0
- package/src/stores/settings.ts +174 -21
- package/src/types/applet.ts +2 -0
- package/src/types/enums.ts +2 -1
- package/src/types/hardware.ts +17 -0
- package/src/utils/configuredDevHost.ts +17 -0
- package/src/utils/devMiniappLaunch.ts +151 -23
- package/src/utils/diagnosticContext.ts +17 -17
- package/src/utils/hardware/hardware.ts +7 -9
- package/src/utils/miniappDiagnostics.ts +226 -0
- package/src/utils/timers/timers.ts +57 -21
- package/build/services/asgOtaVersionUrl.d.ts +0 -2
- package/build/services/asgOtaVersionUrl.d.ts.map +0 -1
- package/build/services/asgOtaVersionUrl.js.map +0 -1
|
@@ -98,6 +98,12 @@ const BACKGROUND_LOCK_TIMEOUT_MS = 10_000
|
|
|
98
98
|
// Sentinel package name used as the "source" of the system boot message.
|
|
99
99
|
const SYSTEM_BOOT_PKG = "system.boot"
|
|
100
100
|
|
|
101
|
+
/** "Render nothing" — an empty scene or an explicit clear_view layout. */
|
|
102
|
+
function isClearPayload(payload: DisplayPayload): boolean {
|
|
103
|
+
if (payload.scene) return payload.scene.length === 0
|
|
104
|
+
return payload.layout?.layoutType === "clear_view"
|
|
105
|
+
}
|
|
106
|
+
|
|
101
107
|
// =============================================================================
|
|
102
108
|
// LocalDisplayManager
|
|
103
109
|
// =============================================================================
|
|
@@ -144,14 +150,20 @@ class LocalDisplayManager {
|
|
|
144
150
|
public onMount(packageName: string, displayName: string): void {
|
|
145
151
|
console.log(`${LOG_TAG}: onMount(${packageName}, "${displayName}")`)
|
|
146
152
|
|
|
147
|
-
// Cancel any in-flight boot for a prior app.
|
|
148
|
-
this.cancelBoot()
|
|
149
|
-
|
|
150
153
|
// Snapshot whatever's on the glasses BEFORE the boot text overwrites it.
|
|
151
154
|
// registerApp fires onMount for every spawn — including a background app or
|
|
152
155
|
// a crash-respawn while another app is foreground — so a boot that times out
|
|
153
156
|
// without rendering must put the prior frame back rather than blank it.
|
|
154
|
-
|
|
157
|
+
// Never snapshot the boot text itself: back-to-back mounts (the autostart
|
|
158
|
+
// restore loop, crash-respawn chains) land while the previous app's
|
|
159
|
+
// "Starting X…" is still on the glasses, and endBoot would "restore" that
|
|
160
|
+
// stale, expiry-less frame permanently. Across chained boots, inherit the
|
|
161
|
+
// original pre-boot frame instead.
|
|
162
|
+
const inherited = this.bootingApp ? this.bootingApp.preBoot : this.currentDisplay
|
|
163
|
+
const preBoot = inherited?.packageName === SYSTEM_BOOT_PKG ? null : inherited
|
|
164
|
+
|
|
165
|
+
// Cancel any in-flight boot for a prior app.
|
|
166
|
+
this.cancelBoot()
|
|
155
167
|
|
|
156
168
|
// Send the boot message directly (bypass arbitration — this is a system
|
|
157
169
|
// display). Goes through sendNow so scene devices render it as a scene:
|
|
@@ -163,7 +175,7 @@ class LocalDisplayManager {
|
|
|
163
175
|
})
|
|
164
176
|
|
|
165
177
|
const timerId = BgTimer.setTimeout(() => {
|
|
166
|
-
this.endBoot(
|
|
178
|
+
this.endBoot()
|
|
167
179
|
}, BOOT_DURATION_MS)
|
|
168
180
|
|
|
169
181
|
this.bootingApp = {
|
|
@@ -195,15 +207,39 @@ class LocalDisplayManager {
|
|
|
195
207
|
}
|
|
196
208
|
}
|
|
197
209
|
|
|
210
|
+
/** Report-safe ownership snapshot for incident diagnostics. */
|
|
211
|
+
public getDiagnosticSnapshot(): Record<string, unknown> {
|
|
212
|
+
return {
|
|
213
|
+
coreAppPackageName: this.coreApp,
|
|
214
|
+
currentDisplayPackageName: this.currentDisplay?.packageName ?? null,
|
|
215
|
+
backgroundLockPackageName: this.backgroundLock?.packageName ?? null,
|
|
216
|
+
bootingPackageName: this.bootingApp?.packageName ?? null,
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
198
220
|
/**
|
|
199
221
|
* A local miniapp is going away. Clean up all state associated with it.
|
|
200
222
|
*/
|
|
201
223
|
public onUnmount(packageName: string): void {
|
|
202
224
|
console.log(`${LOG_TAG}: onUnmount(${packageName})`)
|
|
203
225
|
|
|
204
|
-
// If this was the booting app, cancel boot
|
|
226
|
+
// If this was the booting app, cancel boot — and don't strand its
|
|
227
|
+
// "Starting X…" text (a system frame with no expiry): put back what the
|
|
228
|
+
// boot covered, or clear.
|
|
205
229
|
if (this.bootingApp?.packageName === packageName) {
|
|
230
|
+
const preBoot = this.bootingApp.preBoot
|
|
206
231
|
this.cancelBoot()
|
|
232
|
+
if (this.currentDisplay?.packageName === SYSTEM_BOOT_PKG) {
|
|
233
|
+
// The preBoot owner may have forfeited its frame during the boot
|
|
234
|
+
// window (a clear parked in the boot queue) — don't resurrect it.
|
|
235
|
+
const ownerQueued = preBoot ? this.bootQueue.get(preBoot.packageName) : undefined
|
|
236
|
+
const preBootForfeited = ownerQueued !== undefined && isClearPayload(ownerQueued.payload)
|
|
237
|
+
if (preBoot && !preBootForfeited && (preBoot.expiresAt === null || preBoot.expiresAt > this.now())) {
|
|
238
|
+
this.restoreDisplay(preBoot)
|
|
239
|
+
} else {
|
|
240
|
+
this.sendClear()
|
|
241
|
+
}
|
|
242
|
+
}
|
|
207
243
|
}
|
|
208
244
|
this.bootQueue.get(packageName)?.resolve?.({status: "blocked", reason: "app stopped"})
|
|
209
245
|
this.bootQueue.delete(packageName)
|
|
@@ -216,10 +252,17 @@ class LocalDisplayManager {
|
|
|
216
252
|
this.backgroundLock = null
|
|
217
253
|
}
|
|
218
254
|
|
|
219
|
-
//
|
|
255
|
+
// Drop the saved core frame if the core's context is going away — the
|
|
256
|
+
// frame belongs to a dead context and must not be restored later. The
|
|
257
|
+
// coreApp POINTER itself is NOT cleared here: it is derived state owned
|
|
258
|
+
// by the apps-store reconciler. A liveness/crash respawn tears the
|
|
259
|
+
// context down (this path) without any store change — the app is still
|
|
260
|
+
// "running" — and clearing the pointer here would leave the respawned
|
|
261
|
+
// foreground app arbitrating as background until an unrelated store
|
|
262
|
+
// write happened to re-run the reconciler. Real stops release the slot
|
|
263
|
+
// via the store (running → false → reconciler → onCoreAppChange(null)).
|
|
220
264
|
if (this.coreApp === packageName) {
|
|
221
265
|
this.coreAppDisplay = null
|
|
222
|
-
this.coreApp = null
|
|
223
266
|
}
|
|
224
267
|
|
|
225
268
|
// If this app owned the current on-glasses display, clear it (and maybe
|
|
@@ -263,7 +306,7 @@ class LocalDisplayManager {
|
|
|
263
306
|
superseded?.resolve?.({status: "blocked", reason: "superseded by a newer frame"})
|
|
264
307
|
this.bootQueue.set(packageName, {payload, resolve})
|
|
265
308
|
if (this.bootingApp.packageName === packageName) {
|
|
266
|
-
this.endBoot(
|
|
309
|
+
this.endBoot()
|
|
267
310
|
}
|
|
268
311
|
return
|
|
269
312
|
}
|
|
@@ -271,6 +314,16 @@ class LocalDisplayManager {
|
|
|
271
314
|
this.arbitrateAndSend(packageName, payload, resolve)
|
|
272
315
|
}
|
|
273
316
|
|
|
317
|
+
/**
|
|
318
|
+
* End a package's temporary display early. If it currently owns the main
|
|
319
|
+
* view, release its background lock and restore the foreground miniapp's
|
|
320
|
+
* saved frame. A dismissal for a package that is no longer visible is a
|
|
321
|
+
* no-op.
|
|
322
|
+
*/
|
|
323
|
+
public dismiss(packageName: string): void {
|
|
324
|
+
this.handleExpiry(packageName)
|
|
325
|
+
}
|
|
326
|
+
|
|
274
327
|
// ===========================================================================
|
|
275
328
|
// Internals — arbitration
|
|
276
329
|
// ===========================================================================
|
|
@@ -283,6 +336,16 @@ class LocalDisplayManager {
|
|
|
283
336
|
this.backgroundLock = null
|
|
284
337
|
}
|
|
285
338
|
|
|
339
|
+
// A clear ("render nothing") means "I'm done with the display" — it is a
|
|
340
|
+
// forfeit, not a frame. A background app releases its lock and the core
|
|
341
|
+
// app's still-valid display comes back; treating it as a render instead
|
|
342
|
+
// would RENEW the lock with an empty frame and blank the glasses while
|
|
343
|
+
// still blocking everyone else.
|
|
344
|
+
if (isClearPayload(payload)) {
|
|
345
|
+
this.handleAppClear(packageName, resolve)
|
|
346
|
+
return
|
|
347
|
+
}
|
|
348
|
+
|
|
286
349
|
const isCore = packageName === this.coreApp
|
|
287
350
|
|
|
288
351
|
if (isCore) {
|
|
@@ -339,6 +402,33 @@ class LocalDisplayManager {
|
|
|
339
402
|
this.sendNow(packageName, payload, resolve)
|
|
340
403
|
}
|
|
341
404
|
|
|
405
|
+
/**
|
|
406
|
+
* An app cleared its display ("render nothing"). Same semantics as its
|
|
407
|
+
* frame expiring: give up ownership, restore the core app's still-valid
|
|
408
|
+
* display if there is one, otherwise clear the glasses.
|
|
409
|
+
*/
|
|
410
|
+
private handleAppClear(packageName: string, resolve?: DisplayRequestResolver): void {
|
|
411
|
+
// Forget the app's retained scene state — its next render starts fresh.
|
|
412
|
+
sceneRenderer.clearApp(packageName)
|
|
413
|
+
|
|
414
|
+
if (this.backgroundLock?.packageName === packageName) {
|
|
415
|
+
this.backgroundLock = null
|
|
416
|
+
}
|
|
417
|
+
if (this.coreApp === packageName) {
|
|
418
|
+
this.coreAppDisplay = null
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
if (this.currentDisplay?.packageName === packageName) {
|
|
422
|
+
this.clearExpiryTimer()
|
|
423
|
+
this.currentDisplay = null
|
|
424
|
+
this.tryRestoreCoreDisplay()
|
|
425
|
+
if (!this.currentDisplay) {
|
|
426
|
+
this.sendClear()
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
resolve?.({status: "displayed"})
|
|
430
|
+
}
|
|
431
|
+
|
|
342
432
|
// ===========================================================================
|
|
343
433
|
// Internals — send
|
|
344
434
|
// ===========================================================================
|
|
@@ -523,7 +613,7 @@ class LocalDisplayManager {
|
|
|
523
613
|
this.bootingApp = null
|
|
524
614
|
}
|
|
525
615
|
|
|
526
|
-
private endBoot(
|
|
616
|
+
private endBoot(): void {
|
|
527
617
|
if (!this.bootingApp) return
|
|
528
618
|
const preBoot = this.bootingApp.preBoot
|
|
529
619
|
BgTimer.clearTimeout(this.bootingApp.timerId)
|
|
@@ -543,17 +633,18 @@ class LocalDisplayManager {
|
|
|
543
633
|
this.arbitrateAndSend(pkg, entry.payload, entry.resolve)
|
|
544
634
|
}
|
|
545
635
|
|
|
546
|
-
//
|
|
547
|
-
//
|
|
548
|
-
//
|
|
549
|
-
//
|
|
550
|
-
//
|
|
551
|
-
//
|
|
552
|
-
//
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
636
|
+
// If the boot text is still on the glasses — nothing was queued, or every
|
|
637
|
+
// drained request lost arbitration — it must not strand: it's a system
|
|
638
|
+
// frame with no expiry. Restore whatever was on the glasses before the
|
|
639
|
+
// boot, else clear. Two reasons NOT to restore: the frame's duration
|
|
640
|
+
// elapsed during the boot window, or its owner FORFEITED it during the
|
|
641
|
+
// window (its final queued intent — the queue keeps last-wins per app —
|
|
642
|
+
// was a clear, which the drain above processed as a forfeit; restoring
|
|
643
|
+
// would resurrect content the clear removed).
|
|
644
|
+
if (this.currentDisplay?.packageName === SYSTEM_BOOT_PKG) {
|
|
645
|
+
const ownerEntry = preBoot ? queued.find(([pkg]) => pkg === preBoot.packageName) : undefined
|
|
646
|
+
const preBootForfeited = ownerEntry !== undefined && isClearPayload(ownerEntry[1].payload)
|
|
647
|
+
if (preBoot && !preBootForfeited && (preBoot.expiresAt === null || preBoot.expiresAt > this.now())) {
|
|
557
648
|
this.restoreDisplay(preBoot)
|
|
558
649
|
} else {
|
|
559
650
|
this.sendClear()
|