diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6fe9549b2d3..6832e080d4b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1406,7 +1406,7 @@
Choose your backup screen lock method
- This lock can\u2019t be reset by your IT admin. LINK_BEGINSet a separate work lock insteadLINK_END
+ If you forget your screen lock, your IT admin can\u2019t reset it. Set a separate work lock
If you forget this lock, ask your IT admin to reset it
diff --git a/src/com/android/settings/password/ChooseLockGeneric.java b/src/com/android/settings/password/ChooseLockGeneric.java
index e340b505356..e2b91c753fd 100644
--- a/src/com/android/settings/password/ChooseLockGeneric.java
+++ b/src/com/android/settings/password/ChooseLockGeneric.java
@@ -67,7 +67,6 @@ import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockscreenCredential;
import com.android.settings.EncryptionInterstitial;
import com.android.settings.EventLogTags;
-import com.android.settings.LinkifyUtils;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.SettingsPreferenceFragment;
@@ -78,7 +77,9 @@ import com.android.settings.core.SubSettingLauncher;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
import com.android.settings.safetycenter.LockScreenSafetySource;
import com.android.settings.search.SearchFeatureProvider;
+import com.android.settings.utils.AnnotationSpan;
import com.android.settingslib.RestrictedPreference;
+import com.android.settingslib.widget.FooterPreference;
import com.google.android.setupcompat.util.WizardManagerHelper;
@@ -403,32 +404,7 @@ public class ChooseLockGeneric extends SettingsActivity {
WORK_PROFILE_SCREEN_LOCK_SETUP_MESSAGE,
() -> getString(R.string.lock_settings_picker_profile_message)));
} else {
- int profileUserId = Utils.getManagedProfileId(mUserManager, mUserId);
- if (mController.isScreenLockRestrictedByAdmin()
- && profileUserId != UserHandle.USER_NULL) {
- final StringBuilder description = new StringBuilder(
- mDpm.getResources().getString(
- WORK_PROFILE_IT_ADMIN_CANT_RESET_SCREEN_LOCK,
- () -> getString(
- R.string.lock_settings_picker_admin_restricted_personal_message)));
- final LinkifyUtils.OnClickListener clickListener = () -> {
- final Bundle extras = new Bundle();
- extras.putInt(Intent.EXTRA_USER_ID, profileUserId);
- if (mUserPassword != null) {
- extras.putParcelable(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD,
- mUserPassword);
- }
- new SubSettingLauncher(getActivity())
- .setDestination(ChooseLockGenericFragment.class.getName())
- .setSourceMetricsCategory(getMetricsCategory())
- .setArguments(extras)
- .launch();
- finish();
- };
- LinkifyUtils.linkify(textView, description, clickListener);
- } else {
- textView.setText("");
- }
+ textView.setText("");
}
}
}
@@ -633,10 +609,39 @@ public class ChooseLockGeneric extends SettingsActivity {
protected void addPreferences() {
addPreferencesFromResource(R.xml.security_settings_picker);
- final Preference footer = findPreference(KEY_LOCK_SETTINGS_FOOTER);
+ int profileUserId = Utils.getManagedProfileId(mUserManager, mUserId);
+ final FooterPreference footer = findPreference(KEY_LOCK_SETTINGS_FOOTER);
if (!TextUtils.isEmpty(mCallerAppName) && !mIsCallingAppAdmin) {
footer.setVisible(true);
footer.setTitle(getFooterString());
+ } else if (!mForFace && !mForBiometrics && !mForFingerprint && !mIsManagedProfile
+ && mController.isScreenLockRestrictedByAdmin()
+ && profileUserId != UserHandle.USER_NULL) {
+ CharSequence description =
+ mDpm.getResources().getString(WORK_PROFILE_IT_ADMIN_CANT_RESET_SCREEN_LOCK,
+ () -> null);
+ if (description == null) {
+ description = getText(
+ R.string.lock_settings_picker_admin_restricted_personal_message);
+ }
+ final AnnotationSpan.LinkInfo linkInfo = new AnnotationSpan.LinkInfo(
+ AnnotationSpan.LinkInfo.DEFAULT_ANNOTATION, (view) -> {
+ final Bundle extras = new Bundle();
+ extras.putInt(Intent.EXTRA_USER_ID, profileUserId);
+ if (mUserPassword != null) {
+ extras.putParcelable(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD,
+ mUserPassword);
+ }
+ new SubSettingLauncher(getActivity())
+ .setDestination(ChooseLockGenericFragment.class.getName())
+ .setSourceMetricsCategory(getMetricsCategory())
+ .setArguments(extras)
+ .launch();
+ finish();
+ });
+ CharSequence footerText = AnnotationSpan.linkify(description, linkInfo);
+ footer.setVisible(true);
+ footer.setTitle(footerText);
} else {
footer.setVisible(false);
}