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

Commit 6c74a6cc authored by Justin Weir's avatar Justin Weir Committed by Android (Google) Code Review
Browse files

Merge "Revert^2 "Long press Lockscreen status bar expands the shade"" into main

parents 81b28b16 dddab5ba
Loading
Loading
Loading
Loading
+16 −10
Original line number Diff line number Diff line
@@ -3109,14 +3109,20 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
        if (isTracking()) {
            onTrackingStopped(true);
        }
        if (isExpanded() && !mQsController.getExpanded()) {
        if (isExpanded() && mBarState != KEYGUARD && !mQsController.getExpanded()) {
            mShadeLog.d("Status Bar was long pressed. Expanding to QS.");
            expandToQs();
        } else {
            if (mBarState == KEYGUARD) {
                mShadeLog.d("Lockscreen Status Bar was long pressed. Expanding to Notifications.");
                mLockscreenShadeTransitionController.goToLockedShade(
                        /* expandedView= */null, /* needsQSAnimation= */false);
            } else {
                mShadeLog.d("Status Bar was long pressed. Expanding to Notifications.");
                expandToNotifications();
            }
        }
    }

    @Override
    public int getBarState() {
@@ -5091,13 +5097,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
            }
            boolean handled = mHeadsUpTouchHelper.onTouchEvent(event);

            if (!mHeadsUpTouchHelper.isTrackingHeadsUp() && mQsController.handleTouch(
                    event, isFullyCollapsed(), isShadeOrQsHeightAnimationRunning())) {
                if (event.getActionMasked() != MotionEvent.ACTION_MOVE) {
                    mShadeLog.logMotionEvent(event, "onTouch: handleQsTouch handled event");
                }
                return true;
            }
            // This touch session has already resulted in shade expansion. Ignore everything else.
            if (ShadeExpandsOnStatusBarLongPress.isEnabled()
                    && event.getActionMasked() != MotionEvent.ACTION_DOWN
@@ -5105,6 +5104,13 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
                mShadeLog.d("Touch has same down time as Status Bar long press. Ignoring.");
                return false;
            }
            if (!mHeadsUpTouchHelper.isTrackingHeadsUp() && mQsController.handleTouch(
                    event, isFullyCollapsed(), isShadeOrQsHeightAnimationRunning())) {
                if (event.getActionMasked() != MotionEvent.ACTION_MOVE) {
                    mShadeLog.logMotionEvent(event, "onTouch: handleQsTouch handled event");
                }
                return true;
            }
            if (event.getActionMasked() == MotionEvent.ACTION_DOWN && isFullyCollapsed()) {
                mMetricsLogger.count(COUNTER_PANEL_OPEN, 1);
                handled = true;
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ import javax.inject.Inject

/** Accepts touch events, detects long press, and calls ShadeViewController#onStatusBarLongPress. */
@SysUISingleton
class LongPressGestureDetector
class StatusBarLongPressGestureDetector
@Inject
constructor(context: Context, val shadeViewController: ShadeViewController) {
    val gestureDetector =
+10 −0
Original line number Diff line number Diff line
@@ -171,12 +171,14 @@ import com.android.systemui.shade.NotificationShadeWindowView;
import com.android.systemui.shade.NotificationShadeWindowViewController;
import com.android.systemui.shade.QuickSettingsController;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeExpandsOnStatusBarLongPress;
import com.android.systemui.shade.ShadeExpansionChangeEvent;
import com.android.systemui.shade.ShadeExpansionListener;
import com.android.systemui.shade.ShadeExpansionStateManager;
import com.android.systemui.shade.ShadeLogger;
import com.android.systemui.shade.ShadeSurface;
import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.shade.StatusBarLongPressGestureDetector;
import com.android.systemui.shared.recents.utilities.Utilities;
import com.android.systemui.shared.statusbar.phone.BarTransitions;
import com.android.systemui.statusbar.AutoHideUiElement;
@@ -366,6 +368,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {

    private PhoneStatusBarViewController mPhoneStatusBarViewController;
    private PhoneStatusBarTransitions mStatusBarTransitions;
    private final Provider<StatusBarLongPressGestureDetector> mStatusBarLongPressGestureDetector;
    private final AuthRippleController mAuthRippleController;
    @WindowVisibleState private int mStatusBarWindowState = WINDOW_STATE_SHOWING;
    private final NotificationShadeWindowController mNotificationShadeWindowController;
@@ -671,6 +674,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
            ShadeController shadeController,
            WindowRootViewVisibilityInteractor windowRootViewVisibilityInteractor,
            StatusBarKeyguardViewManager statusBarKeyguardViewManager,
            Provider<StatusBarLongPressGestureDetector> statusBarLongPressGestureDetector,
            ViewMediatorCallback viewMediatorCallback,
            InitController initController,
            @Named(TIME_TICK_HANDLER_NAME) Handler timeTickHandler,
@@ -778,6 +782,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        mShadeController = shadeController;
        mWindowRootViewVisibilityInteractor = windowRootViewVisibilityInteractor;
        mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
        mStatusBarLongPressGestureDetector = statusBarLongPressGestureDetector;
        mKeyguardViewMediatorCallback = viewMediatorCallback;
        mInitController = initController;
        mPluginDependencyProvider = pluginDependencyProvider;
@@ -1527,6 +1532,11 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
                // to touch outside the customizer to close it, such as on the status or nav bar.
                mShadeController.onStatusBarTouch(event);
            }
            if (ShadeExpandsOnStatusBarLongPress.isEnabled()
                    && mStatusBarStateController.getState() == StatusBarState.KEYGUARD) {
                mStatusBarLongPressGestureDetector.get().handleTouch(event);
            }

            return getNotificationShadeWindowView().onTouchEvent(event);
        };
    }
+8 −6
Original line number Diff line number Diff line
@@ -39,8 +39,8 @@ import com.android.systemui.Dependency;
import com.android.systemui.Flags;
import com.android.systemui.Gefingerpoken;
import com.android.systemui.res.R;
import com.android.systemui.shade.LongPressGestureDetector;
import com.android.systemui.shade.ShadeExpandsOnStatusBarLongPress;
import com.android.systemui.shade.StatusBarLongPressGestureDetector;
import com.android.systemui.statusbar.phone.userswitcher.StatusBarUserSwitcherContainer;
import com.android.systemui.statusbar.window.StatusBarWindowControllerStore;
import com.android.systemui.user.ui.binder.StatusBarUserChipViewBinder;
@@ -69,7 +69,7 @@ public class PhoneStatusBarView extends FrameLayout {
    private InsetsFetcher mInsetsFetcher;
    private int mDensity;
    private float mFontScale;
    private LongPressGestureDetector mLongPressGestureDetector;
    private StatusBarLongPressGestureDetector mStatusBarLongPressGestureDetector;

    /**
     * Draw this many pixels into the left/right side of the cutout to optimally use the space
@@ -81,9 +81,10 @@ public class PhoneStatusBarView extends FrameLayout {
        mStatusBarWindowControllerStore = Dependency.get(StatusBarWindowControllerStore.class);
    }

    void setLongPressGestureDetector(LongPressGestureDetector longPressGestureDetector) {
    void setLongPressGestureDetector(
            StatusBarLongPressGestureDetector statusBarLongPressGestureDetector) {
        if (ShadeExpandsOnStatusBarLongPress.isEnabled()) {
            mLongPressGestureDetector = longPressGestureDetector;
            mStatusBarLongPressGestureDetector = statusBarLongPressGestureDetector;
        }
    }

@@ -207,8 +208,9 @@ public class PhoneStatusBarView extends FrameLayout {

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (ShadeExpandsOnStatusBarLongPress.isEnabled() && mLongPressGestureDetector != null) {
            mLongPressGestureDetector.handleTouch(event);
        if (ShadeExpandsOnStatusBarLongPress.isEnabled()
                && mStatusBarLongPressGestureDetector != null) {
            mStatusBarLongPressGestureDetector.handleTouch(event);
        }
        if (mTouchEventHandler == null) {
            Log.w(
+5 −5
Original line number Diff line number Diff line
@@ -34,11 +34,11 @@ import com.android.systemui.plugins.DarkIconDispatcher
import com.android.systemui.res.R
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.scene.ui.view.WindowRootView
import com.android.systemui.shade.LongPressGestureDetector
import com.android.systemui.shade.ShadeController
import com.android.systemui.shade.ShadeExpandsOnStatusBarLongPress
import com.android.systemui.shade.ShadeLogger
import com.android.systemui.shade.ShadeViewController
import com.android.systemui.shade.StatusBarLongPressGestureDetector
import com.android.systemui.shade.domain.interactor.PanelExpansionInteractor
import com.android.systemui.shared.animation.UnfoldMoveFromCenterAnimator
import com.android.systemui.statusbar.data.repository.StatusBarContentInsetsProviderStore
@@ -69,7 +69,7 @@ private constructor(
    private val shadeController: ShadeController,
    private val shadeViewController: ShadeViewController,
    private val panelExpansionInteractor: PanelExpansionInteractor,
    private val longPressGestureDetector: Provider<LongPressGestureDetector>,
    private val statusBarLongPressGestureDetector: Provider<StatusBarLongPressGestureDetector>,
    private val windowRootView: Provider<WindowRootView>,
    private val shadeLogger: ShadeLogger,
    private val moveFromCenterAnimationController: StatusBarMoveFromCenterAnimationController?,
@@ -119,7 +119,7 @@ private constructor(
        addCursorSupportToIconContainers()

        if (ShadeExpandsOnStatusBarLongPress.isEnabled) {
            mView.setLongPressGestureDetector(longPressGestureDetector.get())
            mView.setLongPressGestureDetector(statusBarLongPressGestureDetector.get())
        }

        progressProvider?.setReadyToHandleTransition(true)
@@ -336,7 +336,7 @@ private constructor(
        private val shadeController: ShadeController,
        private val shadeViewController: ShadeViewController,
        private val panelExpansionInteractor: PanelExpansionInteractor,
        private val longPressGestureDetector: Provider<LongPressGestureDetector>,
        private val statusBarLongPressGestureDetector: Provider<StatusBarLongPressGestureDetector>,
        private val windowRootView: Provider<WindowRootView>,
        private val shadeLogger: ShadeLogger,
        private val viewUtil: ViewUtil,
@@ -361,7 +361,7 @@ private constructor(
                shadeController,
                shadeViewController,
                panelExpansionInteractor,
                longPressGestureDetector,
                statusBarLongPressGestureDetector,
                windowRootView,
                shadeLogger,
                statusBarMoveFromCenterAnimationController,
Loading