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

Commit ef8801a1 authored by Justin Weir's avatar Justin Weir
Browse files

Check if shade disabled before long press expansion

Bug: 417577717
Test: CtsVerifier app
Flag: com.android.systemui.shade_expands_on_status_bar_long_press
Change-Id: I908409bca9684bfc9bc6731ebff7f55147e355a2
parent fc17ba01
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -2303,6 +2303,10 @@ public final class NotificationPanelViewController implements
    @Deprecated
    @Deprecated
    public void onStatusBarLongPress(MotionEvent event) {
    public void onStatusBarLongPress(MotionEvent event) {
        Log.i(TAG, "Status Bar was long pressed.");
        Log.i(TAG, "Status Bar was long pressed.");
        if (mTouchDisabled) {
            mShadeLog.d("Touch disabled. Long press expansion ignored.");
            return;
        }
        if (mBarState == KEYGUARD) {
        if (mBarState == KEYGUARD) {
            mShadeLog.d("Lockscreen Status Bar was long pressed. Expansion not supported.");
            mShadeLog.d("Lockscreen Status Bar was long pressed. Expansion not supported.");
            return;
            return;
+9 −1
Original line number Original line Diff line number Diff line
@@ -22,6 +22,7 @@ import android.view.GestureDetector.SimpleOnGestureListener
import android.view.MotionEvent
import android.view.MotionEvent
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.statusbar.policy.DeviceProvisionedController
import javax.inject.Inject
import javax.inject.Inject


/** Accepts touch events, detects long press, and calls ShadeViewController#onStatusBarLongPress. */
/** Accepts touch events, detects long press, and calls ShadeViewController#onStatusBarLongPress. */
@@ -32,14 +33,21 @@ constructor(
    // TODO b/383125226 - Make this class per-display
    // TODO b/383125226 - Make this class per-display
    @Main context: Context,
    @Main context: Context,
    val shadeViewController: ShadeViewController,
    val shadeViewController: ShadeViewController,
    val shadeController: ShadeController,
    val deviceProvisionedController: DeviceProvisionedController,
) {
) {
    val gestureDetector =
    val gestureDetector =
        GestureDetector(
        GestureDetector(
            context,
            context,
            object : SimpleOnGestureListener() {
            object : SimpleOnGestureListener() {
                override fun onLongPress(event: MotionEvent) {
                override fun onLongPress(event: MotionEvent) {
                    if (
                        shadeController.isShadeEnabled() &&
                            deviceProvisionedController.isDeviceProvisioned()
                    ) {
                        shadeViewController.onStatusBarLongPress(event)
                        shadeViewController.onStatusBarLongPress(event)
                    }
                    }
                }
            },
            },
        )
        )