Merge "Ensure detached children aren't parented to new SurfaceControl" into rvc-dev am: ac3ce5c425
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11817537 Change-Id: I271edcea4601cfee5bc507b250d6e7519acebf77
This commit is contained in:
@@ -247,10 +247,6 @@ class WindowStateAnimator {
|
|||||||
private final SurfaceControl.Transaction mPostDrawTransaction =
|
private final SurfaceControl.Transaction mPostDrawTransaction =
|
||||||
new SurfaceControl.Transaction();
|
new SurfaceControl.Transaction();
|
||||||
|
|
||||||
// Used to track whether we have called detach children on the way to invisibility, in which
|
|
||||||
// case we need to give the client a new Surface if it lays back out to a visible state.
|
|
||||||
boolean mChildrenDetached = false;
|
|
||||||
|
|
||||||
// Set to true after the first frame of the Pinned stack animation
|
// Set to true after the first frame of the Pinned stack animation
|
||||||
// and reset after the last to ensure we only reset mForceScaleUntilResize
|
// and reset after the last to ensure we only reset mForceScaleUntilResize
|
||||||
// once per animation.
|
// once per animation.
|
||||||
@@ -425,7 +421,8 @@ class WindowStateAnimator {
|
|||||||
// transparent to the app.
|
// transparent to the app.
|
||||||
// If the children are detached, we don't want to reparent them to the new surface.
|
// If the children are detached, we don't want to reparent them to the new surface.
|
||||||
// Instead let the children get removed when the old surface is deleted.
|
// Instead let the children get removed when the old surface is deleted.
|
||||||
if (mSurfaceController != null && mPendingDestroySurface != null && !mChildrenDetached
|
if (mSurfaceController != null && mPendingDestroySurface != null
|
||||||
|
&& !mPendingDestroySurface.mChildrenDetached
|
||||||
&& (mWin.mActivityRecord == null || !mWin.mActivityRecord.isRelaunching())) {
|
&& (mWin.mActivityRecord == null || !mWin.mActivityRecord.isRelaunching())) {
|
||||||
mPostDrawTransaction.reparentChildren(
|
mPostDrawTransaction.reparentChildren(
|
||||||
mPendingDestroySurface.getClientViewRootSurface(),
|
mPendingDestroySurface.getClientViewRootSurface(),
|
||||||
@@ -461,7 +458,6 @@ class WindowStateAnimator {
|
|||||||
if (mSurfaceController != null) {
|
if (mSurfaceController != null) {
|
||||||
return mSurfaceController;
|
return mSurfaceController;
|
||||||
}
|
}
|
||||||
mChildrenDetached = false;
|
|
||||||
|
|
||||||
if ((mWin.mAttrs.privateFlags & PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY) != 0) {
|
if ((mWin.mAttrs.privateFlags & PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY) != 0) {
|
||||||
windowType = SurfaceControl.WINDOW_TYPE_DONT_SCREENSHOT;
|
windowType = SurfaceControl.WINDOW_TYPE_DONT_SCREENSHOT;
|
||||||
@@ -1365,7 +1361,7 @@ class WindowStateAnimator {
|
|||||||
mPostDrawTransaction.reparent(pendingSurfaceControl, null);
|
mPostDrawTransaction.reparent(pendingSurfaceControl, null);
|
||||||
// If the children are detached, we don't want to reparent them to the new surface.
|
// If the children are detached, we don't want to reparent them to the new surface.
|
||||||
// Instead let the children get removed when the old surface is deleted.
|
// Instead let the children get removed when the old surface is deleted.
|
||||||
if (!mChildrenDetached) {
|
if (!mPendingDestroySurface.mChildrenDetached) {
|
||||||
mPostDrawTransaction.reparentChildren(
|
mPostDrawTransaction.reparentChildren(
|
||||||
mPendingDestroySurface.getClientViewRootSurface(),
|
mPendingDestroySurface.getClientViewRootSurface(),
|
||||||
mSurfaceController.mSurfaceControl);
|
mSurfaceController.mSurfaceControl);
|
||||||
@@ -1596,7 +1592,6 @@ class WindowStateAnimator {
|
|||||||
if (mSurfaceController != null) {
|
if (mSurfaceController != null) {
|
||||||
mSurfaceController.detachChildren();
|
mSurfaceController.detachChildren();
|
||||||
}
|
}
|
||||||
mChildrenDetached = true;
|
|
||||||
// If the children are detached, it means the app is exiting. We don't want to tear the
|
// If the children are detached, it means the app is exiting. We don't want to tear the
|
||||||
// content down too early, otherwise we could end up with a flicker. By preserving the
|
// content down too early, otherwise we could end up with a flicker. By preserving the
|
||||||
// current surface, we ensure the content remains on screen until the window is completely
|
// current surface, we ensure the content remains on screen until the window is completely
|
||||||
|
|||||||
@@ -90,6 +90,9 @@ class WindowSurfaceController {
|
|||||||
|
|
||||||
private final SurfaceControl.Transaction mTmpTransaction;
|
private final SurfaceControl.Transaction mTmpTransaction;
|
||||||
|
|
||||||
|
// Used to track whether we have called detach children on the way to invisibility.
|
||||||
|
boolean mChildrenDetached;
|
||||||
|
|
||||||
WindowSurfaceController(String name, int w, int h, int format,
|
WindowSurfaceController(String name, int w, int h, int format,
|
||||||
int flags, WindowStateAnimator animator, int windowType, int ownerUid) {
|
int flags, WindowStateAnimator animator, int windowType, int ownerUid) {
|
||||||
mAnimator = animator;
|
mAnimator = animator;
|
||||||
@@ -144,6 +147,7 @@ class WindowSurfaceController {
|
|||||||
|
|
||||||
void detachChildren() {
|
void detachChildren() {
|
||||||
ProtoLog.i(WM_SHOW_TRANSACTIONS, "SEVER CHILDREN");
|
ProtoLog.i(WM_SHOW_TRANSACTIONS, "SEVER CHILDREN");
|
||||||
|
mChildrenDetached = true;
|
||||||
if (mSurfaceControl != null) {
|
if (mSurfaceControl != null) {
|
||||||
mSurfaceControl.detachChildren();
|
mSurfaceControl.detachChildren();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user