Merge "Update WM Extensions aar for animation background color" into tm-qpr-dev

This commit is contained in:
TreeHugger Robot
2023-02-14 06:38:08 +00:00
committed by Android (Google) Code Review
4 changed files with 24 additions and 10 deletions

View File

@@ -33,6 +33,13 @@ public final class TaskFragmentAnimationParams implements Parcelable {
public static final TaskFragmentAnimationParams DEFAULT =
new TaskFragmentAnimationParams.Builder().build();
/**
* The default value for animation background color, which means to use the theme window
* background color.
*/
@ColorInt
public static final int DEFAULT_ANIMATION_BACKGROUND_COLOR = 0;
@ColorInt
private final int mAnimationBackgroundColor;
@@ -104,12 +111,13 @@ public final class TaskFragmentAnimationParams implements Parcelable {
public static final class Builder {
@ColorInt
private int mAnimationBackgroundColor = 0;
private int mAnimationBackgroundColor = DEFAULT_ANIMATION_BACKGROUND_COLOR;
/**
* Sets the {@link ColorInt} to use for the background during the animation with this
* TaskFragment if the animation requires a background. The default value is
* {@code 0}, which is to use the theme window background.
* {@link #DEFAULT_ANIMATION_BACKGROUND_COLOR}, which is to use the theme window background
* color.
*
* @param color a packed color int, {@code AARRGGBB}, for the animation background color.
* @return this {@link Builder}.

View File

@@ -45,6 +45,7 @@ import static android.view.WindowManager.TRANSIT_TO_FRONT;
import static android.view.WindowManager.TransitionFlags;
import static android.view.WindowManager.TransitionType;
import static android.view.WindowManager.transitTypeToString;
import static android.window.TaskFragmentAnimationParams.DEFAULT_ANIMATION_BACKGROUND_COLOR;
import static android.window.TransitionInfo.FLAG_DISPLAY_HAS_ALERT_WINDOWS;
import static android.window.TransitionInfo.FLAG_FILLS_TASK;
import static android.window.TransitionInfo.FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY;
@@ -1736,7 +1737,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
? activityRecord.getOrganizedTaskFragment()
: taskFragment.getOrganizedTaskFragment();
if (organizedTf != null && organizedTf.getAnimationParams()
.getAnimationBackgroundColor() != 0) {
.getAnimationBackgroundColor() != DEFAULT_ANIMATION_BACKGROUND_COLOR) {
// This window is embedded and has an animation background color set on the
// TaskFragment. Pass this color with this window, so the handler can use it as
// the animation background color if needed,
@@ -1748,10 +1749,11 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
final Task parentTask = activityRecord != null
? activityRecord.getTask()
: taskFragment.getTask();
backgroundColor = ColorUtils.setAlphaComponent(
parentTask.getTaskDescription().getBackgroundColor(), 255);
backgroundColor = parentTask.getTaskDescription().getBackgroundColor();
}
change.setBackgroundColor(backgroundColor);
// Set to opaque for animation background to prevent it from exposing the blank
// background or content below.
change.setBackgroundColor(ColorUtils.setAlphaComponent(backgroundColor, 255));
}
change.setRotation(info.mRotation, endRotation);

View File

@@ -33,6 +33,7 @@ import static android.os.UserHandle.USER_NULL;
import static android.view.SurfaceControl.Transaction;
import static android.view.WindowManager.LayoutParams.INVALID_WINDOW_TYPE;
import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.window.TaskFragmentAnimationParams.DEFAULT_ANIMATION_BACKGROUND_COLOR;
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_ANIM;
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_APP_TRANSITIONS;
@@ -3168,7 +3169,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
? activityRecord.getOrganizedTaskFragment()
: taskFragment.getOrganizedTaskFragment();
if (organizedTf != null && organizedTf.getAnimationParams()
.getAnimationBackgroundColor() != 0) {
.getAnimationBackgroundColor() != DEFAULT_ANIMATION_BACKGROUND_COLOR) {
// This window is embedded and has an animation background color set on the
// TaskFragment. Pass this color with this window, so the handler can use it
// as the animation background color if needed,
@@ -3181,11 +3182,14 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
final Task parentTask = activityRecord != null
? activityRecord.getTask()
: taskFragment.getTask();
backgroundColorForTransition = ColorUtils.setAlphaComponent(
parentTask.getTaskDescription().getBackgroundColor(), 255);
backgroundColorForTransition = parentTask.getTaskDescription()
.getBackgroundColor();
}
}
animationRunnerBuilder.setTaskBackgroundColor(backgroundColorForTransition);
// Set to opaque for animation background to prevent it from exposing the blank
// background or content below.
animationRunnerBuilder.setTaskBackgroundColor(ColorUtils.setAlphaComponent(
backgroundColorForTransition, 255));
}
animationRunnerBuilder.build()