Merge "WindowManager: Avoid reparenting BLAST Surface in reparentChildren" into rvc-dev am: c2adc8d64c

Change-Id: If9afd1120c343459ecb77adda769eb8969c603c7
This commit is contained in:
Automerger Merge Worker
2020-03-09 22:00:57 +00:00
6 changed files with 29 additions and 19 deletions

View File

@@ -1735,7 +1735,7 @@ public final class ViewRootImpl implements ViewParent,
mBoundsLayer = new SurfaceControl.Builder(mSurfaceSession)
.setContainerLayer()
.setName("Bounds for - " + getTitle().toString())
.setParent(mSurfaceControl)
.setParent(getRenderSurfaceControl())
.build();
setBoundsLayerCrop();
mTransaction.show(mBoundsLayer).apply();

View File

@@ -274,7 +274,7 @@ class InsetsSourceProvider {
// window crop of the surface controls (including the leash) until the client finishes
// drawing the new frame of the new orientation. Although we cannot defer the reparent
// operation, it is fine, because reparent won't cause any visual effect.
final SurfaceControl barrier = mWin.getDeferTransactionBarrier();
final SurfaceControl barrier = mWin.getClientViewRootSurface();
t.deferTransactionUntil(mWin.getSurfaceControl(), barrier, frameNumber);
t.deferTransactionUntil(leash, barrier, frameNumber);
}

View File

@@ -118,9 +118,9 @@ public class SeamlessRotator {
finish(t, win);
if (win.mWinAnimator.mSurfaceController != null && !timeout) {
t.deferTransactionUntil(win.mSurfaceControl,
win.getDeferTransactionBarrier(), win.getFrameNumber());
win.getClientViewRootSurface(), win.getFrameNumber());
t.deferTransactionUntil(win.mWinAnimator.mSurfaceController.mSurfaceControl,
win.getDeferTransactionBarrier(), win.getFrameNumber());
win.getClientViewRootSurface(), win.getFrameNumber());
}
}

View File

@@ -5660,8 +5660,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
return mSession.mPid == pid && isNonToastOrStarting() && isVisibleNow();
}
SurfaceControl getDeferTransactionBarrier() {
return mWinAnimator.getDeferTransactionBarrier();
SurfaceControl getClientViewRootSurface() {
return mWinAnimator.getClientViewRootSurface();
}
@Override

View File

@@ -383,8 +383,9 @@ class WindowStateAnimator {
// Make sure to reparent any children of the new surface back to the preserved
// surface before destroying it.
if (mSurfaceController != null && mPendingDestroySurface != null) {
mPostDrawTransaction.reparentChildren(mSurfaceController.mSurfaceControl,
mPendingDestroySurface.mSurfaceControl).apply();
mPostDrawTransaction.reparentChildren(
mSurfaceController.getClientViewRootSurface(),
mPendingDestroySurface.mSurfaceControl).apply();
}
destroySurfaceLocked();
mSurfaceDestroyDeferred = true;
@@ -413,9 +414,9 @@ class WindowStateAnimator {
// child layers need to be reparented to the new surface to make this
// transparent to the app.
if (mWin.mActivityRecord == null || mWin.mActivityRecord.isRelaunching() == false) {
mPostDrawTransaction.reparentChildren(mPendingDestroySurface.mSurfaceControl,
mSurfaceController.mSurfaceControl)
.apply();
mPostDrawTransaction.reparentChildren(
mPendingDestroySurface.getClientViewRootSurface(),
mSurfaceController.mSurfaceControl).apply();
}
}
}
@@ -875,7 +876,7 @@ class WindowStateAnimator {
if (mSurfaceResized && (mAttrType == TYPE_BASE_APPLICATION) &&
(task != null) && (task.getMainWindowSizeChangeTransaction() != null)) {
mSurfaceController.deferTransactionUntil(mWin.getDeferTransactionBarrier(),
mSurfaceController.deferTransactionUntil(mWin.getClientViewRootSurface(),
mWin.getFrameNumber());
SurfaceControl.mergeToGlobalTransaction(task.getMainWindowSizeChangeTransaction());
task.setMainWindowSizeChangeTransaction(null);
@@ -1012,7 +1013,7 @@ class WindowStateAnimator {
// the WS position is reset (so the stack position is shown) at the same
// time that the buffer size changes.
setOffsetPositionForStackResize(false);
mSurfaceController.deferTransactionUntil(mWin.getDeferTransactionBarrier(),
mSurfaceController.deferTransactionUntil(mWin.getClientViewRootSurface(),
mWin.getFrameNumber());
} else {
final ActivityStack stack = mWin.getRootTask();
@@ -1043,7 +1044,7 @@ class WindowStateAnimator {
// comes in at the new size (normally position and crop are unfrozen).
// deferTransactionUntil accomplishes this for us.
if (wasForceScaled && !mForceScaleUntilResize) {
mSurfaceController.deferTransactionUntil(mWin.getDeferTransactionBarrier(),
mSurfaceController.deferTransactionUntil(mWin.getClientViewRootSurface(),
mWin.getFrameNumber());
mSurfaceController.forceScaleableInTransaction(false);
}
@@ -1288,8 +1289,9 @@ class WindowStateAnimator {
if (mPendingDestroySurface != null && mDestroyPreservedSurfaceUponRedraw) {
final SurfaceControl pendingSurfaceControl = mPendingDestroySurface.mSurfaceControl;
mPostDrawTransaction.reparent(pendingSurfaceControl, null);
mPostDrawTransaction.reparentChildren(pendingSurfaceControl,
mSurfaceController.mSurfaceControl);
mPostDrawTransaction.reparentChildren(
mPendingDestroySurface.getClientViewRootSurface(),
mSurfaceController.mSurfaceControl);
}
SurfaceControl.mergeToGlobalTransaction(mPostDrawTransaction);
@@ -1521,10 +1523,10 @@ class WindowStateAnimator {
mOffsetPositionForStackResize = offsetPositionForStackResize;
}
SurfaceControl getDeferTransactionBarrier() {
SurfaceControl getClientViewRootSurface() {
if (!hasSurface()) {
return null;
}
return mSurfaceController.getDeferTransactionBarrier();
return mSurfaceController.getClientViewRootSurface();
}
}

View File

@@ -533,7 +533,15 @@ class WindowSurfaceController {
return mSurfaceH;
}
SurfaceControl getDeferTransactionBarrier() {
/**
* Returns the Surface which the client-framework ViewRootImpl will be using.
* This is either the WSA SurfaceControl or it's BLAST child surface.
* This has too main uses:
* 1. This is the Surface the client will add children to, we use this to make
* sure we don't reparent the BLAST surface itself when calling reparentChildren
* 2. We use this as the barrier Surface for some deferTransaction operations.
*/
SurfaceControl getClientViewRootSurface() {
if (mBLASTSurfaceControl != null) {
return mBLASTSurfaceControl;
}