Merge "Show bg color during ActivityEmbedding change anim for legacy transition" into tm-qpr-dev am: 2d0d492064

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20265109

Change-Id: I999c2a6e635edbe70b15e7e20126fce28abeefc2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Chris Li
2022-10-26 03:46:56 +00:00
committed by Automerger Merge Worker
3 changed files with 32 additions and 9 deletions

View File

@@ -161,7 +161,7 @@ class TaskFragmentAnimationSpec {
// The position should be 0-based as we will post translate in // The position should be 0-based as we will post translate in
// TaskFragmentAnimationAdapter#onAnimationUpdate // TaskFragmentAnimationAdapter#onAnimationUpdate
final Animation endTranslate = new TranslateAnimation(startBounds.left - endBounds.left, 0, final Animation endTranslate = new TranslateAnimation(startBounds.left - endBounds.left, 0,
0, 0); startBounds.top - endBounds.top, 0);
endTranslate.setDuration(CHANGE_ANIMATION_DURATION); endTranslate.setDuration(CHANGE_ANIMATION_DURATION);
endSet.addAnimation(endTranslate); endSet.addAnimation(endTranslate);
// The end leash is resizing, we should update the window crop based on the clip rect. // The end leash is resizing, we should update the window crop based on the clip rect.

View File

@@ -1460,6 +1460,12 @@ public class AppTransition implements Dump {
|| transit == TRANSIT_OLD_ACTIVITY_RELAUNCH; || transit == TRANSIT_OLD_ACTIVITY_RELAUNCH;
} }
static boolean isTaskFragmentTransitOld(@TransitionOldType int transit) {
return transit == TRANSIT_OLD_TASK_FRAGMENT_OPEN
|| transit == TRANSIT_OLD_TASK_FRAGMENT_CLOSE
|| transit == TRANSIT_OLD_TASK_FRAGMENT_CHANGE;
}
static boolean isChangeTransitOld(@TransitionOldType int transit) { static boolean isChangeTransitOld(@TransitionOldType int transit) {
return transit == TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE return transit == TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE
|| transit == TRANSIT_OLD_TASK_FRAGMENT_CHANGE; || transit == TRANSIT_OLD_TASK_FRAGMENT_CHANGE;

View File

@@ -41,6 +41,7 @@ import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_SYNC_ENGINE;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
import static com.android.server.wm.AppTransition.MAX_APP_TRANSITION_DURATION; import static com.android.server.wm.AppTransition.MAX_APP_TRANSITION_DURATION;
import static com.android.server.wm.AppTransition.isActivityTransitOld; import static com.android.server.wm.AppTransition.isActivityTransitOld;
import static com.android.server.wm.AppTransition.isTaskFragmentTransitOld;
import static com.android.server.wm.AppTransition.isTaskTransitOld; import static com.android.server.wm.AppTransition.isTaskTransitOld;
import static com.android.server.wm.DisplayContent.IME_TARGET_LAYERING; import static com.android.server.wm.DisplayContent.IME_TARGET_LAYERING;
import static com.android.server.wm.IdentifierProto.HASH_CODE; import static com.android.server.wm.IdentifierProto.HASH_CODE;
@@ -2985,10 +2986,17 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
// {@link Activity#overridePendingTransition(int, int, int)}. // {@link Activity#overridePendingTransition(int, int, int)}.
@ColorInt int backdropColor = 0; @ColorInt int backdropColor = 0;
if (controller.isFromActivityEmbedding()) { if (controller.isFromActivityEmbedding()) {
if (isChanging) {
// When there are more than one changing containers, it may leave part of the
// screen empty. Show background color to cover that.
showBackdrop = getDisplayContent().mChangingContainers.size() > 1;
} else {
// Check whether or not to show backdrop for open/close transition.
final int animAttr = AppTransition.mapOpenCloseTransitTypes(transit, enter); final int animAttr = AppTransition.mapOpenCloseTransitTypes(transit, enter);
final Animation a = animAttr != 0 final Animation a = animAttr != 0
? appTransition.loadAnimationAttr(lp, animAttr, transit) : null; ? appTransition.loadAnimationAttr(lp, animAttr, transit) : null;
showBackdrop = a != null && a.getShowBackdrop(); showBackdrop = a != null && a.getShowBackdrop();
}
backdropColor = appTransition.getNextAppTransitionBackgroundColor(); backdropColor = appTransition.getNextAppTransitionBackgroundColor();
} }
final Rect localBounds = new Rect(mTmpRect); final Rect localBounds = new Rect(mTmpRect);
@@ -3091,9 +3099,16 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
} }
} }
// Check if the animation requests to show background color for Activity and embedded
// TaskFragment.
final ActivityRecord activityRecord = asActivityRecord(); final ActivityRecord activityRecord = asActivityRecord();
if (activityRecord != null && isActivityTransitOld(transit) final TaskFragment taskFragment = asTaskFragment();
&& adapter.getShowBackground()) { if (adapter.getShowBackground()
// Check if it is Activity transition.
&& ((activityRecord != null && isActivityTransitOld(transit))
// Check if it is embedded TaskFragment transition.
|| (taskFragment != null && taskFragment.isEmbedded()
&& isTaskFragmentTransitOld(transit)))) {
final @ColorInt int backgroundColorForTransition; final @ColorInt int backgroundColorForTransition;
if (adapter.getBackgroundColor() != 0) { if (adapter.getBackgroundColor() != 0) {
// If available use the background color provided through getBackgroundColor // If available use the background color provided through getBackgroundColor
@@ -3103,9 +3118,11 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
// Otherwise default to the window's background color if provided through // Otherwise default to the window's background color if provided through
// the theme as the background color for the animation - the top most window // the theme as the background color for the animation - the top most window
// with a valid background color and showBackground set takes precedence. // with a valid background color and showBackground set takes precedence.
final Task arTask = activityRecord.getTask(); final Task parentTask = activityRecord != null
? activityRecord.getTask()
: taskFragment.getTask();
backgroundColorForTransition = ColorUtils.setAlphaComponent( backgroundColorForTransition = ColorUtils.setAlphaComponent(
arTask.getTaskDescription().getBackgroundColor(), 255); parentTask.getTaskDescription().getBackgroundColor(), 255);
} }
animationRunnerBuilder.setTaskBackgroundColor(backgroundColorForTransition); animationRunnerBuilder.setTaskBackgroundColor(backgroundColorForTransition);
} }