Merge "Update BiometricPrompt default title"

This commit is contained in:
Kevin Chyn
2019-04-04 00:35:01 +00:00
committed by Android (Google) Code Review
2 changed files with 4 additions and 26 deletions

View File

@@ -1434,7 +1434,7 @@
<string name="permdesc_mediaLocation">Allows the app to read locations from your media collection.</string>
<!-- Title shown when the system-provided biometric dialog is shown, asking the user to authenticate. [CHAR LIMIT=40] -->
<string name="biometric_dialog_default_title">Application <xliff:g id="app" example="Gmail">%s</xliff:g> wants to authenticate.</string>
<string name="biometric_dialog_default_title">Verify it\u2018s you</string>
<!-- Message shown when biometric hardware is not available [CHAR LIMIT=50] -->
<string name="biometric_error_hw_unavailable">Biometric hardware unavailable</string>
<!-- Message shown when biometric authentication was canceled by the user [CHAR LIMIT=50] -->

View File

@@ -19,7 +19,6 @@ package com.android.server.biometrics;
import static android.Manifest.permission.USE_BIOMETRIC;
import static android.Manifest.permission.USE_BIOMETRIC_INTERNAL;
import static android.Manifest.permission.USE_FINGERPRINT;
import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND;
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FACE;
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FINGERPRINT;
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_IRIS;
@@ -576,30 +575,9 @@ public class BiometricService extends SystemService {
if (useDefaultTitle) {
checkInternalPermission();
// Set the default title if necessary
try {
final List<ActivityManager.RunningAppProcessInfo> procs =
ActivityManager.getService().getRunningAppProcesses();
for (int i = 0; i < procs.size(); i++) {
final ActivityManager.RunningAppProcessInfo info = procs.get(i);
if (info.uid == callingUid
&& info.importance == IMPORTANCE_FOREGROUND) {
PackageManager pm = getContext().getPackageManager();
final CharSequence label = pm.getApplicationLabel(
pm.getApplicationInfo(info.processName,
PackageManager.GET_META_DATA));
final String title = getContext()
.getString(R.string.biometric_dialog_default_title, label);
if (TextUtils.isEmpty(
bundle.getCharSequence(BiometricPrompt.KEY_TITLE))) {
bundle.putCharSequence(BiometricPrompt.KEY_TITLE, title);
}
break;
}
}
} catch (RemoteException e) {
Slog.e(TAG, "Remote exception", e);
} catch (PackageManager.NameNotFoundException e) {
Slog.e(TAG, "Name not found", e);
if (TextUtils.isEmpty(bundle.getCharSequence(BiometricPrompt.KEY_TITLE))) {
bundle.putCharSequence(BiometricPrompt.KEY_TITLE,
getContext().getString(R.string.biometric_dialog_default_title));
}
}