Improve handling of launching translucent occluding activities.
If the window is translucent we don't want to draw a solid color starting view. We also don't want to translate/scale it, since it's transparent.
Bug: 303010980
Test: launch assistant
Flag: com.android.systemui.translucent_occluding_activity_fix
Change-Id: I11e75fe0215ab812d32ccc8aa2758b6fe58d86c3
diff --git a/packages/SystemUI/aconfig/systemui.aconfig b/packages/SystemUI/aconfig/systemui.aconfig
index 23422d1..4bd8b3b 100644
--- a/packages/SystemUI/aconfig/systemui.aconfig
+++ b/packages/SystemUI/aconfig/systemui.aconfig
@@ -1129,3 +1129,13 @@
purpose: PURPOSE_BUGFIX
}
}
+
+flag {
+ name: "translucent_occluding_activity_fix"
+ namespace: "systemui"
+ description: "Fixes occlusion animation for transluent activities"
+ bug: "303010980"
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+}
\ No newline at end of file
diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityTransitionAnimator.kt b/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityTransitionAnimator.kt
index b6e4e9b..c14ee62 100644
--- a/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityTransitionAnimator.kt
+++ b/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityTransitionAnimator.kt
@@ -22,6 +22,7 @@
import android.app.TaskInfo
import android.app.WindowConfiguration
import android.content.ComponentName
+import android.graphics.Color
import android.graphics.Matrix
import android.graphics.Rect
import android.graphics.RectF
@@ -53,6 +54,7 @@
import com.android.internal.annotations.VisibleForTesting
import com.android.internal.policy.ScreenDecorationsUtils
import com.android.systemui.Flags.activityTransitionUseLargestWindow
+import com.android.systemui.Flags.translucentOccludingActivityFix
import com.android.systemui.shared.Flags.returnAnimationFrameworkLibrary
import com.android.wm.shell.shared.IShellTransitions
import com.android.wm.shell.shared.ShellTransitions
@@ -991,7 +993,12 @@
controller.createAnimatorState()
}
val windowBackgroundColor =
- window.taskInfo?.let { callback.getBackgroundColor(it) } ?: window.backgroundColor
+ if (translucentOccludingActivityFix() && window.isTranslucent) {
+ Color.TRANSPARENT
+ } else {
+ window.taskInfo?.let { callback.getBackgroundColor(it) }
+ ?: window.backgroundColor
+ }
// TODO(b/184121838): We should somehow get the top and bottom radius of the window
// instead of recomputing isExpandingFullyAbove here.
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 36b7ed2..544bbce 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -42,6 +42,7 @@
import static com.android.systemui.DejankUtils.whitelistIpcs;
import static com.android.systemui.Flags.notifyPowerManagerUserActivityBackground;
import static com.android.systemui.Flags.refactorGetCurrentUser;
+import static com.android.systemui.Flags.translucentOccludingActivityFix;
import static com.android.systemui.keyguard.ui.viewmodel.LockscreenToDreamingTransitionViewModel.DREAMING_ANIMATION_DURATION_MS;
import android.animation.Animator;
@@ -1036,6 +1037,17 @@
(int) (fullWidth - initialWidth) /* left */,
fullWidth /* right */,
mWindowCornerRadius, mWindowCornerRadius);
+ } else if (translucentOccludingActivityFix()
+ && mOccludingRemoteAnimationTarget != null
+ && mOccludingRemoteAnimationTarget.isTranslucent) {
+ // Animating in a transparent window looks really weird. Just let it be
+ // fullscreen and the app can do an internal animation if it wants to.
+ return new TransitionAnimator.State(
+ 0,
+ fullHeight,
+ 0,
+ fullWidth,
+ 0f, 0f);
} else {
final float initialHeight = fullHeight / 2f;
final float initialWidth = fullWidth / 2f;
@@ -1399,6 +1411,11 @@
private final Lazy<DreamViewModel> mDreamViewModel;
private final Lazy<CommunalTransitionViewModel> mCommunalTransitionViewModel;
private RemoteAnimationTarget mRemoteAnimationTarget;
+
+ /**
+ * The most recent RemoteAnimationTarget provided for an occluding activity animation.
+ */
+ private RemoteAnimationTarget mOccludingRemoteAnimationTarget;
private boolean mShowCommunalWhenUnoccluding = false;
private final Lazy<WindowManagerLockscreenVisibilityManager> mWmLockscreenVisibilityManager;
@@ -3937,6 +3954,13 @@
public void onAnimationStart(int transit, RemoteAnimationTarget[] apps,
RemoteAnimationTarget[] wallpapers, RemoteAnimationTarget[] nonApps,
IRemoteAnimationFinishedCallback finishedCallback) throws RemoteException {
+ // Save mRemoteAnimationTarget for reference in the animation controller. Needs to be
+ // called prior to super.onAnimationStart() since that's the call that eventually asks
+ // the animation controller to configure the animation state.
+ if (apps.length > 0) {
+ mOccludingRemoteAnimationTarget = apps[0];
+ }
+
super.onAnimationStart(transit, apps, wallpapers, nonApps, finishedCallback);
mInteractionJankMonitor.begin(