Disable overriding task animation through windowAnimationStyle attribute.
Bug: 211624533 Test: atest ActivityTransitionTests Change-Id: Ia6844ab4397a54dc510f34f06edc4d8a188db1fc
This commit is contained in:
@@ -25,6 +25,7 @@ import static android.view.WindowManager.TRANSIT_OLD_ACTIVITY_OPEN;
|
||||
import static android.view.WindowManager.TRANSIT_OLD_NONE;
|
||||
import static android.view.WindowManager.TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE;
|
||||
import static android.view.WindowManager.TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN;
|
||||
import static android.view.WindowManager.TRANSIT_OLD_UNSET;
|
||||
import static android.view.WindowManager.TRANSIT_OLD_WALLPAPER_INTRA_CLOSE;
|
||||
import static android.view.WindowManager.TRANSIT_OLD_WALLPAPER_INTRA_OPEN;
|
||||
import static android.view.WindowManager.TRANSIT_OPEN;
|
||||
@@ -261,11 +262,17 @@ public class TransitionAnimation {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Load animation by attribute Id from a specific AnimationStyle resource. */
|
||||
/**
|
||||
* Load animation by attribute Id from a specific AnimationStyle resource.
|
||||
*
|
||||
* @param translucent {@code true} if we're sure that the animation is applied on a translucent
|
||||
* window container, {@code false} otherwise.
|
||||
* @param transit {@link TransitionOldType} for the app transition of this animation, or
|
||||
* {@link TransitionOldType#TRANSIT_OLD_UNSET} if app transition type is unknown.
|
||||
*/
|
||||
@Nullable
|
||||
public Animation loadAnimationAttr(String packageName, int animStyleResId, int animAttr,
|
||||
boolean translucent) {
|
||||
private Animation loadAnimationAttr(String packageName, int animStyleResId, int animAttr,
|
||||
boolean translucent, @TransitionOldType int transit) {
|
||||
if (animStyleResId == 0) {
|
||||
return null;
|
||||
}
|
||||
@@ -281,6 +288,8 @@ public class TransitionAnimation {
|
||||
}
|
||||
if (translucent) {
|
||||
resId = updateToTranslucentAnimIfNeeded(resId);
|
||||
} else if (transit != TRANSIT_OLD_UNSET) {
|
||||
resId = updateToTranslucentAnimIfNeeded(resId, transit);
|
||||
}
|
||||
if (ResourceId.isValid(resId)) {
|
||||
return loadAnimationSafely(context, resId, mTag);
|
||||
@@ -288,6 +297,15 @@ public class TransitionAnimation {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/** Load animation by attribute Id from a specific AnimationStyle resource. */
|
||||
@Nullable
|
||||
public Animation loadAnimationAttr(String packageName, int animStyleResId, int animAttr,
|
||||
boolean translucent) {
|
||||
return loadAnimationAttr(packageName, animStyleResId, animAttr, translucent,
|
||||
TRANSIT_OLD_UNSET);
|
||||
}
|
||||
|
||||
/** Load animation by attribute Id from android package. */
|
||||
@Nullable
|
||||
public Animation loadDefaultAnimationAttr(int animAttr, boolean translucent) {
|
||||
@@ -295,6 +313,13 @@ public class TransitionAnimation {
|
||||
translucent);
|
||||
}
|
||||
|
||||
/** Load animation by attribute Id from android package. */
|
||||
@Nullable
|
||||
public Animation loadDefaultAnimationAttr(int animAttr, @TransitionOldType int transit) {
|
||||
return loadAnimationAttr(DEFAULT_PACKAGE, mDefaultWindowAnimationStyleResId, animAttr,
|
||||
false /* translucent */, transit);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private AttributeCache.Entry getCachedAnimations(LayoutParams lp) {
|
||||
if (mDebug) {
|
||||
|
||||
@@ -2065,6 +2065,12 @@
|
||||
"group": "WM_DEBUG_IME",
|
||||
"at": "com\/android\/server\/wm\/DisplayContent.java"
|
||||
},
|
||||
"-57572004": {
|
||||
"message": "applyAnimation: anim=%s animAttr=0x%x transit=%s isEntrance=%b canCustomizeAppTransition=%b Callers=%s",
|
||||
"level": "VERBOSE",
|
||||
"group": "WM_DEBUG_APP_TRANSITIONS_ANIM",
|
||||
"at": "com\/android\/server\/wm\/AppTransition.java"
|
||||
},
|
||||
"-55185509": {
|
||||
"message": "setFocusedTask: taskId=%d touchedActivity=%s",
|
||||
"level": "DEBUG",
|
||||
@@ -4171,6 +4177,12 @@
|
||||
"group": "WM_DEBUG_ANIM",
|
||||
"at": "com\/android\/server\/wm\/WindowManagerService.java"
|
||||
},
|
||||
"2079410261": {
|
||||
"message": "applyAnimation: override requested, but it is prohibited by policy.",
|
||||
"level": "ERROR",
|
||||
"group": "WM_DEBUG_APP_TRANSITIONS_ANIM",
|
||||
"at": "com\/android\/server\/wm\/AppTransition.java"
|
||||
},
|
||||
"2083556954": {
|
||||
"message": "Set mOrientationChanging of %s",
|
||||
"level": "VERBOSE",
|
||||
@@ -4224,12 +4236,6 @@
|
||||
"level": "VERBOSE",
|
||||
"group": "WM_DEBUG_ORIENTATION",
|
||||
"at": "com\/android\/server\/wm\/DisplayRotation.java"
|
||||
},
|
||||
"2137411379": {
|
||||
"message": "applyAnimation: anim=%s animAttr=0x%x transit=%s isEntrance=%b Callers=%s",
|
||||
"level": "VERBOSE",
|
||||
"group": "WM_DEBUG_APP_TRANSITIONS_ANIM",
|
||||
"at": "com\/android\/server\/wm\/AppTransition.java"
|
||||
}
|
||||
},
|
||||
"groups": {
|
||||
|
||||
@@ -645,9 +645,15 @@ public class AppTransition implements Dump {
|
||||
@Nullable Rect surfaceInsets, @Nullable Rect stableInsets, boolean isVoiceInteraction,
|
||||
boolean freeform, WindowContainer container) {
|
||||
|
||||
if (mNextAppTransitionOverrideRequested
|
||||
&& (container.canCustomizeAppTransition() || mOverrideTaskTransition)) {
|
||||
mNextAppTransitionType = NEXT_TRANSIT_TYPE_CUSTOM;
|
||||
final boolean canCustomizeAppTransition = container.canCustomizeAppTransition();
|
||||
|
||||
if (mNextAppTransitionOverrideRequested) {
|
||||
if (canCustomizeAppTransition || mOverrideTaskTransition) {
|
||||
mNextAppTransitionType = NEXT_TRANSIT_TYPE_CUSTOM;
|
||||
} else {
|
||||
ProtoLog.e(WM_DEBUG_APP_TRANSITIONS_ANIM, "applyAnimation: "
|
||||
+ " override requested, but it is prohibited by policy.");
|
||||
}
|
||||
}
|
||||
|
||||
Animation a;
|
||||
@@ -836,13 +842,15 @@ public class AppTransition implements Dump {
|
||||
: WindowAnimation_activityCloseExitAnimation;
|
||||
break;
|
||||
}
|
||||
a = animAttr != 0 ? loadAnimationAttr(lp, animAttr, transit) : null;
|
||||
|
||||
a = animAttr == 0 ? null : (canCustomizeAppTransition
|
||||
? loadAnimationAttr(lp, animAttr, transit)
|
||||
: mTransitionAnimation.loadDefaultAnimationAttr(animAttr, transit));
|
||||
ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM,
|
||||
"applyAnimation: anim=%s animAttr=0x%x transit=%s isEntrance=%b "
|
||||
+ "Callers=%s",
|
||||
+ " canCustomizeAppTransition=%b Callers=%s",
|
||||
a, animAttr, appTransitionOldToString(transit), enter,
|
||||
Debug.getCallers(3));
|
||||
canCustomizeAppTransition, Debug.getCallers(3));
|
||||
}
|
||||
setAppTransitionFinishedCallbackIfNeeded(a);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user