1import { Buffer, RectF, Transform, Matrix, Color, Rect, Region } from '../../src/flickerlib/common.js';
2import { VISIBLE_CHIP } from '../../src/flickerlib/treeview/Chips';
3
4const standardTransform = new Transform(0, new Matrix(1, 0, 0, 0, 1, 0));
5const standardRect = new Rect(0, 0, 0, 0);
6const standardColor = new Color(0, 0, 0, 1);
7const standardCrop = new Rect(0, 0, -1, -1);
8
9const expectedEmptyRegionLayer = {
10  backgroundBlurRadius: 0,
11  chips: [],
12  cornerRadius: 0,
13  effectiveScalingMode: 0,
14  hwcCompositionType: "INVALID",
15  id: 580,
16  isOpaque: false,
17  isRelativeOf: false,
18  kind: "580",
19  name: "SurfaceView - com.android.chrome/com.google.android.apps.chrome.Main#0",
20  shadowRadius: 0,
21  shortName: "SurfaceView - com.android.(...).Main#0",
22  type: "BufferLayer",
23  z: -1,
24  zOrderRelativeOf: null,
25  parentId: 579,
26  activeBuffer: new Buffer(1440, 2614, 1472, 1),
27  bufferTransform: standardTransform,
28  color: new Color(0, 0, 0, 0.0069580078125),
29  crop: standardCrop,
30  hwcFrame: standardRect,
31  screenBounds: new RectF(37, 43, 146, 152),
32  transform: new Transform(0, new Matrix(1, 0, 37.37078094482422, 0, 1, -3.5995326042175293)),
33  visibleRegion: new Region([new Rect(37, 43, 146, 152)]),
34};
35const emptyRegionProto = {
36  2: "\nparent=0\ntype=BufferLayer\nname=Display Root#0",
37  3: "\nparent=0\ntype=BufferLayer\nname=Display Overlays#0",
38  4: "\nparent=2\ntype=BufferLayer\nname=mBelowAppWindowsContainers#0",
39  5: "\nparent=2\ntype=BufferLayer\nname=com.android.server.wm.DisplayContent$TaskStackContainers@193aa46#0",
40  6: "\nparent=5\ntype=BufferLayer\nname=animationLayer#0",
41  7: "\nparent=5\ntype=BufferLayer\nname=splitScreenDividerAnchor#0",
42  8: "\nparent=2\ntype=BufferLayer\nname=mAboveAppWindowsContainers#0",
43  9: "\nparent=2\ntype=BufferLayer\nname=mImeWindowsContainers#0",
44  10: "\nparent=5\ntype=BufferLayer\nname=Stack=0#0",
45  11: "\nparent=10\ntype=ColorLayer\nname=animation background stackId=0#0",
46  12: "\nparent=9\ntype=BufferLayer\nname=WindowToken{f81e7fc android.os.Binder@7c880ef}#0",
47  13: "\nparent=4\ntype=BufferLayer\nname=WallpaperWindowToken{3756850 token=android.os.Binder@25b3e13}#0",
48  18: "\nparent=13\ntype=BufferLayer\nname=fd46a8e com.breel.wallpapers.dioramas.lagos.LagosWallpaperService#0",
49  19: "\nparent=18\ntype=BufferLayer\nname=com.breel.wallpapers.dioramas.lagos.LagosWallpaperService#0",
50  20: "\nparent=8\ntype=BufferLayer\nname=WindowToken{fc1aa98 android.os.BinderProxy@3517c7b}#0",
51  21: "\nparent=20\ntype=BufferLayer\nname=10022f1 DockedStackDivider#0",
52  22: "\nparent=8\ntype=BufferLayer\nname=WindowToken{49a6772 android.os.BinderProxy@7ba1c7d}#0",
53  23: "\nparent=22\ntype=BufferLayer\nname=56ef7c3 AssistPreviewPanel#0",
54  24: "\nparent=8\ntype=BufferLayer\nname=WindowToken{35f7d5c android.os.BinderProxy@8b38fcf}#0",
55  25: "\nparent=24\ntype=BufferLayer\nname=9029865 NavigationBar#0",
56  26: "\nparent=8\ntype=BufferLayer\nname=WindowToken{a9a69ab android.os.BinderProxy@f64ffa}#0",
57  27: "\nparent=26\ntype=BufferLayer\nname=5334808 StatusBar#0",
58  28: "\nparent=8\ntype=BufferLayer\nname=WindowToken{a63ca37 android.os.BinderProxy@435eb36}#0",
59  29: "\nparent=28\ntype=BufferLayer\nname=1a40ba4 ScreenDecorOverlay#0",
60  30: "\nparent=8\ntype=BufferLayer\nname=WindowToken{4ed84c2 android.os.BinderProxy@33d1d0d}#0",
61  31: "\nparent=30\ntype=BufferLayer\nname=7a0d2d3 ScreenDecorOverlayBottom#0",
62  32: "\nparent=25\ntype=BufferLayer\nname=NavigationBar#0",
63  33: "\nparent=27\ntype=BufferLayer\nname=StatusBar#0",
64  34: "\nparent=29\ntype=BufferLayer\nname=ScreenDecorOverlay#0",
65  35: "\nparent=31\ntype=BufferLayer\nname=ScreenDecorOverlayBottom#0",
66  36: "\nparent=10\ntype=BufferLayer\nname=Task=239#0",
67  37: "\nparent=632\ntype=BufferLayer\nname=AppWindowToken{188ce21 token=Token{824488 ActivityRecord{b0d882b u0 com.google.android.apps.nexuslauncher/.NexusLauncherActivity t239}}}#0",
68  38: "\nparent=37\ntype=BufferLayer\nname=9f6e33d com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity#0",
69  44: "\nparent=37\ntype=BufferLayer\nname=81a00fc com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity#0",
70  88: "\nparent=5\ntype=BufferLayer\nname=Stack=2#0",
71  89: "\nparent=88\ntype=ColorLayer\nname=animation background stackId=2#0",
72  90: "\nparent=88\ntype=BufferLayer\nname=Task=241#0",
73  91: "\nparent=633\ntype=BufferLayer\nname=AppWindowToken{a9f5144 token=Token{f102257 ActivityRecord{3a0fd6 u0 com.android.chrome/com.google.android.apps.chrome.Main t241}}}#0",
74  96: "\nparent=91\ntype=BufferLayer\nname=87e310e com.android.chrome/com.google.android.apps.chrome.Main#0",
75  574: "\nparent=8\ntype=BufferLayer\nname=WindowToken{37eed7d android.os.Binder@6e217d4}#0",
76  579: "\nparent=96\ntype=BufferLayer\nname=com.android.chrome/com.google.android.apps.chrome.Main#0",
77  580: "\nparent=579\ntype=BufferLayer\nname=SurfaceView - com.android.chrome/com.google.android.apps.chrome.Main#0",
78  581: "\nparent=579\ntype=ColorLayer\nname=Background for -SurfaceView - com.android.chrome/com.google.android.apps.chrome.Main#0",
79  583: "\nparent=44\ntype=BufferLayer\nname=com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity#0",
80  629: "\nparent=38\ntype=BufferLayer\nname=com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity#2",
81  632: "\nparent=6\ntype=BufferLayer\nname=Surface(name=AppWindowToken{188ce21 token=Token{824488 ActivityRecord{b0d882b u0 com.google.android.apps.nexuslauncher/.NexusLauncherActivity t239}}})/@0x90c9c46 - animation-leash#1",
82  633: "\nparent=6\ntype=BufferLayer\nname=Surface(name=AppWindowToken{a9f5144 token=Token{f102257 ActivityRecord{3a0fd6 u0 com.android.chrome/com.google.android.apps.chrome.Main t241}}})/@0xd9b9374 - animation-leash#1"
83};
84const expectedEmptyRegion = {
85  chips: [],
86  proto: emptyRegionProto,
87  hwcBlob: "",
88  isVisible: true,
89  kind: "entry",
90  rects: [],
91  shortName: "0d0h38m28s521ms",
92  timestampMs: "2308521813510",
93  where: "",
94  name: "0d0h38m28s521ms",
95  stableId: "LayerTraceEntry",
96  visibleLayers: [],
97};
98
99const expectedInvalidLayerVisibilityLayer = {
100  backgroundBlurRadius: 0,
101  chips: [],
102  cornerRadius: 0,
103  effectiveScalingMode: 0,
104  hwcCompositionType: "INVALID",
105  id: 1536,
106  isOpaque: false,
107  isRelativeOf: false,
108  kind: "1536",
109  name: "com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity#2",
110  shadowRadius: 0,
111  shortName: "com.google.(...).NexusLauncherActivity#2",
112  type: "BufferLayer",
113  z: 0,
114  zOrderRelativeOf: null,
115  parentId: 1535,
116  stableId: "BufferLayer 1536 com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity#2",
117  activeBuffer: new Buffer(1440, 2880, 1472, 1),
118  bufferTransform: standardTransform,
119  color: new Color(-1, -1, -1, 0),
120  hwcFrame: standardRect,
121  transform: standardTransform,
122  visibleRegion: new Region([standardRect]),
123};
124const invalidLayerVisibilityProto = {
125  2: "\nparent=0\ntype=BufferLayer\nname=Display Root#0",
126  3: "\nparent=0\ntype=BufferLayer\nname=Display Overlays#0",
127  4: "\nparent=2\ntype=BufferLayer\nname=mBelowAppWindowsContainers#0",
128  5: "\nparent=2\ntype=BufferLayer\nname=com.android.server.wm.DisplayContent$TaskStackContainers@4270eb4#0",
129  6: "\nparent=5\ntype=BufferLayer\nname=animationLayer#0",
130  7: "\nparent=5\ntype=BufferLayer\nname=boostedAnimationLayer#0",
131  8: "\nparent=5\ntype=BufferLayer\nname=homeAnimationLayer#0",
132  9: "\nparent=5\ntype=BufferLayer\nname=splitScreenDividerAnchor#0",
133  10: "\nparent=2\ntype=BufferLayer\nname=mAboveAppWindowsContainers#0",
134  11: "\nparent=2\ntype=BufferLayer\nname=mImeWindowsContainers#0",
135  12: "\nparent=5\ntype=BufferLayer\nname=Stack=0#0",
136  13: "\nparent=12\ntype=ColorLayer\nname=animation background stackId=0#0",
137  14: "\nparent=11\ntype=BufferLayer\nname=WindowToken{268fcff android.os.Binder@6688c1e}#0",
138  15: "\nparent=4\ntype=BufferLayer\nname=WallpaperWindowToken{6572e20 token=android.os.Binder@9543923}#0",
139  20: "\nparent=15\ntype=BufferLayer\nname=5e2e96f com.breel.wallpapers.dioramas.lagos.LagosWallpaperService#0",
140  21: "\nparent=20\ntype=BufferLayer\nname=com.breel.wallpapers.dioramas.lagos.LagosWallpaperService#0",
141  26: "\nparent=10\ntype=BufferLayer\nname=WindowToken{68e3f31 android.os.BinderProxy@f018fd8}#0",
142  27: "\nparent=26\ntype=BufferLayer\nname=2b80616 NavigationBar#0",
143  28: "\nparent=10\ntype=BufferLayer\nname=WindowToken{4e20cae android.os.BinderProxy@9086129}#0",
144  29: "\nparent=28\ntype=BufferLayer\nname=b09a4f StatusBar#0",
145  30: "\nparent=3\ntype=BufferLayer\nname=WindowToken{501e3b8 android.os.BinderProxy@238661b}#0",
146  31: "\nparent=30\ntype=BufferLayer\nname=d803591 ScreenDecorOverlay#0",
147  32: "\nparent=3\ntype=BufferLayer\nname=WindowToken{56d48f7 android.os.BinderProxy@f0f2cf6}#0",
148  33: "\nparent=32\ntype=BufferLayer\nname=1cd8364 ScreenDecorOverlayBottom#0",
149  35: "\nparent=29\ntype=BufferLayer\nname=StatusBar#0",
150  36: "\nparent=31\ntype=BufferLayer\nname=ScreenDecorOverlay#0",
151  37: "\nparent=33\ntype=BufferLayer\nname=ScreenDecorOverlayBottom#0",
152  38: "\nparent=12\ntype=BufferLayer\nname=Task=2#0",
153  39: "\nparent=38\ntype=BufferLayer\nname=AppWindowToken{215b919 token=Token{104a060 ActivityRecord{7e30c63 u0 com.google.android.apps.nexuslauncher/.NexusLauncherActivity t2}}}#0",
154  821: "\nparent=14\ntype=BufferLayer\nname=5c937c8 InputMethod#0",
155  1078: "\nparent=10\ntype=BufferLayer\nname=WindowToken{7dc6283 android.os.BinderProxy@f83c532}#0",
156  1079: "\nparent=1078\ntype=BufferLayer\nname=32c0c00 AssistPreviewPanel#0",
157  1080: "\nparent=10\ntype=BufferLayer\nname=WindowToken{9f8a3df android.os.BinderProxy@825027e}#0",
158  1081: "\nparent=1080\ntype=BufferLayer\nname=26d9efb DockedStackDivider#0",
159  1403: "\nparent=10\ntype=BufferLayer\nname=WindowToken{dedcfff android.os.Binder@a80cb1e}#0",
160  1447: "\nparent=39\ntype=BufferLayer\nname=39ca531 com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity#0",
161  1454: "\nparent=27\ntype=BufferLayer\nname=NavigationBar#0",
162  1502: "\nparent=10\ntype=BufferLayer\nname=WindowToken{3ea357b android.os.Binder@6d9a90a}#0",
163  1505: "\nparent=1518\ntype=BufferLayer\nname=Task=623#0",
164  1506: "\nparent=1505\ntype=BufferLayer\nname=AppWindowToken{6deed44 token=Token{45cae57 ActivityRecord{7f14bd6 u0 com.android.server.wm.flicker.testapp/.SimpleActivity t623}}}#0",
165  1518: "\nparent=5\ntype=BufferLayer\nname=Stack=51#0",
166  1519: "\nparent=1518\ntype=ColorLayer\nname=animation background stackId=51#0",
167  1521: "\nparent=1506\ntype=BufferLayer\nname=496d52e com.android.server.wm.flicker.testapp/com.android.server.wm.flicker.testapp.SimpleActivity#0",
168  1534: "\nparent=1447\ntype=BufferLayer\nname=com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity#0",
169  1535: "\nparent=39\ntype=BufferLayer\nname=e280197 com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity#0",
170  1536: "\nparent=1535\ntype=BufferLayer\nname=com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity#2",
171};
172const expectedInvalidLayerVisibility = {
173  chips: [],
174  proto: invalidLayerVisibilityProto,
175  hwcBlob: "",
176  isVisible: true,
177  kind: "entry",
178  rects: [],
179  shortName: "2d22h13m17s233ms",
180  timestampMs: "252797233543024",
181  where: "",
182  name: "2d22h13m17s233ms",
183  stableId: "LayerTraceEntry",
184  visibleLayers: [],
185};
186
187const expectedOrphanLayersLayer = {
188  backgroundBlurRadius: 0,
189  chips: [],
190  cornerRadius: 0,
191  effectiveScalingMode: 0,
192  hwcCompositionType: "INVALID",
193  id: 1012,
194  isOpaque: true,
195  isRelativeOf: false,
196  kind: "1012",
197  name: "SurfaceView - com.android.chrome/com.google.android.apps.chrome.Main#0",
198  shadowRadius: 0,
199  shortName: "SurfaceView - com.android.(...).Main#0",
200  type: "BufferLayer",
201  z: -1,
202  zOrderRelativeOf: null,
203  parentId: 1011,
204  stableId: "BufferLayer 1012 SurfaceView - com.android.chrome/com.google.android.apps.chrome.Main#0",
205  activeBuffer: new Buffer(1440, 2614, 1472, 1),
206  bufferTransform: standardTransform,
207  color: standardColor,
208  crop: standardCrop,
209  hwcFrame: standardRect,
210  screenBounds: new RectF(0, 98, 1440, 2712),
211  transform: new Transform(0, new Matrix(1, 0, 0, 0, 1, 98)),
212  visibleRegion: new Region([new Rect(0, 98, 1440, 2712)]),
213};
214const expectedOrphanLayersProto = {
215  2: "\nparent=0\ntype=BufferLayer\nname=Display Root#0",
216  3: "\nparent=0\ntype=BufferLayer\nname=Display Overlays#0",
217  4: "\nparent=2\ntype=BufferLayer\nname=mBelowAppWindowsContainers#0",
218  5: "\nparent=2\ntype=BufferLayer\nname=com.android.server.wm.DisplayContent$TaskStackContainers@e7dd520#0",
219  6: "\nparent=5\ntype=BufferLayer\nname=animationLayer#0",
220  7: "\nparent=5\ntype=BufferLayer\nname=splitScreenDividerAnchor#0",
221  8: "\nparent=2\ntype=BufferLayer\nname=mAboveAppWindowsContainers#0",
222  9: "\nparent=2\ntype=BufferLayer\nname=mImeWindowsContainers#0",
223  10: "\nparent=5\ntype=BufferLayer\nname=Stack=0#0",
224  11: "\nparent=10\ntype=ColorLayer\nname=animation background stackId=0#0",
225  12: "\nparent=9\ntype=BufferLayer\nname=WindowToken{1350b6f android.os.Binder@d1b0e4e}#0",
226  13: "\nparent=4\ntype=BufferLayer\nname=WallpaperWindowToken{4537182 token=android.os.Binder@d87c4cd}#0",
227  18: "\nparent=13\ntype=BufferLayer\nname=8d26107 com.breel.wallpapers.dioramas.lagos.LagosWallpaperService#0",
228  19: "\nparent=18\ntype=BufferLayer\nname=com.breel.wallpapers.dioramas.lagos.LagosWallpaperService#0",
229  20: "\nparent=8\ntype=BufferLayer\nname=WindowToken{fba948d android.os.BinderProxy@756b124}#0",
230  21: "\nparent=20\ntype=BufferLayer\nname=dc26642 DockedStackDivider#0",
231  22: "\nparent=8\ntype=BufferLayer\nname=WindowToken{45663b4 android.os.BinderProxy@5273887}#0",
232  23: "\nparent=22\ntype=BufferLayer\nname=c617bdd AssistPreviewPanel#0",
233  24: "\nparent=8\ntype=BufferLayer\nname=WindowToken{ef90888 android.os.BinderProxy@9d4dc2b}#0",
234  25: "\nparent=24\ntype=BufferLayer\nname=1d24221 NavigationBar#0",
235  26: "\nparent=8\ntype=BufferLayer\nname=WindowToken{6b1dca9 android.os.BinderProxy@a53d830}#0",
236  27: "\nparent=26\ntype=BufferLayer\nname=eaca22e StatusBar#0",
237  28: "\nparent=8\ntype=BufferLayer\nname=WindowToken{72e584c android.os.BinderProxy@3ba407f}#0",
238  29: "\nparent=28\ntype=BufferLayer\nname=46af095 ScreenDecorOverlay#0",
239  30: "\nparent=8\ntype=BufferLayer\nname=WindowToken{bc659b android.os.BinderProxy@f1405aa}#0",
240  31: "\nparent=30\ntype=BufferLayer\nname=80ead38 ScreenDecorOverlayBottom#0",
241  33: "\nparent=27\ntype=BufferLayer\nname=StatusBar#0",
242  34: "\nparent=29\ntype=BufferLayer\nname=ScreenDecorOverlay#0",
243  35: "\nparent=31\ntype=BufferLayer\nname=ScreenDecorOverlayBottom#0",
244  36: "\nparent=10\ntype=BufferLayer\nname=Task=2#0",
245  37: "\nparent=36\ntype=BufferLayer\nname=AppWindowToken{5162f77 token=Token{ac99d76 ActivityRecord{7749795 u0 com.google.android.apps.nexuslauncher/.NexusLauncherActivity t2}}}#0",
246  38: "\nparent=37\ntype=BufferLayer\nname=2c19e73 com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity#0",
247  41: "\nparent=25\ntype=BufferLayer\nname=NavigationBar#1",
248  43: "\nparent=37\ntype=BufferLayer\nname=2f0c80b com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity#0",
249  46: "\nparent=5\ntype=BufferLayer\nname=Stack=1#0",
250  47: "\nparent=46\ntype=ColorLayer\nname=animation background stackId=1#0",
251  48: "\nparent=46\ntype=BufferLayer\nname=Task=89#0",
252  49: "\nparent=48\ntype=BufferLayer\nname=AppWindowToken{1d514da token=Token{d36fe85 ActivityRecord{e0ec0ef u0 com.android.chrome/com.google.android.apps.chrome.Main t89}}}#0",
253  54: "\nparent=49\ntype=BufferLayer\nname=8ae6e06 com.android.chrome/com.google.android.apps.chrome.Main#0",
254  607: "\nparent=5\ntype=BufferLayer\nname=Stack=9#0",
255  608: "\nparent=607\ntype=ColorLayer\nname=animation background stackId=9#0",
256  609: "\nparent=607\ntype=BufferLayer\nname=Task=97#0",
257  615: "\nparent=609\ntype=BufferLayer\nname=AppWindowToken{28730c9 token=Token{4d768d0 ActivityRecord{faf093 u0 com.google.android.gm/.welcome.WelcomeTourActivity t97}}}#0",
258  616: "\nparent=615\ntype=BufferLayer\nname=44e6e5c com.google.android.gm/com.google.android.gm.welcome.WelcomeTourActivity#0",
259  679: "\nparent=12\ntype=BufferLayer\nname=2d0b1e4 InputMethod#0",
260  993: "\nparent=8\ntype=BufferLayer\nname=WindowToken{e425e58 android.os.Binder@6d9a73b}#0",
261  1011: "\nparent=54\ntype=BufferLayer\nname=com.android.chrome/com.google.android.apps.chrome.Main#0",
262  1012: "\nparent=1011\ntype=BufferLayer\nname=SurfaceView - com.android.chrome/com.google.android.apps.chrome.Main#0",
263  1013: "\nparent=1011\ntype=ColorLayer\nname=Background for -SurfaceView - com.android.chrome/com.google.android.apps.chrome.Main#0",
264};
265const expectedOrphanLayers = {
266  chips: [],
267  proto: expectedOrphanLayersProto,
268  hwcBlob: "",
269  isVisible: true,
270  kind: "entry",
271  rects: [],
272  shortName: "3d23h30m9s820ms",
273  timestampMs: "343809820196384",
274  where: "",
275  name: "3d23h30m9s820ms",
276  stableId: "LayerTraceEntry",
277  visibleLayers: [],
278};
279
280const expectedRootLayer = {
281  backgroundBlurRadius: 0,
282  cornerRadius: 0,
283  effectiveScalingMode: 0,
284  hwcCompositionType: "INVALID",
285  id: 12545,
286  isOpaque: true,
287  isRelativeOf: false,
288  kind: "12545",
289  name: "com.android.server.wm.flicker.testapp/com.android.server.wm.flicker.testapp.SimpleActivity#0",
290  shadowRadius: 0,
291  shortName: "com.android.(...).SimpleActivity#0",
292  type: "BufferQueueLayer",
293  z: 0,
294  zOrderRelativeOf: null,
295  parentId: 12541,
296  stableId: "BufferQueueLayer 12545 com.android.server.wm.flicker.testapp/com.android.server.wm.flicker.testapp.SimpleActivity#0",
297  activeBuffer: new Buffer(1440, 2960, 1472, 1),
298  chips: [VISIBLE_CHIP],
299  bufferTransform: standardTransform,
300  color: standardColor,
301  crop: new Rect(0, 0, 1440, 2960),
302  hwcFrame: standardRect,
303  screenBounds: new RectF(0, 0, 1440, 2960),
304  sourceBounds: new RectF(0, 0, 1440, 2960),
305  transform: standardTransform,
306  visibleRegion: new Region([new Rect(0, 0, 1440, 2960)]),
307};
308const expectedRootProto = {
309  2: "\nparent=-1\ntype=ContainerLayer\nname=Root#0",
310  3: "\nparent=2\ntype=ContainerLayer\nname=mWindowContainers#0",
311  4: "\nparent=2\ntype=ContainerLayer\nname=mOverlayContainers#0",
312  5: "\nparent=3\ntype=ContainerLayer\nname=mBelowAppWindowsContainers#0",
313  6: "\nparent=3\ntype=ContainerLayer\nname=com.android.server.wm.DisplayContent$TaskContainers@708b672#0",
314  7: "\nparent=6\ntype=ContainerLayer\nname=animationLayer#0",
315  8: "\nparent=6\ntype=ContainerLayer\nname=boostedAnimationLayer#0",
316  9: "\nparent=6\ntype=ContainerLayer\nname=homeAnimationLayer#0",
317  10: "\nparent=6\ntype=ContainerLayer\nname=splitScreenDividerAnchor#0",
318  11: "\nparent=3\ntype=ContainerLayer\nname=mAboveAppWindowsContainers#0",
319  12: "\nparent=3\ntype=ContainerLayer\nname=ImeContainer#0",
320  13: "\nparent=6\ntype=ContainerLayer\nname=Task=1#0",
321  18: "\nparent=5\ntype=ContainerLayer\nname=WallpaperWindowToken{4c3f8ef token=android.os.Binder@a0341ce}#0",
322  19: "\nparent=18\ntype=ContainerLayer\nname=aa9ba7e com.breel.wallpapers18.soundviz.wallpaper.variations.SoundVizWallpaperV2#0",
323  20: "\nparent=19\ntype=BufferQueueLayer\nname=com.breel.wallpapers18.soundviz.wallpaper.variations.SoundVizWallpaperV2#0",
324  23: "\nparent=11\ntype=ContainerLayer\nname=WindowToken{2e98b86 android.os.BinderProxy@6e5dbc8}#0",
325  24: "\nparent=23\ntype=ContainerLayer\nname=5976c47 NavigationBar0#0",
326  25: "\nparent=11\ntype=ContainerLayer\nname=WindowToken{525aa4 android.os.BinderProxy@df1e236}#0",
327  26: "\nparent=25\ntype=ContainerLayer\nname=986c00d NotificationShade#0",
328  27: "\nparent=11\ntype=ContainerLayer\nname=WindowToken{7ec5009 android.os.BinderProxy@de2add3}#0",
329  28: "\nparent=27\ntype=ContainerLayer\nname=3a0542f StatusBar#0",
330  31: "\nparent=-1\ntype=ContainerLayer\nname=WindowToken{eef604c android.os.BinderProxy@d3a687f}#0",
331  32: "\nparent=31\ntype=ContainerLayer\nname=20b5895 ScreenDecorOverlay#0",
332  33: "\nparent=-1\ntype=ContainerLayer\nname=WindowToken{4846f6f android.os.BinderProxy@39824e}#0",
333  34: "\nparent=33\ntype=ContainerLayer\nname=1d714 ScreenDecorOverlayBottom#0",
334  36: "\nparent=32\ntype=BufferQueueLayer\nname=ScreenDecorOverlay#0",
335  38: "\nparent=34\ntype=BufferQueueLayer\nname=ScreenDecorOverlayBottom#0",
336  40: "\nparent=28\ntype=BufferQueueLayer\nname=StatusBar#0",
337  43: "\nparent=12\ntype=ContainerLayer\nname=WindowToken{fa12db9 android.os.Binder@4b88380}#0",
338  46: "\nparent=13\ntype=ContainerLayer\nname=Task=4#0",
339  47: "\nparent=46\ntype=ContainerLayer\nname=ActivityRecord{99bbfb0 u0 com.google.android.apps.nexuslauncher/.NexusLauncherActivity#0",
340  54: "\nparent=24\ntype=BufferQueueLayer\nname=NavigationBar0#0",
341  71: "\nparent=43\ntype=ContainerLayer\nname=e8f94d2 InputMethod#0",
342  11499: "\nparent=47\ntype=ContainerLayer\nname=6737b79 com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity#0",
343  11501: "\nparent=-1\ntype=ContainerLayer\nname=Input Consumer recents_animation_input_consumer#2",
344  11759: "\nparent=6\ntype=ContainerLayer\nname=Task=873#0",
345  11760: "\nparent=11759\ntype=ContainerLayer\nname=Task=874#0",
346  11761: "\nparent=11760\ntype=ContainerLayer\nname=ActivityRecord{7398002 u0 com.android.server.wm.flicker.testapp/.ImeActivityAutoFocus#0",
347  11785: "\nparent=11761\ntype=ColorLayer\nname=Letterbox - right#0",
348  12131: "\nparent=11\ntype=ContainerLayer\nname=WindowToken{bbffcfd android.os.Binder@547b554}#0",
349  12379: "\nparent=47\ntype=ContainerLayer\nname=3f8f098 com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity#0",
350  12412: "\nparent=11761\ntype=ContainerLayer\nname=edca7c6 com.android.server.wm.flicker.testapp/com.android.server.wm.flicker.testapp.ImeActivityAutoFocus#0",
351  12448: "\nparent=2147483645\ntype=ContainerLayer\nname=Surface(name=ActivityRecord{99bbfb0 u0 com.google.android.apps.nexuslauncher/.NexusLauncherActivity)/@0x2c3972c - animation-leash#0",
352  12449: "\nparent=2147483645\ntype=ContainerLayer\nname=Surface(name=ActivityRecord{fc16c94 u0 com.android.server.wm.flicker.testapp/.ImeActivity)/@0x7049863 - animation-leash#0",
353  12485: "\nparent=6\ntype=ContainerLayer\nname=Task=908#0",
354  12486: "\nparent=12485\ntype=ContainerLayer\nname=Task=909#0",
355  12487: "\nparent=12486\ntype=ContainerLayer\nname=ActivityRecord{4b3c5cb u0 com.android.server.wm.flicker.testapp/.ImeActivity#0",
356  12500: "\nparent=2147483645\ntype=ContainerLayer\nname=Surface(name=ActivityRecord{99bbfb0 u0 com.google.android.apps.nexuslauncher/.NexusLauncherActivity)/@0x2c3972c - animation-leash#0",
357  12501: "\nparent=2147483645\ntype=ContainerLayer\nname=Surface(name=ActivityRecord{4b3c5cb u0 com.android.server.wm.flicker.testapp/.ImeActivity)/@0x4ad47a1 - animation-leash#0",
358  12502: "\nparent=2147483645\ntype=ContainerLayer\nname=Surface(name=WallpaperWindowToken{4c3f8ef token=android.os.Binder@a0341ce})/@0xcde5e65 - animation-leash#0",
359  12511: "\nparent=12487\ntype=ColorLayer\nname=Letterbox - right#1",
360  12514: "\nparent=12487\ntype=ContainerLayer\nname=debe1ed com.android.server.wm.flicker.testapp/com.android.server.wm.flicker.testapp.ImeActivity#0",
361  12526: "\nparent=11\ntype=ContainerLayer\nname=WindowToken{6b7d663 android.os.BinderProxy@391f21d}#0",
362  12527: "\nparent=12526\ntype=ContainerLayer\nname=32aa260 AssistPreviewPanel#0",
363  12529: "\nparent=11\ntype=ContainerLayer\nname=WindowToken{31f7489 android.os.BinderProxy@67b1e53}#0",
364  12530: "\nparent=12529\ntype=ContainerLayer\nname=cbb28bc DockedStackDivider#0",
365  12536: "\nparent=6\ntype=ContainerLayer\nname=Task=910#0",
366  12537: "\nparent=12536\ntype=ContainerLayer\nname=Task=911#0",
367  12538: "\nparent=12537\ntype=ContainerLayer\nname=ActivityRecord{d3b8a44 u0 com.android.server.wm.flicker.testapp/.SimpleActivity#0",
368  12541: "\nparent=12538\ntype=ContainerLayer\nname=a3583c5 com.android.server.wm.flicker.testapp/com.android.server.wm.flicker.testapp.SimpleActivity#0",
369  12545: "\nparent=12541\ntype=BufferQueueLayer\nname=com.android.server.wm.flicker.testapp/com.android.server.wm.flicker.testapp.SimpleActivity#0",
370  2147483645: "\nparent=-1\ntype=\nname=Offscreen Root",
371};
372const expectedRoot = {
373  chips: [],
374  proto: expectedRootProto,
375  hwcBlob: "",
376  isVisible: true,
377  kind: "entry",
378  shortName: "0d1h46m19s146ms",
379  timestampMs: "6379146308030",
380  where: "",
381  name: "0d1h46m19s146ms",
382  stableId: "LayerTraceEntry",
383};
384
385const expectedRootAospLayer = {
386  backgroundBlurRadius: 0,
387  cornerRadius: 0,
388  effectiveScalingMode: 0,
389  hwcCompositionType: "INVALID",
390  id: 876,
391  isOpaque: false,
392  isRelativeOf: false,
393  kind: "876",
394  name: "com.android.launcher3/com.android.launcher3.Launcher#0",
395  shadowRadius: 0,
396  shortName: "com.android.(...).Launcher#0",
397  type: "BufferLayer",
398  z: 0,
399  zOrderRelativeOf: null,
400  parentId: 41,
401  activeBuffer: new Buffer(1440, 2880, 1472, 1),
402  bufferTransform: standardTransform,
403  chips: [VISIBLE_CHIP],
404  color: standardColor,
405  crop: new Rect(0, 0, 1440, 2880),
406  hwcFrame: standardRect,
407  screenBounds: new RectF(0, 0, 1440, 2880),
408  sourceBounds: new RectF(0, 0, 1440, 2880),
409  transform: standardTransform,
410  visibleRegion: new Region([new Rect(0, 0, 1440, 2880)]),
411};
412const expectedRootAospProto = {
413  2: "\nparent=-1\ntype=ContainerLayer\nname=Display Root#0",
414  3: "\nparent=-1\ntype=ContainerLayer\nname=Display Overlays#0",
415  4: "\nparent=2\ntype=ContainerLayer\nname=mBelowAppWindowsContainers#0",
416  5: "\nparent=2\ntype=ContainerLayer\nname=com.android.server.wm.DisplayContent$TaskStackContainers@d8077b3#0",
417  6: "\nparent=5\ntype=ContainerLayer\nname=animationLayer#0",
418  7: "\nparent=5\ntype=ContainerLayer\nname=boostedAnimationLayer#0",
419  8: "\nparent=5\ntype=ContainerLayer\nname=homeAnimationLayer#0",
420  9: "\nparent=5\ntype=ContainerLayer\nname=splitScreenDividerAnchor#0",
421  10: "\nparent=2\ntype=ContainerLayer\nname=mAboveAppWindowsContainers#0",
422  11: "\nparent=2\ntype=ContainerLayer\nname=mImeWindowsContainers#0",
423  12: "\nparent=5\ntype=ContainerLayer\nname=Stack=0#0",
424  13: "\nparent=12\ntype=ColorLayer\nname=animation background stackId=0#0",
425  18: "\nparent=4\ntype=ContainerLayer\nname=WallpaperWindowToken{5a7eaca token=android.os.Binder@438b635}#0",
426  23: "\nparent=10\ntype=ContainerLayer\nname=WindowToken{d19e48 android.os.BinderProxy@560ac3a}#0",
427  24: "\nparent=23\ntype=ContainerLayer\nname=b2a84e1 NavigationBar0#0",
428  25: "\nparent=10\ntype=ContainerLayer\nname=WindowToken{74d6851 android.os.BinderProxy@8b22adb}#0",
429  26: "\nparent=25\ntype=ContainerLayer\nname=16448b6 StatusBar#0",
430  27: "\nparent=-1\ntype=ContainerLayer\nname=WindowToken{624863c android.os.BinderProxy@975b02f}#0",
431  28: "\nparent=27\ntype=ContainerLayer\nname=cdb9fc5 ScreenDecorOverlay#0",
432  29: "\nparent=-1\ntype=ContainerLayer\nname=WindowToken{cb7204b android.os.BinderProxy@b8f3d1a}#0",
433  30: "\nparent=29\ntype=ContainerLayer\nname=ad1ca28 ScreenDecorOverlayBottom#0",
434  31: "\nparent=28\ntype=BufferLayer\nname=ScreenDecorOverlay#0",
435  32: "\nparent=30\ntype=BufferLayer\nname=ScreenDecorOverlayBottom#0",
436  33: "\nparent=18\ntype=ContainerLayer\nname=4f4b23b com.android.systemui.ImageWallpaper#0",
437  34: "\nparent=33\ntype=BufferLayer\nname=com.android.systemui.ImageWallpaper#0",
438  36: "\nparent=26\ntype=BufferLayer\nname=StatusBar#0",
439  37: "\nparent=12\ntype=ContainerLayer\nname=Task=144#0",
440  38: "\nparent=37\ntype=ContainerLayer\nname=AppWindowToken{54e2de0 token=Token{f4c5fe3 ActivityRecord{6a9dc12 u0 com.android.launcher3/.Launcher t144}}}#0",
441  40: "\nparent=-1\ntype=ContainerLayer\nname=Input Consumer recents_animation_input_consumer#1",
442  41: "\nparent=38\ntype=ContainerLayer\nname=418b5c0 com.android.launcher3/com.android.launcher3.Launcher#0",
443  45: "\nparent=11\ntype=ContainerLayer\nname=WindowToken{9158878 android.os.Binder@4f4a5db}#0",
444  46: "\nparent=24\ntype=BufferLayer\nname=NavigationBar0#0",
445  731: "\nparent=10\ntype=ContainerLayer\nname=WindowToken{c0ebbde android.os.BinderProxy@1af0e60}#0",
446  732: "\nparent=731\ntype=ContainerLayer\nname=b37d1bf AssistPreviewPanel#0",
447  733: "\nparent=10\ntype=ContainerLayer\nname=WindowToken{dc6b7ea android.os.BinderProxy@166b08c}#0",
448  734: "\nparent=733\ntype=ContainerLayer\nname=2a1cadb DockedStackDivider#0",
449  862: "\nparent=10\ntype=ContainerLayer\nname=WindowToken{f63efe6 android.os.Binder@d536e41}#0",
450  865: "\nparent=887\ntype=ContainerLayer\nname=Task=170#0",
451  866: "\nparent=865\ntype=ContainerLayer\nname=AppWindowToken{c829d40 token=Token{59970c3 ActivityRecord{36f2472 u0 com.android.server.wm.flicker.testapp/.PipActivity t170}}}#0",
452  871: "\nparent=866\ntype=ContainerLayer\nname=8153ff7 com.android.server.wm.flicker.testapp/com.android.server.wm.flicker.testapp.PipActivity#0",
453  876: "\nparent=41\ntype=BufferLayer\nname=com.android.launcher3/com.android.launcher3.Launcher#0",
454  887: "\nparent=5\ntype=ContainerLayer\nname=Stack=78#0",
455  888: "\nparent=887\ntype=ColorLayer\nname=animation background stackId=78#0",
456};
457const expectedRootAosp = {
458  chips: [],
459  proto: expectedRootAospProto,
460  hwcBlob: "",
461  isVisible: true,
462  kind: "entry",
463  shortName: "0d1h3m1s911ms",
464  timestampMs: "3781911657318",
465  where: "",
466  name: "0d1h3m1s911ms",
467  stableId: "LayerTraceEntry",
468};
469
470const expectedEntries = [
471  expectedEmptyRegion,
472  expectedInvalidLayerVisibility,
473  expectedOrphanLayers,
474  expectedRoot,
475  expectedRootAosp
476];
477const expectedLayers = [
478  expectedEmptyRegionLayer,
479  expectedInvalidLayerVisibilityLayer,
480  expectedOrphanLayersLayer,
481  expectedRootLayer,
482  expectedRootAospLayer
483];
484const layers_traces = [
485  '../spec/traces/layers_trace/layers_trace_emptyregion.pb',
486  '../spec/traces/layers_trace/layers_trace_invalid_layer_visibility.pb',
487  '../spec/traces/layers_trace/layers_trace_orphanlayers.pb',
488  '../spec/traces/layers_trace/layers_trace_root.pb',
489  '../spec/traces/layers_trace/layers_trace_root_aosp.pb',
490];
491
492export { expectedEntries, expectedLayers, layers_traces };
493