diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index 0e359b7f0eeca637230eee269704e1f2aed7f0a2..fe45df89b5264924e5382b8cfd8c976e4a3d57d2 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -71,7 +71,6 @@ import android.util.IndentingPrintWriter; import android.util.Log; import android.util.MathUtils; import android.view.HapticFeedbackConstants; -import android.view.InputDevice; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.VelocityTracker; @@ -5066,19 +5065,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump return false; } - final boolean isTrackpadTwoOrThreeFingerSwipe = isTrackpadScroll( - mTrackpadGestureFeaturesEnabled, event) || isTrackpadThreeFingerSwipe( - mTrackpadGestureFeaturesEnabled, event); - - // On expanding, single mouse click expands the panel instead of dragging. - if (isFullyCollapsed() && (event.isFromSource(InputDevice.SOURCE_MOUSE) - && !isTrackpadTwoOrThreeFingerSwipe)) { - if (event.getAction() == MotionEvent.ACTION_UP) { - expand(true /* animate */); - } - return true; - } - /* * We capture touch events here and update the expand height here in case according to * the users fingers. This also handles multi-touch. @@ -5099,6 +5085,10 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mIgnoreXTouchSlop = true; } + final boolean isTrackpadTwoOrThreeFingerSwipe = isTrackpadScroll( + mTrackpadGestureFeaturesEnabled, event) || isTrackpadThreeFingerSwipe( + mTrackpadGestureFeaturesEnabled, event); + switch (event.getActionMasked()) { case MotionEvent.ACTION_DOWN: if (QuickStepContract.ALLOW_BACK_GESTURE_IN_SHADE && mAnimateBack) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewController.kt index f9702dd12535d4886aaac235ec4c806e232baff6..a39bfe00be28f6f60c4211826b23165059ee00a4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewController.kt @@ -81,6 +81,7 @@ private constructor( statusContainer.setOnHoverListener( statusOverlayHoverListenerFactory.createDarkAwareListener(statusContainer) ) + statusContainer.setOnClickListener { shadeViewController.expand(/* animate= */true) } progressProvider?.setReadyToHandleTransition(true) configurationController.addCallback(configurationListener) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewControllerTest.kt index b7560ad7902634d26ae352e6c51cfbe23e6a8b36..1687ccbf5826f86a6f66e64d4b7f52ae78d1e89b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewControllerTest.kt @@ -22,15 +22,16 @@ import android.app.StatusBarManager.WINDOW_STATE_SHOWING import android.app.StatusBarManager.WINDOW_STATUS_BAR import android.view.LayoutInflater import android.view.MotionEvent +import android.view.View import android.view.ViewTreeObserver import android.view.ViewTreeObserver.OnPreDrawListener import android.widget.FrameLayout import androidx.test.filters.SmallTest import androidx.test.platform.app.InstrumentationRegistry -import com.android.systemui.res.R import com.android.systemui.SysuiTestCase import com.android.systemui.flags.FeatureFlags import com.android.systemui.flags.Flags +import com.android.systemui.res.R import com.android.systemui.scene.shared.flag.FakeSceneContainerFlags import com.android.systemui.scene.ui.view.WindowRootView import com.android.systemui.shade.ShadeControllerImpl @@ -48,8 +49,6 @@ import com.android.systemui.util.mockito.argumentCaptor import com.android.systemui.util.mockito.whenever import com.android.systemui.util.view.ViewUtil import com.google.common.truth.Truth.assertThat -import java.util.Optional -import javax.inject.Provider import org.junit.Before import org.junit.Test import org.mockito.ArgumentCaptor @@ -60,6 +59,8 @@ import org.mockito.Mockito.spy import org.mockito.Mockito.verify import org.mockito.Mockito.`when` import org.mockito.MockitoAnnotations +import java.util.Optional +import javax.inject.Provider @SmallTest class PhoneStatusBarViewControllerTest : SysuiTestCase() { @@ -98,7 +99,7 @@ class PhoneStatusBarViewControllerTest : SysuiTestCase() { val parent = FrameLayout(mContext) // add parent to keep layout params view = LayoutInflater.from(mContext).inflate(R.layout.status_bar, parent, false) - as PhoneStatusBarView + as PhoneStatusBarView controller = createAndInitController(view) } } @@ -231,6 +232,27 @@ class PhoneStatusBarViewControllerTest : SysuiTestCase() { verify(centralSurfacesImpl).setInteracting(any(), any()) } + @Test + fun shadeIsExpandedOnStatusIconClick() { + val view = createViewMock() + InstrumentationRegistry.getInstrumentation().runOnMainSync { + controller = createAndInitController(view) + } + val statusContainer = view.requireViewById<View>(R.id.system_icons) + statusContainer.performClick() + verify(shadeViewController).expand(any()) + } + + @Test + fun shadeIsNotExpandedOnStatusBarGeneralClick() { + val view = createViewMock() + InstrumentationRegistry.getInstrumentation().runOnMainSync { + controller = createAndInitController(view) + } + view.performClick() + verify(shadeViewController, never()).expand(any()) + } + private fun getCommandQueueCallback(): CommandQueue.Callbacks { val captor = argumentCaptor<CommandQueue.Callbacks>() verify(commandQueue).addCallback(captor.capture())