diff options
3 files changed, 42 insertions, 1 deletions
diff --git a/packages/SystemUI/aconfig/systemui.aconfig b/packages/SystemUI/aconfig/systemui.aconfig index 9e0f78ce0900..28d7caef2db2 100644 --- a/packages/SystemUI/aconfig/systemui.aconfig +++ b/packages/SystemUI/aconfig/systemui.aconfig @@ -628,3 +628,13 @@ flag { description: "Refactors media code to follow the recommended architecture" bug: "326408371" } + +flag { + name: "translucent_occluding_activity_fix" + namespace: "systemui" + description: "Fixes occlusion animation for transluent activities" + bug: "303010980" + metadata { + purpose: PURPOSE_BUGFIX + } +} 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 ea1cb3441215..a48e5366214f 100644 --- a/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityTransitionAnimator.kt +++ b/packages/SystemUI/animation/src/com/android/systemui/animation/ActivityTransitionAnimator.kt @@ -20,6 +20,7 @@ import android.app.ActivityManager import android.app.ActivityTaskManager import android.app.PendingIntent import android.app.TaskInfo +import android.graphics.Color import android.graphics.Matrix import android.graphics.Rect import android.graphics.RectF @@ -44,6 +45,7 @@ import com.android.app.animation.Interpolators 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 kotlin.math.roundToInt private const val TAG = "ActivityTransitionAnimator" @@ -715,7 +717,12 @@ class ActivityTransitionAnimator( right = windowBounds.right ) 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 9edea279a57f..7a7c6aa2b10f 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -41,6 +41,7 @@ import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STR 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 static com.android.systemui.util.kotlin.JavaAdapterKt.collectFlow; @@ -1028,6 +1029,17 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, (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; @@ -1362,6 +1374,11 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, mDreamingToLockscreenTransitionViewModel; private RemoteAnimationTarget mRemoteAnimationTarget; + /** + * The most recent RemoteAnimationTarget provided for an occluding activity animation. + */ + private RemoteAnimationTarget mOccludingRemoteAnimationTarget; + private final Lazy<WindowManagerLockscreenVisibilityManager> mWmLockscreenVisibilityManager; /** @@ -3866,6 +3883,13 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, 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( |