Merge "Call finishDrawing and notify when Window is removed or hidden" into rvc-dev am: cae0a5b56a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11971839 Change-Id: Ib39f7b565471aa648c91fd7bdcf3438369a95d69
This commit is contained in:
@@ -5142,8 +5142,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
}
|
}
|
||||||
case WINDOW_STATE_BLAST_SYNC_TIMEOUT: {
|
case WINDOW_STATE_BLAST_SYNC_TIMEOUT: {
|
||||||
synchronized (mGlobalLock) {
|
synchronized (mGlobalLock) {
|
||||||
final WindowState ws = (WindowState) msg.obj;
|
final WindowState ws = (WindowState) msg.obj;
|
||||||
ws.finishDrawing(null);
|
ws.immediatelyNotifyBlastSync();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -428,6 +428,9 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
|
|||||||
try {
|
try {
|
||||||
callback.onTransactionReady(mSyncId, mergedTransaction);
|
callback.onTransactionReady(mSyncId, mergedTransaction);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
// If there's an exception when trying to send the mergedTransaction to the client, we
|
||||||
|
// should immediately apply it here so the transactions aren't lost.
|
||||||
|
mergedTransaction.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
mTransactionCallbacksByPendingSyncId.remove(mSyncId);
|
mTransactionCallbacksByPendingSyncId.remove(mSyncId);
|
||||||
|
|||||||
@@ -2192,7 +2192,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
void removeIfPossible() {
|
void removeIfPossible() {
|
||||||
super.removeIfPossible();
|
super.removeIfPossible();
|
||||||
removeIfPossible(false /*keepVisibleDeadWindow*/);
|
removeIfPossible(false /*keepVisibleDeadWindow*/);
|
||||||
finishDrawing(null);
|
immediatelyNotifyBlastSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeIfPossible(boolean keepVisibleDeadWindow) {
|
private void removeIfPossible(boolean keepVisibleDeadWindow) {
|
||||||
@@ -5806,7 +5806,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
// client will not render when visibility is GONE. Therefore, call finishDrawing here to
|
// client will not render when visibility is GONE. Therefore, call finishDrawing here to
|
||||||
// prevent system server from blocking on a window that will not draw.
|
// prevent system server from blocking on a window that will not draw.
|
||||||
if (viewVisibility == View.GONE && mUsingBLASTSyncTransaction) {
|
if (viewVisibility == View.GONE && mUsingBLASTSyncTransaction) {
|
||||||
finishDrawing(null);
|
immediatelyNotifyBlastSync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5844,7 +5844,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
return mWinAnimator.finishDrawingLocked(postDrawTransaction);
|
return mWinAnimator.finishDrawingLocked(postDrawTransaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
mWmService.mH.removeMessages(WINDOW_STATE_BLAST_SYNC_TIMEOUT, this);
|
|
||||||
if (postDrawTransaction != null) {
|
if (postDrawTransaction != null) {
|
||||||
mBLASTSyncTransaction.merge(postDrawTransaction);
|
mBLASTSyncTransaction.merge(postDrawTransaction);
|
||||||
}
|
}
|
||||||
@@ -5853,8 +5852,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
return mWinAnimator.finishDrawingLocked(null);
|
return mWinAnimator.finishDrawingLocked(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
private void notifyBlastSyncTransaction() {
|
||||||
void notifyBlastSyncTransaction() {
|
mWmService.mH.removeMessages(WINDOW_STATE_BLAST_SYNC_TIMEOUT, this);
|
||||||
|
|
||||||
if (!mNotifyBlastOnSurfacePlacement || mWaitingListener == null) {
|
if (!mNotifyBlastOnSurfacePlacement || mWaitingListener == null) {
|
||||||
mNotifyBlastOnSurfacePlacement = false;
|
mNotifyBlastOnSurfacePlacement = false;
|
||||||
return;
|
return;
|
||||||
@@ -5877,6 +5877,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
mNotifyBlastOnSurfacePlacement = false;
|
mNotifyBlastOnSurfacePlacement = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void immediatelyNotifyBlastSync() {
|
||||||
|
finishDrawing(null);
|
||||||
|
notifyBlastSyncTransaction();
|
||||||
|
}
|
||||||
|
|
||||||
private boolean requestResizeForBlastSync() {
|
private boolean requestResizeForBlastSync() {
|
||||||
return useBLASTSync() && !mResizeForBlastSyncReported;
|
return useBLASTSync() && !mResizeForBlastSyncReported;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -729,7 +729,7 @@ public class WindowOrganizerTests extends WindowTestsBase {
|
|||||||
// We should be rejected from the second sync since we are already
|
// We should be rejected from the second sync since we are already
|
||||||
// in one.
|
// in one.
|
||||||
assertEquals(false, bse.addToSyncSet(id2, task));
|
assertEquals(false, bse.addToSyncSet(id2, task));
|
||||||
finishAndNotifyDrawing(w);
|
w.immediatelyNotifyBlastSync();
|
||||||
assertEquals(true, bse.addToSyncSet(id2, task));
|
assertEquals(true, bse.addToSyncSet(id2, task));
|
||||||
bse.setReady(id2);
|
bse.setReady(id2);
|
||||||
}
|
}
|
||||||
@@ -753,7 +753,7 @@ public class WindowOrganizerTests extends WindowTestsBase {
|
|||||||
// Since we have a window we have to wait for it to draw to finish sync.
|
// Since we have a window we have to wait for it to draw to finish sync.
|
||||||
verify(transactionListener, never())
|
verify(transactionListener, never())
|
||||||
.onTransactionReady(anyInt(), any());
|
.onTransactionReady(anyInt(), any());
|
||||||
finishAndNotifyDrawing(w);
|
w.immediatelyNotifyBlastSync();
|
||||||
verify(transactionListener)
|
verify(transactionListener)
|
||||||
.onTransactionReady(anyInt(), any());
|
.onTransactionReady(anyInt(), any());
|
||||||
}
|
}
|
||||||
@@ -821,14 +821,14 @@ public class WindowOrganizerTests extends WindowTestsBase {
|
|||||||
int id = bse.startSyncSet(transactionListener);
|
int id = bse.startSyncSet(transactionListener);
|
||||||
assertEquals(true, bse.addToSyncSet(id, task));
|
assertEquals(true, bse.addToSyncSet(id, task));
|
||||||
bse.setReady(id);
|
bse.setReady(id);
|
||||||
finishAndNotifyDrawing(w);
|
w.immediatelyNotifyBlastSync();
|
||||||
|
|
||||||
// Since we have a child window we still shouldn't be done.
|
// Since we have a child window we still shouldn't be done.
|
||||||
verify(transactionListener, never())
|
verify(transactionListener, never())
|
||||||
.onTransactionReady(anyInt(), any());
|
.onTransactionReady(anyInt(), any());
|
||||||
reset(transactionListener);
|
reset(transactionListener);
|
||||||
|
|
||||||
finishAndNotifyDrawing(child);
|
child.immediatelyNotifyBlastSync();
|
||||||
// Ah finally! Done
|
// Ah finally! Done
|
||||||
verify(transactionListener)
|
verify(transactionListener)
|
||||||
.onTransactionReady(anyInt(), any());
|
.onTransactionReady(anyInt(), any());
|
||||||
@@ -1002,20 +1002,15 @@ public class WindowOrganizerTests extends WindowTestsBase {
|
|||||||
verify(mockCallback, never()).onTransactionReady(anyInt(), any());
|
verify(mockCallback, never()).onTransactionReady(anyInt(), any());
|
||||||
assertTrue(w1.useBLASTSync());
|
assertTrue(w1.useBLASTSync());
|
||||||
assertTrue(w2.useBLASTSync());
|
assertTrue(w2.useBLASTSync());
|
||||||
finishAndNotifyDrawing(w1);
|
w1.immediatelyNotifyBlastSync();
|
||||||
|
|
||||||
// Even though one Window finished drawing, both windows should still be using blast sync
|
// Even though one Window finished drawing, both windows should still be using blast sync
|
||||||
assertTrue(w1.useBLASTSync());
|
assertTrue(w1.useBLASTSync());
|
||||||
assertTrue(w2.useBLASTSync());
|
assertTrue(w2.useBLASTSync());
|
||||||
|
|
||||||
finishAndNotifyDrawing(w2);
|
w2.immediatelyNotifyBlastSync();
|
||||||
verify(mockCallback).onTransactionReady(anyInt(), any());
|
verify(mockCallback).onTransactionReady(anyInt(), any());
|
||||||
assertFalse(w1.useBLASTSync());
|
assertFalse(w1.useBLASTSync());
|
||||||
assertFalse(w2.useBLASTSync());
|
assertFalse(w2.useBLASTSync());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void finishAndNotifyDrawing(WindowState ws) {
|
|
||||||
ws.finishDrawing(null);
|
|
||||||
ws.notifyBlastSyncTransaction();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user