Merge upstream main preserving custom feature integrations

This commit is contained in:
MasterControl committed 2026-11-10 17:08:15 +00:00
commit 6150a1ac57
228 files changed
+16844 -1388

No files matched your search

+43 -11
View File
@@ -1,5 +1,5 @@
import { encodeShellScene } from "../../graphics/shell-scene";
import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage } from "../../graphics/image";
import { GrayImage } from "../../graphics/image";
import { singlePlane, type Plane } from "../../graphics/plane";
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
import { EvenAIStatus, EventSourceType, OsEventTypeList, WatchGestureType } from "../../g2/events";
@@ -49,8 +49,11 @@ import {
veniceWebSearchSetting,
batteryIndicatorSettingsKey,
brightnessSetting,
newNotificationDisplaySetting,
newNotificationDisplayTimeoutMs,
onAnySettingChanged,
openAiApiKeySetting,
shouldPopUpNewNotification,
statusBarPositionSetting,
statusBarVisibilitySetting,
timeFormatSetting,
@@ -70,8 +73,8 @@ import {
} from "./chrome-layer";
import { ShellModalLayer } from "./modal-layer";
import { NotificationModalQueue } from "./notification-modal-queue";
import { NotificationPopupTimeout } from "./notification-popup-timeout";
import { ALL_NOTIFICATIONS, readActiveNotifications } from "../../native/notification-icons";
import { shouldShowNotificationOnGlasses } from "../../native/notification-sources";
import { ToolDebugMenuLayer } from "./tool-debug-layer";
import type { InProcessWindow } from "./in-process-window";
import { BrightnessPickerLayer } from "./brightness-picker-layer";
@@ -87,6 +90,8 @@ import {
windowFramed,
windowTop,
type WindowHeightMode,
screenHeight,
screenWidth,
} from "./geometry";
import type { AppSwitcherPosition } from "../dashboard-settings";
@@ -169,6 +174,12 @@ export type ShellWindow = {
* they opened with when the bottom switcher changes height.
*/
relayout?: () => void;
/**
* The viewport size the window is laid out at (it changes on relayout), so
* the controller can tell a window whose size fell behind the geometry from
* one whose surface merely moved.
*/
layoutSize?: () => { width: number; height: number };
/**
* A touch from the phone's mirror at (x, y) in app-viewport coordinates.
* True if the window acted on it; otherwise the controller sends a select.
@@ -364,7 +375,10 @@ class ShellOverlayMenuLayer extends MenuLayer {
/** How long a show_alert popup stays before auto-dismissing. */
const ALERT_DISMISS_MS = 6000;
const ALERT_X = 40;
const ALERT_W = G2_LENS_WIDTH - 80;
/** Alert width: the screen less ALERT_X on each side. */
function alertW(): number {
return screenWidth() - 2 * ALERT_X;
}
const ALERT_Y = 96;
const ALERT_H = 96;
@@ -388,14 +402,14 @@ class ShellAlertLayer implements Layer {
const font = getDefaultSmallFont();
// Positioned within the min-height window band, like the other shell overlays.
const alertY = minWindowTop() + ALERT_Y;
image.fillRect(ALERT_X, alertY, ALERT_W, ALERT_H, 1);
image.drawRect(ALERT_X, alertY, ALERT_W, ALERT_H, 90);
image.fillRect(ALERT_X, alertY, alertW(), ALERT_H, 1);
image.drawRect(ALERT_X, alertY, alertW(), ALERT_H, 90);
image.drawText(font, ALERT_X + 16, alertY + 12, "Assistant", 200);
image.drawTextWrapped({
font,
x: ALERT_X + 16,
y: alertY + 18 + font.lineHeight + 4,
width: ALERT_W - 32,
width: alertW() - 32,
text: this.text,
value: 235,
});
@@ -482,7 +496,7 @@ class Shell {
isAvailable: (notificationKey) => {
if (this.appNotifications.has(notificationKey)) return true;
const notification = readActiveNotifications(ALL_NOTIFICATIONS).find((item) => item.key === notificationKey);
return !!notification && shouldShowNotificationOnGlasses(notification.packageName);
return !!notification && shouldPopUpNewNotification(notification.packageName);
},
sleep: () => this.sleep(),
});
@@ -936,18 +950,36 @@ class Shell {
const content = appNotification
? null
: new SingleNotificationLayer(notificationKey, { origin: "new-notification-modal", onClose: close });
// A phone notification's popup closes once left untouched for the
// "Display new notifications" time, as if closed by hand: the notification
// stays on the phone and in the status bar. An app's own notification
// (e.g. a Nightscout alert) is nowhere else to be found, so it stays up.
const timeout = new NotificationPopupTimeout(
appNotification ? null : newNotificationDisplayTimeoutMs(newNotificationDisplaySetting.get()),
() => {
// Something over the popup (a voice dialog, the system menu) is in
// use; count that as interaction rather than closing underneath it.
if (this.stack.topMatches((layer) => layer === popup.modal)) close();
else timeout.restart();
},
);
const popup: NotificationPopup = {
content,
modal: new ShellModalLayer(
appNotification ? appNotification.createLayer(close) : content!,
this.config.actions,
() => {
this.appNotifications.delete(notificationKey);
this.notificationModals.removed(popup, this.screenOn);
{
removed: () => {
timeout.stop();
this.appNotifications.delete(notificationKey);
this.notificationModals.removed(popup, this.screenOn);
},
input: () => timeout.restart(),
},
),
};
this.stack.push(popup.modal);
timeout.restart();
return popup;
}
@@ -984,7 +1016,7 @@ class Shell {
paintSurface(): Plane[] {
if (!this.screenOn) {
return singlePlane(new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0));
return singlePlane(new GrayImage(screenWidth(), screenHeight(), 0));
}
return this.stack.paint();
}