Skip to content

Commit 4f004ed

Browse files
committed
docs(android): correct the chrome-classifier TODO — window-type keying is ruled out on device
Follow-up to the #1319 investigation, acting on review feedback that a paragraph justifying fragile behavior means the code is wrong. Two candidate fixes for the capture-shape-dependent chrome classification were tested, and BOTH are dead. Recording that here so the next person does not re-walk them: 1. The window-type approach this file's own TODO proposed. Measured against the live helper XML (emulator-5554, Pixel 9 Pro XL API 37): systemui reports `window-type=3` (TYPE_SYSTEM) both collapsed and expanded, `TYPE_STATUS_BAR` (2000) never appears, the helper stamps window metadata on window ROOTS only (1 of 169 nodes in an expanded-shade capture), and an expanded shade is ONE window hosting the status icons AND the quick-settings tiles. No window-level signal separates them. The TODO promised a fix the device data rules out. 2. Replacing run-condemnation with "condemn each marked node's subtree plus fully-condemned ancestors". Shape-independent as intended, and it keeps the tiles in both walks — but on the COLLAPSED status bar it leaks the unmarked chrome the walk re-parents next to the markers ("Battery 100 percent.", the notification-icon summary, neither carrying any resource-id). That is the ticking-clock regression #1319 explicitly warned against. So run-condemnation is not a lazy workaround: it reconstructs identity the walk already discarded when it drops the `status_bar*` wrappers and re-parents chrome leaves next to content. That upstream information loss is the actual root cause, and a provenance-preserving walk is the real fix — larger than this PR, and it would let #1318's divergence fallback be revisited. Also trims the #1319 test's doc comment from a long justification of the current behavior down to the finding, the defect, and what the test holds in place.
1 parent d7c522f commit 4f004ed

2 files changed

Lines changed: 34 additions & 40 deletions

File tree

‎src/contracts/android-system-chrome.ts‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,26 @@ const ANDROID_SYSTEM_CHROME_MARKER_PREFIXES = [
3030
* `--raw` keeps the wrapper markers, so the prefix check above stays
3131
* load-bearing there.
3232
*
33-
* A more robust fix would thread the AOSP window-type constants
34-
* (`TYPE_STATUS_BAR` = 2000, `TYPE_NAVIGATION_BAR` = 2019) already parsed in
35-
* `readNodeAttributes` (ui-hierarchy.ts) through to the output `SnapshotNode`
36-
* and key off that instead of resource-ids — deferred until the id-based
37-
* approach here proves insufficient.
33+
* This note previously proposed threading the AOSP window-type constants
34+
* (`TYPE_STATUS_BAR` = 2000, `TYPE_NAVIGATION_BAR` = 2019) through to the
35+
* output `SnapshotNode` and keying off those instead. Measured against the
36+
* helper XML on a live device (2026-07-21, emulator-5554, Pixel 9 Pro XL API
37+
* 37), that does not work and should not be attempted:
38+
*
39+
* - systemui reports `window-type=3` (`TYPE_SYSTEM`) both with the shade
40+
* collapsed and fully expanded; `TYPE_STATUS_BAR` never appears at all;
41+
* - the helper stamps window metadata on window ROOT nodes only (1 of 169
42+
* nodes in an expanded-shade capture), not per node;
43+
* - an expanded shade is ONE window hosting the status icons AND the
44+
* quick-settings tiles, so no window-level signal separates them.
45+
*
46+
* The real constraint is upstream: the walk drops the `status_bar*` wrappers —
47+
* the only nodes that identify the region — and re-parents chrome leaves next
48+
* to unmarked chrome siblings that carry no id (`"Battery 100 percent."`, the
49+
* notification-icon summary). Everything here is reconstructing identity the
50+
* walk already discarded, which is why classification depends on capture
51+
* shape (#1318 raw vs #1319 interactive-only). See #1319 for the measured
52+
* dead ends and the provenance-preserving alternative.
3853
*/
3954
const ANDROID_SYSTEM_CHROME_MARKER_LEAF_IDS: ReadonlySet<string> = new Set(
4055
[

‎src/core/__tests__/snapshot-chrome-android-statusbar.test.ts‎

Lines changed: 14 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -239,43 +239,22 @@ test('Android nav-bar leaves are recognized as chrome once their navigation_bar*
239239
});
240240

241241
/**
242-
* #1319: does the run-condemnation rule make `--settle` blind to a fully
243-
* expanded quick-settings shade? It does NOT, and this pins the reason,
244-
* because the reason is structural rather than intentional and nothing else
245-
* guards it.
242+
* #1319: `--settle` is NOT blind to a fully expanded quick-settings shade.
243+
* Live-verified on emulator-5554 (Pixel 9 Pro XL API 37, deskclock) in both
244+
* directions — opening mid-settle diffs `+28 -25`, closing diffs `+25 -28` —
245+
* while the shade's own status bar stays stripped from both.
246246
*
247-
* #1318 established that under the `--raw` / non-raw walk this exact capture
248-
* is ONE `legacy_window_root` run whose four status-icon markers condemn all
249-
* 95 nodes — which is why the divergence layer needed its own fallback. But
250-
* the settle loop never sees that shape: it captures `interactiveOnly: true`
251-
* (`stable-capture.ts`), and that walk also drops the structural window spine
252-
* that merged the shade into a single run. The shade therefore reaches
253-
* `withoutSettleChrome` as SEPARATE runs, and only the status-bar one carries
254-
* a marker.
247+
* The classification is capture-shape-dependent, which is the real defect
248+
* (#1319 has the measurements): the same shade is ONE condemned run under the
249+
* `--raw`/non-raw walk #1318 measured, and separate runs under the
250+
* `interactiveOnly: true` walk settle captures with, because that walk also
251+
* drops the systemui spine holding the run together. Settle lands on the right
252+
* side of that; the divergence layer needed its own fallback to.
255253
*
256-
* So settle and divergence disagreeing about these nodes (#1318's framing) is
257-
* not two layers reading one tree differently — they consume different capture
258-
* shapes. Settle already gets the outcome that layer wants: shade content
259-
* survives the diff, status-bar churn does not.
260-
*
261-
* Revert sensitivity runs through the interactive walk: if
262-
* `shouldIncludeInteractiveAndroidNode` ever retains the systemui spine, the
263-
* runs re-merge, every assertion in the first half of this test flips, and
264-
* `--settle` silently starts reporting a full-cover shade as bare removals
265-
* with no added content.
266-
*
267-
* Live end-to-end confirmation (2026-07-21, emulator-5554 Pixel 9 Pro XL API 37,
268-
* deskclock), covering both halves this test asserts and both directions #1319
269-
* asked about:
270-
*
271-
* - shade OPENING mid-settle: `settled after 6917ms: +28 -25`, the added lines
272-
* being the brightness seekbar and the Wi-Fi/Bluetooth/Mobile data/Quick
273-
* Share/Modes/Wallet tiles;
274-
* - shade CLOSING mid-settle: `settled after 6919ms: +25 -28`, the mirror image;
275-
* - and in the same runs the shade's OWN status bar (one group labeled
276-
* "Tue, Jul 21, Wifi signal full., T-Mobile") is absent from the settle diff
277-
* while `snapshot -i` of the identical screen still lists it — so the run rule
278-
* is filtering the churn, not sitting inert.
254+
* Until the shape-dependence is fixed upstream, this is what holds the settle
255+
* side in place: retaining the spine in the interactive walk re-merges the
256+
* runs and makes `--settle` report a full-cover shade as bare removals with no
257+
* added content.
279258
*/
280259
test('Android expanded quick-settings shade stays visible to --settle while its status bar is still stripped (#1319)', () => {
281260
const appBundleId = 'com.google.android.deskclock';

0 commit comments

Comments
 (0)