Merge "Force reportResized when useBlastSync enabled" into rvc-dev am: d91929d91f

Change-Id: I9c54e6296a065b9284ba2d34f2777971a76b37a8
This commit is contained in:
Chavi Weingarten
2020-05-26 21:49:31 +00:00
committed by Automerger Merge Worker
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 mDragResizing;
private boolean mDragResizingChangeReported = true; private boolean mDragResizingChangeReported = true;
private int mResizeMode; private int mResizeMode;
private boolean mResizeForBlastSyncReported;
/** /**
* Special mode that is intended only for the rounded corner overlay: during rotation * 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 * 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. // variables, because mFrameSizeChanged only tracks the width and height changing.
updateLastFrames(); 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 if (didFrameInsetsChange
|| winAnimator.mSurfaceResized || winAnimator.mSurfaceResized
|| configChanged || configChanged
|| dragResizingChanged || dragResizingChanged
|| mReportOrientationChanged) { || mReportOrientationChanged
|| requestResizeForBlastSync()) {
ProtoLog.v(WM_DEBUG_RESIZE, ProtoLog.v(WM_DEBUG_RESIZE,
"Resize reasons for w=%s: %s surfaceResized=%b configChanged=%b " "Resize reasons for w=%s: %s surfaceResized=%b configChanged=%b "
+ "dragResizingChanged=%b reportOrientationChanged=%b", + "dragResizingChanged=%b reportOrientationChanged=%b",
@@ -3483,6 +3488,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
mReportOrientationChanged = false; mReportOrientationChanged = false;
mDragResizingChangeReported = true; mDragResizingChangeReported = true;
mWinAnimator.mSurfaceResized = false; mWinAnimator.mSurfaceResized = false;
mResizeForBlastSyncReported = true;
mWindowFrames.resetInsetsChanged(); mWindowFrames.resetInsetsChanged();
final Rect frame = mWindowFrames.mCompatFrame; final Rect frame = mWindowFrames.mCompatFrame;
@@ -5733,6 +5739,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
if (!willSync) { if (!willSync) {
return false; return false;
} }
mResizeForBlastSyncReported = false;
mLocalSyncId = mBLASTSyncEngine.startSyncSet(this); mLocalSyncId = mBLASTSyncEngine.startSyncSet(this);
addChildrenToSyncSet(mLocalSyncId); addChildrenToSyncSet(mLocalSyncId);
@@ -5777,4 +5784,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
mWaitingListener = null; mWaitingListener = null;
return mWinAnimator.finishDrawingLocked(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()); 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 @Test
public void testGetTransformationMatrix() { public void testGetTransformationMatrix() {
final int PARENT_WINDOW_OFFSET = 1; final int PARENT_WINDOW_OFFSET = 1;