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

Commit 1500d9a7 authored by Dave Mankoff's avatar Dave Mankoff Committed by Android (Google) Code Review
Browse files

Merge changes from topic "b172655679-bayes-falsing" into sc-dev

* changes:
  Add falsing to quick settings buttons.
  Add continuous falsing to keyguard.
  Incorporate Bayes into Falsing.
parents 9c988738 03eb095c
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ public interface FalsingManager {
    /**
     * Returns true if the FalsingManager thinks the last gesure was not a valid tap.
     *
     * Accepts one parameter, robustCheck, that distinctly changes behavior. When set to false,
     * The first parameter, robustCheck, distinctly changes behavior. When set to false,
     * this method simply looks at the last gesture and returns whether it is a tap or not, (as
     * opposed to a swipe or other non-tap gesture). When set to true, a more thorough analysis
     * is performed that can include historical interactions and other contextual cues to see
@@ -53,8 +53,11 @@ public interface FalsingManager {
     * Set robustCheck to true if you want to validate a tap for launching an action, like opening
     * a notification. Set to false if you simply want to know if the last gesture looked like a
     * tap.
     *
     * The second parameter, falsePenalty, indicates how much this should affect future gesture
     * classifications if this tap looks like a false.
     */
    boolean isFalseTap(boolean robustCheck);
    boolean isFalseTap(boolean robustCheck, double falsePenalty);

    /**
     * Returns true if the last two gestures do not look like a double tap.
+6 −1
Original line number Diff line number Diff line
@@ -35,12 +35,15 @@ import com.android.keyguard.EmergencyButton.EmergencyButtonCallback;
import com.android.keyguard.KeyguardAbsKeyInputView.KeyDownListener;
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
import com.android.systemui.R;
import com.android.systemui.classifier.FalsingClassifier;
import com.android.systemui.classifier.FalsingCollector;

public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKeyInputView>
        extends KeyguardInputViewController<T> {
    private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
    private final LockPatternUtils mLockPatternUtils;
    private final LatencyTracker mLatencyTracker;
    private final FalsingCollector mFalsingCollector;
    private CountDownTimer mCountdownTimer;
    protected KeyguardMessageAreaController mMessageAreaController;
    private boolean mDismissing;
@@ -70,11 +73,12 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
            LockPatternUtils lockPatternUtils,
            KeyguardSecurityCallback keyguardSecurityCallback,
            KeyguardMessageAreaController.Factory messageAreaControllerFactory,
            LatencyTracker latencyTracker) {
            LatencyTracker latencyTracker, FalsingCollector falsingCollector) {
        super(view, securityMode, keyguardSecurityCallback);
        mKeyguardUpdateMonitor = keyguardUpdateMonitor;
        mLockPatternUtils = lockPatternUtils;
        mLatencyTracker = latencyTracker;
        mFalsingCollector = falsingCollector;
        KeyguardMessageArea kma = KeyguardMessageArea.findSecurityMessageDisplay(mView);
        mMessageAreaController = messageAreaControllerFactory.create(kma);
    }
@@ -256,6 +260,7 @@ public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKey
    }

    protected void onUserInput() {
        mFalsingCollector.updateFalseConfidence(FalsingClassifier.Result.passed(0.6));
        getKeyguardSecurityCallback().userActivity();
        getKeyguardSecurityCallback().onUserInput();
        mMessageAreaController.setMessage("");
+0 −27
Original line number Diff line number Diff line
@@ -26,16 +26,11 @@ import android.widget.LinearLayout;
import androidx.annotation.Nullable;

import com.android.internal.jank.InteractionJankMonitor;
import com.android.systemui.Gefingerpoken;

import java.util.ArrayList;
import java.util.List;

/**
 * A Base class for all Keyguard password/pattern/pin related inputs.
 */
public abstract class KeyguardInputView extends LinearLayout {
    private final List<Gefingerpoken> mMotionEventListener = new ArrayList<>();

    public KeyguardInputView(Context context) {
        super(context);
@@ -53,7 +48,6 @@ public abstract class KeyguardInputView extends LinearLayout {
    abstract CharSequence getTitle();

    void animateForIme(float interpolatedFraction) {
        return;
    }

    boolean disallowInterceptTouch(MotionEvent event) {
@@ -66,27 +60,6 @@ public abstract class KeyguardInputView extends LinearLayout {
        return false;
    }

    void addMotionEventListener(Gefingerpoken listener) {
        mMotionEventListener.add(listener);
    }

    void removeMotionEventListener(Gefingerpoken listener) {
        mMotionEventListener.remove(listener);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        return mMotionEventListener.stream().anyMatch(listener -> listener.onTouchEvent(event))
                || super.onTouchEvent(event);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent event) {
        return mMotionEventListener.stream().anyMatch(
                listener -> listener.onInterceptTouchEvent(event))
                || super.onInterceptTouchEvent(event);
    }

    protected AnimatorListenerAdapter getAnimationListener(int cuj) {
        return new AnimatorListenerAdapter() {
            private boolean mIsCancel;
+10 −10
Original line number Diff line number Diff line
@@ -155,8 +155,8 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView>
        private final InputMethodManager mInputMethodManager;
        private final DelayableExecutor mMainExecutor;
        private final Resources mResources;
        private LiftToActivateListener mLiftToActivateListener;
        private TelephonyManager mTelephonyManager;
        private final LiftToActivateListener mLiftToActivateListener;
        private final TelephonyManager mTelephonyManager;
        private final FalsingCollector mFalsingCollector;
        private final boolean mIsNewLayoutEnabled;

@@ -167,8 +167,7 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView>
                KeyguardMessageAreaController.Factory messageAreaControllerFactory,
                InputMethodManager inputMethodManager, @Main DelayableExecutor mainExecutor,
                @Main Resources resources, LiftToActivateListener liftToActivateListener,
                TelephonyManager telephonyManager,
                FalsingCollector falsingCollector,
                TelephonyManager telephonyManager, FalsingCollector falsingCollector,
                FeatureFlags featureFlags) {
            mKeyguardUpdateMonitor = keyguardUpdateMonitor;
            mLockPatternUtils = lockPatternUtils;
@@ -189,12 +188,13 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView>
            if (keyguardInputView instanceof KeyguardPatternView) {
                return new KeyguardPatternViewController((KeyguardPatternView) keyguardInputView,
                        mKeyguardUpdateMonitor, securityMode, mLockPatternUtils,
                        keyguardSecurityCallback, mLatencyTracker, mMessageAreaControllerFactory);
                        keyguardSecurityCallback, mLatencyTracker, mFalsingCollector,
                        mMessageAreaControllerFactory);
            } else if (keyguardInputView instanceof KeyguardPasswordView) {
                return new KeyguardPasswordViewController((KeyguardPasswordView) keyguardInputView,
                        mKeyguardUpdateMonitor, securityMode, mLockPatternUtils,
                        keyguardSecurityCallback, mMessageAreaControllerFactory, mLatencyTracker,
                        mInputMethodManager, mMainExecutor, mResources);
                        mInputMethodManager, mMainExecutor, mResources, mFalsingCollector);
            } else if (keyguardInputView instanceof KeyguardPINView) {
                return new KeyguardPinViewController((KeyguardPINView) keyguardInputView,
                        mKeyguardUpdateMonitor, securityMode, mLockPatternUtils,
@@ -204,14 +204,14 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView>
                return new KeyguardSimPinViewController((KeyguardSimPinView) keyguardInputView,
                        mKeyguardUpdateMonitor, securityMode, mLockPatternUtils,
                        keyguardSecurityCallback, mMessageAreaControllerFactory, mLatencyTracker,
                        mLiftToActivateListener, mTelephonyManager,
                        mFalsingCollector, mIsNewLayoutEnabled);
                        mLiftToActivateListener, mTelephonyManager, mFalsingCollector,
                        mIsNewLayoutEnabled);
            } else if (keyguardInputView instanceof KeyguardSimPukView) {
                return new KeyguardSimPukViewController((KeyguardSimPukView) keyguardInputView,
                        mKeyguardUpdateMonitor, securityMode, mLockPatternUtils,
                        keyguardSecurityCallback, mMessageAreaControllerFactory, mLatencyTracker,
                        mLiftToActivateListener, mTelephonyManager,
                        mFalsingCollector, mIsNewLayoutEnabled);
                        mLiftToActivateListener, mTelephonyManager, mFalsingCollector,
                        mIsNewLayoutEnabled);
            }

            throw new RuntimeException("Unable to find controller for " + keyguardInputView);
+4 −2
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
import com.android.settingslib.Utils;
import com.android.systemui.R;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.util.concurrency.DelayableExecutor;

@@ -112,9 +113,10 @@ public class KeyguardPasswordViewController
            LatencyTracker latencyTracker,
            InputMethodManager inputMethodManager,
            @Main DelayableExecutor mainExecutor,
            @Main Resources resources) {
            @Main Resources resources,
            FalsingCollector falsingCollector) {
        super(view, keyguardUpdateMonitor, securityMode, lockPatternUtils, keyguardSecurityCallback,
                messageAreaControllerFactory, latencyTracker);
                messageAreaControllerFactory, latencyTracker, falsingCollector);
        mKeyguardSecurityCallback = keyguardSecurityCallback;
        mInputMethodManager = inputMethodManager;
        mMainExecutor = mainExecutor;
Loading