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

Commit cf68e59c authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Finish the running recents animation when the user locks their device...

Merge "Finish the running recents animation when the user locks their device mid-animation." into main
parents c22a8e74 e2bdd156
Loading
Loading
Loading
Loading
+2 −17
Original line number Diff line number Diff line
@@ -5,9 +5,6 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BACK_DISABLED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_DEVICE_DOZING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_DEVICE_DREAMING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_WAKEFULNESS_MASK;
@@ -16,6 +13,7 @@ import static com.android.systemui.shared.system.QuickStepContract.WAKEFULNESS_A
import android.app.KeyguardManager;

import com.android.launcher3.AbstractFloatingView;
import com.android.quickstep.util.SystemUiFlagUtils;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.QuickStepContract.SystemUiStateFlags;

@@ -26,19 +24,6 @@ import java.io.PrintWriter;
 */
public class TaskbarKeyguardController implements TaskbarControllers.LoggableTaskbarController {

    private static final long KEYGUARD_SYSUI_FLAGS = SYSUI_STATE_BOUNCER_SHOWING
            | SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING | SYSUI_STATE_DEVICE_DOZING
            | SYSUI_STATE_OVERVIEW_DISABLED | SYSUI_STATE_HOME_DISABLED
            | SYSUI_STATE_BACK_DISABLED | SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED
            | SYSUI_STATE_WAKEFULNESS_MASK;

    // If any of these SysUi flags (via QuickstepContract) is set, the device to be considered
    // locked.
    public static final long MASK_ANY_SYSUI_LOCKED = SYSUI_STATE_BOUNCER_SHOWING
            | SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING
            | SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED
            | SYSUI_STATE_DEVICE_DREAMING;

    private final TaskbarActivityContext mContext;
    private long mKeyguardSysuiFlags;
    private boolean mBouncerShowing;
@@ -55,7 +40,7 @@ public class TaskbarKeyguardController implements TaskbarControllers.LoggableTas
    }

    public void updateStateForSysuiFlags(@SystemUiStateFlags long systemUiStateFlags) {
        long interestingKeyguardFlags = systemUiStateFlags & KEYGUARD_SYSUI_FLAGS;
        long interestingKeyguardFlags = systemUiStateFlags & SystemUiFlagUtils.KEYGUARD_SYSUI_FLAGS;
        if (interestingKeyguardFlags == mKeyguardSysuiFlags) {
            // No change in keyguard relevant flags
            return;
+2 −3
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@
package com.android.launcher3.taskbar;

import static com.android.app.animation.Interpolators.EMPHASIZED;
import static com.android.launcher3.taskbar.TaskbarKeyguardController.MASK_ANY_SYSUI_LOCKED;
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_APP;
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_OVERVIEW;
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_STASHED_LAUNCHER_STATE;
@@ -51,6 +50,7 @@ import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.launcher3.util.MultiPropertyFactory.MultiProperty;
import com.android.quickstep.RecentsAnimationCallbacks;
import com.android.quickstep.RecentsAnimationController;
import com.android.quickstep.util.SystemUiFlagUtils;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.animation.ViewRootSync;
import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -343,8 +343,7 @@ public class TaskbarLauncherStateController {
                    prevIsAwake && hasAnyFlag(FLAGS_LAUNCHER_ACTIVE));
        }

        boolean isDeviceLocked = hasAnyFlag(systemUiStateFlags, MASK_ANY_SYSUI_LOCKED);
        updateStateForFlag(FLAG_DEVICE_LOCKED, isDeviceLocked);
        updateStateForFlag(FLAG_DEVICE_LOCKED, SystemUiFlagUtils.isLocked(systemUiStateFlags));

        // Taskbar is hidden whenever the device is dreaming. The dreaming state includes the
        // interactive dreams, AoD, screen off. Since the SYSUI_STATE_DEVICE_DREAMING only kicks in
+3 −5
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import static com.android.internal.jank.InteractionJankMonitor.Configuration;
import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TRANSIENT_TASKBAR_HIDE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TRANSIENT_TASKBAR_SHOW;
import static com.android.launcher3.taskbar.TaskbarKeyguardController.MASK_ANY_SYSUI_LOCKED;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.launcher3.util.FlagDebugUtils.appendFlag;
import static com.android.launcher3.util.FlagDebugUtils.formatFlagChange;
@@ -35,7 +34,6 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_I
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_IME_SWITCHER_SHOWING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_VISIBLE;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_GOING_AWAY;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -66,6 +64,7 @@ import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.MultiPropertyFactory.MultiProperty;
import com.android.quickstep.LauncherActivityInterface;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.util.SystemUiFlagUtils;

import java.io.PrintWriter;
import java.lang.annotation.Retention;
@@ -950,9 +949,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
                && DisplayController.isTransientTaskbar(mActivity);
        updateStateForFlag(FLAG_STASHED_SYSUI,
                hasAnyFlag(systemUiStateFlags, SYSUI_STATE_SCREEN_PINNING) || stashForBubbles);
        boolean isLocked = hasAnyFlag(systemUiStateFlags, MASK_ANY_SYSUI_LOCKED)
                && !hasAnyFlag(systemUiStateFlags, SYSUI_STATE_STATUS_BAR_KEYGUARD_GOING_AWAY);
        updateStateForFlag(FLAG_STASHED_DEVICE_LOCKED, isLocked);
        updateStateForFlag(FLAG_STASHED_DEVICE_LOCKED,
                SystemUiFlagUtils.isLocked(systemUiStateFlags));

        mIsImeShowing = hasAnyFlag(systemUiStateFlags, SYSUI_STATE_IME_SHOWING);
        mIsImeSwitcherShowing = hasAnyFlag(systemUiStateFlags, SYSUI_STATE_IME_SWITCHER_SHOWING);
+48 −10
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ import static com.android.quickstep.GestureState.STATE_END_TARGET_ANIMATION_FINI
import static com.android.quickstep.GestureState.STATE_RECENTS_ANIMATION_INITIALIZED;
import static com.android.quickstep.GestureState.STATE_RECENTS_ANIMATION_STARTED;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.START_RECENTS_ANIMATION;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED;

import android.app.ActivityManager;
import android.app.ActivityOptions;
@@ -44,9 +46,11 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.util.DisplayController;
import com.android.quickstep.util.ActiveGestureLog;
import com.android.quickstep.util.SystemUiFlagUtils;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.systemui.shared.system.TaskStackChangeListeners;

@@ -373,20 +377,54 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
        return mCallbacks;
    }

    public void endLiveTile() {
        if (mLastGestureState == null) {
    public void onSystemUiFlagsChanged(@QuickStepContract.SystemUiStateFlags long lastSysUIFlags,
            @QuickStepContract.SystemUiStateFlags long newSysUIFlags) {
        long isShadeExpandedFlagMask =
                SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED | SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
        boolean wasExpanded = hasAnyFlag(lastSysUIFlags, isShadeExpandedFlagMask);
        boolean isExpanded = hasAnyFlag(newSysUIFlags, isShadeExpandedFlagMask);
        if (wasExpanded != isExpanded && isExpanded) {
            // End live tile when expanding the notification panel for the first time from
            // overview.
            if (endLiveTile()) {
                return;
            }
        }

        boolean wasLocked = SystemUiFlagUtils.isLocked(lastSysUIFlags);
        boolean isLocked = SystemUiFlagUtils.isLocked(newSysUIFlags);
        if (wasLocked != isLocked && isLocked) {
            // Finish the running recents animation when locking the device.
            finishRunningRecentsAnimation(
                    mController != null && mController.getFinishTargetIsLauncher());
        }
    }

    private boolean hasAnyFlag(long flags, long flagMask) {
        return (flags & flagMask) != 0;
    }

    /**
     * Switches the {@link RecentsView} to screenshot if in live tile mode.
     *
     * @return true iff the {@link RecentsView} was in live tile mode and was switched to screenshot
     */
    public boolean endLiveTile() {
        if (mLastGestureState == null) {
            return false;
        }
        BaseContainerInterface containerInterface = mLastGestureState.getContainerInterface();
        if (containerInterface.isInLiveTileMode()
                && containerInterface.getCreatedContainer() != null) {
            RecentsView recentsView = containerInterface.getCreatedContainer().getOverviewPanel();
            if (recentsView != null) {
                recentsView.switchToScreenshot(null,
                        () -> recentsView.finishRecentsAnimation(true /* toRecents */,
                                false /* shouldPip */, null));
        if (!containerInterface.isInLiveTileMode()
                || containerInterface.getCreatedContainer() == null) {
            return false;
        }
        RecentsView recentsView = containerInterface.getCreatedContainer().getOverviewPanel();
        if (recentsView == null) {
            return false;
        }
        recentsView.switchToScreenshot(null, () -> recentsView.finishRecentsAnimation(
                true /* toRecents */, false /* shouldPip */, null));
        return true;
    }

    public void setLiveTileCleanUpHandler(Runnable cleanUpHandler) {
+1 −12
Original line number Diff line number Diff line
@@ -47,8 +47,6 @@ import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SY
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SYSUI_PROXY;
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_UNFOLD_ANIMATION_FORWARDER;
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_UNLOCK_ANIMATION_CONTROLLER;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
import static com.android.wm.shell.Flags.enableBubblesLongPressNavHandle;
import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_BACK_ANIMATION;
import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_BUBBLES;
@@ -719,16 +717,7 @@ public class TouchInteractionService extends Service {
            SystemUiProxy.INSTANCE.get(this).setLastSystemUiStateFlags(systemUiStateFlags);
            mOverviewComponentObserver.onSystemUiStateChanged();
            mTaskbarManager.onSystemUiFlagsChanged(systemUiStateFlags);

            long isShadeExpandedFlag =
                    SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED | SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
            boolean wasExpanded = (lastSysUIFlags & isShadeExpandedFlag) != 0;
            boolean isExpanded = (systemUiStateFlags & isShadeExpandedFlag) != 0;
            if (wasExpanded != isExpanded && isExpanded) {
                // End live tile when expanding the notification panel for the first time from
                // overview.
                mTaskAnimationManager.endLiveTile();
            }
            mTaskAnimationManager.onSystemUiFlagsChanged(lastSysUIFlags, systemUiStateFlags);
        }
    }

Loading