Merge "Override animation background with app override color" into tm-qpr-dev

This commit is contained in:
TreeHugger Robot
2023-01-05 16:34:29 +00:00
committed by Android (Google) Code Review
2 changed files with 40 additions and 15 deletions

View File

@@ -1731,13 +1731,26 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
} }
if (activityRecord != null || (taskFragment != null && taskFragment.isEmbedded())) { if (activityRecord != null || (taskFragment != null && taskFragment.isEmbedded())) {
// Set background color to Task theme color for activity and embedded TaskFragment final int backgroundColor;
// in case we want to show background during the animation. final TaskFragment organizedTf = activityRecord != null
final Task parentTask = activityRecord != null ? activityRecord.getOrganizedTaskFragment()
? activityRecord.getTask() : taskFragment.getOrganizedTaskFragment();
: taskFragment.getTask(); if (organizedTf != null && organizedTf.getAnimationParams()
final int backgroundColor = ColorUtils.setAlphaComponent( .getAnimationBackgroundColor() != 0) {
parentTask.getTaskDescription().getBackgroundColor(), 255); // 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,
backgroundColor = organizedTf.getAnimationParams()
.getAnimationBackgroundColor();
} else {
// Set background color to Task theme color for activity and embedded
// TaskFragment in case we want to show background during the animation.
final Task parentTask = activityRecord != null
? activityRecord.getTask()
: taskFragment.getTask();
backgroundColor = ColorUtils.setAlphaComponent(
parentTask.getTaskDescription().getBackgroundColor(), 255);
}
change.setBackgroundColor(backgroundColor); change.setBackgroundColor(backgroundColor);
} }

View File

@@ -3145,14 +3145,26 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
// which if set originates from a call to overridePendingAppTransition. // which if set originates from a call to overridePendingAppTransition.
backgroundColorForTransition = adapter.getBackgroundColor(); backgroundColorForTransition = adapter.getBackgroundColor();
} else { } else {
// Otherwise default to the window's background color if provided through final TaskFragment organizedTf = activityRecord != null
// the theme as the background color for the animation - the top most window ? activityRecord.getOrganizedTaskFragment()
// with a valid background color and showBackground set takes precedence. : taskFragment.getOrganizedTaskFragment();
final Task parentTask = activityRecord != null if (organizedTf != null && organizedTf.getAnimationParams()
? activityRecord.getTask() .getAnimationBackgroundColor() != 0) {
: taskFragment.getTask(); // This window is embedded and has an animation background color set on the
backgroundColorForTransition = ColorUtils.setAlphaComponent( // TaskFragment. Pass this color with this window, so the handler can use it
parentTask.getTaskDescription().getBackgroundColor(), 255); // as the animation background color if needed,
backgroundColorForTransition = organizedTf.getAnimationParams()
.getAnimationBackgroundColor();
} else {
// Otherwise default to the window's background color if provided through
// the theme as the background color for the animation - the top most window
// with a valid background color and showBackground set takes precedence.
final Task parentTask = activityRecord != null
? activityRecord.getTask()
: taskFragment.getTask();
backgroundColorForTransition = ColorUtils.setAlphaComponent(
parentTask.getTaskDescription().getBackgroundColor(), 255);
}
} }
animationRunnerBuilder.setTaskBackgroundColor(backgroundColorForTransition); animationRunnerBuilder.setTaskBackgroundColor(backgroundColorForTransition);
} }