Only run Animation#setBackdropColor on overriden app transition

Only setBackdropColor from overridePendingAppTransition when mNextAppTransitionType is NEXT_TRANSIT_TYPE_CUSTOM since that is when we want overridePendingAppTransition to take effect. And because mNextAppTransitionBackgroundColor is not cleared after overridePendingAppTransition is called be don't want to continue applying it to other transitions leading to a persistent background color. And in some cases a is null which leads to a NPE if overridePendingAppTransition was called at some point before.

Bug: 229929107
Bug: 229822876
Bug: 222438428

Test: atest CtsWindowManagerDeviceTestCases:ActivityTransitionTests
Change-Id: I39c768f147a0fafec063c3929974c280556997cc
This commit is contained in:
Pablo Gamito
2022-04-27 15:53:53 +00:00
parent 809036e638
commit 96b645d043

View File

@@ -683,6 +683,9 @@ public class AppTransition implements Dump {
} else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_CUSTOM) {
a = mTransitionAnimation.loadAppTransitionAnimation(mNextAppTransitionPackage,
enter ? mNextAppTransitionEnter : mNextAppTransitionExit);
if (mNextAppTransitionBackgroundColor != 0) {
a.setBackdropColor(mNextAppTransitionBackgroundColor);
}
ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM,
"applyAnimation: anim=%s nextAppTransition=ANIM_CUSTOM transit=%s "
+ "isEntrance=%b Callers=%s",
@@ -842,10 +845,6 @@ public class AppTransition implements Dump {
}
setAppTransitionFinishedCallbackIfNeeded(a);
if (mNextAppTransitionBackgroundColor != 0) {
a.setBackdropColor(mNextAppTransitionBackgroundColor);
}
return a;
}