diff options
| author | 2024-11-07 14:18:01 -0500 | |
|---|---|---|
| committer | 2024-11-18 14:43:29 +0000 | |
| commit | cfa9ce9ee37536a8a60497a5c9e41075f48c150d (patch) | |
| tree | ccb0c1a9cb64ff0f7ab3548112c701ac41dd6eaa | |
| parent | 1ba241bebb4bd6ea766468f7568eb00f92d1dad4 (diff) | |
Long press Shade status bar expands to QS
Bug: 371224114
Test: Ran affected tests
Test: Manually verified with go/shade-cujs
Flag: com.android.systemui.shade_expands_on_status_bar_long_press
Change-Id: I78d86257abbdc8c90f3359b85ee5f476b7fc7b72
6 files changed, 26 insertions, 24 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java index 94a19c80dc00..ed31f366e1d0 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java @@ -349,6 +349,7 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { @Mock private KeyguardClockPositionAlgorithm mKeyguardClockPositionAlgorithm; @Mock private NaturalScrollingSettingObserver mNaturalScrollingSettingObserver; @Mock private LargeScreenHeaderHelper mLargeScreenHeaderHelper; + @Mock private StatusBarLongPressGestureDetector mStatusBarLongPressGestureDetector; protected final int mMaxUdfpsBurnInOffsetY = 5; protected FakeFeatureFlagsClassic mFeatureFlags = new FakeFeatureFlagsClassic(); protected KeyguardBottomAreaInteractor mKeyguardBottomAreaInteractor; @@ -819,6 +820,7 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mNotificationShadeDepthController, mShadeHeaderController, mStatusBarTouchableRegionManager, + () -> mStatusBarLongPressGestureDetector, mKeyguardStateController, mKeyguardBypassController, mScrimController, diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java index ef132d5a4989..61d4c9968d49 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/QuickSettingsControllerImplBaseTest.java @@ -126,6 +126,7 @@ public class QuickSettingsControllerImplBaseTest extends SysuiTestCase { @Mock protected NotificationShadeDepthController mNotificationShadeDepthController; @Mock protected ShadeHeaderController mShadeHeaderController; @Mock protected StatusBarTouchableRegionManager mStatusBarTouchableRegionManager; + @Mock protected StatusBarLongPressGestureDetector mStatusBarLongPressGestureDetector; @Mock protected DozeParameters mDozeParameters; @Mock protected KeyguardStateController mKeyguardStateController; @Mock protected KeyguardBypassController mKeyguardBypassController; @@ -250,6 +251,7 @@ public class QuickSettingsControllerImplBaseTest extends SysuiTestCase { mNotificationShadeDepthController, mShadeHeaderController, mStatusBarTouchableRegionManager, + () -> mStatusBarLongPressGestureDetector, mKeyguardStateController, mKeyguardBypassController, mScrimController, diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index 4ccd2b93911e..42a756c27de7 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -3109,17 +3109,20 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump if (isTracking()) { onTrackingStopped(true); } - 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); + if (!mQsController.getExpanded()) { + performHapticFeedback(HapticFeedbackConstants.GESTURE_START); + if (isExpanded() && mBarState != KEYGUARD) { + mShadeLog.d("Status Bar was long pressed. Expanding to QS."); + mQsController.flingQs(0, FLING_EXPAND); } else { - mShadeLog.d("Status Bar was long pressed. Expanding to Notifications."); - expandToNotifications(); + if (mBarState == KEYGUARD) { + mShadeLog.d("Lockscreen Status Bar was long pressed. Expanding to Notifications."); + mLockscreenShadeTransitionController.goToLockedShade( + /* expandedView= */null, /* needsQSAnimation= */true); + } else { + mShadeLog.d("Status Bar was long pressed. Expanding to Notifications."); + expandToNotifications(); + } } } } diff --git a/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsControllerImpl.java b/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsControllerImpl.java index 830649be2a98..04f89be97e0a 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsControllerImpl.java @@ -114,6 +114,7 @@ import kotlin.Unit; import java.io.PrintWriter; import javax.inject.Inject; +import javax.inject.Provider; /** Handles QuickSettings touch handling, expansion and animation state * TODO (b/264460656) make this dumpable @@ -141,6 +142,7 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum private final NotificationShadeDepthController mDepthController; private final ShadeHeaderController mShadeHeaderController; private final StatusBarTouchableRegionManager mStatusBarTouchableRegionManager; + private final Provider<StatusBarLongPressGestureDetector> mStatusBarLongPressGestureDetector; private final KeyguardStateController mKeyguardStateController; private final KeyguardBypassController mKeyguardBypassController; private final NotificationRemoteInputManager mRemoteInputManager; @@ -316,6 +318,7 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum NotificationShadeDepthController notificationShadeDepthController, ShadeHeaderController shadeHeaderController, StatusBarTouchableRegionManager statusBarTouchableRegionManager, + Provider<StatusBarLongPressGestureDetector> statusBarLongPressGestureDetector, KeyguardStateController keyguardStateController, KeyguardBypassController keyguardBypassController, ScrimController scrimController, @@ -364,6 +367,7 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum mDepthController = notificationShadeDepthController; mShadeHeaderController = shadeHeaderController; mStatusBarTouchableRegionManager = statusBarTouchableRegionManager; + mStatusBarLongPressGestureDetector = statusBarLongPressGestureDetector; mKeyguardStateController = keyguardStateController; mKeyguardBypassController = keyguardBypassController; mScrimController = scrimController; @@ -1648,6 +1652,10 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum if (isSplitShadeAndTouchXOutsideQs(event.getX())) { return false; } + boolean isInStatusBar = event.getY(event.getActionIndex()) < mStatusBarMinHeight; + if (ShadeExpandsOnStatusBarLongPress.isEnabled() && isInStatusBar) { + mStatusBarLongPressGestureDetector.get().handleTouch(event); + } final int action = event.getActionMasked(); boolean collapsedQs = !getExpanded() && !mSplitShadeEnabled; boolean expandedShadeCollapsedQs = mShadeExpandedFraction == 1f @@ -1684,9 +1692,7 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum if (action == MotionEvent.ACTION_DOWN && isFullyCollapsed && isExpansionEnabled()) { mTwoFingerExpandPossible = true; } - if (mTwoFingerExpandPossible && isOpenQsEvent(event) - && event.getY(event.getActionIndex()) - < mStatusBarMinHeight) { + if (mTwoFingerExpandPossible && isOpenQsEvent(event) && isInStatusBar) { mMetricsLogger.count(COUNTER_PANEL_OPEN_QS, 1); setExpandImmediate(true); mNotificationStackScrollLayoutController.setShouldShowShelfOnly(!mSplitShadeEnabled); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java index 80c8e8b2a109..db294934c9ed 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java @@ -171,14 +171,12 @@ 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; @@ -368,7 +366,6 @@ 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; @@ -674,7 +671,6 @@ 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, @@ -782,7 +778,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { mShadeController = shadeController; mWindowRootViewVisibilityInteractor = windowRootViewVisibilityInteractor; mStatusBarKeyguardViewManager = statusBarKeyguardViewManager; - mStatusBarLongPressGestureDetector = statusBarLongPressGestureDetector; mKeyguardViewMediatorCallback = viewMediatorCallback; mInitController = initController; mPluginDependencyProvider = pluginDependencyProvider; @@ -1532,11 +1527,6 @@ 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); }; } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java index b142fc2deea9..c9f8463d510c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java @@ -607,7 +607,6 @@ public class CentralSurfacesImplTest extends SysuiTestCase { mShadeController, mWindowRootViewVisibilityInteractor, mStatusBarKeyguardViewManager, - () -> mStatusBarLongPressGestureDetector, mViewMediatorCallback, mInitController, new Handler(TestableLooper.get(this).getLooper()), |