RESTRICT AUTOMERGE Refactor device policy resource APIs to a separate class
Bug: 217388602 Bug: 218875965 Test: atest EnterpriseResourcesTests Test: manual Change-Id: I4775d7741c7819fd811c3fc4eda1636b1e04b398
This commit is contained in:
@@ -225,7 +225,7 @@ public class FaceEnrollIntroduction extends BiometricEnrollIntroduction {
|
||||
@Override
|
||||
protected String getDescriptionDisabledByAdmin() {
|
||||
DevicePolicyManager devicePolicyManager = getSystemService(DevicePolicyManager.class);
|
||||
return devicePolicyManager.getString(
|
||||
return devicePolicyManager.getResources().getString(
|
||||
FACE_UNLOCK_DISABLED,
|
||||
() -> getString(R.string.security_settings_face_enroll_introduction_message_unlock_disabled));
|
||||
}
|
||||
|
@@ -80,7 +80,7 @@ public class FaceProfileStatusPreferenceController extends FaceStatusPreferenceC
|
||||
super.updateState(preference);
|
||||
|
||||
preference.setTitle(
|
||||
mDevicePolicyManager.getString(FACE_SETTINGS_FOR_WORK_TITLE, () ->
|
||||
mDevicePolicyManager.getResources().getString(FACE_SETTINGS_FOR_WORK_TITLE, () ->
|
||||
mContext.getResources().getString(
|
||||
R.string.security_settings_face_profile_preference_title)));
|
||||
}
|
||||
|
@@ -162,9 +162,9 @@ public class FaceSettings extends DashboardFragment {
|
||||
|
||||
if (mUserManager.getUserInfo(mUserId).isManagedProfile()) {
|
||||
getActivity().setTitle(
|
||||
mDevicePolicyManager.getString(FACE_SETTINGS_FOR_WORK_TITLE, () ->
|
||||
getActivity().getResources().getString(
|
||||
R.string.security_settings_face_profile_preference_title)));
|
||||
mDevicePolicyManager.getResources().getString(FACE_SETTINGS_FOR_WORK_TITLE,
|
||||
() -> getActivity().getResources().getString(
|
||||
R.string.security_settings_face_profile_preference_title)));
|
||||
}
|
||||
|
||||
mLockscreenController = Utils.isMultipleBiometricsSupported(context)
|
||||
|
@@ -186,7 +186,7 @@ public class FingerprintEnrollIntroduction extends BiometricEnrollIntroduction {
|
||||
|
||||
@Override
|
||||
protected String getDescriptionDisabledByAdmin() {
|
||||
return mDevicePolicyManager.getString(
|
||||
return mDevicePolicyManager.getResources().getString(
|
||||
FINGERPRINT_UNLOCK_DISABLED,
|
||||
() -> getString(R.string.security_settings_fingerprint_enroll_introduction_message_unlock_disabled));
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ package com.android.settings.biometrics.fingerprint;
|
||||
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.FINGERPRINT_UNLOCK_DISABLED_EXPLANATION;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_FINGERPRINT_LAST_DELETE_MESSAGE;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.UNDEFINED;
|
||||
import static android.app.admin.DevicePolicyResources.UNDEFINED;
|
||||
|
||||
import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
|
||||
|
||||
@@ -366,7 +366,7 @@ public class FingerprintSettings extends SubSettings {
|
||||
if (admin != null) {
|
||||
DevicePolicyManager devicePolicyManager =
|
||||
getSystemService(DevicePolicyManager.class);
|
||||
String footerText = devicePolicyManager.getString(
|
||||
String footerText = devicePolicyManager.getResources().getString(
|
||||
FINGERPRINT_UNLOCK_DISABLED_EXPLANATION,
|
||||
() -> getString(R.string.security_settings_fingerprint_enroll_disclaimer_lockscreen_disabled));
|
||||
|
||||
@@ -457,10 +457,8 @@ public class FingerprintSettings extends SubSettings {
|
||||
final Preference addPreference = findPreference(KEY_FINGERPRINT_ADD);
|
||||
|
||||
/* Disable preference if too many fingerprints added */
|
||||
final List<FingerprintSensorPropertiesInternal> props =
|
||||
mFingerprintManager.getSensorPropertiesInternal();
|
||||
// This will need to be updated for devices with multiple fingerprint sensors
|
||||
final int max = props.get(0).maxEnrollmentsPerUser;
|
||||
final int max = getContext().getResources().getInteger(
|
||||
com.android.internal.R.integer.config_fingerprintMaxTemplatesPerUser);
|
||||
boolean tooMany = mFingerprintManager.getEnrolledFingerprints(mUserId).size() >= max;
|
||||
// retryFingerprint() will be called when remove finishes
|
||||
// need to disable enroll or have a way to determine if enroll is in progress
|
||||
@@ -948,7 +946,7 @@ public class FingerprintSettings extends SubSettings {
|
||||
|
||||
final AlertDialog alertDialog = new AlertDialog.Builder(getActivity())
|
||||
.setTitle(R.string.fingerprint_last_delete_title)
|
||||
.setMessage(devicePolicyManager.getString(
|
||||
.setMessage(devicePolicyManager.getResources().getString(
|
||||
messageId, () -> getContext().getString(defaultMessageId)))
|
||||
.setPositiveButton(R.string.fingerprint_last_delete_confirm,
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
Reference in New Issue
Block a user