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

Commit d16b6685 authored by Beverly Tai's avatar Beverly Tai Committed by Automerger Merge Worker
Browse files

Merge "Don't send lock icon touches to NotifShade" into sc-v2-dev am: 12aff064 am: 9d7958a9

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

Change-Id: I584b0643dec94ac20cf5bb997250ebe2e4d447ff
parents 8a0f023d 9d7958a9
Loading
Loading
Loading
Loading
+24 −12
Original line number Diff line number Diff line
@@ -658,24 +658,36 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
     * @return whether to intercept the touch event
     */
    public boolean onTouchEvent(MotionEvent event, Runnable onGestureDetectedRunnable) {
        if (mSensorTouchLocation.contains((int) event.getX(), (int) event.getY())
                && (mView.getVisibility() == View.VISIBLE
                || (mAodFp != null && mAodFp.getVisibility() == View.VISIBLE))) {
        if (onInterceptTouchEvent(event)) {
            mOnGestureDetectedRunnable = onGestureDetectedRunnable;
            mGestureDetector.onTouchEvent(event);
            return true;
        }

        // we continue to intercept all following touches until we see MotionEvent.ACTION_CANCEL UP
        // or MotionEvent.ACTION_UP. this is to avoid passing the touch to NPV
        // after the lock icon disappears on device entry
        if (mDownDetected) {
            if (event.getAction() == MotionEvent.ACTION_CANCEL
                    || event.getAction() == MotionEvent.ACTION_UP) {
        mDownDetected = false;
        return false;
    }

    /**
     * Intercepts the touch if the onDown event and current event are within this lock icon view's
     * bounds.
     */
    public boolean onInterceptTouchEvent(MotionEvent event) {
        if (!inLockIconArea(event) || !isClickable()) {
            return false;
        }

        if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
            return true;
        }
        return false;

        return mDownDetected;
    }

    private boolean inLockIconArea(MotionEvent event) {
        return mSensorTouchLocation.contains((int) event.getX(), (int) event.getY())
                && (mView.getVisibility() == View.VISIBLE
                || (mAodFp != null && mAodFp.getVisibility() == View.VISIBLE));
    }

    private boolean isClickable() {
+5 −0
Original line number Diff line number Diff line
@@ -338,6 +338,11 @@ public class NotificationShadeWindowViewController {
                    return true;
                }

                if (mLockIconViewController.onInterceptTouchEvent(ev)) {
                    // immediately return true; don't send the touch to the drag down helper
                    return true;
                }

                boolean intercept = false;
                if (mNotificationPanelViewController.isFullyExpanded()
                        && mDragDownHelper.isDragDownEnabled()