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

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

Merge "Disable the support to close the notification shade on long press for...

Merge "Disable the support to close the notification shade on long press for navigation bar buttons."
parents 8b4ed43f fb2409f7
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.os.Build;
import android.os.UserHandle;
import android.util.AttributeSet;
import android.view.Display;
@@ -122,7 +123,7 @@ public class CarFacetButton extends LinearLayout {
                        new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS), UserHandle.CURRENT);
            });

            if (longPressIntentString != null) {
            if (longPressIntentString != null && (Build.IS_ENG || Build.IS_USERDEBUG)) {
                final Intent longPressIntent = Intent.parseUri(longPressIntentString,
                        Intent.URI_INTENT_SCHEME);
                setOnLongClickListener(v -> {
+0 −28
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.systemui.statusbar.car;

import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
@@ -75,40 +74,13 @@ class CarNavigationBarView extends LinearLayout {
    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        if (mStatusBarWindowTouchListener != null) {
            boolean shouldConsumeEvent = shouldConsumeNotificationButtonEvent(ev);
            // Forward touch events to the status bar window so it can drag
            // windows if required (Notification shade)
            mStatusBarWindowTouchListener.onTouch(this, ev);
            // return true if child views should not receive this event.
            if (shouldConsumeEvent) {
                return true;
            }
        }
        return super.onInterceptTouchEvent(ev);
    }

    /**
     * If the motion event is over top of the notification button while the notification
     * panel is open, we need the statusbar touch listeners handle the event instead of the button.
     * Since the statusbar listener will trigger a close of the notification panel before the
     * any button click events are fired this will prevent reopening the panel.
     *
     * Note: we can't use requestDisallowInterceptTouchEvent because the gesture detector will
     * always receive the ACTION_DOWN and thus think a longpress happened if no other events are
     * received
     *
     * @return true if the notification button should not receive the event
     */
    private boolean shouldConsumeNotificationButtonEvent(MotionEvent ev) {
        if (mNotificationsButton == null || !mCarStatusBar.isNotificationPanelOpen()) {
            return false;
        }
        Rect notificationButtonLocation = new Rect();
        mNotificationsButton.getHitRect(notificationButtonLocation);
        return notificationButtonLocation.contains((int) ev.getX(), (int) ev.getY());
    }


    void setStatusBar(CarStatusBar carStatusBar) {
        mCarStatusBar = carStatusBar;
    }
+2 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.os.Build;
import android.os.UserHandle;
import android.util.AttributeSet;
import android.util.Log;
@@ -114,7 +115,7 @@ public class CarNavigationButton extends com.android.keyguard.AlphaOptimizedImag
        }

        try {
            if (mLongIntent != null) {
            if (mLongIntent != null && (Build.IS_ENG || Build.IS_USERDEBUG)) {
                final Intent intent = Intent.parseUri(mLongIntent, Intent.URI_INTENT_SCHEME);
                setOnLongClickListener(v -> {
                    try {
+0 −7
Original line number Diff line number Diff line
@@ -1248,13 +1248,6 @@ public class CarStatusBar extends StatusBar implements
            setNotificationViewClipBounds((int) event2.getRawY());
            return true;
        }

        @Override
        public void onLongPress(MotionEvent e) {
            mClosingVelocity = DEFAULT_FLING_VELOCITY;
            close();
            super.onLongPress(e);
        }
    }

    /**