Fix issue no action on clicking link in footer
Links are not allowed in footer preference title now, so splitting the string in to title text and learn more text for set a separate work lock message Bug: 206083998 Bug: 231296099 Test: NA Change-Id: Ic19b4b7a9c8239726b1d53cecad1e341458610cb
This commit is contained in:
@@ -1413,8 +1413,10 @@
|
||||
<!-- Message shown in screen lock picker while setting up the backup/fallback screen lock method for biometrics. Users can choose to use this method to unlock the screen instead of biometrics, or when biometrics are not accepted. [CHAR LIMIT=80] [BACKUP_MESSAGE_ID=2799884038398627882] -->
|
||||
<string name="lock_settings_picker_biometric_message">Choose your backup screen lock method</string>
|
||||
|
||||
<!-- Text shown on the screen lock menu. This text is letting the user know that their IT admin can't reset their screen lock if they forget it, and they can choose to set another lock that would be specifically for their work apps. The place-holders "LINK_BEGIN" and "LINK_END" must NOT be translated. They mark a link to bring the user to enroll a work profile screen lock instead. [CHAR LIMIT=100] -->
|
||||
<string name="lock_settings_picker_admin_restricted_personal_message">If you forget your screen lock, your IT admin can\u2019t reset it. <annotation id="link">Set a separate work lock</annotation></string>
|
||||
<!-- Text shown on the screen lock menu. This text is letting the user know that their IT admin can't reset their screen lock if they forget it. [CHAR LIMIT=100] -->
|
||||
<string name="lock_settings_picker_admin_restricted_personal_message">If you forget your screen lock, your IT admin can\u2019t reset it.</string>
|
||||
<!-- Text shown on the screen lock menu. This text is letting the user know that they can choose to set another lock that would be specifically for their work apps. [CHAR LIMIT=100] -->
|
||||
<string name="lock_settings_picker_admin_restricted_personal_message_action">Set a separate work lock</string>
|
||||
|
||||
<!-- Message shown in screen lock picker for setting up a work profile screen lock. [CHAR LIMIT=80] -->
|
||||
<string name="lock_settings_picker_profile_message">If you forget this lock, ask your IT admin to reset it</string>
|
||||
|
@@ -25,6 +25,7 @@ import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_NONE;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.LOCK_SETTINGS_NEW_PROFILE_LOCK_TITLE;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.LOCK_SETTINGS_UPDATE_PROFILE_LOCK_TITLE;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_IT_ADMIN_CANT_RESET_SCREEN_LOCK;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_IT_ADMIN_CANT_RESET_SCREEN_LOCK_ACTION;
|
||||
import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROFILE_SCREEN_LOCK_SETUP_MESSAGE;
|
||||
|
||||
import static com.android.settings.password.ChooseLockPassword.ChooseLockPasswordFragment.RESULT_FINISHED;
|
||||
@@ -78,7 +79,6 @@ 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;
|
||||
|
||||
@@ -621,15 +621,20 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
} 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 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)));
|
||||
footer.setVisible(true);
|
||||
footer.setTitle(description);
|
||||
|
||||
final StringBuilder setLockText = new StringBuilder(
|
||||
mDpm.getResources().getString(
|
||||
WORK_PROFILE_IT_ADMIN_CANT_RESET_SCREEN_LOCK_ACTION,
|
||||
() -> getString(
|
||||
R.string.lock_settings_picker_admin_restricted_personal_message_action)));
|
||||
View.OnClickListener setLockClickListener = (v) -> {
|
||||
final Bundle extras = new Bundle();
|
||||
extras.putInt(Intent.EXTRA_USER_ID, profileUserId);
|
||||
if (mUserPassword != null) {
|
||||
@@ -642,10 +647,9 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
.setArguments(extras)
|
||||
.launch();
|
||||
finish();
|
||||
});
|
||||
CharSequence footerText = AnnotationSpan.linkify(description, linkInfo);
|
||||
footer.setVisible(true);
|
||||
footer.setTitle(footerText);
|
||||
};
|
||||
footer.setLearnMoreText(setLockText);
|
||||
footer.setLearnMoreAction(setLockClickListener);
|
||||
} else {
|
||||
footer.setVisible(false);
|
||||
}
|
||||
|
Reference in New Issue
Block a user