Fix bugs around unification when no password is set
- When in a unified state, selecting the work lock to be "none" caused a security exception - When the work lock was set to "none", unifying didn't work - When in a unified state, the work lock type selection screen showed "none" as the current type instead of the device lock type Bug: 26577247 Change-Id: I853d77186e23b6a458eaa6c1047942a7eefddc9c
This commit is contained in:
@@ -128,12 +128,16 @@ public class ProfileChallengePreferenceFragment extends SettingsPreferenceFragme
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == UNIFY_LOCK_METHOD_REQUEST && resultCode == Activity.RESULT_OK) {
|
||||
mLockPatternUtils.clearLock(mProfileUserId);
|
||||
mLockPatternUtils.setSeparateProfileChallengeEnabled(mProfileUserId, false);
|
||||
unifyLocks();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void unifyLocks() {
|
||||
mLockPatternUtils.clearLock(mProfileUserId);
|
||||
mLockPatternUtils.setSeparateProfileChallengeEnabled(mProfileUserId, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
@@ -260,6 +264,8 @@ public class ProfileChallengePreferenceFragment extends SettingsPreferenceFragme
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
final Bundle args = getArguments();
|
||||
final ProfileChallengePreferenceFragment parentFragment =
|
||||
((ProfileChallengePreferenceFragment) getParentFragment());
|
||||
return new AlertDialog.Builder(getActivity())
|
||||
.setTitle(R.string.lock_settings_profile_unification_dialog_title)
|
||||
.setMessage(R.string.lock_settings_profile_unification_dialog_body)
|
||||
@@ -271,9 +277,13 @@ public class ProfileChallengePreferenceFragment extends SettingsPreferenceFragme
|
||||
R.string.lock_settings_profile_screen_lock_title);
|
||||
ChooseLockSettingsHelper helper =
|
||||
new ChooseLockSettingsHelper(
|
||||
getActivity(), getParentFragment());
|
||||
helper.launchConfirmationActivity(UNIFY_LOCK_METHOD_REQUEST,
|
||||
title, true, args.getInt(ARG_USER_ID));
|
||||
getActivity(), parentFragment);
|
||||
if (!helper.launchConfirmationActivity(
|
||||
UNIFY_LOCK_METHOD_REQUEST,
|
||||
title, true, args.getInt(ARG_USER_ID))) {
|
||||
parentFragment.unifyLocks();
|
||||
parentFragment.createPreferenceHierarchy();
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user