Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7080b6a authored by Josh Tsuji's avatar Josh Tsuji Committed by Android Build Coastguard Worker
Browse files

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
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:22bbcfb1dabb95d2a1ec25bec59653c9946d27aa)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a61ffe42e31b1dd08ce0a9af73538fa048d0869d)
Merged-In: I11e75fe0215ab812d32ccc8aa2758b6fe58d86c3
Change-Id: I11e75fe0215ab812d32ccc8aa2758b6fe58d86c3
parent f2e19129
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1105,3 +1105,13 @@ flag {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "translucent_occluding_activity_fix"
  namespace: "systemui"
  description: "Fixes occlusion animation for transluent activities"
  bug: "303010980"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}
+8 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.app.PendingIntent
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.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 com.android.systemui.shared.Flags.returnAnimationFrameworkLibrary
import com.android.wm.shell.shared.IShellTransitions
import com.android.wm.shell.shared.ShellTransitions
@@ -991,7 +993,12 @@ constructor(
                    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.
+24 −0
Original line number Diff line number Diff line
@@ -42,6 +42,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 android.animation.Animator;
@@ -1035,6 +1036,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;
@@ -1398,6 +1410,11 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
    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;
@@ -3930,6 +3947,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(