Show customized message for private space while choosing lock

The change adds private profile checks in addition to the exisiting
managed profile check to show customized message while choosing lock for
private profile in Pattern, PIN and Password screens.

Bug: 311343571
Test: Verify lock screen message for private space
Change-Id: Ic8173ff8c1af23fc593390acaff4c67390f99b9c
This commit is contained in:
josephpv
2023-12-11 11:34:00 +00:00
committed by Joseph Vincent
parent bb49d847a2
commit 223737e0b5
4 changed files with 70 additions and 16 deletions

View File

@@ -478,6 +478,8 @@ public class ChooseLockPattern extends SettingsActivity {
.getString(SET_WORK_PROFILE_PATTERN_HEADER,
() -> getString(
R.string.lockpassword_choose_your_profile_pattern_header));
} else if (android.os.Flags.allowPrivateProfile() && isPrivateProfile()) {
msg = getString(R.string.private_space_choose_your_pattern_header);
} else {
msg = getString(R.string.lockpassword_choose_your_pattern_header);
}
@@ -873,5 +875,11 @@ public class ChooseLockPattern extends SettingsActivity {
}
getActivity().finish();
}
private boolean isPrivateProfile() {
UserManager userManager = getContext().createContextAsUser(UserHandle.of(mUserId),
/*flags=*/0).getSystemService(UserManager.class);
return userManager.isPrivateProfile();
}
}
}