Merge "Store the PIN length to disk when Pin auto confirm feature is enabled" into udc-dev am: e1ae1c6516

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/22550309

Change-Id: I7e02848d8e6b13d89a766841a7675df2b76de33b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-04-14 21:11:59 +00:00
committed by Automerger Merge Worker

View File

@@ -107,12 +107,21 @@ public class ScreenLockSettings extends DashboardFragment
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
if (requestCode == AUTO_PIN_SETTING_ENABLING_REQUEST_CODE) {
if (resultCode == Activity.RESULT_OK) {
mLockPatternUtils.setAutoPinConfirm(/* enabled= */ true, MY_USER_ID);
onAutoPinConfirmSettingChange(/* newState= */ true);
}
} else if (requestCode == AUTO_PIN_SETTING_DISABLING_REQUEST_CODE) {
if (resultCode == Activity.RESULT_OK) {
mLockPatternUtils.setAutoPinConfirm(/* enabled= */ false, MY_USER_ID);
onAutoPinConfirmSettingChange(/* newState= */ false);
}
}
}
private void onAutoPinConfirmSettingChange(boolean newState) {
// update the auto pin confirm setting.
mLockPatternUtils.setAutoPinConfirm(newState, MY_USER_ID);
// store the pin length info to disk; If it fails, reset the setting to prev state.
if (!mLockPatternUtils.refreshStoredPinLength(MY_USER_ID)) {
mLockPatternUtils.setAutoPinConfirm(!newState, MY_USER_ID);
}
}
}