diff options
5 files changed, 18 insertions, 165 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 6d144e1da234..68bc925c1a67 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -401,10 +401,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A private static final int STARTING_WINDOW_TYPE_SNAPSHOT = 1; private static final int STARTING_WINDOW_TYPE_SPLASH_SCREEN = 2; - /** - * Value to increment the z-layer when boosting a layer during animations. BOOST in l33tsp34k. - */ - @VisibleForTesting static final int Z_BOOST_BASE = 800570000; static final int INVALID_PID = -1; // How long we wait until giving up on the last activity to pause. This @@ -4244,20 +4240,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return callback.test(this) ? this : null; } - @Override - protected void setLayer(Transaction t, int layer) { - if (!mSurfaceAnimator.hasLeash()) { - t.setLayer(mSurfaceControl, layer); - } - } - - @Override - protected void setRelativeLayer(Transaction t, SurfaceControl relativeTo, int layer) { - if (!mSurfaceAnimator.hasLeash()) { - t.setRelativeLayer(mSurfaceControl, relativeTo, layer); - } - } - void logStartActivity(int tag, Task task) { final Uri data = intent.getData(); final String strData = data != null ? data.toSafeString() : null; @@ -6787,12 +6769,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return candidate; } - SurfaceControl getAppAnimationLayer() { - return getAppAnimationLayer(isActivityTypeHome() ? ANIMATION_LAYER_HOME - : needsZBoost() ? ANIMATION_LAYER_BOOSTED - : ANIMATION_LAYER_STANDARD); - } - @Override boolean needsZBoost() { return mNeedsZBoost || super.needsZBoost(); @@ -6853,29 +6829,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A || mDisplayContent.isNextTransitionForward(); } - private int getAnimationLayer() { - // The leash is parented to the animation layer. We need to preserve the z-order by using - // the prefix order index, but we boost if necessary. - int layer; - if (!inPinnedWindowingMode()) { - layer = getPrefixOrderIndex(); - } else { - // Root pinned tasks have animations take place within themselves rather than an - // animation layer so we need to preserve the order relative to the root task (e.g. - // the order of our task/parent). - layer = getParent().getPrefixOrderIndex(); - } - - if (mNeedsZBoost) { - layer += Z_BOOST_BASE; - } - return layer; - } - @Override - public void onAnimationLeashCreated(Transaction t, SurfaceControl leash) { - t.setLayer(leash, getAnimationLayer()); - getDisplayContent().assignRootTaskOrdering(); + void resetSurfacePositionForAnimationLeash(SurfaceControl.Transaction t) { + // Noop as Activity may be offset for letterbox } @Override @@ -6904,7 +6860,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // Crop to root task bounds. t.setLayer(leash, 0); - t.setLayer(mAnimationBoundsLayer, getAnimationLayer()); + t.setLayer(mAnimationBoundsLayer, getLastLayer()); // Reparent leash to animation bounds layer. t.reparent(leash, mAnimationBoundsLayer); diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index 594b6be489d6..3cb80d6e643e 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -2972,11 +2972,6 @@ class Task extends TaskFragment { return super.makeAnimationLeash().setMetadata(METADATA_TASK_ID, mTaskId); } - @Override - void resetSurfacePositionForAnimationLeash(SurfaceControl.Transaction t) { - super.resetSurfacePositionForAnimationLeash(t); - } - boolean shouldAnimate() { /** * Animations are handled by the TaskOrganizer implementation. diff --git a/services/core/java/com/android/server/wm/TaskDisplayArea.java b/services/core/java/com/android/server/wm/TaskDisplayArea.java index 66f2dbc8ec09..71844ce02b20 100644 --- a/services/core/java/com/android/server/wm/TaskDisplayArea.java +++ b/services/core/java/com/android/server/wm/TaskDisplayArea.java @@ -99,13 +99,6 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { private int mColorLayerCounter = 0; /** - * A control placed at the appropriate level for transitions to occur. - */ - private SurfaceControl mAppAnimationLayer; - private SurfaceControl mBoostedAppAnimationLayer; - private SurfaceControl mHomeAppAnimationLayer; - - /** * Given that the split-screen divider does not have an AppWindowToken, it * will have to live inside of a "NonAppWindowContainer". However, in visual Z order * it will need to be interleaved with some of our children, appearing on top of @@ -132,7 +125,6 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { private final ArrayList<WindowContainer> mTmpNormalChildren = new ArrayList<>(); private final ArrayList<WindowContainer> mTmpHomeChildren = new ArrayList<>(); private final IntArray mTmpNeedsZBoostIndexes = new IntArray(); - private int mTmpLayerForAnimationLayer; private ArrayList<Task> mTmpTasks = new ArrayList<>(); @@ -871,33 +863,13 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { int layer = 0; // Place root home tasks to the bottom. - layer = adjustRootTaskLayer(t, mTmpHomeChildren, layer, false /* normalRootTasks */); - // The home animation layer is between the root home tasks and the normal root tasks. - final int layerForHomeAnimationLayer = layer++; - mTmpLayerForAnimationLayer = layer++; - layer = adjustRootTaskLayer(t, mTmpNormalChildren, layer, true /* normalRootTasks */); - - // The boosted animation layer is between the normal root tasks and the always on top - // root tasks. - final int layerForBoostedAnimationLayer = layer++; - // Always on top tasks layer should higher than split divider layer so set it as start. - layer = SPLIT_DIVIDER_LAYER + 1; - adjustRootTaskLayer(t, mTmpAlwaysOnTopChildren, layer, false /* normalRootTasks */); + layer = adjustRootTaskLayer(t, mTmpHomeChildren, layer); + adjustRootTaskLayer(t, mTmpNormalChildren, layer); - t.setLayer(mHomeAppAnimationLayer, layerForHomeAnimationLayer); - t.setLayer(mAppAnimationLayer, mTmpLayerForAnimationLayer); + // Always on top tasks layer should higher than split divider layer so set it as start. t.setLayer(mSplitScreenDividerAnchor, SPLIT_DIVIDER_LAYER); - t.setLayer(mBoostedAppAnimationLayer, layerForBoostedAnimationLayer); - } - - private int adjustNormalRootTaskLayer(WindowContainer child, int layer) { - if ((child.asTask() != null && child.asTask().isAnimatingByRecents()) - || child.isAppTransitioning()) { - // The animation layer is located above the highest animating root task and no - // higher. - mTmpLayerForAnimationLayer = layer++; - } - return layer; + layer = SPLIT_DIVIDER_LAYER + 1; + adjustRootTaskLayer(t, mTmpAlwaysOnTopChildren, layer); } /** @@ -906,11 +878,10 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { * normal rootTasks. * * @param startLayer The beginning layer of this group of rootTasks. - * @param normalRootTasks Set {@code true} if this group is neither home nor always on top. * @return The adjusted layer value. */ private int adjustRootTaskLayer(SurfaceControl.Transaction t, - ArrayList<WindowContainer> children, int startLayer, boolean normalRootTasks) { + ArrayList<WindowContainer> children, int startLayer) { mTmpNeedsZBoostIndexes.clear(); final int childCount = children.size(); for (int i = 0; i < childCount; i++) { @@ -923,9 +894,6 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { if (!childNeedsZBoost) { child.assignLayer(t, startLayer++); - if (normalRootTasks) { - startLayer = adjustNormalRootTaskLayer(child, startLayer); - } } else { mTmpNeedsZBoostIndexes.add(i); } @@ -935,9 +903,6 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { for (int i = 0; i < zBoostSize; i++) { final WindowContainer child = children.get(mTmpNeedsZBoostIndexes.get(i)); child.assignLayer(t, startLayer++); - if (normalRootTasks) { - startLayer = adjustNormalRootTaskLayer(child, startLayer); - } } return startLayer; } @@ -951,19 +916,6 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { } @Override - SurfaceControl getAppAnimationLayer(@AnimationLayer int animationLayer) { - switch (animationLayer) { - case ANIMATION_LAYER_BOOSTED: - return mBoostedAppAnimationLayer; - case ANIMATION_LAYER_HOME: - return mHomeAppAnimationLayer; - case ANIMATION_LAYER_STANDARD: - default: - return mAppAnimationLayer; - } - } - - @Override RemoteAnimationTarget createRemoteAnimationTarget( RemoteAnimationController.RemoteAnimationRecord record) { final ActivityRecord activity = getTopMostActivity(); @@ -983,42 +935,21 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { .setName("colorBackgroundLayer") .setCallsite("TaskDisplayArea.onParentChanged") .build(); - mAppAnimationLayer = makeChildSurface(null) - .setName("animationLayer") - .setCallsite("TaskDisplayArea.onParentChanged") - .build(); - mBoostedAppAnimationLayer = makeChildSurface(null) - .setName("boostedAnimationLayer") - .setCallsite("TaskDisplayArea.onParentChanged") - .build(); - mHomeAppAnimationLayer = makeChildSurface(null) - .setName("homeAnimationLayer") - .setCallsite("TaskDisplayArea.onParentChanged") - .build(); mSplitScreenDividerAnchor = makeChildSurface(null) .setName("splitScreenDividerAnchor") .setCallsite("TaskDisplayArea.onParentChanged") .build(); getSyncTransaction() - .show(mAppAnimationLayer) - .show(mBoostedAppAnimationLayer) - .show(mHomeAppAnimationLayer) .show(mSplitScreenDividerAnchor); }); } else { super.onParentChanged(newParent, oldParent); mWmService.mTransactionFactory.get() .remove(mColorBackgroundLayer) - .remove(mAppAnimationLayer) - .remove(mBoostedAppAnimationLayer) - .remove(mHomeAppAnimationLayer) .remove(mSplitScreenDividerAnchor) .apply(); mColorBackgroundLayer = null; - mAppAnimationLayer = null; - mBoostedAppAnimationLayer = null; - mHomeAppAnimationLayer = null; mSplitScreenDividerAnchor = null; } } @@ -1059,15 +990,12 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { @Override void migrateToNewSurfaceControl(SurfaceControl.Transaction t) { super.migrateToNewSurfaceControl(t); - if (mAppAnimationLayer == null) { + if (mColorBackgroundLayer == null) { return; } // As TaskDisplayArea is getting a new surface, reparent and reorder the child surfaces. t.reparent(mColorBackgroundLayer, mSurfaceControl); - t.reparent(mAppAnimationLayer, mSurfaceControl); - t.reparent(mBoostedAppAnimationLayer, mSurfaceControl); - t.reparent(mHomeAppAnimationLayer, mSurfaceControl); t.reparent(mSplitScreenDividerAnchor, mSurfaceControl); reassignLayer(t); scheduleAnimation(); diff --git a/services/core/java/com/android/server/wm/WindowContainer.java b/services/core/java/com/android/server/wm/WindowContainer.java index 6b21858ebd29..9a4bf6318249 100644 --- a/services/core/java/com/android/server/wm/WindowContainer.java +++ b/services/core/java/com/android/server/wm/WindowContainer.java @@ -71,7 +71,6 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityThread; -import android.app.WindowConfiguration; import android.content.Context; import android.content.pm.ActivityInfo; import android.content.res.Configuration; @@ -128,26 +127,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< private static final String TAG = TAG_WITH_CLASS_NAME ? "WindowContainer" : TAG_WM; - /** Animation layer that happens above all animating {@link Task}s. */ - static final int ANIMATION_LAYER_STANDARD = 0; - - /** Animation layer that happens above all {@link Task}s. */ - static final int ANIMATION_LAYER_BOOSTED = 1; - - /** - * Animation layer that is reserved for {@link WindowConfiguration#ACTIVITY_TYPE_HOME} - * activities and all activities that are being controlled by the recents animation. This - * layer is generally below all {@link Task}s. - */ - static final int ANIMATION_LAYER_HOME = 2; - - @IntDef(prefix = { "ANIMATION_LAYER_" }, value = { - ANIMATION_LAYER_STANDARD, - ANIMATION_LAYER_BOOSTED, - ANIMATION_LAYER_HOME, - }) - @interface AnimationLayer {} - static final int POSITION_TOP = Integer.MAX_VALUE; static final int POSITION_BOTTOM = Integer.MIN_VALUE; @@ -2672,17 +2651,6 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< return getParentSurfaceControl(); } - /** - * @return The layer on which all app animations are happening. - */ - SurfaceControl getAppAnimationLayer(@AnimationLayer int animationLayer) { - final WindowContainer parent = getParent(); - if (parent != null) { - return parent.getAppAnimationLayer(animationLayer); - } - return null; - } - // TODO: Remove this and use #getBounds() instead once we set an app transition animation // on TaskStack. Rect getAnimationBounds(int appRootTaskClipMode) { diff --git a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenAnimationTests.java b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenAnimationTests.java index fd562c3f90b2..ebefeaff7f26 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenAnimationTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenAnimationTests.java @@ -75,13 +75,19 @@ public class AppWindowTokenAnimationTests extends WindowTestsBase { @Test public void clipAfterAnim_boundsLayerZBoosted() { + final Task task = mActivity.getTask(); + final ActivityRecord topActivity = createActivityRecord(task); + task.assignChildLayers(mTransaction); + + assertThat(topActivity.getLastLayer()).isGreaterThan(mActivity.getLastLayer()); + mActivity.mNeedsAnimationBoundsLayer = true; mActivity.mNeedsZBoost = true; - mActivity.mSurfaceAnimator.startAnimation(mTransaction, mSpec, true /* hidden */, ANIMATION_TYPE_APP_TRANSITION); + verify(mTransaction).setLayer(eq(mActivity.mAnimationBoundsLayer), - intThat(layer -> layer >= ActivityRecord.Z_BOOST_BASE)); + intThat(layer -> layer > topActivity.getLastLayer())); } @Test |