Merge "Fix a bug about the z-order of layers caused by merging transactions" into qt-dev
This commit is contained in:
@@ -2660,6 +2660,9 @@ public final class SurfaceControl implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
@NonNull
|
@NonNull
|
||||||
public Transaction merge(@NonNull Transaction other) {
|
public Transaction merge(@NonNull Transaction other) {
|
||||||
|
if (this == other) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
mResizedSurfaces.putAll(other.mResizedSurfaces);
|
mResizedSurfaces.putAll(other.mResizedSurfaces);
|
||||||
other.mResizedSurfaces.clear();
|
other.mResizedSurfaces.clear();
|
||||||
nativeMergeTransaction(mNativeObject, other.mNativeObject);
|
nativeMergeTransaction(mNativeObject, other.mNativeObject);
|
||||||
|
|||||||
@@ -2005,7 +2005,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
|
|||||||
}
|
}
|
||||||
layoutLetterbox(winHint);
|
layoutLetterbox(winHint);
|
||||||
if (mLetterbox != null && mLetterbox.needsApplySurfaceChanges()) {
|
if (mLetterbox != null && mLetterbox.needsApplySurfaceChanges()) {
|
||||||
mLetterbox.applySurfaceChanges(mPendingTransaction);
|
mLetterbox.applySurfaceChanges(getPendingTransaction());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3059,13 +3059,13 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
|
|||||||
|
|
||||||
if (mSurfaceControl != null) {
|
if (mSurfaceControl != null) {
|
||||||
if (show && !mLastSurfaceShowing) {
|
if (show && !mLastSurfaceShowing) {
|
||||||
mPendingTransaction.show(mSurfaceControl);
|
getPendingTransaction().show(mSurfaceControl);
|
||||||
} else if (!show && mLastSurfaceShowing) {
|
} else if (!show && mLastSurfaceShowing) {
|
||||||
mPendingTransaction.hide(mSurfaceControl);
|
getPendingTransaction().hide(mSurfaceControl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mThumbnail != null) {
|
if (mThumbnail != null) {
|
||||||
mThumbnail.setShowing(mPendingTransaction, show);
|
mThumbnail.setShowing(getPendingTransaction(), show);
|
||||||
}
|
}
|
||||||
mLastSurfaceShowing = show;
|
mLastSurfaceShowing = show;
|
||||||
super.prepareSurfaces();
|
super.prepareSurfaces();
|
||||||
@@ -3225,8 +3225,8 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
|
|||||||
|
|
||||||
private void updateColorTransform() {
|
private void updateColorTransform() {
|
||||||
if (mSurfaceControl != null && mLastAppSaturationInfo != null) {
|
if (mSurfaceControl != null && mLastAppSaturationInfo != null) {
|
||||||
mPendingTransaction.setColorTransform(mSurfaceControl, mLastAppSaturationInfo.mMatrix,
|
getPendingTransaction().setColorTransform(mSurfaceControl,
|
||||||
mLastAppSaturationInfo.mTranslation);
|
mLastAppSaturationInfo.mMatrix, mLastAppSaturationInfo.mTranslation);
|
||||||
mWmService.scheduleAnimationLocked();
|
mWmService.scheduleAnimationLocked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3340,7 +3340,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
|||||||
final SurfaceControl newParent =
|
final SurfaceControl newParent =
|
||||||
shouldAttachToDisplay ? mWindowingLayer : computeImeParent();
|
shouldAttachToDisplay ? mWindowingLayer : computeImeParent();
|
||||||
if (newParent != null) {
|
if (newParent != null) {
|
||||||
mPendingTransaction.reparent(mImeWindowsContainers.mSurfaceControl, newParent);
|
getPendingTransaction().reparent(mImeWindowsContainers.mSurfaceControl, newParent);
|
||||||
scheduleAnimation();
|
scheduleAnimation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3747,7 +3747,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
|||||||
mPortalWindowHandle.touchableRegion.getBounds(mTmpRect);
|
mPortalWindowHandle.touchableRegion.getBounds(mTmpRect);
|
||||||
if (!mTmpBounds.equals(mTmpRect)) {
|
if (!mTmpBounds.equals(mTmpRect)) {
|
||||||
mPortalWindowHandle.touchableRegion.set(mTmpBounds);
|
mPortalWindowHandle.touchableRegion.set(mTmpBounds);
|
||||||
mPendingTransaction.setInputWindowInfo(mParentSurfaceControl, mPortalWindowHandle);
|
getPendingTransaction().setInputWindowInfo(
|
||||||
|
mParentSurfaceControl, mPortalWindowHandle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4846,18 +4847,23 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
|||||||
try {
|
try {
|
||||||
final ScreenRotationAnimation screenRotationAnimation =
|
final ScreenRotationAnimation screenRotationAnimation =
|
||||||
mWmService.mAnimator.getScreenRotationAnimationLocked(mDisplayId);
|
mWmService.mAnimator.getScreenRotationAnimationLocked(mDisplayId);
|
||||||
|
final Transaction transaction = getPendingTransaction();
|
||||||
if (screenRotationAnimation != null && screenRotationAnimation.isAnimating()) {
|
if (screenRotationAnimation != null && screenRotationAnimation.isAnimating()) {
|
||||||
screenRotationAnimation.getEnterTransformation().getMatrix().getValues(mTmpFloats);
|
screenRotationAnimation.getEnterTransformation().getMatrix().getValues(mTmpFloats);
|
||||||
mPendingTransaction.setMatrix(mWindowingLayer,
|
transaction.setMatrix(mWindowingLayer,
|
||||||
mTmpFloats[Matrix.MSCALE_X], mTmpFloats[Matrix.MSKEW_Y],
|
mTmpFloats[Matrix.MSCALE_X], mTmpFloats[Matrix.MSKEW_Y],
|
||||||
mTmpFloats[Matrix.MSKEW_X], mTmpFloats[Matrix.MSCALE_Y]);
|
mTmpFloats[Matrix.MSKEW_X], mTmpFloats[Matrix.MSCALE_Y]);
|
||||||
mPendingTransaction.setPosition(mWindowingLayer,
|
transaction.setPosition(mWindowingLayer,
|
||||||
mTmpFloats[Matrix.MTRANS_X], mTmpFloats[Matrix.MTRANS_Y]);
|
mTmpFloats[Matrix.MTRANS_X], mTmpFloats[Matrix.MTRANS_Y]);
|
||||||
mPendingTransaction.setAlpha(mWindowingLayer,
|
transaction.setAlpha(mWindowingLayer,
|
||||||
screenRotationAnimation.getEnterTransformation().getAlpha());
|
screenRotationAnimation.getEnterTransformation().getAlpha());
|
||||||
}
|
}
|
||||||
|
|
||||||
super.prepareSurfaces();
|
super.prepareSurfaces();
|
||||||
|
|
||||||
|
// TODO: Once we totally eliminate global transaction we will pass transaction in here
|
||||||
|
// rather than merging to global.
|
||||||
|
SurfaceControl.mergeToGlobalTransaction(transaction);
|
||||||
} finally {
|
} finally {
|
||||||
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
|
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
|
||||||
}
|
}
|
||||||
@@ -5013,7 +5019,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
|||||||
if (mPortalWindowHandle == null) {
|
if (mPortalWindowHandle == null) {
|
||||||
mPortalWindowHandle = createPortalWindowHandle(sc.toString());
|
mPortalWindowHandle = createPortalWindowHandle(sc.toString());
|
||||||
}
|
}
|
||||||
mPendingTransaction.setInputWindowInfo(sc, mPortalWindowHandle)
|
getPendingTransaction().setInputWindowInfo(sc, mPortalWindowHandle)
|
||||||
.reparent(mWindowingLayer, sc).reparent(mOverlayLayer, sc);
|
.reparent(mWindowingLayer, sc).reparent(mOverlayLayer, sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -138,6 +138,7 @@ class Task extends WindowContainer<AppWindowToken> implements ConfigurationConta
|
|||||||
setOrientation(SCREEN_ORIENTATION_UNSET);
|
setOrientation(SCREEN_ORIENTATION_UNSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
DisplayContent getDisplayContent() {
|
DisplayContent getDisplayContent() {
|
||||||
return mStack != null ? mStack.getDisplayContent() : null;
|
return mStack != null ? mStack.getDisplayContent() : null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class TaskScreenshotAnimatable implements SurfaceAnimator.Animatable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SurfaceControl.Transaction getPendingTransaction() {
|
public SurfaceControl.Transaction getPendingTransaction() {
|
||||||
return mTask.mPendingTransaction;
|
return mTask.getPendingTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -93,10 +93,6 @@ public class TaskStack extends WindowContainer<Task> implements
|
|||||||
/** Unique identifier */
|
/** Unique identifier */
|
||||||
final int mStackId;
|
final int mStackId;
|
||||||
|
|
||||||
/** The display this stack sits under. */
|
|
||||||
// TODO: Track parent marks like this in WindowContainer.
|
|
||||||
private DisplayContent mDisplayContent;
|
|
||||||
|
|
||||||
/** For comparison with DisplayContent bounds. */
|
/** For comparison with DisplayContent bounds. */
|
||||||
private Rect mTmpRect = new Rect();
|
private Rect mTmpRect = new Rect();
|
||||||
private Rect mTmpRect2 = new Rect();
|
private Rect mTmpRect2 = new Rect();
|
||||||
@@ -177,10 +173,6 @@ public class TaskStack extends WindowContainer<Task> implements
|
|||||||
EventLog.writeEvent(EventLogTags.WM_STACK_CREATED, stackId);
|
EventLog.writeEvent(EventLogTags.WM_STACK_CREATED, stackId);
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayContent getDisplayContent() {
|
|
||||||
return mDisplayContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
Task findHomeTask() {
|
Task findHomeTask() {
|
||||||
if (!isActivityTypeHome() || mChildren.isEmpty()) {
|
if (!isActivityTypeHome() || mChildren.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
@@ -825,8 +817,7 @@ public class TaskStack extends WindowContainer<Task> implements
|
|||||||
throw new IllegalStateException("onDisplayChanged: Already attached");
|
throw new IllegalStateException("onDisplayChanged: Already attached");
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean movedToNewDisplay = mDisplayContent == null;
|
super.onDisplayChanged(dc);
|
||||||
mDisplayContent = dc;
|
|
||||||
|
|
||||||
updateSurfaceBounds();
|
updateSurfaceBounds();
|
||||||
if (mAnimationBackgroundSurface == null) {
|
if (mAnimationBackgroundSurface == null) {
|
||||||
@@ -834,8 +825,6 @@ public class TaskStack extends WindowContainer<Task> implements
|
|||||||
.setName("animation background stackId=" + mStackId)
|
.setName("animation background stackId=" + mStackId)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onDisplayChanged(dc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -109,14 +109,19 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
|
|||||||
// The owner/creator for this container. No controller if null.
|
// The owner/creator for this container. No controller if null.
|
||||||
WindowContainerController mController;
|
WindowContainerController mController;
|
||||||
|
|
||||||
|
// The display this window container is on.
|
||||||
|
protected DisplayContent mDisplayContent;
|
||||||
|
|
||||||
protected SurfaceControl mSurfaceControl;
|
protected SurfaceControl mSurfaceControl;
|
||||||
private int mLastLayer = 0;
|
private int mLastLayer = 0;
|
||||||
private SurfaceControl mLastRelativeToLayer = null;
|
private SurfaceControl mLastRelativeToLayer = null;
|
||||||
|
|
||||||
|
// TODO(b/132320879): Remove this from WindowContainers except DisplayContent.
|
||||||
|
private final Transaction mPendingTransaction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Applied as part of the animation pass in "prepareSurfaces".
|
* Applied as part of the animation pass in "prepareSurfaces".
|
||||||
*/
|
*/
|
||||||
protected final Transaction mPendingTransaction;
|
|
||||||
protected final SurfaceAnimator mSurfaceAnimator;
|
protected final SurfaceAnimator mSurfaceAnimator;
|
||||||
protected final WindowManagerService mWmService;
|
protected final WindowManagerService mWmService;
|
||||||
|
|
||||||
@@ -320,12 +325,12 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mSurfaceControl != null) {
|
if (mSurfaceControl != null) {
|
||||||
mPendingTransaction.remove(mSurfaceControl);
|
getPendingTransaction().remove(mSurfaceControl);
|
||||||
|
|
||||||
// Merge to parent transaction to ensure the transactions on this WindowContainer are
|
// Merge to parent transaction to ensure the transactions on this WindowContainer are
|
||||||
// applied in native even if WindowContainer is removed.
|
// applied in native even if WindowContainer is removed.
|
||||||
if (mParent != null) {
|
if (mParent != null) {
|
||||||
mParent.getPendingTransaction().merge(mPendingTransaction);
|
mParent.getPendingTransaction().merge(getPendingTransaction());
|
||||||
}
|
}
|
||||||
|
|
||||||
mSurfaceControl = null;
|
mSurfaceControl = null;
|
||||||
@@ -508,12 +513,20 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
|
|||||||
* @param dc The display this container is on after changes.
|
* @param dc The display this container is on after changes.
|
||||||
*/
|
*/
|
||||||
void onDisplayChanged(DisplayContent dc) {
|
void onDisplayChanged(DisplayContent dc) {
|
||||||
|
mDisplayContent = dc;
|
||||||
|
if (dc != null && dc != this) {
|
||||||
|
dc.getPendingTransaction().merge(mPendingTransaction);
|
||||||
|
}
|
||||||
for (int i = mChildren.size() - 1; i >= 0; --i) {
|
for (int i = mChildren.size() - 1; i >= 0; --i) {
|
||||||
final WindowContainer child = mChildren.get(i);
|
final WindowContainer child = mChildren.get(i);
|
||||||
child.onDisplayChanged(dc);
|
child.onDisplayChanged(dc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DisplayContent getDisplayContent() {
|
||||||
|
return mDisplayContent;
|
||||||
|
}
|
||||||
|
|
||||||
void setWaitingForDrawnIfResizingChanged() {
|
void setWaitingForDrawnIfResizingChanged() {
|
||||||
for (int i = mChildren.size() - 1; i >= 0; --i) {
|
for (int i = mChildren.size() - 1; i >= 0; --i) {
|
||||||
final WindowContainer wc = mChildren.get(i);
|
final WindowContainer wc = mChildren.get(i);
|
||||||
@@ -1180,13 +1193,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: Once we totally eliminate global transaction we will pass transaction in here
|
|
||||||
* rather than merging to global.
|
|
||||||
*/
|
|
||||||
void prepareSurfaces() {
|
void prepareSurfaces() {
|
||||||
SurfaceControl.mergeToGlobalTransaction(getPendingTransaction());
|
|
||||||
|
|
||||||
// If a leash has been set when the transaction was committed, then the leash reparent has
|
// If a leash has been set when the transaction was committed, then the leash reparent has
|
||||||
// been committed.
|
// been committed.
|
||||||
mCommittedReparentToAnimationLeash = mSurfaceAnimator.hasLeash();
|
mCommittedReparentToAnimationLeash = mSurfaceAnimator.hasLeash();
|
||||||
@@ -1204,8 +1211,8 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger a call to prepareSurfaces from the animation thread, such that
|
* Trigger a call to prepareSurfaces from the animation thread, such that pending transactions
|
||||||
* mPendingTransaction will be applied.
|
* will be applied.
|
||||||
*/
|
*/
|
||||||
void scheduleAnimation() {
|
void scheduleAnimation() {
|
||||||
if (mParent != null) {
|
if (mParent != null) {
|
||||||
@@ -1224,6 +1231,14 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Transaction getPendingTransaction() {
|
public Transaction getPendingTransaction() {
|
||||||
|
final DisplayContent displayContent = getDisplayContent();
|
||||||
|
if (displayContent != null && displayContent != this) {
|
||||||
|
return displayContent.getPendingTransaction();
|
||||||
|
}
|
||||||
|
// This WindowContainer has not attached to a display yet or this is a DisplayContent, so we
|
||||||
|
// let the caller to save the surface operations within the local mPendingTransaction.
|
||||||
|
// If this is not a DisplayContent, we will merge it to the pending transaction of its
|
||||||
|
// display once it attaches to it.
|
||||||
return mPendingTransaction;
|
return mPendingTransaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1313,6 +1313,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
mOrientationChangeTimedOut = true;
|
mOrientationChangeTimedOut = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
DisplayContent getDisplayContent() {
|
DisplayContent getDisplayContent() {
|
||||||
return mToken.getDisplayContent();
|
return mToken.getDisplayContent();
|
||||||
}
|
}
|
||||||
@@ -4602,7 +4603,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
new WindowAnimationSpec(anim, mSurfacePosition, false /* canSkipFirstFrame */,
|
new WindowAnimationSpec(anim, mSurfacePosition, false /* canSkipFirstFrame */,
|
||||||
0 /* windowCornerRadius */),
|
0 /* windowCornerRadius */),
|
||||||
mWmService.mSurfaceAnimationRunner);
|
mWmService.mSurfaceAnimationRunner);
|
||||||
startAnimation(mPendingTransaction, adapter);
|
startAnimation(getPendingTransaction(), adapter);
|
||||||
commitPendingTransaction();
|
commitPendingTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,9 +82,6 @@ class WindowToken extends WindowContainer<WindowState> {
|
|||||||
// windows will be put to the bottom of the list.
|
// windows will be put to the bottom of the list.
|
||||||
boolean sendingToBottom;
|
boolean sendingToBottom;
|
||||||
|
|
||||||
// The display this token is on.
|
|
||||||
protected DisplayContent mDisplayContent;
|
|
||||||
|
|
||||||
/** The owner has {@link android.Manifest.permission#MANAGE_APP_TOKENS} */
|
/** The owner has {@link android.Manifest.permission#MANAGE_APP_TOKENS} */
|
||||||
final boolean mOwnerCanManageAppTokens;
|
final boolean mOwnerCanManageAppTokens;
|
||||||
|
|
||||||
@@ -249,10 +246,6 @@ class WindowToken extends WindowContainer<WindowState> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayContent getDisplayContent() {
|
|
||||||
return mDisplayContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void removeImmediately() {
|
void removeImmediately() {
|
||||||
if (mDisplayContent != null) {
|
if (mDisplayContent != null) {
|
||||||
@@ -266,7 +259,6 @@ class WindowToken extends WindowContainer<WindowState> {
|
|||||||
@Override
|
@Override
|
||||||
void onDisplayChanged(DisplayContent dc) {
|
void onDisplayChanged(DisplayContent dc) {
|
||||||
dc.reParentWindowToken(this);
|
dc.reParentWindowToken(this);
|
||||||
mDisplayContent = dc;
|
|
||||||
|
|
||||||
// TODO(b/36740756): One day this should perhaps be hooked
|
// TODO(b/36740756): One day this should perhaps be hooked
|
||||||
// up with goodToGo, so we don't move a window
|
// up with goodToGo, so we don't move a window
|
||||||
|
|||||||
Reference in New Issue
Block a user