Merge "Force reportResized when useBlastSync enabled" into rvc-dev

This commit is contained in:
Chavi Weingarten
2020-05-26 21:45:03 +00:00
committed by Android (Google) Code Review
2 changed files with 35 additions and 1 deletions

View File

@@ -334,6 +334,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
private boolean mDragResizing;
private boolean mDragResizingChangeReported = true;
private int mResizeMode;
private boolean mResizeForBlastSyncReported;
/**
* Special mode that is intended only for the rounded corner overlay: during rotation
* transition, we un-rotate the window token such that the window appears as it did before the
@@ -1370,11 +1372,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
// variables, because mFrameSizeChanged only tracks the width and height changing.
updateLastFrames();
// Add a window that is using blastSync to the resizing list if it hasn't been reported
// already. This because the window is waiting on a finishDrawing from the client.
if (didFrameInsetsChange
|| winAnimator.mSurfaceResized
|| configChanged
|| dragResizingChanged
|| mReportOrientationChanged) {
|| mReportOrientationChanged
|| requestResizeForBlastSync()) {
ProtoLog.v(WM_DEBUG_RESIZE,
"Resize reasons for w=%s: %s surfaceResized=%b configChanged=%b "
+ "dragResizingChanged=%b reportOrientationChanged=%b",
@@ -3483,6 +3488,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
mReportOrientationChanged = false;
mDragResizingChangeReported = true;
mWinAnimator.mSurfaceResized = false;
mResizeForBlastSyncReported = true;
mWindowFrames.resetInsetsChanged();
final Rect frame = mWindowFrames.mCompatFrame;
@@ -5733,6 +5739,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
if (!willSync) {
return false;
}
mResizeForBlastSyncReported = false;
mLocalSyncId = mBLASTSyncEngine.startSyncSet(this);
addChildrenToSyncSet(mLocalSyncId);
@@ -5777,4 +5784,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
mWaitingListener = null;
return mWinAnimator.finishDrawingLocked(null);
}
private boolean requestResizeForBlastSync() {
return useBLASTSync() && !mResizeForBlastSyncReported;
}
}

View File

@@ -602,6 +602,29 @@ public class WindowStateTests extends WindowTestsBase {
assertFalse(win.getOrientationChanging());
}
@Test
public void testRequestResizeForBlastSync() {
final WindowState win = mChildAppWindowAbove;
makeWindowVisible(win, win.getParentWindow());
win.mLayoutSeq = win.getDisplayContent().mLayoutSeq;
win.reportResized();
win.updateResizingWindowIfNeeded();
assertThat(mWm.mResizingWindows).doesNotContain(win);
// Check that the window is in resizing if using blast sync.
win.reportResized();
win.prepareForSync(mock(BLASTSyncEngine.TransactionReadyListener.class), 1);
win.updateResizingWindowIfNeeded();
assertThat(mWm.mResizingWindows).contains(win);
// Don't re-add the window again if it's been reported to the client and still waiting on
// the client draw for blast sync.
win.reportResized();
mWm.mResizingWindows.remove(win);
win.updateResizingWindowIfNeeded();
assertThat(mWm.mResizingWindows).doesNotContain(win);
}
@Test
public void testGetTransformationMatrix() {
final int PARENT_WINDOW_OFFSET = 1;