diff --git a/res/values/strings.xml b/res/values/strings.xml index 905f036321a..26b79d82490 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -4680,8 +4680,8 @@ Clear storage Uninstall updates - - Unlock restricted settings + + Allow restricted settings Some activities you\u2019ve selected open in this app by default. @@ -12166,7 +12166,9 @@ Learn more - Restricted Settings + Restricted setting + + Restricted settings allowed for %s For your security, this setting is currently unavailable. diff --git a/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java b/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java index 5bc4118bfef..ac5330c4f99 100755 --- a/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java +++ b/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java @@ -48,6 +48,7 @@ import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; +import android.widget.Toast; import androidx.annotation.VisibleForTesting; @@ -443,14 +444,14 @@ public class AppInfoDashboardFragment extends DashboardFragment }; final BiometricPrompt.Builder builder = new BiometricPrompt.Builder(context) - .setTitle(context.getText(R.string.app_restricted_settings_lockscreen_title)); + .setUseDefaultTitle(); // use default title if title is null/empty - if (context.getSystemService(BiometricManager.class).canAuthenticate( - BiometricManager.Authenticators.DEVICE_CREDENTIAL - | BiometricManager.Authenticators.BIOMETRIC_WEAK) - == BiometricManager.BIOMETRIC_SUCCESS) { - builder.setAllowedAuthenticators(BiometricManager.Authenticators.DEVICE_CREDENTIAL - | BiometricManager.Authenticators.BIOMETRIC_WEAK); + final BiometricManager bm = context.getSystemService(BiometricManager.class); + final int authenticators = BiometricManager.Authenticators.DEVICE_CREDENTIAL + | BiometricManager.Authenticators.BIOMETRIC_WEAK; + if (bm.canAuthenticate(authenticators) == BiometricManager.BIOMETRIC_SUCCESS) { + builder.setAllowedAuthenticators(authenticators); + builder.setSubtitle(bm.getStrings(authenticators).getPromptMessage()); } final BiometricPrompt bp = builder.build(); @@ -481,6 +482,10 @@ public class AppInfoDashboardFragment extends DashboardFragment getPackageName(), AppOpsManager.MODE_ALLOWED); getActivity().invalidateOptionsMenu(); + final String toastString = getContext().getString( + R.string.toast_allows_restricted_settings_successfully, + mAppEntry.label); + Toast.makeText(getContext(), toastString, Toast.LENGTH_LONG).show(); }); return true; }