Only reset layout seq when moved to a new display.

In previous commit 2f145f225e we
consolidated display info change and moving to new display into one
single method. Partner found that change may lead to timeout on turning
on the screen (needs more than 1s to turn on screen). Thus restrict the
layout sequence update to only moving to a new display, which is
effectively the same to it before the consolidation in the previous
commit.

Bug: 128812757
Test: go/wm-smoke. Partner verified this fix too.
atest WmTests:WindowStateTests
Change-Id: Ifd5d8e98468f5fdb4bf9ec0de14766b58b36085e
This commit is contained in:
Garfield Tan
2019-04-15 09:59:25 -07:00
parent 4bea465dbb
commit e223e68d05
2 changed files with 4 additions and 2 deletions

View File

@@ -1305,7 +1305,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
void onDisplayChanged(DisplayContent dc) {
super.onDisplayChanged(dc);
// Window was not laid out for this display yet, so make sure mLayoutSeq does not match.
if (dc != null) {
if (dc != null && mInputWindowHandle.displayId != dc.getDisplayId()) {
mLayoutSeq = dc.mLayoutSeq - 1;
mInputWindowHandle.displayId = dc.getDisplayId();
}

View File

@@ -397,7 +397,9 @@ public class WindowStateTests extends WindowTestsBase {
app.mLayoutSeq = 1;
mDisplayContent.mLayoutSeq = 1;
app.onDisplayChanged(mDisplayContent);
DisplayContent newDisplay = createNewDisplay();
app.onDisplayChanged(newDisplay);
assertThat(app.mLayoutSeq, not(is(mDisplayContent.mLayoutSeq)));
}