Update restricted setting dialog, unlock toast, and menu strings

Bug: 224970895
Bug: 224992636
Bug: 224970884
Bug: 224988456

Test: Can see updated strings and toast in UI
Change-Id: I29e257fcc15310558ae8e56cbc51de3c874471ed
This commit is contained in:
Ricky Wai
2022-03-17 18:20:21 +00:00
parent 8ba7ed6451
commit 1aa790501f
2 changed files with 17 additions and 10 deletions

View File

@@ -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;
}