Merge "Finish sync for unchanged drawn window" into tm-qpr-dev
This commit is contained in:
@@ -3759,7 +3759,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
|
|||||||
if (mSyncState == SYNC_STATE_NONE) return false;
|
if (mSyncState == SYNC_STATE_NONE) return false;
|
||||||
mSyncState = SYNC_STATE_READY;
|
mSyncState = SYNC_STATE_READY;
|
||||||
mSyncMethodOverride = BLASTSyncEngine.METHOD_UNDEFINED;
|
mSyncMethodOverride = BLASTSyncEngine.METHOD_UNDEFINED;
|
||||||
mWmService.mWindowPlacerLocked.requestTraversal();
|
|
||||||
ProtoLog.v(WM_DEBUG_SYNC_ENGINE, "onSyncFinishedDrawing %s", this);
|
ProtoLog.v(WM_DEBUG_SYNC_ENGINE, "onSyncFinishedDrawing %s", this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -3829,8 +3828,8 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the subtree rooted at this container is finished syncing (everything is ready or
|
* Checks if the subtree rooted at this container is finished syncing (everything is ready or
|
||||||
* not visible). NOTE, this is not const: it will cancel/prepare itself depending on its state
|
* not visible). NOTE, this is not const: it may cancel/prepare/complete itself depending on
|
||||||
* in the hierarchy.
|
* its state in the hierarchy.
|
||||||
*
|
*
|
||||||
* @return {@code true} if this subtree is finished waiting for sync participants.
|
* @return {@code true} if this subtree is finished waiting for sync participants.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2587,12 +2587,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
&& win.mSyncSeqId > lastSyncSeqId) {
|
&& win.mSyncSeqId > lastSyncSeqId) {
|
||||||
maybeSyncSeqId = win.shouldSyncWithBuffers() ? win.mSyncSeqId : -1;
|
maybeSyncSeqId = win.shouldSyncWithBuffers() ? win.mSyncSeqId : -1;
|
||||||
win.markRedrawForSyncReported();
|
win.markRedrawForSyncReported();
|
||||||
if (win.mSyncState == WindowContainer.SYNC_STATE_WAITING_FOR_DRAW
|
|
||||||
&& winAnimator.mDrawState == WindowStateAnimator.HAS_DRAWN
|
|
||||||
&& maybeSyncSeqId < 0) {
|
|
||||||
// Do not wait for a drawn window which won't report draw.
|
|
||||||
win.onSyncFinishedDrawing();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
maybeSyncSeqId = -1;
|
maybeSyncSeqId = -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6004,12 +6004,16 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean isSyncFinished() {
|
boolean isSyncFinished() {
|
||||||
if (mSyncState == SYNC_STATE_WAITING_FOR_DRAW && mViewVisibility != View.VISIBLE
|
if (!isVisibleRequested()) {
|
||||||
&& !isVisibleRequested()) {
|
|
||||||
// Don't wait for invisible windows. However, we don't alter the state in case the
|
// Don't wait for invisible windows. However, we don't alter the state in case the
|
||||||
// window becomes visible while the sync group is still active.
|
// window becomes visible while the sync group is still active.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (mSyncState == SYNC_STATE_WAITING_FOR_DRAW && mWinAnimator.mDrawState == HAS_DRAWN
|
||||||
|
&& !mRedrawForSyncReported && !mWmService.mResizingWindows.contains(this)) {
|
||||||
|
// Complete the sync state immediately for a drawn window that doesn't need to redraw.
|
||||||
|
onSyncFinishedDrawing();
|
||||||
|
}
|
||||||
return super.isSyncFinished();
|
return super.isSyncFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6060,6 +6064,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
final boolean hasSyncHandlers = executeDrawHandlers(postDrawTransaction, syncSeqId);
|
final boolean hasSyncHandlers = executeDrawHandlers(postDrawTransaction, syncSeqId);
|
||||||
|
|
||||||
boolean skipLayout = false;
|
boolean skipLayout = false;
|
||||||
|
boolean layoutNeeded = false;
|
||||||
// Control the timing to switch the appearance of window with different rotations.
|
// Control the timing to switch the appearance of window with different rotations.
|
||||||
final AsyncRotationController asyncRotationController =
|
final AsyncRotationController asyncRotationController =
|
||||||
mDisplayContent.getAsyncRotationController();
|
mDisplayContent.getAsyncRotationController();
|
||||||
@@ -6072,7 +6077,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
} else if (syncActive) {
|
} else if (syncActive) {
|
||||||
// Currently in a Sync that is using BLAST.
|
// Currently in a Sync that is using BLAST.
|
||||||
if (!syncStillPending) {
|
if (!syncStillPending) {
|
||||||
onSyncFinishedDrawing();
|
layoutNeeded = onSyncFinishedDrawing();
|
||||||
}
|
}
|
||||||
if (postDrawTransaction != null) {
|
if (postDrawTransaction != null) {
|
||||||
mSyncTransaction.merge(postDrawTransaction);
|
mSyncTransaction.merge(postDrawTransaction);
|
||||||
@@ -6081,10 +6086,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
}
|
}
|
||||||
} else if (useBLASTSync()) {
|
} else if (useBLASTSync()) {
|
||||||
// Sync that is not using BLAST
|
// Sync that is not using BLAST
|
||||||
onSyncFinishedDrawing();
|
layoutNeeded = onSyncFinishedDrawing();
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean layoutNeeded =
|
layoutNeeded |=
|
||||||
mWinAnimator.finishDrawingLocked(postDrawTransaction, mClientWasDrawingForSync);
|
mWinAnimator.finishDrawingLocked(postDrawTransaction, mClientWasDrawingForSync);
|
||||||
mClientWasDrawingForSync = false;
|
mClientWasDrawingForSync = false;
|
||||||
// We always want to force a traversal after a finish draw for blast sync.
|
// We always want to force a traversal after a finish draw for blast sync.
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import static com.android.server.wm.WindowState.BLAST_TIMEOUT_DURATION;
|
|||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
@@ -108,9 +109,7 @@ public class SyncEngineTests extends WindowTestsBase {
|
|||||||
bse.onSurfacePlacement();
|
bse.onSurfacePlacement();
|
||||||
verify(listener, times(0)).onTransactionReady(anyInt(), any());
|
verify(listener, times(0)).onTransactionReady(anyInt(), any());
|
||||||
|
|
||||||
mockWC.onSyncFinishedDrawing();
|
assertTrue(mockWC.onSyncFinishedDrawing());
|
||||||
// Make sure the second traversal is requested.
|
|
||||||
verify(mWm.mWindowPlacerLocked, times(2)).requestTraversal();
|
|
||||||
bse.onSurfacePlacement();
|
bse.onSurfacePlacement();
|
||||||
verify(listener, times(1)).onTransactionReady(eq(id), notNull());
|
verify(listener, times(1)).onTransactionReady(eq(id), notNull());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1240,7 +1240,8 @@ public class WindowOrganizerTests extends WindowTestsBase {
|
|||||||
assertTrue(w1.useBLASTSync());
|
assertTrue(w1.useBLASTSync());
|
||||||
assertTrue(w2.useBLASTSync());
|
assertTrue(w2.useBLASTSync());
|
||||||
|
|
||||||
w1.immediatelyNotifyBlastSync();
|
// A drawn window can complete the sync state automatically.
|
||||||
|
w1.mWinAnimator.mDrawState = WindowStateAnimator.HAS_DRAWN;
|
||||||
mWm.mSyncEngine.onSurfacePlacement();
|
mWm.mSyncEngine.onSurfacePlacement();
|
||||||
verify(mockCallback).onTransactionReady(anyInt(), any());
|
verify(mockCallback).onTransactionReady(anyInt(), any());
|
||||||
assertFalse(w1.useBLASTSync());
|
assertFalse(w1.useBLASTSync());
|
||||||
|
|||||||
Reference in New Issue
Block a user