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

Commit 96c47464 authored by Dave Mankoff's avatar Dave Mankoff
Browse files

Pass interaction type to FalsingManager.isFalse

This ensures that the falsing manager always is testing against the
correct interaction type when it is asked. Prior to this change, we
could end up in states where a user was swiping down (opening the
quick settings) but the falsing manager believed the user was trying
to unlock the phone.

Fixes: 160967364
Test: atest SystemUITests && manual
Change-Id: I176f54a768622dec3e758a7f01ed8aec26223648
parent de89203f
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ import java.io.PrintWriter;
 */
@ProvidesInterface(version = FalsingManager.VERSION)
public interface FalsingManager {
    int VERSION = 4;
    int VERSION = 5;

    void onSuccessfulUnlock();

@@ -42,7 +42,8 @@ public interface FalsingManager {

    boolean isUnlockingDisabled();

    boolean isFalseTouch();
    /** Returns true if the gesture should be rejected. */
    boolean isFalseTouch(int interactionType);

    void onNotificatonStopDraggingDown();

+6 −5
Original line number Diff line number Diff line
@@ -14,16 +14,16 @@

package com.android.systemui.plugins.statusbar;

import com.android.systemui.plugins.annotations.DependsOn;
import com.android.systemui.plugins.annotations.ProvidesInterface;
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption;

import android.service.notification.SnoozeCriterion;
import android.service.notification.StatusBarNotification;
import android.view.MotionEvent;
import android.view.View;
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;

import com.android.systemui.plugins.annotations.DependsOn;
import com.android.systemui.plugins.annotations.ProvidesInterface;
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption;

@ProvidesInterface(version = NotificationSwipeActionHelper.VERSION)
@DependsOn(target = SnoozeOption.class)
public interface NotificationSwipeActionHelper {
@@ -52,7 +52,8 @@ public interface NotificationSwipeActionHelper {

    public boolean isDismissGesture(MotionEvent ev);

    public boolean isFalseGesture(MotionEvent ev);
    /** Returns true if the gesture should be rejected. */
    boolean isFalseGesture();

    public boolean swipedFarEnough(float translation, float viewSize);

+6 −3
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.systemui;

import static com.android.systemui.classifier.Classifier.NOTIFICATION_DISMISS;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
@@ -696,14 +698,15 @@ public class SwipeHelper implements Gefingerpoken {
        float translation = getTranslation(mCurrView);
        return ev.getActionMasked() == MotionEvent.ACTION_UP
                && !mFalsingManager.isUnlockingDisabled()
                && !isFalseGesture(ev) && (swipedFastEnough() || swipedFarEnough())
                && !isFalseGesture() && (swipedFastEnough() || swipedFarEnough())
                && mCallback.canChildBeDismissedInDirection(mCurrView, translation > 0);
    }

    public boolean isFalseGesture(MotionEvent ev) {
    /** Returns true if the gesture should be rejected. */
    public boolean isFalseGesture() {
        boolean falsingDetected = mCallback.isAntiFalsingNeeded();
        if (mFalsingManager.isClassifierEnabled()) {
            falsingDetected = falsingDetected && mFalsingManager.isFalseTouch();
            falsingDetected = falsingDetected && mFalsingManager.isFalseTouch(NOTIFICATION_DISMISS);
        } else {
            falsingDetected = falsingDetected && !mTouchAboveFalsingThreshold;
        }
+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ public class FalsingManagerFake implements FalsingManager {
    }

    @Override
    public boolean isFalseTouch() {
    public boolean isFalseTouch(@Classifier.InteractionType int interactionType) {
        return mIsFalseTouch;
    }

+1 −1
Original line number Diff line number Diff line
@@ -262,7 +262,7 @@ public class FalsingManagerImpl implements FalsingManager {
    /**
     * @return true if the classifier determined that this is not a human interacting with the phone
     */
    public boolean isFalseTouch() {
    public boolean isFalseTouch(@Classifier.InteractionType int interactionType) {
        if (FalsingLog.ENABLED) {
            // We're getting some false wtfs from touches that happen after the device went
            // to sleep. Only report missing sessions that happen when the device is interactive.
Loading