Clear mSyncGroups when VRI does a performTraversal
When VRI is ready to start drawing, we need to sync any SV syncs that have started, but not completed yet. However, it's possible a second VRI can start drawing before the SV completes which would include those original SV syncs in the second VRI frame. This isn't the expected behavior since each SV sync is intended for a single VRI frame. Therefore, clear the saved SV syncGroups once VRI is expected to start drawing. Test: async SV with resize due to insets no longer ANRs. Bug: 263340543 Change-Id: Ib37505cd494ced68a7d9db291fe42d786d900a8a
This commit is contained in:
@@ -1122,14 +1122,15 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
|
||||
* @hide
|
||||
*/
|
||||
@Override
|
||||
public void surfaceSyncStarted() {
|
||||
public void vriDrawStarted(boolean isWmSync) {
|
||||
ViewRootImpl viewRoot = getViewRootImpl();
|
||||
if (viewRoot != null) {
|
||||
synchronized (mSyncGroups) {
|
||||
synchronized (mSyncGroups) {
|
||||
if (isWmSync && viewRoot != null) {
|
||||
for (SurfaceSyncGroup syncGroup : mSyncGroups) {
|
||||
viewRoot.addToSync(syncGroup);
|
||||
}
|
||||
}
|
||||
mSyncGroups.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2115,7 +2115,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
void surfaceCreated(Transaction t);
|
||||
void surfaceReplaced(Transaction t);
|
||||
void surfaceDestroyed();
|
||||
default void surfaceSyncStarted() {};
|
||||
default void vriDrawStarted(boolean isWmSync) {};
|
||||
}
|
||||
|
||||
private final ArrayList<SurfaceChangedCallback> mSurfaceChangedCallbacks = new ArrayList<>();
|
||||
@@ -2150,9 +2150,9 @@ public final class ViewRootImpl implements ViewParent,
|
||||
}
|
||||
}
|
||||
|
||||
private void notifySurfaceSyncStarted() {
|
||||
private void notifyDrawStarted(boolean isWmSync) {
|
||||
for (int i = 0; i < mSurfaceChangedCallbacks.size(); i++) {
|
||||
mSurfaceChangedCallbacks.get(i).surfaceSyncStarted();
|
||||
mSurfaceChangedCallbacks.get(i).vriDrawStarted(isWmSync);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3664,6 +3664,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
}
|
||||
|
||||
createSyncIfNeeded();
|
||||
notifyDrawStarted(isInWMSRequestedSync());
|
||||
mDrewOnceForSync = true;
|
||||
}
|
||||
|
||||
@@ -3737,7 +3738,6 @@ public final class ViewRootImpl implements ViewParent,
|
||||
|
||||
mWmsRequestSyncGroup.addToSync(this);
|
||||
Trace.traceEnd(Trace.TRACE_TAG_VIEW);
|
||||
notifySurfaceSyncStarted();
|
||||
}
|
||||
|
||||
private void notifyContentCatpureEvents() {
|
||||
|
||||
Reference in New Issue
Block a user