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

Commit 8d6b1647 authored by Justin Weir's avatar Justin Weir Committed by Android (Google) Code Review
Browse files

Merge "Disable long press to open shade on emulated hardware" into main

parents f550c7f1 ed148faf
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()) {