Merge "Animate home in separate layer" into pi-dev

This commit is contained in:
Jorim Jaggi
2018-04-19 13:01:48 +00:00
committed by Android (Google) Code Review
4 changed files with 51 additions and 9 deletions

View File

@@ -1662,7 +1662,9 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
}
SurfaceControl getAppAnimationLayer() {
return getAppAnimationLayer(needsZBoost());
return getAppAnimationLayer(isActivityTypeHome() ? ANIMATION_LAYER_HOME
: needsZBoost() ? ANIMATION_LAYER_BOOSTED
: ANIMATION_LAYER_STANDARD);
}
@Override

View File

@@ -3190,6 +3190,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
*/
SurfaceControl mAppAnimationLayer = null;
SurfaceControl mBoostedAppAnimationLayer = null;
SurfaceControl mHomeAppAnimationLayer = null;
/**
* Given that the split-screen divider does not have an AppWindowToken, it
@@ -3552,6 +3553,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
int layer = 0;
int layerForAnimationLayer = 0;
int layerForBoostedAnimationLayer = 0;
int layerForHomeAnimationLayer = 0;
for (int state = 0; state <= ALWAYS_ON_TOP_STATE; state++) {
for (int i = 0; i < mChildren.size(); i++) {
@@ -3578,6 +3580,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
layerForBoostedAnimationLayer = layer++;
}
}
if (state == HOME_STACK_STATE) {
layerForHomeAnimationLayer = layer++;
}
}
if (mAppAnimationLayer != null) {
t.setLayer(mAppAnimationLayer, layerForAnimationLayer);
@@ -3585,11 +3590,22 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
if (mBoostedAppAnimationLayer != null) {
t.setLayer(mBoostedAppAnimationLayer, layerForBoostedAnimationLayer);
}
if (mHomeAppAnimationLayer != null) {
t.setLayer(mHomeAppAnimationLayer, layerForHomeAnimationLayer);
}
}
@Override
SurfaceControl getAppAnimationLayer(boolean boosted) {
return boosted ? mBoostedAppAnimationLayer : mAppAnimationLayer;
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;
}
}
SurfaceControl getSplitScreenDividerAnchor() {
@@ -3606,12 +3622,16 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
mBoostedAppAnimationLayer = makeChildSurface(null)
.setName("boostedAnimationLayer")
.build();
mHomeAppAnimationLayer = makeChildSurface(null)
.setName("homeAnimationLayer")
.build();
mSplitScreenDividerAnchor = makeChildSurface(null)
.setName("splitScreenDividerAnchor")
.build();
getPendingTransaction()
.show(mAppAnimationLayer)
.show(mBoostedAppAnimationLayer)
.show(mHomeAppAnimationLayer)
.show(mSplitScreenDividerAnchor);
scheduleAnimation();
} else {
@@ -3619,6 +3639,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
mAppAnimationLayer = null;
mBoostedAppAnimationLayer.destroy();
mBoostedAppAnimationLayer = null;
mHomeAppAnimationLayer.destroy();
mHomeAppAnimationLayer = null;
mSplitScreenDividerAnchor.destroy();
mSplitScreenDividerAnchor = null;
}

View File

@@ -564,7 +564,7 @@ class Task extends WindowContainer<AppWindowToken> {
public SurfaceControl getAnimationLeashParent() {
// Reparent to the animation layer so that we aren't clipped by the non-minimized
// stack bounds, currently we only animate the task for the recents animation
return getAppAnimationLayer(false /* boosted */);
return getAppAnimationLayer(ANIMATION_LAYER_STANDARD);
}
boolean isTaskAnimating() {

View File

@@ -29,6 +29,8 @@ import static com.android.server.wm.WindowContainerProto.SURFACE_ANIMATOR;
import static com.android.server.wm.WindowContainerProto.VISIBLE;
import android.annotation.CallSuper;
import android.annotation.IntDef;
import android.app.WindowConfiguration;
import android.content.res.Configuration;
import android.graphics.Point;
import android.graphics.Rect;
@@ -60,6 +62,25 @@ 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 TaskStack}s. */
static final int ANIMATION_LAYER_STANDARD = 0;
/** Animation layer that happens above all {@link TaskStack}s. */
static final int ANIMATION_LAYER_BOOSTED = 1;
/**
* Animation layer that is reserved for {@link WindowConfiguration#ACTIVITY_TYPE_HOME}
* activities that happens below all {@link TaskStack}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;
@@ -1125,15 +1146,12 @@ 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(boolean boosted) {
SurfaceControl getAppAnimationLayer(@AnimationLayer int animationLayer) {
final WindowContainer parent = getParent();
if (parent != null) {
return parent.getAppAnimationLayer(boosted);
return parent.getAppAnimationLayer(animationLayer);
}
return null;
}