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

Commit a1238591 authored by Dave Mankoff's avatar Dave Mankoff
Browse files

Track Falsing on Notification Taps.

This ensures that the falsing manager doesn't treat valid taps as
erroneous. It makes the falsing "belief" that the history tracker
maintains more accurate.

Bug: 172655679
Test: manual
Change-Id: I5c50062942ddfa7d02d203aea8b6a7ce7d4a7ef7
parent 8a80ffbe
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ public class ActivatableNotificationViewController

        @Override
        public boolean onTouch(View v, MotionEvent ev) {
            boolean result;
            boolean result = false;
            if (mBlockNextTouch) {
                mBlockNextTouch = false;
                return true;
@@ -112,16 +112,20 @@ public class ActivatableNotificationViewController
            if (ev.getAction() == MotionEvent.ACTION_UP) {
                mView.setLastActionUpTime(SystemClock.uptimeMillis());
            }
            if (mNeedsDimming && !mAccessibilityManager.isTouchExplorationEnabled()
                    && mView.isInteractive()) {
            // With a11y, just do nothing.
            if (mAccessibilityManager.isTouchExplorationEnabled()) {
                return false;
            }
            if (mNeedsDimming && mView.isInteractive()) {
                if (mNeedsDimming && !mView.isDimmed()) {
                    // We're actually dimmed, but our content isn't dimmable,
                    // let's ensure we have a ripple
                    return false;
                }
                result = mNotificationTapHelper.onTouchEvent(ev, mView.getActualHeight());
            } else {
                return false;
            } else if (ev.getAction() == MotionEvent.ACTION_UP) {
                // If this is a false tap, capture the even so it doesn't result in a click.
                return mFalsingManager.isFalseTap(true, 0.1);
            }
            return result;
        }
+14 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ import com.android.systemui.Dependency;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.PluginListener;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin.MenuItem;
@@ -215,6 +216,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    private NotificationGuts mGuts;
    private NotificationEntry mEntry;
    private String mAppName;
    private FalsingManager mFalsingManager;
    private FalsingCollector mFalsingCollector;

    /**
@@ -886,6 +888,16 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        updateBackgroundClipping();
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        // Other parts of the system may intercept and handle all the falsing.
        // Otherwise, if we see motion and follow-on events, try to classify them as a tap.
        if (ev.getActionMasked() != MotionEvent.ACTION_DOWN) {
            mFalsingManager.isFalseTap(true, 0.3);
        }
        return super.onInterceptTouchEvent(ev);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (event.getActionMasked() != MotionEvent.ACTION_DOWN
@@ -1569,6 +1581,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
            OnExpandClickListener onExpandClickListener,
            NotificationMediaManager notificationMediaManager,
            CoordinateOnClickListener onFeedbackClickListener,
            FalsingManager falsingManager,
            FalsingCollector falsingCollector,
            StatusBarStateController statusBarStateController,
            PeopleNotificationIdentifier peopleNotificationIdentifier,
@@ -1594,6 +1607,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        mOnExpandClickListener = onExpandClickListener;
        mMediaManager = notificationMediaManager;
        setOnFeedbackClickListener(onFeedbackClickListener);
        mFalsingManager = falsingManager;
        mFalsingCollector = falsingCollector;
        mStatusBarStateController = statusBarStateController;

+5 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.view.ViewGroup;
import androidx.annotation.NonNull;

import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.shared.plugins.PluginManager;
@@ -78,6 +79,7 @@ public class ExpandableNotificationRowController implements NodeController {
    private final ExpandableNotificationRow.CoordinateOnClickListener mOnFeedbackClickListener;
    private final NotificationGutsManager mNotificationGutsManager;
    private final OnUserInteractionCallback mOnUserInteractionCallback;
    private final FalsingManager mFalsingManager;
    private final FalsingCollector mFalsingCollector;
    private final boolean mAllowLongPress;
    private final PeopleNotificationIdentifier mPeopleNotificationIdentifier;
@@ -104,6 +106,7 @@ public class ExpandableNotificationRowController implements NodeController {
            NotificationGutsManager notificationGutsManager,
            @Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME) boolean allowLongPress,
            OnUserInteractionCallback onUserInteractionCallback,
            FalsingManager falsingManager,
            FalsingCollector falsingCollector,
            PeopleNotificationIdentifier peopleNotificationIdentifier,
            Optional<BubblesManager> bubblesManagerOptional) {
@@ -125,6 +128,7 @@ public class ExpandableNotificationRowController implements NodeController {
        mStatusBarStateController = statusBarStateController;
        mNotificationGutsManager = notificationGutsManager;
        mOnUserInteractionCallback = onUserInteractionCallback;
        mFalsingManager = falsingManager;
        mOnFeedbackClickListener = mNotificationGutsManager::openGuts;
        mAllowLongPress = allowLongPress;
        mFalsingCollector = falsingCollector;
@@ -150,6 +154,7 @@ public class ExpandableNotificationRowController implements NodeController {
                mOnExpandClickListener,
                mMediaManager,
                mOnFeedbackClickListener,
                mFalsingManager,
                mFalsingCollector,
                mStatusBarStateController,
                mPeopleNotificationIdentifier,
+2 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import com.android.internal.util.NotificationMessagingUtil;
import com.android.systemui.R;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.classifier.FalsingCollectorFake;
import com.android.systemui.classifier.FalsingManagerFake;
import com.android.systemui.media.MediaFeatureFlag;
import com.android.systemui.media.dialog.MediaOutputDialogFactory;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
@@ -260,6 +261,7 @@ public class NotificationEntryManagerInflationTest extends SysuiTestCase {
                                mGutsManager,
                                true,
                                null,
                                new FalsingManagerFake(),
                                new FalsingCollectorFake(),
                                mPeopleNotificationIdentifier,
                                Optional.of(mock(BubblesManager.class))
+2 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import android.widget.RemoteViews;

import com.android.systemui.TestableDependency;
import com.android.systemui.classifier.FalsingCollectorFake;
import com.android.systemui.classifier.FalsingManagerFake;
import com.android.systemui.media.MediaFeatureFlag;
import com.android.systemui.media.dialog.MediaOutputDialogFactory;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
@@ -429,6 +430,7 @@ public class NotificationTestHelper {
                mock(OnExpandClickListener.class),
                mock(NotificationMediaManager.class),
                mock(ExpandableNotificationRow.CoordinateOnClickListener.class),
                new FalsingManagerFake(),
                new FalsingCollectorFake(),
                mStatusBarStateController,
                mPeopleNotificationIdentifier,