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

Commit c3a2d64f authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Check if shade disabled before long press expansion" into main

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

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