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

Commit 68b5b180 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Prevent touch event dispatch on the top edge when collapsed" into...

Merge "Prevent touch event dispatch on the top edge when collapsed" into tm-qpr-dev am: e3544779 am: a0a82d46

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20581317



Change-Id: I9ef03b35acfa6ee0d971cb5ffd658009d5fb38ab
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 8e718a5b a0a82d46
Loading
Loading
Loading
Loading
+13 −13
Original line number Original line Diff line number Diff line
@@ -4618,20 +4618,20 @@ public final class NotificationPanelViewController implements Dumpable {
                        return false;
                        return false;
                    }
                    }


                    // If the view that would receive the touch is disabled, just have status bar
                    if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    // eat the gesture.
                        // If the view that would receive the touch is disabled, just have status
                    if (event.getAction() == MotionEvent.ACTION_DOWN && !mView.isEnabled()) {
                        // bar eat the gesture.
                        Log.v(TAG,
                        if (!mView.isEnabled()) {
                                String.format(
                            mShadeLog.logMotionEvent(event,
                                        "onTouchForwardedFromStatusBar: "
                                    "onTouchForwardedFromStatusBar: panel view disabled");
                                                + "panel view disabled, eating touch at (%d,%d)",
                                        (int) event.getX(),
                                        (int) event.getY()
                                )
                        );
                            return true;
                            return true;
                        }
                        }

                        if (isFullyCollapsed() && event.getY() < 1f) {
                            // b/235889526 Eat events on the top edge of the phone when collapsed
                            mShadeLog.logMotionEvent(event, "top edge touch ignored");
                            return true;
                        }
                    }
                    return mView.dispatchTouchEvent(event);
                    return mView.dispatchTouchEvent(event);
                }
                }
            };
            };
+12 −1
Original line number Original line Diff line number Diff line
@@ -843,13 +843,24 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
    public void handleTouchEventFromStatusBar_panelAndViewEnabled_viewReceivesEvent() {
    public void handleTouchEventFromStatusBar_panelAndViewEnabled_viewReceivesEvent() {
        when(mCommandQueue.panelsEnabled()).thenReturn(true);
        when(mCommandQueue.panelsEnabled()).thenReturn(true);
        when(mView.isEnabled()).thenReturn(true);
        when(mView.isEnabled()).thenReturn(true);
        MotionEvent event = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 0f, 0);
        MotionEvent event = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 2f, 0);


        mNotificationPanelViewController.getStatusBarTouchEventHandler().handleTouchEvent(event);
        mNotificationPanelViewController.getStatusBarTouchEventHandler().handleTouchEvent(event);


        verify(mView).dispatchTouchEvent(event);
        verify(mView).dispatchTouchEvent(event);
    }
    }


    @Test
    public void handleTouchEventFromStatusBar_topEdgeTouch_viewNeverReceivesEvent() {
        when(mCommandQueue.panelsEnabled()).thenReturn(true);
        when(mView.isEnabled()).thenReturn(true);
        MotionEvent event = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 0f, 0);

        mNotificationPanelViewController.getStatusBarTouchEventHandler().handleTouchEvent(event);

        verify(mView, never()).dispatchTouchEvent(event);
    }

    @Test
    @Test
    public void testA11y_initializeNode() {
    public void testA11y_initializeNode() {
        AccessibilityNodeInfo nodeInfo = new AccessibilityNodeInfo();
        AccessibilityNodeInfo nodeInfo = new AccessibilityNodeInfo();