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

Commit 3fd99e46 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Enable back gesture when a SysUI dialog is showing (1/2)" into tm-dev

parents 07a5716e caa4eced
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -103,8 +103,8 @@ public class QuickStepContract {
    // enabled (since it's used to navigate back within the bubbled app, or to collapse the bubble
    // stack.
    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;
    // A SysUI dialog is showing.
    public static final int SYSUI_STATE_DIALOG_SHOWING = 1 << 15;
    // The one-handed mode is active
    public static final int SYSUI_STATE_ONE_HANDED_ACTIVE = 1 << 16;
    // Allow system gesture no matter the system bar(s) is visible or not
@@ -140,7 +140,7 @@ public class QuickStepContract {
            SYSUI_STATE_TRACING_ENABLED,
            SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED,
            SYSUI_STATE_BUBBLES_EXPANDED,
            SYSUI_STATE_GLOBAL_ACTIONS_SHOWING,
            SYSUI_STATE_DIALOG_SHOWING,
            SYSUI_STATE_ONE_HANDED_ACTIVE,
            SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY,
            SYSUI_STATE_IME_SHOWING,
@@ -166,7 +166,7 @@ public class QuickStepContract {
        str.add((flags & SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED) != 0
                ? "keygrd_occluded" : "");
        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_DIALOG_SHOWING) != 0 ? "dialog_showing" : "");
        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_TRACING_ENABLED) != 0 ? "tracing" : "");
@@ -256,7 +256,7 @@ public class QuickStepContract {
    public static boolean isBackGestureDisabled(int sysuiStateFlags) {
        // Always allow when the bouncer/global actions is showing (even on top of the keyguard)
        if ((sysuiStateFlags & SYSUI_STATE_BOUNCER_SHOWING) != 0
                || (sysuiStateFlags & SYSUI_STATE_GLOBAL_ACTIONS_SHOWING) != 0) {
                || (sysuiStateFlags & SYSUI_STATE_DIALOG_SHOWING) != 0) {
            return false;
        }
        if ((sysuiStateFlags & SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY) != 0) {
+6 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import com.android.settingslib.bluetooth.LocalBluetoothManager;
import com.android.systemui.accessibility.AccessibilityButtonModeObserver;
import com.android.systemui.accessibility.AccessibilityButtonTargetsObserver;
import com.android.systemui.accessibility.floatingmenu.AccessibilityFloatingMenuController;
import com.android.systemui.animation.DialogLaunchAnimator;
import com.android.systemui.appops.AppOpsController;
import com.android.systemui.assist.AssistManager;
import com.android.systemui.broadcast.BroadcastDispatcher;
@@ -107,6 +108,7 @@ import com.android.systemui.statusbar.phone.ScreenOffAnimationController;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBarContentInsetsProvider;
import com.android.systemui.statusbar.phone.StatusBarIconController;
import com.android.systemui.statusbar.phone.SystemUIDialogManager;
import com.android.systemui.statusbar.policy.AccessibilityController;
import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper;
import com.android.systemui.statusbar.policy.BatteryController;
@@ -372,6 +374,8 @@ public class Dependency {
    @Inject Lazy<AmbientState> mAmbientStateLazy;
    @Inject Lazy<GroupMembershipManager> mGroupMembershipManagerLazy;
    @Inject Lazy<GroupExpansionManager> mGroupExpansionManagerLazy;
    @Inject Lazy<SystemUIDialogManager> mSystemUIDialogManagerLazy;
    @Inject Lazy<DialogLaunchAnimator> mDialogLaunchAnimatorLazy;

    @Inject
    public Dependency() {
@@ -592,6 +596,8 @@ public class Dependency {
        mProviders.put(AmbientState.class, mAmbientStateLazy::get);
        mProviders.put(GroupMembershipManager.class, mGroupMembershipManagerLazy::get);
        mProviders.put(GroupExpansionManager.class, mGroupExpansionManagerLazy::get);
        mProviders.put(SystemUIDialogManager.class, mSystemUIDialogManagerLazy::get);
        mProviders.put(DialogLaunchAnimator.class, mDialogLaunchAnimatorLazy::get);

        Dependency.setInstance(this);
    }
+9 −28
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ import static android.view.WindowManagerPolicyConstants.NAV_BAR_MODE_2BUTTON;
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_REQUIRED_AFTER_USER_LOCKDOWN;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_GLOBAL_ACTIONS_SHOWING;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -117,7 +116,6 @@ import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.model.SysUiState;
import com.android.systemui.plugins.GlobalActions.GlobalActionsManager;
import com.android.systemui.plugins.GlobalActionsPanelPlugin;
import com.android.systemui.scrim.ScrimDrawable;
@@ -125,7 +123,6 @@ import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.VibratorHelper;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.phone.SystemUIDialog;
import com.android.systemui.statusbar.phone.SystemUIDialogManager;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.telephony.TelephonyListenerManager;
@@ -200,7 +197,6 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
    private final TelecomManager mTelecomManager;
    private final MetricsLogger mMetricsLogger;
    private final UiEventLogger mUiEventLogger;
    private final SysUiState mSysUiState;

    // Used for RingerModeTracker
    private final LifecycleRegistry mLifecycle = new LifecycleRegistry(this);
@@ -241,7 +237,6 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
    protected Handler mMainHandler;
    private int mSmallestScreenWidthDp;
    private final Optional<StatusBar> mStatusBarOptional;
    private final SystemUIDialogManager mDialogManager;
    private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
    private final DialogLaunchAnimator mDialogLaunchAnimator;

@@ -347,13 +342,11 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
            @Background Executor backgroundExecutor,
            UiEventLogger uiEventLogger,
            RingerModeTracker ringerModeTracker,
            SysUiState sysUiState,
            @Main Handler handler,
            PackageManager packageManager,
            Optional<StatusBar> statusBarOptional,
            KeyguardUpdateMonitor keyguardUpdateMonitor,
            DialogLaunchAnimator dialogLaunchAnimator,
            SystemUIDialogManager dialogManager) {
            DialogLaunchAnimator dialogLaunchAnimator) {
        mContext = context;
        mWindowManagerFuncs = windowManagerFuncs;
        mAudioManager = audioManager;
@@ -379,13 +372,11 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
        mIWindowManager = iWindowManager;
        mBackgroundExecutor = backgroundExecutor;
        mRingerModeTracker = ringerModeTracker;
        mSysUiState = sysUiState;
        mMainHandler = handler;
        mSmallestScreenWidthDp = resources.getConfiguration().smallestScreenWidthDp;
        mStatusBarOptional = statusBarOptional;
        mKeyguardUpdateMonitor = keyguardUpdateMonitor;
        mDialogLaunchAnimator = dialogLaunchAnimator;
        mDialogManager = dialogManager;

        // receive broadcasts
        IntentFilter filter = new IntentFilter();
@@ -682,11 +673,10 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene

        ActionsDialogLite dialog = new ActionsDialogLite(mContext,
                com.android.systemui.R.style.Theme_SystemUI_Dialog_GlobalActionsLite,
                mAdapter, mOverflowAdapter, mSysuiColorExtractor,
                mStatusBarService, mNotificationShadeWindowController,
                mSysUiState, this::onRefresh, mKeyguardShowing, mPowerAdapter, mUiEventLogger,
                mStatusBarOptional, mKeyguardUpdateMonitor, mLockPatternUtils,
                mDialogManager);
                mAdapter, mOverflowAdapter, mSysuiColorExtractor, mStatusBarService,
                mNotificationShadeWindowController, this::onRefresh, mKeyguardShowing,
                mPowerAdapter, mUiEventLogger, mStatusBarOptional, mKeyguardUpdateMonitor,
                mLockPatternUtils);

        dialog.setOnDismissListener(this);
        dialog.setOnShowListener(this);
@@ -2165,7 +2155,6 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
        private boolean mKeyguardShowing;
        protected float mScrimAlpha;
        protected final NotificationShadeWindowController mNotificationShadeWindowController;
        protected final SysUiState mSysUiState;
        private ListPopupWindow mOverflowPopup;
        private Dialog mPowerOptionsDialog;
        protected final Runnable mOnRefreshCallback;
@@ -2226,15 +2215,13 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
                MyOverflowAdapter overflowAdapter,
                SysuiColorExtractor sysuiColorExtractor, IStatusBarService statusBarService,
                NotificationShadeWindowController notificationShadeWindowController,
                SysUiState sysuiState, Runnable onRefreshCallback, boolean keyguardShowing,
                Runnable onRefreshCallback, boolean keyguardShowing,
                MyPowerOptionsAdapter powerAdapter, UiEventLogger uiEventLogger,
                Optional<StatusBar> statusBarOptional,
                KeyguardUpdateMonitor keyguardUpdateMonitor, LockPatternUtils lockPatternUtils,
                SystemUIDialogManager systemUiDialogManager) {
                Optional<StatusBar> statusBarOptional, KeyguardUpdateMonitor keyguardUpdateMonitor,
                LockPatternUtils lockPatternUtils) {
            // We set dismissOnDeviceLock to false because we have a custom broadcast receiver to
            // dismiss this dialog when the device is locked.
            super(context, themeRes, false /* dismissOnDeviceLock */,
                    systemUiDialogManager);
            super(context, themeRes, false /* dismissOnDeviceLock */);
            mContext = context;
            mAdapter = adapter;
            mOverflowAdapter = overflowAdapter;
@@ -2242,7 +2229,6 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
            mColorExtractor = sysuiColorExtractor;
            mStatusBarService = statusBarService;
            mNotificationShadeWindowController = notificationShadeWindowController;
            mSysUiState = sysuiState;
            mOnRefreshCallback = onRefreshCallback;
            mKeyguardShowing = keyguardShowing;
            mUiEventLogger = uiEventLogger;
@@ -2463,8 +2449,6 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
        public void show() {
            super.show();
            mNotificationShadeWindowController.setRequestTopUi(true, TAG);
            mSysUiState.setFlag(SYSUI_STATE_GLOBAL_ACTIONS_SHOWING, true)
                    .commitUpdate(mContext.getDisplayId());

            // By default this dialog windowAnimationStyle is null, and therefore windowAnimations
            // should be equal to 0 which means we need to animate the dialog in-window. If it's not
@@ -2563,9 +2547,6 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
            dismissPowerOptions();

            mNotificationShadeWindowController.setRequestTopUi(false, TAG);
            mSysUiState.setFlag(SYSUI_STATE_GLOBAL_ACTIONS_SHOWING, false)
                    .commitUpdate(mContext.getDisplayId());

            super.dismiss();
        }

+2 −4
Original line number Diff line number Diff line
@@ -56,7 +56,6 @@ import androidx.recyclerview.widget.RecyclerView;

import com.android.systemui.R;
import com.android.systemui.statusbar.phone.SystemUIDialog;
import com.android.systemui.statusbar.phone.SystemUIDialogManager;

/**
 * Base dialog for media output UI
@@ -99,9 +98,8 @@ public abstract class MediaOutputBaseDialog extends SystemUIDialog implements
        }
    };

    public MediaOutputBaseDialog(Context context, MediaOutputController mediaOutputController,
            SystemUIDialogManager dialogManager) {
        super(context, R.style.Theme_SystemUI_Dialog_Media, dialogManager);
    public MediaOutputBaseDialog(Context context, MediaOutputController mediaOutputController) {
        super(context, R.style.Theme_SystemUI_Dialog_Media);

        // Save the context that is wrapped with our theme.
        mContext = getContext();
+3 −7
Original line number Diff line number Diff line
@@ -66,7 +66,6 @@ import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.SystemUIDialogManager;

import java.util.ArrayList;
import java.util.Collection;
@@ -91,7 +90,6 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback {
    private final ShadeController mShadeController;
    private final ActivityStarter mActivityStarter;
    private final DialogLaunchAnimator mDialogLaunchAnimator;
    private final SystemUIDialogManager mDialogManager;
    private final List<MediaDevice> mGroupMediaDevices = new CopyOnWriteArrayList<>();
    private final boolean mAboveStatusbar;
    private final boolean mVolumeAdjustmentForRemoteGroupSessions;
@@ -119,7 +117,7 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback {
            boolean aboveStatusbar, MediaSessionManager mediaSessionManager, LocalBluetoothManager
            lbm, ShadeController shadeController, ActivityStarter starter,
            CommonNotifCollection notifCollection, UiEventLogger uiEventLogger,
            DialogLaunchAnimator dialogLaunchAnimator, SystemUIDialogManager dialogManager) {
            DialogLaunchAnimator dialogLaunchAnimator) {
        mContext = context;
        mPackageName = packageName;
        mMediaSessionManager = mediaSessionManager;
@@ -135,7 +133,6 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback {
        mDialogLaunchAnimator = dialogLaunchAnimator;
        mVolumeAdjustmentForRemoteGroupSessions = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_volumeAdjustmentForRemoteGroupSessions);
        mDialogManager = dialogManager;
        mColorActiveItem = Utils.getColorStateListDefaultColor(mContext,
                R.color.media_dialog_active_item_main_content);
        mColorInactiveItem = Utils.getColorStateListDefaultColor(mContext,
@@ -610,10 +607,9 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback {
        // We show the output group dialog from the output dialog.
        MediaOutputController controller = new MediaOutputController(mContext, mPackageName,
                mAboveStatusbar, mMediaSessionManager, mLocalBluetoothManager, mShadeController,
                mActivityStarter, mNotifCollection, mUiEventLogger, mDialogLaunchAnimator,
                mDialogManager);
                mActivityStarter, mNotifCollection, mUiEventLogger, mDialogLaunchAnimator);
        MediaOutputGroupDialog dialog = new MediaOutputGroupDialog(mContext, mAboveStatusbar,
                controller, mDialogManager);
                controller);
        mDialogLaunchAnimator.showFromView(dialog, mediaOutputDialog);
    }

Loading