Merge "Use activity-exit animation for translucent-only close" into udc-dev
This commit is contained in:
@@ -327,6 +327,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
|||||||
final int wallpaperTransit = getWallpaperTransitType(info);
|
final int wallpaperTransit = getWallpaperTransitType(info);
|
||||||
boolean isDisplayRotationAnimationStarted = false;
|
boolean isDisplayRotationAnimationStarted = false;
|
||||||
final boolean isDreamTransition = isDreamTransition(info);
|
final boolean isDreamTransition = isDreamTransition(info);
|
||||||
|
final boolean isOnlyTranslucent = isOnlyTranslucent(info);
|
||||||
|
|
||||||
for (int i = info.getChanges().size() - 1; i >= 0; --i) {
|
for (int i = info.getChanges().size() - 1; i >= 0; --i) {
|
||||||
final TransitionInfo.Change change = info.getChanges().get(i);
|
final TransitionInfo.Change change = info.getChanges().get(i);
|
||||||
@@ -452,6 +453,17 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
|||||||
final int layer = zSplitLine + numChanges - i;
|
final int layer = zSplitLine + numChanges - i;
|
||||||
startTransaction.setLayer(change.getLeash(), layer);
|
startTransaction.setLayer(change.getLeash(), layer);
|
||||||
}
|
}
|
||||||
|
} else if (isOnlyTranslucent && TransitionUtil.isOpeningType(info.getType())
|
||||||
|
&& TransitionUtil.isClosingType(mode)) {
|
||||||
|
// If there is a closing translucent task in an OPENING transition, we will
|
||||||
|
// actually select a CLOSING animation, so move the closing task into
|
||||||
|
// the animating part of the z-order.
|
||||||
|
|
||||||
|
// See Transitions#setupAnimHierarchy for details about these variables.
|
||||||
|
final int numChanges = info.getChanges().size();
|
||||||
|
final int zSplitLine = numChanges + 1;
|
||||||
|
final int layer = zSplitLine + numChanges - i;
|
||||||
|
startTransaction.setLayer(change.getLeash(), layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -543,6 +555,29 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does `info` only contain translucent visibility changes (CHANGEs are ignored). We select
|
||||||
|
* different animations and z-orders for these
|
||||||
|
*/
|
||||||
|
private static boolean isOnlyTranslucent(@NonNull TransitionInfo info) {
|
||||||
|
int translucentOpen = 0;
|
||||||
|
int translucentClose = 0;
|
||||||
|
for (int i = info.getChanges().size() - 1; i >= 0; --i) {
|
||||||
|
final TransitionInfo.Change change = info.getChanges().get(i);
|
||||||
|
if (change.getMode() == TRANSIT_CHANGE) continue;
|
||||||
|
if (change.hasFlags(FLAG_TRANSLUCENT)) {
|
||||||
|
if (TransitionUtil.isOpeningType(change.getMode())) {
|
||||||
|
translucentOpen += 1;
|
||||||
|
} else {
|
||||||
|
translucentClose += 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (translucentOpen + translucentClose) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mergeAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info,
|
public void mergeAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info,
|
||||||
@NonNull SurfaceControl.Transaction t, @NonNull IBinder mergeTarget,
|
@NonNull SurfaceControl.Transaction t, @NonNull IBinder mergeTarget,
|
||||||
|
|||||||
@@ -103,10 +103,11 @@ public class TransitionAnimationHelper {
|
|||||||
// We will translucent open animation for translucent activities and tasks. Choose
|
// We will translucent open animation for translucent activities and tasks. Choose
|
||||||
// WindowAnimation_activityOpenEnterAnimation and set translucent here, then
|
// WindowAnimation_activityOpenEnterAnimation and set translucent here, then
|
||||||
// TransitionAnimation loads appropriate animation later.
|
// TransitionAnimation loads appropriate animation later.
|
||||||
if ((changeFlags & FLAG_TRANSLUCENT) != 0 && enter) {
|
translucent = (changeFlags & FLAG_TRANSLUCENT) != 0;
|
||||||
translucent = true;
|
if (isTask && translucent && !enter) {
|
||||||
}
|
// For closing translucent tasks, use the activity close animation
|
||||||
if (isTask && !translucent) {
|
animAttr = R.styleable.WindowAnimation_activityCloseExitAnimation;
|
||||||
|
} else if (isTask && !translucent) {
|
||||||
animAttr = enter
|
animAttr = enter
|
||||||
? R.styleable.WindowAnimation_taskOpenEnterAnimation
|
? R.styleable.WindowAnimation_taskOpenEnterAnimation
|
||||||
: R.styleable.WindowAnimation_taskOpenExitAnimation;
|
: R.styleable.WindowAnimation_taskOpenExitAnimation;
|
||||||
|
|||||||
@@ -570,8 +570,8 @@ public class Transitions implements RemoteCallable<Transitions>,
|
|||||||
layer = zSplitLine + numChanges - i;
|
layer = zSplitLine + numChanges - i;
|
||||||
}
|
}
|
||||||
} else { // CHANGE or other
|
} else { // CHANGE or other
|
||||||
if (isClosing) {
|
if (isClosing || TransitionUtil.isOrderOnly(change)) {
|
||||||
// Put below CLOSE mode.
|
// Put below CLOSE mode (in the "static" section).
|
||||||
layer = zSplitLine - i;
|
layer = zSplitLine - i;
|
||||||
} else {
|
} else {
|
||||||
// Put above CLOSE mode.
|
// Put above CLOSE mode.
|
||||||
|
|||||||
Reference in New Issue
Block a user