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

Commit f5cfae40 authored by Winson Chung's avatar Winson Chung Committed by Automerger Merge Worker
Browse files

Merge "Add global actions to sysui state for handling with gesture nav" into...

Merge "Add global actions to sysui state for handling with gesture nav" into rvc-dev am: 4b3634f7 am: a77737aa am: ba8f9728

Change-Id: I7bbc0b52464bb1cd0678b722e7e353f05c285094
parents 6d2d05ed ba8f9728
Loading
Loading
Loading
Loading
+8 −3
Original line number Original line Diff line number Diff line
@@ -86,6 +86,8 @@ public class QuickStepContract {
    // enabled (since it's used to navigate back within the bubbled app, or to collapse the bubble
    // enabled (since it's used to navigate back within the bubbled app, or to collapse the bubble
    // stack.
    // stack.
    public static final int SYSUI_STATE_BUBBLES_EXPANDED = 1 << 14;
    public static final int SYSUI_STATE_BUBBLES_EXPANDED = 1 << 14;
    // The global actions dialog is showing
    public static final int SYSUI_STATE_GLOBAL_ACTIONS_SHOWING = 1 << 15;


    @Retention(RetentionPolicy.SOURCE)
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({SYSUI_STATE_SCREEN_PINNING,
    @IntDef({SYSUI_STATE_SCREEN_PINNING,
@@ -102,7 +104,8 @@ public class QuickStepContract {
            SYSUI_STATE_SEARCH_DISABLED,
            SYSUI_STATE_SEARCH_DISABLED,
            SYSUI_STATE_TRACING_ENABLED,
            SYSUI_STATE_TRACING_ENABLED,
            SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED,
            SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED,
            SYSUI_STATE_BUBBLES_EXPANDED
            SYSUI_STATE_BUBBLES_EXPANDED,
            SYSUI_STATE_GLOBAL_ACTIONS_SHOWING
    })
    })
    public @interface SystemUiStateFlags {}
    public @interface SystemUiStateFlags {}


@@ -119,6 +122,7 @@ public class QuickStepContract {
        str.add((flags & SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED) != 0
        str.add((flags & SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED) != 0
                ? "keygrd_occluded" : "");
                ? "keygrd_occluded" : "");
        str.add((flags & SYSUI_STATE_BOUNCER_SHOWING) != 0 ? "bouncer_visible" : "");
        str.add((flags & SYSUI_STATE_BOUNCER_SHOWING) != 0 ? "bouncer_visible" : "");
        str.add((flags & SYSUI_STATE_GLOBAL_ACTIONS_SHOWING) != 0 ? "global_actions" : "");
        str.add((flags & SYSUI_STATE_A11Y_BUTTON_CLICKABLE) != 0 ? "a11y_click" : "");
        str.add((flags & SYSUI_STATE_A11Y_BUTTON_CLICKABLE) != 0 ? "a11y_click" : "");
        str.add((flags & SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE) != 0 ? "a11y_long_click" : "");
        str.add((flags & SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE) != 0 ? "a11y_long_click" : "");
        str.add((flags & SYSUI_STATE_TRACING_ENABLED) != 0 ? "tracing" : "");
        str.add((flags & SYSUI_STATE_TRACING_ENABLED) != 0 ? "tracing" : "");
@@ -192,8 +196,9 @@ public class QuickStepContract {
     * disabled.
     * disabled.
     */
     */
    public static boolean isBackGestureDisabled(int sysuiStateFlags) {
    public static boolean isBackGestureDisabled(int sysuiStateFlags) {
        // Always allow when the bouncer is showing (even on top of the keyguard)
        // Always allow when the bouncer/global actions is showing (even on top of the keyguard)
        if ((sysuiStateFlags & SYSUI_STATE_BOUNCER_SHOWING) != 0) {
        if ((sysuiStateFlags & SYSUI_STATE_BOUNCER_SHOWING) != 0
                || (sysuiStateFlags & SYSUI_STATE_GLOBAL_ACTIONS_SHOWING) != 0) {
            return false;
            return false;
        }
        }
        // Disable when in immersive, or the notifications are interactive
        // Disable when in immersive, or the notifications are interactive
+15 −3
Original line number Original line Diff line number Diff line
@@ -23,6 +23,7 @@ import static android.view.WindowManager.TAKE_SCREENSHOT_FULLSCREEN;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.SOME_AUTH_REQUIRED_AFTER_USER_REQUEST;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.SOME_AUTH_REQUIRED_AFTER_USER_REQUEST;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_NOT_REQUIRED;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_NOT_REQUIRED;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_GLOBAL_ACTIONS_SHOWING;


import android.animation.Animator;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorListenerAdapter;
@@ -124,9 +125,11 @@ import com.android.systemui.controls.management.ControlsListingController;
import com.android.systemui.controls.ui.ControlsUiController;
import com.android.systemui.controls.ui.ControlsUiController;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.model.SysUiState;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.GlobalActions.GlobalActionsManager;
import com.android.systemui.plugins.GlobalActions.GlobalActionsManager;
import com.android.systemui.plugins.GlobalActionsPanelPlugin;
import com.android.systemui.plugins.GlobalActionsPanelPlugin;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.statusbar.BlurUtils;
import com.android.systemui.statusbar.BlurUtils;
import com.android.systemui.statusbar.NotificationShadeDepthController;
import com.android.systemui.statusbar.NotificationShadeDepthController;
import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
@@ -200,6 +203,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
    private final UiEventLogger mUiEventLogger;
    private final UiEventLogger mUiEventLogger;
    private final NotificationShadeDepthController mDepthController;
    private final NotificationShadeDepthController mDepthController;
    private final BlurUtils mBlurUtils;
    private final BlurUtils mBlurUtils;
    private final SysUiState mSysUiState;


    // Used for RingerModeTracker
    // Used for RingerModeTracker
    private final LifecycleRegistry mLifecycle = new LifecycleRegistry(this);
    private final LifecycleRegistry mLifecycle = new LifecycleRegistry(this);
@@ -301,7 +305,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
            @Background Executor backgroundExecutor,
            @Background Executor backgroundExecutor,
            ControlsListingController controlsListingController,
            ControlsListingController controlsListingController,
            ControlsController controlsController, UiEventLogger uiEventLogger,
            ControlsController controlsController, UiEventLogger uiEventLogger,
            RingerModeTracker ringerModeTracker, @Main Handler handler) {
            RingerModeTracker ringerModeTracker, SysUiState sysUiState, @Main Handler handler) {
        mContext = new ContextThemeWrapper(context, com.android.systemui.R.style.qs_theme);
        mContext = new ContextThemeWrapper(context, com.android.systemui.R.style.qs_theme);
        mWindowManagerFuncs = windowManagerFuncs;
        mWindowManagerFuncs = windowManagerFuncs;
        mAudioManager = audioManager;
        mAudioManager = audioManager;
@@ -330,6 +334,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
        mBlurUtils = blurUtils;
        mBlurUtils = blurUtils;
        mRingerModeTracker = ringerModeTracker;
        mRingerModeTracker = ringerModeTracker;
        mControlsController = controlsController;
        mControlsController = controlsController;
        mSysUiState = sysUiState;
        mMainHandler = handler;
        mMainHandler = handler;


        // receive broadcasts
        // receive broadcasts
@@ -638,7 +643,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
        ActionsDialog dialog = new ActionsDialog(mContext, mAdapter, mOverflowAdapter,
        ActionsDialog dialog = new ActionsDialog(mContext, mAdapter, mOverflowAdapter,
                getWalletPanelViewController(), mDepthController, mSysuiColorExtractor,
                getWalletPanelViewController(), mDepthController, mSysuiColorExtractor,
                mStatusBarService, mNotificationShadeWindowController,
                mStatusBarService, mNotificationShadeWindowController,
                shouldShowControls() ? mControlsUiController : null, mBlurUtils,
                shouldShowControls() ? mControlsUiController : null, mBlurUtils, mSysUiState,
                shouldUseControlsLayout(), this::onRotate, mKeyguardShowing);
                shouldUseControlsLayout(), this::onRotate, mKeyguardShowing);
        dialog.setCanceledOnTouchOutside(false); // Handled by the custom class.
        dialog.setCanceledOnTouchOutside(false); // Handled by the custom class.
        dialog.setOnDismissListener(this);
        dialog.setOnDismissListener(this);
@@ -1920,6 +1925,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
        private final NotificationShadeWindowController mNotificationShadeWindowController;
        private final NotificationShadeWindowController mNotificationShadeWindowController;
        private final NotificationShadeDepthController mDepthController;
        private final NotificationShadeDepthController mDepthController;
        private final BlurUtils mBlurUtils;
        private final BlurUtils mBlurUtils;
        private final SysUiState mSysUiState;
        private final boolean mUseControlsLayout;
        private final boolean mUseControlsLayout;
        private ListPopupWindow mOverflowPopup;
        private ListPopupWindow mOverflowPopup;
        private final Runnable mOnRotateCallback;
        private final Runnable mOnRotateCallback;
@@ -1934,7 +1940,8 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
                SysuiColorExtractor sysuiColorExtractor, IStatusBarService statusBarService,
                SysuiColorExtractor sysuiColorExtractor, IStatusBarService statusBarService,
                NotificationShadeWindowController notificationShadeWindowController,
                NotificationShadeWindowController notificationShadeWindowController,
                ControlsUiController controlsUiController, BlurUtils blurUtils,
                ControlsUiController controlsUiController, BlurUtils blurUtils,
                boolean useControlsLayout, Runnable onRotateCallback, boolean keyguardShowing) {
                SysUiState sysuiState, boolean useControlsLayout, Runnable onRotateCallback,
                boolean keyguardShowing) {
            super(context, com.android.systemui.R.style.Theme_SystemUI_Dialog_GlobalActions);
            super(context, com.android.systemui.R.style.Theme_SystemUI_Dialog_GlobalActions);
            mContext = context;
            mContext = context;
            mAdapter = adapter;
            mAdapter = adapter;
@@ -1945,6 +1952,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
            mNotificationShadeWindowController = notificationShadeWindowController;
            mNotificationShadeWindowController = notificationShadeWindowController;
            mControlsUiController = controlsUiController;
            mControlsUiController = controlsUiController;
            mBlurUtils = blurUtils;
            mBlurUtils = blurUtils;
            mSysUiState = sysuiState;
            mUseControlsLayout = useControlsLayout;
            mUseControlsLayout = useControlsLayout;
            mOnRotateCallback = onRotateCallback;
            mOnRotateCallback = onRotateCallback;
            mKeyguardShowing = keyguardShowing;
            mKeyguardShowing = keyguardShowing;
@@ -2203,6 +2211,8 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
            mShowing = true;
            mShowing = true;
            mHadTopUi = mNotificationShadeWindowController.getForceHasTopUi();
            mHadTopUi = mNotificationShadeWindowController.getForceHasTopUi();
            mNotificationShadeWindowController.setForceHasTopUi(true);
            mNotificationShadeWindowController.setForceHasTopUi(true);
            mSysUiState.setFlag(SYSUI_STATE_GLOBAL_ACTIONS_SHOWING, true)
                    .commitUpdate(mContext.getDisplayId());


            ViewGroup root = (ViewGroup) mGlobalActionsLayout.getRootView();
            ViewGroup root = (ViewGroup) mGlobalActionsLayout.getRootView();
            root.setOnApplyWindowInsetsListener((v, windowInsets) -> {
            root.setOnApplyWindowInsetsListener((v, windowInsets) -> {
@@ -2303,6 +2313,8 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
            if (mControlsUiController != null) mControlsUiController.hide();
            if (mControlsUiController != null) mControlsUiController.hide();
            mNotificationShadeWindowController.setForceHasTopUi(mHadTopUi);
            mNotificationShadeWindowController.setForceHasTopUi(mHadTopUi);
            mDepthController.updateGlobalDialogVisibility(0, null /* view */);
            mDepthController.updateGlobalDialogVisibility(0, null /* view */);
            mSysUiState.setFlag(SYSUI_STATE_GLOBAL_ACTIONS_SHOWING, false)
                    .commitUpdate(mContext.getDisplayId());
            super.dismiss();
            super.dismiss();
        }
        }


+3 −0
Original line number Original line Diff line number Diff line
@@ -53,6 +53,7 @@ import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.controls.controller.ControlsController;
import com.android.systemui.controls.controller.ControlsController;
import com.android.systemui.controls.management.ControlsListingController;
import com.android.systemui.controls.management.ControlsListingController;
import com.android.systemui.controls.ui.ControlsUiController;
import com.android.systemui.controls.ui.ControlsUiController;
import com.android.systemui.model.SysUiState;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.GlobalActions;
import com.android.systemui.plugins.GlobalActions;
import com.android.systemui.statusbar.BlurUtils;
import com.android.systemui.statusbar.BlurUtils;
@@ -107,6 +108,7 @@ public class GlobalActionsDialogTest extends SysuiTestCase {
    @Mock private UiEventLogger mUiEventLogger;
    @Mock private UiEventLogger mUiEventLogger;
    @Mock private RingerModeTracker mRingerModeTracker;
    @Mock private RingerModeTracker mRingerModeTracker;
    @Mock private RingerModeLiveData mRingerModeLiveData;
    @Mock private RingerModeLiveData mRingerModeLiveData;
    @Mock private SysUiState mSysUiState;
    @Mock private Handler mHandler;
    @Mock private Handler mHandler;


    private TestableLooper mTestableLooper;
    private TestableLooper mTestableLooper;
@@ -150,6 +152,7 @@ public class GlobalActionsDialogTest extends SysuiTestCase {
                mControlsController,
                mControlsController,
                mUiEventLogger,
                mUiEventLogger,
                mRingerModeTracker,
                mRingerModeTracker,
                mSysUiState,
                mHandler
                mHandler
        );
        );
        mGlobalActionsDialog.setZeroDialogPressDelayForTesting();
        mGlobalActionsDialog.setZeroDialogPressDelayForTesting();