Merge "Restrict change mode to apply transition background" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ad693c128c
@@ -37,12 +37,8 @@ import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_ROTATE;
|
|||||||
import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS;
|
import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS;
|
||||||
import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_UNSPECIFIED;
|
import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_UNSPECIFIED;
|
||||||
import static android.view.WindowManager.TRANSIT_CHANGE;
|
import static android.view.WindowManager.TRANSIT_CHANGE;
|
||||||
import static android.view.WindowManager.TRANSIT_CLOSE;
|
|
||||||
import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE;
|
import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE;
|
||||||
import static android.view.WindowManager.TRANSIT_OPEN;
|
|
||||||
import static android.view.WindowManager.TRANSIT_RELAUNCH;
|
import static android.view.WindowManager.TRANSIT_RELAUNCH;
|
||||||
import static android.view.WindowManager.TRANSIT_TO_BACK;
|
|
||||||
import static android.view.WindowManager.TRANSIT_TO_FRONT;
|
|
||||||
import static android.window.TransitionInfo.FLAG_BACK_GESTURE_ANIMATED;
|
import static android.window.TransitionInfo.FLAG_BACK_GESTURE_ANIMATED;
|
||||||
import static android.window.TransitionInfo.FLAG_CROSS_PROFILE_OWNER_THUMBNAIL;
|
import static android.window.TransitionInfo.FLAG_CROSS_PROFILE_OWNER_THUMBNAIL;
|
||||||
import static android.window.TransitionInfo.FLAG_CROSS_PROFILE_WORK_THUMBNAIL;
|
import static android.window.TransitionInfo.FLAG_CROSS_PROFILE_WORK_THUMBNAIL;
|
||||||
@@ -93,7 +89,6 @@ import android.view.Choreographer;
|
|||||||
import android.view.SurfaceControl;
|
import android.view.SurfaceControl;
|
||||||
import android.view.SurfaceSession;
|
import android.view.SurfaceSession;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.WindowManager.TransitionType;
|
|
||||||
import android.view.animation.AlphaAnimation;
|
import android.view.animation.AlphaAnimation;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.view.animation.Transformation;
|
import android.view.animation.Transformation;
|
||||||
@@ -346,9 +341,10 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final boolean isTask = change.getTaskInfo() != null;
|
final boolean isTask = change.getTaskInfo() != null;
|
||||||
|
final int mode = change.getMode();
|
||||||
boolean isSeamlessDisplayChange = false;
|
boolean isSeamlessDisplayChange = false;
|
||||||
|
|
||||||
if (change.getMode() == TRANSIT_CHANGE && (change.getFlags() & FLAG_IS_DISPLAY) != 0) {
|
if (mode == TRANSIT_CHANGE && change.hasFlags(FLAG_IS_DISPLAY)) {
|
||||||
if (info.getType() == TRANSIT_CHANGE) {
|
if (info.getType() == TRANSIT_CHANGE) {
|
||||||
final int anim = getRotationAnimationHint(change, info, mDisplayController);
|
final int anim = getRotationAnimationHint(change, info, mDisplayController);
|
||||||
isSeamlessDisplayChange = anim == ROTATION_ANIMATION_SEAMLESS;
|
isSeamlessDisplayChange = anim == ROTATION_ANIMATION_SEAMLESS;
|
||||||
@@ -364,7 +360,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (change.getMode() == TRANSIT_CHANGE) {
|
if (mode == TRANSIT_CHANGE) {
|
||||||
// If task is child task, only set position in parent and update crop when needed.
|
// If task is child task, only set position in parent and update crop when needed.
|
||||||
if (isTask && change.getParent() != null
|
if (isTask && change.getParent() != null
|
||||||
&& info.getChange(change.getParent()).getTaskInfo() != null) {
|
&& info.getChange(change.getParent()).getTaskInfo() != null) {
|
||||||
@@ -413,8 +409,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
|||||||
|
|
||||||
// Hide the invisible surface directly without animating it if there is a display
|
// Hide the invisible surface directly without animating it if there is a display
|
||||||
// rotation animation playing.
|
// rotation animation playing.
|
||||||
if (isDisplayRotationAnimationStarted && TransitionUtil.isClosingType(
|
if (isDisplayRotationAnimationStarted && TransitionUtil.isClosingType(mode)) {
|
||||||
change.getMode())) {
|
|
||||||
startTransaction.hide(change.getLeash());
|
startTransaction.hide(change.getLeash());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -430,13 +425,9 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
|||||||
Animation a = loadAnimation(info, change, wallpaperTransit, isDreamTransition);
|
Animation a = loadAnimation(info, change, wallpaperTransit, isDreamTransition);
|
||||||
if (a != null) {
|
if (a != null) {
|
||||||
if (isTask) {
|
if (isTask) {
|
||||||
final @TransitionType int type = info.getType();
|
|
||||||
final boolean isOpenOrCloseTransition = type == TRANSIT_OPEN
|
|
||||||
|| type == TRANSIT_CLOSE
|
|
||||||
|| type == TRANSIT_TO_FRONT
|
|
||||||
|| type == TRANSIT_TO_BACK;
|
|
||||||
final boolean isTranslucent = (change.getFlags() & FLAG_TRANSLUCENT) != 0;
|
final boolean isTranslucent = (change.getFlags() & FLAG_TRANSLUCENT) != 0;
|
||||||
if (isOpenOrCloseTransition && !isTranslucent
|
if (!isTranslucent && TransitionUtil.isOpenOrCloseMode(mode)
|
||||||
|
&& TransitionUtil.isOpenOrCloseMode(info.getType())
|
||||||
&& wallpaperTransit == WALLPAPER_TRANSITION_NONE) {
|
&& wallpaperTransit == WALLPAPER_TRANSITION_NONE) {
|
||||||
// Use the overview background as the background for the animation
|
// Use the overview background as the background for the animation
|
||||||
final Context uiContext = ActivityThread.currentActivityThread()
|
final Context uiContext = ActivityThread.currentActivityThread()
|
||||||
@@ -461,7 +452,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
|||||||
backgroundColorForTransition);
|
backgroundColorForTransition);
|
||||||
|
|
||||||
if (!isTask && a.hasExtension()) {
|
if (!isTask && a.hasExtension()) {
|
||||||
if (!TransitionUtil.isOpeningType(change.getMode())) {
|
if (!TransitionUtil.isOpeningType(mode)) {
|
||||||
// Can screenshot now (before startTransaction is applied)
|
// Can screenshot now (before startTransaction is applied)
|
||||||
edgeExtendWindow(change, a, startTransaction, finishTransaction);
|
edgeExtendWindow(change, a, startTransaction, finishTransaction);
|
||||||
} else {
|
} else {
|
||||||
@@ -472,7 +463,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final Rect clipRect = TransitionUtil.isClosingType(change.getMode())
|
final Rect clipRect = TransitionUtil.isClosingType(mode)
|
||||||
? new Rect(mRotator.getEndBoundsInStartRotation(change))
|
? new Rect(mRotator.getEndBoundsInStartRotation(change))
|
||||||
: new Rect(change.getEndAbsBounds());
|
: new Rect(change.getEndAbsBounds());
|
||||||
clipRect.offsetTo(0, 0);
|
clipRect.offsetTo(0, 0);
|
||||||
|
|||||||
@@ -68,6 +68,12 @@ public class TransitionUtil {
|
|||||||
return type == TRANSIT_CLOSE || type == TRANSIT_TO_BACK;
|
return type == TRANSIT_CLOSE || type == TRANSIT_TO_BACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns {@code true} if the transition is opening or closing mode. */
|
||||||
|
public static boolean isOpenOrCloseMode(@TransitionInfo.TransitionMode int mode) {
|
||||||
|
return mode == TRANSIT_OPEN || mode == TRANSIT_CLOSE
|
||||||
|
|| mode == TRANSIT_TO_FRONT || mode == TRANSIT_TO_BACK;
|
||||||
|
}
|
||||||
|
|
||||||
/** Returns {@code true} if the transition has a display change. */
|
/** Returns {@code true} if the transition has a display change. */
|
||||||
public static boolean hasDisplayChange(@NonNull TransitionInfo info) {
|
public static boolean hasDisplayChange(@NonNull TransitionInfo info) {
|
||||||
for (int i = info.getChanges().size() - 1; i >= 0; --i) {
|
for (int i = info.getChanges().size() - 1; i >= 0; --i) {
|
||||||
|
|||||||
Reference in New Issue
Block a user