Merge "Fix the regression that closing transition disappeared." into rvc-dev am: 76cfda57e5 am: 13d623015d

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11970300

Change-Id: I60023d5331b24cf39035b3a6573045f5e64489ca
This commit is contained in:
Wei Sheng Shih
2020-07-06 02:20:38 +00:00
committed by Automerger Merge Worker
3 changed files with 70 additions and 26 deletions

View File

@@ -2586,7 +2586,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
if (DEBUG_VISIBILITY || DEBUG_TRANSITION) { if (DEBUG_VISIBILITY || DEBUG_TRANSITION) {
Slog.v(TAG_TRANSITION, "Prepare close transition: finishing " + this); Slog.v(TAG_TRANSITION, "Prepare close transition: finishing " + this);
} }
getDisplay().mDisplayContent.prepareAppTransition(transit, false); mDisplayContent.prepareAppTransition(transit, false);
// When finishing the activity preemptively take the snapshot before the app window // When finishing the activity preemptively take the snapshot before the app window
// is marked as hidden and any configuration changes take place // is marked as hidden and any configuration changes take place
@@ -2611,6 +2611,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
if (endTask) { if (endTask) {
mAtmService.getLockTaskController().clearLockedTask(task); mAtmService.getLockTaskController().clearLockedTask(task);
// This activity was in the top focused stack and this is the last activity in
// that task, give this activity a higher layer so it can stay on top before the
// closing task transition be executed.
if (mayAdjustTop) {
mNeedsZBoost = true;
mDisplayContent.assignWindowLayers(false /* setLayoutNeeded */);
}
} }
} else if (!isState(PAUSING)) { } else if (!isState(PAUSING)) {
if (mVisibleRequested) { if (mVisibleRequested) {
@@ -6111,7 +6118,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "AR#onAnimationFinished"); Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "AR#onAnimationFinished");
mTransit = TRANSIT_UNSET; mTransit = TRANSIT_UNSET;
mTransitFlags = 0; mTransitFlags = 0;
mNeedsZBoost = false;
mNeedsAnimationBoundsLayer = false; mNeedsAnimationBoundsLayer = false;
setAppLayoutChanges(FINISH_LAYOUT_REDO_ANIM | FINISH_LAYOUT_REDO_WALLPAPER, setAppLayoutChanges(FINISH_LAYOUT_REDO_ANIM | FINISH_LAYOUT_REDO_WALLPAPER,

View File

@@ -52,6 +52,7 @@ import android.content.Intent;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.os.UserHandle; import android.os.UserHandle;
import android.util.IntArray;
import android.util.Slog; import android.util.Slog;
import android.view.SurfaceControl; import android.view.SurfaceControl;
import android.window.WindowContainerTransaction; import android.window.WindowContainerTransaction;
@@ -106,6 +107,9 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
private final ArrayList<ActivityStack> mTmpAlwaysOnTopStacks = new ArrayList<>(); private final ArrayList<ActivityStack> mTmpAlwaysOnTopStacks = new ArrayList<>();
private final ArrayList<ActivityStack> mTmpNormalStacks = new ArrayList<>(); private final ArrayList<ActivityStack> mTmpNormalStacks = new ArrayList<>();
private final ArrayList<ActivityStack> mTmpHomeStacks = new ArrayList<>(); private final ArrayList<ActivityStack> mTmpHomeStacks = new ArrayList<>();
private final IntArray mTmpNeedsZBoostIndexes = new IntArray();
private int mTmpLayerForSplitScreenDividerAnchor;
private int mTmpLayerForAnimationLayer;
private ArrayList<Task> mTmpTasks = new ArrayList<>(); private ArrayList<Task> mTmpTasks = new ArrayList<>();
@@ -633,37 +637,70 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
int layer = 0; int layer = 0;
// Place home stacks to the bottom. // Place home stacks to the bottom.
for (int i = 0; i < mTmpHomeStacks.size(); i++) { layer = adjustRootTaskLayer(t, mTmpHomeStacks, layer, false /* normalStacks */);
mTmpHomeStacks.get(i).assignLayer(t, layer++);
}
// The home animation layer is between the home stacks and the normal stacks. // The home animation layer is between the home stacks and the normal stacks.
final int layerForHomeAnimationLayer = layer++; final int layerForHomeAnimationLayer = layer++;
int layerForSplitScreenDividerAnchor = layer++; mTmpLayerForSplitScreenDividerAnchor = layer++;
int layerForAnimationLayer = layer++; mTmpLayerForAnimationLayer = layer++;
for (int i = 0; i < mTmpNormalStacks.size(); i++) { layer = adjustRootTaskLayer(t, mTmpNormalStacks, layer, true /* normalStacks */);
final ActivityStack s = mTmpNormalStacks.get(i);
s.assignLayer(t, layer++); // The boosted animation layer is between the normal stacks and the always on top
// stacks.
final int layerForBoostedAnimationLayer = layer++;
adjustRootTaskLayer(t, mTmpAlwaysOnTopStacks, layer, false /* normalStacks */);
t.setLayer(mHomeAppAnimationLayer, layerForHomeAnimationLayer);
t.setLayer(mAppAnimationLayer, mTmpLayerForAnimationLayer);
t.setLayer(mSplitScreenDividerAnchor, mTmpLayerForSplitScreenDividerAnchor);
t.setLayer(mBoostedAppAnimationLayer, layerForBoostedAnimationLayer);
}
private int adjustNormalStackLayer(ActivityStack s, int layer) {
if (s.inSplitScreenWindowingMode()) { if (s.inSplitScreenWindowingMode()) {
// The split screen divider anchor is located above the split screen window. // The split screen divider anchor is located above the split screen window.
layerForSplitScreenDividerAnchor = layer++; mTmpLayerForSplitScreenDividerAnchor = layer++;
} }
if (s.isTaskAnimating() || s.isAppTransitioning()) { if (s.isTaskAnimating() || s.isAppTransitioning()) {
// The animation layer is located above the highest animating stack and no // The animation layer is located above the highest animating stack and no
// higher. // higher.
layerForAnimationLayer = layer++; mTmpLayerForAnimationLayer = layer++;
} }
} return layer;
// The boosted animation layer is between the normal stacks and the always on top
// stacks.
final int layerForBoostedAnimationLayer = layer++;
for (int i = 0; i < mTmpAlwaysOnTopStacks.size(); i++) {
mTmpAlwaysOnTopStacks.get(i).assignLayer(t, layer++);
} }
t.setLayer(mHomeAppAnimationLayer, layerForHomeAnimationLayer); /**
t.setLayer(mAppAnimationLayer, layerForAnimationLayer); * Adjusts the layer of the stack which belongs to the same group.
t.setLayer(mSplitScreenDividerAnchor, layerForSplitScreenDividerAnchor); * Note that there are three stack groups: home stacks, always on top stacks, and normal stacks.
t.setLayer(mBoostedAppAnimationLayer, layerForBoostedAnimationLayer); *
* @param startLayer The beginning layer of this group of stacks.
* @param normalStacks 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<ActivityStack> stacks,
int startLayer, boolean normalStacks) {
mTmpNeedsZBoostIndexes.clear();
final int stackSize = stacks.size();
for (int i = 0; i < stackSize; i++) {
final ActivityStack stack = stacks.get(i);
if (!stack.needsZBoost()) {
stack.assignLayer(t, startLayer++);
if (normalStacks) {
startLayer = adjustNormalStackLayer(stack, startLayer);
}
} else {
mTmpNeedsZBoostIndexes.add(i);
}
}
final int zBoostSize = mTmpNeedsZBoostIndexes.size();
for (int i = 0; i < zBoostSize; i++) {
final ActivityStack stack = stacks.get(mTmpNeedsZBoostIndexes.get(i));
stack.assignLayer(t, startLayer++);
if (normalStacks) {
startLayer = adjustNormalStackLayer(stack, startLayer);
}
}
return startLayer;
} }
@Override @Override

View File

@@ -2440,6 +2440,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
protected void onAnimationFinished(@AnimationType int type, AnimationAdapter anim) { protected void onAnimationFinished(@AnimationType int type, AnimationAdapter anim) {
doAnimationFinished(type, anim); doAnimationFinished(type, anim);
mWmService.onAnimationFinished(); mWmService.onAnimationFinished();
mNeedsZBoost = false;
} }
/** /**