Loading core/res/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -6555,4 +6555,7 @@ ul.</string> <string name="keyboard_shortcut_group_applications_maps">Maps</string> <!-- User visible title for the keyboard shortcut group containing system-wide application launch shortcuts. [CHAR-LIMIT=70] --> <string name="keyboard_shortcut_group_applications">Applications</string> <!-- Fingerprint loe notification string --> <string name="fingerprint_loe_notification_msg">Your fingerprints can no longer be recognized. Set up Fingerprint Unlock again.</string> </resources> core/res/res/values/symbols.xml +3 −0 Original line number Diff line number Diff line Loading @@ -5584,4 +5584,7 @@ <java-symbol type="string" name="keyboard_shortcut_group_applications_music" /> <java-symbol type="string" name="keyboard_shortcut_group_applications_sms" /> <java-symbol type="string" name="keyboard_shortcut_group_applications" /> <!-- Fingerprint loe notification string --> <java-symbol type="string" name="fingerprint_loe_notification_msg" /> </resources> services/core/java/com/android/server/biometrics/biometrics.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -14,3 +14,10 @@ flag { description: "This flag controls whether virtual HAL is used for testing instead of TestHal " bug: "294254230" } flag { name: "notify_fingerprint_loe" namespace: "biometrics_framework" description: "This flag controls whether a notification should be sent to notify user when loss of enrollment happens" bug: "351036558" } services/core/java/com/android/server/biometrics/sensors/BiometricNotificationUtils.java +37 −0 Original line number Diff line number Diff line Loading @@ -150,6 +150,43 @@ public class BiometricNotificationUtils { } /** * Shows a fingerprint notification for loss of enrollment */ public static void showFingerprintLoeNotification(@NonNull Context context) { Slog.d(TAG, "Showing fingerprint LOE notification"); final String name = context.getString(R.string.device_unlock_notification_name); final String title = context.getString(R.string.fingerprint_dangling_notification_title); final String content = context.getString(R.string.fingerprint_loe_notification_msg); // Create "Set up" notification action button. final Intent setupIntent = new Intent(BiometricDanglingReceiver.ACTION_FINGERPRINT_RE_ENROLL_LAUNCH); final PendingIntent setupPendingIntent = PendingIntent.getBroadcastAsUser(context, 0, setupIntent, PendingIntent.FLAG_IMMUTABLE, UserHandle.CURRENT); final String setupText = context.getString(R.string.biometric_dangling_notification_action_set_up); final Notification.Action setupAction = new Notification.Action.Builder( null, setupText, setupPendingIntent).build(); // Create "Not now" notification action button. final Intent notNowIntent = new Intent(BiometricDanglingReceiver.ACTION_FINGERPRINT_RE_ENROLL_DISMISS); final PendingIntent notNowPendingIntent = PendingIntent.getBroadcastAsUser(context, 0, notNowIntent, PendingIntent.FLAG_IMMUTABLE, UserHandle.CURRENT); final String notNowText = context.getString( R.string.biometric_dangling_notification_action_not_now); final Notification.Action notNowAction = new Notification.Action.Builder( null, notNowText, notNowPendingIntent).build(); showNotificationHelper(context, name, title, content, setupPendingIntent, setupAction, notNowAction, Notification.CATEGORY_SYSTEM, FINGERPRINT_RE_ENROLL_CHANNEL, FINGERPRINT_RE_ENROLL_NOTIFICATION_TAG, Notification.VISIBILITY_SECRET, false, Notification.FLAG_NO_CLEAR); } /** * Shows a fingerprint bad calibration notification. */ Loading services/core/java/com/android/server/biometrics/sensors/BiometricUserState.java +27 −2 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ public abstract class BiometricUserState<T extends BiometricAuthenticator.Identi protected boolean mInvalidationInProgress; protected final Context mContext; protected final File mFile; private boolean mIsInvalidBiometricState = false; private final Runnable mWriteStateRunnable = this::doWriteStateInternal; Loading Loading @@ -102,7 +103,7 @@ public abstract class BiometricUserState<T extends BiometricAuthenticator.Identi serializer.endDocument(); destination.finishWrite(out); } catch (Throwable t) { Slog.wtf(TAG, "Failed to write settings, restoring backup", t); Slog.e(TAG, "Failed to write settings, restoring backup", t); destination.failWrite(out); throw new IllegalStateException("Failed to write to file: " + mFile.toString(), t); } finally { Loading Loading @@ -192,6 +193,29 @@ public abstract class BiometricUserState<T extends BiometricAuthenticator.Identi } } /** * Return true if the biometric file is correctly read. Otherwise return false. */ public boolean isInvalidBiometricState() { return mIsInvalidBiometricState; } /** * Delete the file of the biometric state. */ public void deleteBiometricFile() { synchronized (this) { if (!mFile.exists()) { return; } if (mFile.delete()) { Slog.i(TAG, mFile + " is deleted successfully"); } else { Slog.i(TAG, "Failed to delete " + mFile); } } } private boolean isUnique(String name) { for (T identifier : mBiometrics) { if (identifier.getName().equals(name)) { Loading @@ -218,7 +242,8 @@ public abstract class BiometricUserState<T extends BiometricAuthenticator.Identi try { in = new FileInputStream(mFile); } catch (FileNotFoundException fnfe) { Slog.i(TAG, "No fingerprint state"); Slog.i(TAG, "No fingerprint state", fnfe); mIsInvalidBiometricState = true; return; } try { Loading Loading
core/res/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -6555,4 +6555,7 @@ ul.</string> <string name="keyboard_shortcut_group_applications_maps">Maps</string> <!-- User visible title for the keyboard shortcut group containing system-wide application launch shortcuts. [CHAR-LIMIT=70] --> <string name="keyboard_shortcut_group_applications">Applications</string> <!-- Fingerprint loe notification string --> <string name="fingerprint_loe_notification_msg">Your fingerprints can no longer be recognized. Set up Fingerprint Unlock again.</string> </resources>
core/res/res/values/symbols.xml +3 −0 Original line number Diff line number Diff line Loading @@ -5584,4 +5584,7 @@ <java-symbol type="string" name="keyboard_shortcut_group_applications_music" /> <java-symbol type="string" name="keyboard_shortcut_group_applications_sms" /> <java-symbol type="string" name="keyboard_shortcut_group_applications" /> <!-- Fingerprint loe notification string --> <java-symbol type="string" name="fingerprint_loe_notification_msg" /> </resources>
services/core/java/com/android/server/biometrics/biometrics.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -14,3 +14,10 @@ flag { description: "This flag controls whether virtual HAL is used for testing instead of TestHal " bug: "294254230" } flag { name: "notify_fingerprint_loe" namespace: "biometrics_framework" description: "This flag controls whether a notification should be sent to notify user when loss of enrollment happens" bug: "351036558" }
services/core/java/com/android/server/biometrics/sensors/BiometricNotificationUtils.java +37 −0 Original line number Diff line number Diff line Loading @@ -150,6 +150,43 @@ public class BiometricNotificationUtils { } /** * Shows a fingerprint notification for loss of enrollment */ public static void showFingerprintLoeNotification(@NonNull Context context) { Slog.d(TAG, "Showing fingerprint LOE notification"); final String name = context.getString(R.string.device_unlock_notification_name); final String title = context.getString(R.string.fingerprint_dangling_notification_title); final String content = context.getString(R.string.fingerprint_loe_notification_msg); // Create "Set up" notification action button. final Intent setupIntent = new Intent(BiometricDanglingReceiver.ACTION_FINGERPRINT_RE_ENROLL_LAUNCH); final PendingIntent setupPendingIntent = PendingIntent.getBroadcastAsUser(context, 0, setupIntent, PendingIntent.FLAG_IMMUTABLE, UserHandle.CURRENT); final String setupText = context.getString(R.string.biometric_dangling_notification_action_set_up); final Notification.Action setupAction = new Notification.Action.Builder( null, setupText, setupPendingIntent).build(); // Create "Not now" notification action button. final Intent notNowIntent = new Intent(BiometricDanglingReceiver.ACTION_FINGERPRINT_RE_ENROLL_DISMISS); final PendingIntent notNowPendingIntent = PendingIntent.getBroadcastAsUser(context, 0, notNowIntent, PendingIntent.FLAG_IMMUTABLE, UserHandle.CURRENT); final String notNowText = context.getString( R.string.biometric_dangling_notification_action_not_now); final Notification.Action notNowAction = new Notification.Action.Builder( null, notNowText, notNowPendingIntent).build(); showNotificationHelper(context, name, title, content, setupPendingIntent, setupAction, notNowAction, Notification.CATEGORY_SYSTEM, FINGERPRINT_RE_ENROLL_CHANNEL, FINGERPRINT_RE_ENROLL_NOTIFICATION_TAG, Notification.VISIBILITY_SECRET, false, Notification.FLAG_NO_CLEAR); } /** * Shows a fingerprint bad calibration notification. */ Loading
services/core/java/com/android/server/biometrics/sensors/BiometricUserState.java +27 −2 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ public abstract class BiometricUserState<T extends BiometricAuthenticator.Identi protected boolean mInvalidationInProgress; protected final Context mContext; protected final File mFile; private boolean mIsInvalidBiometricState = false; private final Runnable mWriteStateRunnable = this::doWriteStateInternal; Loading Loading @@ -102,7 +103,7 @@ public abstract class BiometricUserState<T extends BiometricAuthenticator.Identi serializer.endDocument(); destination.finishWrite(out); } catch (Throwable t) { Slog.wtf(TAG, "Failed to write settings, restoring backup", t); Slog.e(TAG, "Failed to write settings, restoring backup", t); destination.failWrite(out); throw new IllegalStateException("Failed to write to file: " + mFile.toString(), t); } finally { Loading Loading @@ -192,6 +193,29 @@ public abstract class BiometricUserState<T extends BiometricAuthenticator.Identi } } /** * Return true if the biometric file is correctly read. Otherwise return false. */ public boolean isInvalidBiometricState() { return mIsInvalidBiometricState; } /** * Delete the file of the biometric state. */ public void deleteBiometricFile() { synchronized (this) { if (!mFile.exists()) { return; } if (mFile.delete()) { Slog.i(TAG, mFile + " is deleted successfully"); } else { Slog.i(TAG, "Failed to delete " + mFile); } } } private boolean isUnique(String name) { for (T identifier : mBiometrics) { if (identifier.getName().equals(name)) { Loading @@ -218,7 +242,8 @@ public abstract class BiometricUserState<T extends BiometricAuthenticator.Identi try { in = new FileInputStream(mFile); } catch (FileNotFoundException fnfe) { Slog.i(TAG, "No fingerprint state"); Slog.i(TAG, "No fingerprint state", fnfe); mIsInvalidBiometricState = true; return; } try { Loading