Winscope: Use a unique stableId for all layers and wm entries

Top level of the hierarchy contains the entry with a timestamp. When
navigating the timeline with arrow keys, entry loses focus since
the timestamp changes.

See: https://android-window-manager.teams.x20web.corp.google.com/winscope/winscope-staging-vishnun.html

Test: Open trace in winscope, click on entry & navigate timeline with arrow keys
Merged-In: Ifbd88da717354c66d96a05d25a9d619fa5209e26
Change-Id: Ifbd88da717354c66d96a05d25a9d619fa5209e26
This commit is contained in:
Vishnu Nair
2018-08-07 10:36:05 -07:00
committed by Nataniel Borges
parent 80ad0baa5b
commit 38ed9eb5d7
3 changed files with 7 additions and 2 deletions

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
function transform({obj, kind, name, children, timestamp, rect, bounds, highlight, rects_transform, chips, visible, flattened}) {
function transform({obj, kind, name, children, timestamp, rect, bounds, highlight, rects_transform, chips, visible, flattened, stableId}) {
function call(fn, arg) {
return (typeof fn == 'function') ? fn(arg) : fn;
}
@@ -55,6 +55,9 @@ function transform({obj, kind, name, children, timestamp, rect, bounds, highligh
var kindResolved = call(kind, obj);
var nameResolved = call(name, obj);
var rectResolved = call(rect, obj);
var stableIdResolved = (stableId === undefined) ?
kindResolved + '|-|' + nameResolved :
call(stableId, obj);
var result = {
kind: kindResolved,
@@ -68,7 +71,7 @@ function transform({obj, kind, name, children, timestamp, rect, bounds, highligh
rects: rects_transform(concat(rectResolved, transformed_children, (e) => e.rects)),
highlight: call(highlight, obj),
chips: call(chips, obj),
stableId: kindResolved + "|-|" + nameResolved,
stableId: stableIdResolved,
visible: call(visible, obj),
childrenVisible: transformed_children.some((c) => {
return c.childrenVisible || c.visible

View File

@@ -159,6 +159,7 @@ function transform_layers_entry(entry) {
[[entry.layers], transform_layers],
],
timestamp: entry.elapsedRealtimeNanos,
stableId: 'entry',
});
}

View File

@@ -182,6 +182,7 @@ function transform_entry(entry) {
[[entry.windowManagerService.policy], transform_policy],
],
timestamp: entry.elapsedRealtimeNanos,
stableId: 'entry',
});
}