User should confirm device lock before un-unifying
User should confirm device lock before un-unifying Move Use the same lock toggle the first option When Unifying Title while confirming device password is of profile. Bug: 26815727 Bug: 27523804 Bug: 27547551 Change-Id: I44857f7dcff3d68486e7e4d2ae8565b56d7c91b7
This commit is contained in:
@@ -3178,9 +3178,9 @@
|
|||||||
<string name="lock_settings_profile_unification_dialog_body">You can use your work profile lock for your device screen lock as well. If you do, any work lock policies will also apply to your device screen lock.</string>
|
<string name="lock_settings_profile_unification_dialog_body">You can use your work profile lock for your device screen lock as well. If you do, any work lock policies will also apply to your device screen lock.</string>
|
||||||
<!-- Security & location settings screen, explanation in the dialog asking if the user wants to create a new lock for personal and work as the current work lock is not enough for the device. -->
|
<!-- Security & location settings screen, explanation in the dialog asking if the user wants to create a new lock for personal and work as the current work lock is not enough for the device. -->
|
||||||
<string name="lock_settings_profile_unification_dialog_uncompliant_body">Your work profile lock doesn\'t meet your organization\'s security requirements.\n\nYou can set a new screen lock for both your device and your work profile, but any work lock policies will apply to your device screen lock as well.</string>
|
<string name="lock_settings_profile_unification_dialog_uncompliant_body">Your work profile lock doesn\'t meet your organization\'s security requirements.\n\nYou can set a new screen lock for both your device and your work profile, but any work lock policies will apply to your device screen lock as well.</string>
|
||||||
<!-- Security & location settings screen, confirmation button of the dialog asking if the user wants to create a new lock for both personal and work profiles. -->
|
<!-- Security & location settings screen, confirmation button of the dialog for user with compliant lock, asking to create a new lock for both personal and work profiles. -->
|
||||||
<string name="lock_settings_profile_unification_dialog_confirm">Change device lock</string>
|
<string name="lock_settings_profile_unification_dialog_confirm">Change device lock</string>
|
||||||
<!-- Security & location settings screen, confirmation button of the dialog asking if the user wants to create a new lock for both personal and work profiles. -->
|
<!-- Security & location settings screen, confirmation button of the dialog for user with uncompliant lock, asking to create a new lock for both personal and work profiles. -->
|
||||||
<string name="lock_settings_profile_unification_dialog_uncompliant_confirm">Change lock</string>
|
<string name="lock_settings_profile_unification_dialog_uncompliant_confirm">Change lock</string>
|
||||||
<!-- Security & location settings screen, summary of the item that changes your work profile lock when it is unified with the personal lock -->
|
<!-- Security & location settings screen, summary of the item that changes your work profile lock when it is unified with the personal lock -->
|
||||||
<string name="lock_settings_profile_unified_summary">Same as device screen lock</string>
|
<string name="lock_settings_profile_unified_summary">Same as device screen lock</string>
|
||||||
|
@@ -97,6 +97,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
private static final int SET_OR_CHANGE_LOCK_METHOD_REQUEST_PROFILE = 127;
|
private static final int SET_OR_CHANGE_LOCK_METHOD_REQUEST_PROFILE = 127;
|
||||||
private static final int UNIFY_LOCK_CONFIRM_DEVICE_REQUEST = 128;
|
private static final int UNIFY_LOCK_CONFIRM_DEVICE_REQUEST = 128;
|
||||||
private static final int UNIFY_LOCK_CONFIRM_PROFILE_REQUEST = 129;
|
private static final int UNIFY_LOCK_CONFIRM_PROFILE_REQUEST = 129;
|
||||||
|
private static final int UNUNIFY_LOCK_CONFIRM_DEVICE_REQUEST = 130;
|
||||||
private static final String TAG_UNIFICATION_DIALOG = "unification_dialog";
|
private static final String TAG_UNIFICATION_DIALOG = "unification_dialog";
|
||||||
|
|
||||||
// Misc Settings
|
// Misc Settings
|
||||||
@@ -247,11 +248,11 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
if (mProfileChallengeUserId != UserHandle.USER_NULL
|
if (mProfileChallengeUserId != UserHandle.USER_NULL
|
||||||
&& mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId)) {
|
&& mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId)) {
|
||||||
addPreferencesFromResource(R.xml.security_settings_profile);
|
addPreferencesFromResource(R.xml.security_settings_profile);
|
||||||
|
addPreferencesFromResource(R.xml.security_settings_unification);
|
||||||
final int profileResid = getResIdForLockUnlockScreen(
|
final int profileResid = getResIdForLockUnlockScreen(
|
||||||
getActivity(), mLockPatternUtils, mProfileChallengeUserId);
|
getActivity(), mLockPatternUtils, mProfileChallengeUserId);
|
||||||
addPreferencesFromResource(profileResid);
|
addPreferencesFromResource(profileResid);
|
||||||
maybeAddFingerprintPreference(root, mProfileChallengeUserId);
|
maybeAddFingerprintPreference(root, mProfileChallengeUserId);
|
||||||
addPreferencesFromResource(R.xml.security_settings_unification);
|
|
||||||
if (!mLockPatternUtils.isSeparateProfileChallengeEnabled(mProfileChallengeUserId)) {
|
if (!mLockPatternUtils.isSeparateProfileChallengeEnabled(mProfileChallengeUserId)) {
|
||||||
Preference lockPreference = root.findPreference(KEY_UNLOCK_SET_OR_CHANGE_PROFILE);
|
Preference lockPreference = root.findPreference(KEY_UNLOCK_SET_OR_CHANGE_PROFILE);
|
||||||
String summary = getContext().getString(
|
String summary = getContext().getString(
|
||||||
@@ -646,24 +647,28 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
data.getStringExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD);
|
data.getStringExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD);
|
||||||
unifyLocks();
|
unifyLocks();
|
||||||
return;
|
return;
|
||||||
|
} else if (requestCode == UNUNIFY_LOCK_CONFIRM_DEVICE_REQUEST
|
||||||
|
&& resultCode == Activity.RESULT_OK) {
|
||||||
|
ununifyLocks();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
createPreferenceHierarchy();
|
createPreferenceHierarchy();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void launchConfirmDeviceLockForUnification() {
|
private void launchConfirmDeviceLockForUnification() {
|
||||||
final String title = getActivity().getString(
|
final String title = getActivity().getString(
|
||||||
R.string.lock_settings_profile_screen_lock_title);
|
R.string.unlock_set_unlock_launch_picker_title);
|
||||||
final ChooseLockSettingsHelper helper =
|
final ChooseLockSettingsHelper helper =
|
||||||
new ChooseLockSettingsHelper(getActivity(), this);
|
new ChooseLockSettingsHelper(getActivity(), this);
|
||||||
if (!helper.launchConfirmationActivity(
|
if (!helper.launchConfirmationActivity(
|
||||||
UNIFY_LOCK_CONFIRM_DEVICE_REQUEST, title, true, UserHandle.myUserId())) {
|
UNIFY_LOCK_CONFIRM_DEVICE_REQUEST, title, true, MY_USER_ID)) {
|
||||||
launchConfirmProfileLockForUnification();
|
launchConfirmProfileLockForUnification();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void launchConfirmProfileLockForUnification() {
|
private void launchConfirmProfileLockForUnification() {
|
||||||
final String title = getActivity().getString(
|
final String title = getActivity().getString(
|
||||||
R.string.lock_settings_profile_screen_lock_title);
|
R.string.unlock_set_unlock_launch_picker_title_profile);
|
||||||
final ChooseLockSettingsHelper helper =
|
final ChooseLockSettingsHelper helper =
|
||||||
new ChooseLockSettingsHelper(getActivity(), this);
|
new ChooseLockSettingsHelper(getActivity(), this);
|
||||||
if (!helper.launchConfirmationActivity(
|
if (!helper.launchConfirmationActivity(
|
||||||
@@ -681,11 +686,11 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
if (profileQuality == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) {
|
if (profileQuality == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) {
|
||||||
mLockPatternUtils.saveLockPattern(
|
mLockPatternUtils.saveLockPattern(
|
||||||
LockPatternUtils.stringToPattern(mCurrentProfilePassword),
|
LockPatternUtils.stringToPattern(mCurrentProfilePassword),
|
||||||
mCurrentDevicePassword, UserHandle.myUserId());
|
mCurrentDevicePassword, MY_USER_ID);
|
||||||
} else {
|
} else {
|
||||||
mLockPatternUtils.saveLockPassword(
|
mLockPatternUtils.saveLockPassword(
|
||||||
mCurrentProfilePassword, mCurrentDevicePassword,
|
mCurrentProfilePassword, mCurrentDevicePassword,
|
||||||
profileQuality, UserHandle.myUserId());
|
profileQuality, MY_USER_ID);
|
||||||
}
|
}
|
||||||
mCurrentDevicePassword = null;
|
mCurrentDevicePassword = null;
|
||||||
mCurrentProfilePassword = null;
|
mCurrentProfilePassword = null;
|
||||||
@@ -698,6 +703,16 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
R.string.lock_settings_picker_title, SET_OR_CHANGE_LOCK_METHOD_REQUEST, null);
|
R.string.lock_settings_picker_title, SET_OR_CHANGE_LOCK_METHOD_REQUEST, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ununifyLocks() {
|
||||||
|
mLockPatternUtils.setSeparateProfileChallengeEnabled(mProfileChallengeUserId, true);
|
||||||
|
Bundle extras = new Bundle();
|
||||||
|
extras.putInt(Intent.EXTRA_USER_ID, mProfileChallengeUserId);
|
||||||
|
startFragment(this,
|
||||||
|
"com.android.settings.ChooseLockGeneric$ChooseLockGenericFragment",
|
||||||
|
R.string.lock_settings_picker_title_profile,
|
||||||
|
SET_OR_CHANGE_LOCK_METHOD_REQUEST_PROFILE, extras);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceChange(Preference preference, Object value) {
|
public boolean onPreferenceChange(Preference preference, Object value) {
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
@@ -716,13 +731,14 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
UnificationConfirmationDialog.newIntance(compliantForDevice);
|
UnificationConfirmationDialog.newIntance(compliantForDevice);
|
||||||
dialog.show(getChildFragmentManager(), TAG_UNIFICATION_DIALOG);
|
dialog.show(getChildFragmentManager(), TAG_UNIFICATION_DIALOG);
|
||||||
} else {
|
} else {
|
||||||
mLockPatternUtils.setSeparateProfileChallengeEnabled(mProfileChallengeUserId, true);
|
final String title = getActivity().getString(
|
||||||
Bundle extras = new Bundle();
|
R.string.unlock_set_unlock_launch_picker_title);
|
||||||
extras.putInt(Intent.EXTRA_USER_ID, mProfileChallengeUserId);
|
final ChooseLockSettingsHelper helper =
|
||||||
startFragment(this,
|
new ChooseLockSettingsHelper(getActivity(), this);
|
||||||
"com.android.settings.ChooseLockGeneric$ChooseLockGenericFragment",
|
if(!helper.launchConfirmationActivity(
|
||||||
R.string.lock_settings_picker_title_profile,
|
UNUNIFY_LOCK_CONFIRM_DEVICE_REQUEST, title, true, MY_USER_ID)) {
|
||||||
SET_OR_CHANGE_LOCK_METHOD_REQUEST_PROFILE, extras);
|
ununifyLocks();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (KEY_SHOW_PASSWORD.equals(key)) {
|
} else if (KEY_SHOW_PASSWORD.equals(key)) {
|
||||||
Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD,
|
Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD,
|
||||||
@@ -1207,7 +1223,8 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
.setTitle(R.string.lock_settings_profile_unification_dialog_title)
|
.setTitle(R.string.lock_settings_profile_unification_dialog_title)
|
||||||
.setMessage(compliant ? R.string.lock_settings_profile_unification_dialog_body
|
.setMessage(compliant ? R.string.lock_settings_profile_unification_dialog_body
|
||||||
: R.string.lock_settings_profile_unification_dialog_uncompliant_body)
|
: R.string.lock_settings_profile_unification_dialog_uncompliant_body)
|
||||||
.setPositiveButton(compliant ? R.string.okay
|
.setPositiveButton(
|
||||||
|
compliant ? R.string.lock_settings_profile_unification_dialog_confirm
|
||||||
: R.string.lock_settings_profile_unification_dialog_uncompliant_confirm,
|
: R.string.lock_settings_profile_unification_dialog_uncompliant_confirm,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user