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) mBoundsLayer = new SurfaceControl.Builder(mSurfaceSession)
.setContainerLayer() .setContainerLayer()
.setName("Bounds for - " + getTitle().toString()) .setName("Bounds for - " + getTitle().toString())
.setParent(mSurfaceControl) .setParent(getRenderSurfaceControl())
.build(); .build();
setBoundsLayerCrop(); setBoundsLayerCrop();
mTransaction.show(mBoundsLayer).apply(); 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 // 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 // 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. // 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(mWin.getSurfaceControl(), barrier, frameNumber);
t.deferTransactionUntil(leash, barrier, frameNumber); t.deferTransactionUntil(leash, barrier, frameNumber);
} }

View File

@@ -118,9 +118,9 @@ public class SeamlessRotator {
finish(t, win); finish(t, win);
if (win.mWinAnimator.mSurfaceController != null && !timeout) { if (win.mWinAnimator.mSurfaceController != null && !timeout) {
t.deferTransactionUntil(win.mSurfaceControl, t.deferTransactionUntil(win.mSurfaceControl,
win.getDeferTransactionBarrier(), win.getFrameNumber()); win.getClientViewRootSurface(), win.getFrameNumber());
t.deferTransactionUntil(win.mWinAnimator.mSurfaceController.mSurfaceControl, 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(); return mSession.mPid == pid && isNonToastOrStarting() && isVisibleNow();
} }
SurfaceControl getDeferTransactionBarrier() { SurfaceControl getClientViewRootSurface() {
return mWinAnimator.getDeferTransactionBarrier(); return mWinAnimator.getClientViewRootSurface();
} }
@Override @Override

View File

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

View File

@@ -533,7 +533,15 @@ class WindowSurfaceController {
return mSurfaceH; 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) { if (mBLASTSurfaceControl != null) {
return mBLASTSurfaceControl; return mBLASTSurfaceControl;
} }