Merge "Do not set insets changed for invisible window" into tm-dev am: e79e811a50

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18912001

Change-Id: I581857d6c8e8b93dbc7cc1582ba1acb921f7c3ba
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Riddle Hsu
2022-06-17 19:23:57 +00:00
committed by Automerger Merge Worker
2 changed files with 12 additions and 1 deletions

View File

@@ -884,7 +884,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
* {@link InsetsStateController#notifyInsetsChanged}. * {@link InsetsStateController#notifyInsetsChanged}.
*/ */
boolean isReadyToDispatchInsetsState() { boolean isReadyToDispatchInsetsState() {
return isVisibleRequested() && mFrozenInsetsState == null; final boolean visible = shouldCheckTokenVisibleRequested()
? isVisibleRequested() : isVisible();
return visible && mFrozenInsetsState == null;
} }
void seamlesslyRotateIfAllowed(Transaction transaction, @Rotation int oldRotation, void seamlesslyRotateIfAllowed(Transaction transaction, @Rotation int oldRotation,

View File

@@ -927,6 +927,15 @@ public class WindowStateTests extends WindowTestsBase {
assertTrue(app.isReadyToDispatchInsetsState()); assertTrue(app.isReadyToDispatchInsetsState());
mDisplayContent.getInsetsStateController().notifyInsetsChanged(); mDisplayContent.getInsetsStateController().notifyInsetsChanged();
verify(app).notifyInsetsChanged(); verify(app).notifyInsetsChanged();
// Verify that invisible non-activity window won't dispatch insets changed.
final WindowState overlay = createWindow(null, TYPE_APPLICATION_OVERLAY, "overlay");
makeWindowVisible(overlay);
assertTrue(overlay.isReadyToDispatchInsetsState());
overlay.mHasSurface = false;
assertFalse(overlay.isReadyToDispatchInsetsState());
mDisplayContent.getInsetsStateController().notifyInsetsChanged();
assertFalse(overlay.getWindowFrames().hasInsetsChanged());
} }
@UseTestDisplay(addWindows = {W_INPUT_METHOD, W_ACTIVITY}) @UseTestDisplay(addWindows = {W_INPUT_METHOD, W_ACTIVITY})