Merge "Fix issues with z-ordering during animations" into pi-dev

This commit is contained in:
Jorim Jaggi
2018-03-28 16:17:33 +00:00
committed by Android (Google) Code Review
3 changed files with 29 additions and 7 deletions

View File

@@ -1660,6 +1660,10 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
true /* topToBottom */);
}
SurfaceControl getAppAnimationLayer() {
return getAppAnimationLayer(needsZBoost());
}
@Override
public SurfaceControl getAnimationLeashParent() {
// All normal app transitions take place in an animation layer which is below the pinned
@@ -1855,7 +1859,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
leash.setLayer(layer);
final DisplayContent dc = getDisplayContent();
dc.assignStackOrdering(t);
dc.assignStackOrdering();
if (mAnimatingAppWindowTokenRegistry != null) {
mAnimatingAppWindowTokenRegistry.notifyStarting(this);
}

View File

@@ -3180,6 +3180,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
* A control placed at the appropriate level for transitions to occur.
*/
SurfaceControl mAppAnimationLayer = null;
SurfaceControl mBoostedAppAnimationLayer = null;
/**
* Given that the split-screen divider does not have an AppWindowToken, it
@@ -3531,12 +3532,14 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
}
void assignStackOrdering(SurfaceControl.Transaction t) {
final int HOME_STACK_STATE = 0;
final int NORMAL_STACK_STATE = 1;
final int ALWAYS_ON_TOP_STATE = 2;
int layer = 0;
int layerForAnimationLayer = 0;
int layerForBoostedAnimationLayer = 0;
for (int state = 0; state <= ALWAYS_ON_TOP_STATE; state++) {
for (int i = 0; i < mChildren.size(); i++) {
@@ -3558,16 +3561,22 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
// highest animating stack and no higher.
layerForAnimationLayer = layer++;
}
if (state != ALWAYS_ON_TOP_STATE) {
layerForBoostedAnimationLayer = layer++;
}
}
}
if (mAppAnimationLayer != null) {
t.setLayer(mAppAnimationLayer, layerForAnimationLayer);
}
if (mBoostedAppAnimationLayer != null) {
t.setLayer(mBoostedAppAnimationLayer, layerForBoostedAnimationLayer);
}
}
@Override
SurfaceControl getAppAnimationLayer() {
return mAppAnimationLayer;
SurfaceControl getAppAnimationLayer(boolean boosted) {
return boosted ? mBoostedAppAnimationLayer : mAppAnimationLayer;
}
SurfaceControl getSplitScreenDividerAnchor() {
@@ -3581,16 +3590,22 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
mAppAnimationLayer = makeChildSurface(null)
.setName("animationLayer")
.build();
mBoostedAppAnimationLayer = makeChildSurface(null)
.setName("boostedAnimationLayer")
.build();
mSplitScreenDividerAnchor = makeChildSurface(null)
.setName("splitScreenDividerAnchor")
.build();
getPendingTransaction()
.show(mAppAnimationLayer)
.show(mBoostedAppAnimationLayer)
.show(mSplitScreenDividerAnchor);
scheduleAnimation();
} else {
mAppAnimationLayer.destroy();
mAppAnimationLayer = null;
mBoostedAppAnimationLayer.destroy();
mBoostedAppAnimationLayer = null;
mSplitScreenDividerAnchor.destroy();
mSplitScreenDividerAnchor = null;
}
@@ -3872,7 +3887,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
super.prepareSurfaces();
}
void assignStackOrdering(SurfaceControl.Transaction t) {
mTaskStackContainers.assignStackOrdering(t);
void assignStackOrdering() {
mTaskStackContainers.assignStackOrdering(getPendingTransaction());
}
}

View File

@@ -1125,12 +1125,15 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
}
/**
* @param boosted If true, returns an animation layer that happens above all {@link TaskStack}s
* Otherwise, the layer will be positioned above all animating
* {@link TaskStack}s.
* @return The layer on which all app animations are happening.
*/
SurfaceControl getAppAnimationLayer() {
SurfaceControl getAppAnimationLayer(boolean boosted) {
final WindowContainer parent = getParent();
if (parent != null) {
return parent.getAppAnimationLayer();
return parent.getAppAnimationLayer(boosted);
}
return null;
}