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

Commit db16f6fe authored by David Lin's avatar David Lin Committed by Android (Google) Code Review
Browse files

Merge "Improve handling of launching translucent occluding activities." into 24D1-dev

parents af1d87c3 9c7f00ce
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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
  }
}
+8 −1
Original line number Diff line number Diff line
@@ -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.
+24 −0
Original line number Diff line number Diff line
@@ -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(