Merge "Fix SurfaceView callback timings" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-04-23 03:47:30 +00:00
committed by Android (Google) Code Review

View File

@@ -2854,7 +2854,6 @@ public final class ViewRootImpl implements ViewParent,
return;
}
}
notifySurfaceCreated();
} else if (surfaceDestroyed) {
// If the surface has been removed, then reset the scroll
// positions.
@@ -2894,10 +2893,6 @@ public final class ViewRootImpl implements ViewParent,
}
}
if (!surfaceCreated && surfaceReplaced) {
notifySurfaceReplaced();
}
if (mDragResizing != dragResizing) {
if (dragResizing) {
mResizeMode = freeformResizing
@@ -3110,7 +3105,14 @@ public final class ViewRootImpl implements ViewParent,
}
}
if (surfaceDestroyed) {
// These callbacks will trigger SurfaceView SurfaceHolder.Callbacks and must be invoked
// after the measure pass. If its invoked before the measure pass and the app modifies
// the view hierarchy in the callbacks, we could leave the views in a broken state.
if (surfaceCreated) {
notifySurfaceCreated();
} else if (surfaceReplaced) {
notifySurfaceReplaced();
} else if (surfaceDestroyed) {
notifySurfaceDestroyed();
}