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

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

Disable long press to open shade on emulated hardware

Test: presubmits are sufficient
Flag: com.android.systemui.shade_expands_on_status_bar_long_press
Bug: 394977231
Change-Id: Icd515fefa2a037d3bda7f849ccd468e6196d6aaf
parent bf8c02bc
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import android.os.Build;
import android.platform.test.annotations.EnableFlags;
import android.testing.TestableLooper;
import android.view.HapticFeedbackConstants;
@@ -41,6 +42,7 @@ import com.android.systemui.flags.DisableSceneContainer;

import com.google.android.msdl.data.model.MSDLToken;

import org.junit.Assume;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -59,6 +61,8 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo
    @Test
    @EnableFlags(com.android.systemui.Flags.FLAG_SHADE_EXPANDS_ON_STATUS_BAR_LONG_PRESS)
    public void onStatusBarLongPress_shadeExpands() {
        //TODO(b/394977231) delete this temporary workaround used only by tests
        Assume.assumeFalse(Build.HARDWARE.equals("cutf_cvm"));
        long downTime = 42L;
        // Start touch session with down event
        onTouchEvent(MotionEvent.obtain(downTime, downTime, MotionEvent.ACTION_DOWN, 1f, 1f, 0));
@@ -85,6 +89,8 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo
    @Test
    @EnableFlags(com.android.systemui.Flags.FLAG_SHADE_EXPANDS_ON_STATUS_BAR_LONG_PRESS)
    public void onStatusBarLongPress_qsExpands() {
        //TODO(b/394977231) delete this temporary workaround used only by tests
        Assume.assumeFalse(Build.HARDWARE.equals("cutf_cvm"));
        long downTime = 42L;
        // Start with shade already expanded
        mNotificationPanelViewController.setExpandedFraction(1F);
+8 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ import android.graphics.Rect;
import android.graphics.Region;
import android.graphics.RenderEffect;
import android.graphics.Shader;
import android.os.Build;
import android.os.Bundle;
import android.os.Trace;
import android.util.IndentingPrintWriter;
@@ -241,6 +242,8 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    private static final String COUNTER_PANEL_OPEN_PEEK = "panel_open_peek";
    private static final Rect M_DUMMY_DIRTY_RECT = new Rect(0, 0, 1, 1);
    private static final Rect EMPTY_RECT = new Rect();
    //TODO(b/394977231) delete this temporary workaround used only by tests
    private static final boolean DISABLE_LONG_PRESS_EXPAND = Build.HARDWARE.equals("cutf_cvm");
    /**
     * Whether the Shade should animate to reflect Back gesture progress.
     * To minimize latency at runtime, we cache this, else we'd be reading it every time
@@ -2202,6 +2205,11 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    @Deprecated
    public void onStatusBarLongPress(MotionEvent event) {
        Log.i(TAG, "Status Bar was long pressed.");
        if (DISABLE_LONG_PRESS_EXPAND) {
            //TODO(b/394977231) delete this temporary workaround used only by tests
            Log.i(TAG, "Ignoring status Bar long press on virtualized test device.");
            return;
        }
        ShadeExpandsOnStatusBarLongPress.assertInNewMode();
        mStatusBarLongPressDowntime = event.getDownTime();
        if (isTracking()) {