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

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

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

parents f2cd7492 775783ee
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -2053,6 +2053,9 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
        }
        if (mQsController.getExpanded()) {
            mQsController.flingQs(0, FLING_COLLAPSE);
        } else if (mBarState == KEYGUARD) {
            mLockscreenShadeTransitionController.goToLockedShade(
                    /* expandedView= */null, /* needsQSAnimation= */false);
        } else {
            expand(true /* animate */);
        }
@@ -3109,7 +3112,7 @@ 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 {
@@ -5091,13 +5094,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 +5101,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
@@ -33,11 +33,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
@@ -68,7 +68,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?,
@@ -118,7 +118,7 @@ private constructor(
        addCursorSupportToIconContainers()

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

        progressProvider?.setReadyToHandleTransition(true)
@@ -335,7 +335,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,
@@ -360,7 +360,7 @@ private constructor(
                shadeController,
                shadeViewController,
                panelExpansionInteractor,
                longPressGestureDetector,
                statusBarLongPressGestureDetector,
                windowRootView,
                shadeLogger,
                statusBarMoveFromCenterAnimationController,
Loading