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

Commit 10e469f2 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[FRR] Support customized frr notification" into main

parents 9bde1a0d da33c362
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -7466,4 +7466,8 @@
    <!-- By default ActivityOptions#makeScaleUpAnimation is only used between activities. This
         config enables OEMs to support its usage across tasks.-->
    <bool name="config_enableCrossTaskScaleUpAnimation">false</bool>

    <!-- Biometrics fingerprint frr notification target activity component name, it shall be customized by OEMs -->
    <string translatable="false" name="config_fingerprintFrrTargetComponent"></string>

</resources>
+6 −0
Original line number Diff line number Diff line
@@ -6867,4 +6867,10 @@ ul.</string>
    <string name="usb_apm_usb_plugged_in_when_locked_notification_text">USB device is plugged in when Android is locked. To use device, please unlock Android first and then reinsert USB device to use it.</string>
    <string name="usb_apm_usb_suspicious_activity_notification_title">Suspicious USB activity</string>
    <string name="usb_apm_usb_suspicious_activity_notification_text">USB data signal has been disabled.</string>
    <!-- Fingerprint failed rate too high notification title -->
    <string name="fingerprint_frr_notification_title">Having trouble with Fingerprint Unlock?</string>
    <!-- Fingerprint failed rate too high notification msg -->
    <string name="fingerprint_frr_notification_msg">Tap to review tips to improve your unlocking experience</string>
</resources>
+6 −0
Original line number Diff line number Diff line
@@ -5992,4 +5992,10 @@

  <!-- Default height of desktop view header for freeform tasks on launch. -->
  <java-symbol type="dimen" name="desktop_view_default_header_height" />

  <!-- Enable OEMs to support different frr notification target component activity -->
  <java-symbol type="string" name="config_fingerprintFrrTargetComponent" />
  <java-symbol type="string" name="fingerprint_frr_notification_title" />
  <java-symbol type="string" name="fingerprint_frr_notification_msg" />

</resources>
+31 −1
Original line number Diff line number Diff line
@@ -32,14 +32,20 @@ public class AuthenticationStats {
    private int mTotalAttempts;
    private int mRejectedAttempts;
    private int mEnrollmentNotifications;

    private long mLastEnrollmentTime;
    private long mLastFrrNotificationTime;
    private final int mModality;

    public AuthenticationStats(final int userId, int totalAttempts, int rejectedAttempts,
            int enrollmentNotifications, final int modality) {
            int enrollmentNotifications, long lastEnrollmentTime, long lastFrrNotificationTime,
            final int modality) {
        mUserId = userId;
        mTotalAttempts = totalAttempts;
        mRejectedAttempts = rejectedAttempts;
        mEnrollmentNotifications = enrollmentNotifications;
        mLastEnrollmentTime = lastEnrollmentTime;
        mLastFrrNotificationTime = lastFrrNotificationTime;
        mModality = modality;
    }

@@ -48,6 +54,8 @@ public class AuthenticationStats {
        mTotalAttempts = 0;
        mRejectedAttempts = 0;
        mEnrollmentNotifications = 0;
        mLastEnrollmentTime = 0;
        mLastFrrNotificationTime = 0;
        mModality = modality;
    }

@@ -71,6 +79,14 @@ public class AuthenticationStats {
        return mModality;
    }

    public long getLastEnrollmentTime() {
        return mLastEnrollmentTime;
    }

    public long getLastFrrNotificationTime() {
        return mLastFrrNotificationTime;
    }

    /** Calculate FRR. */
    public float getFrr() {
        if (mTotalAttempts > 0) {
@@ -100,6 +116,16 @@ public class AuthenticationStats {
        mEnrollmentNotifications++;
    }

    /** Updates last enrollment time */
    public void updateLastEnrollmentTime(long lastEnrollmentTime) {
        mLastEnrollmentTime = lastEnrollmentTime;
    }

    /** Updates frr notification time */
    public void updateLastFrrNotificationTime(long lastFrrNotificationTime) {
        mLastFrrNotificationTime = lastFrrNotificationTime;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
@@ -118,6 +144,10 @@ public class AuthenticationStats {
                == target.getRejectedAttempts()
                && this.getEnrollmentNotifications()
                == target.getEnrollmentNotifications()
                && this.getLastEnrollmentTime()
                == target.getLastEnrollmentTime()
                && this.getLastFrrNotificationTime()
                == target.getLastFrrNotificationTime()
                && this.getModality() == target.getModality();
    }

+2 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.util.Slog;

import com.android.server.biometrics.sensors.BiometricNotificationImpl;

import java.time.Clock;
import java.util.function.Consumer;

/**
@@ -62,7 +63,7 @@ public class AuthenticationStatsBroadcastReceiver extends BroadcastReceiver {

            mCollectorConsumer.accept(
                    new AuthenticationStatsCollector(context, mModality,
                            new BiometricNotificationImpl()));
                            new BiometricNotificationImpl(), Clock.systemUTC()));

            context.unregisterReceiver(this);
        }
Loading