Screen pinning set default lock on exit value

The UI default varies based on security state, so make sure we set
the current value when we turn on the feature so that the setting
has the same value as the UI.

Bug: 21999172
Change-Id: I6c920aa93aab391852d6f3a4dd8ee52da5618729
This commit is contained in:
Jason Monk
2015-06-23 12:07:27 -04:00
parent 9dd754e1f4
commit 39ab4eae12

View File

@@ -93,6 +93,10 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
private void setLockToAppEnabled(boolean isEnabled) {
Settings.System.putInt(getContentResolver(), Settings.System.LOCK_TO_APP_ENABLED,
isEnabled ? 1 : 0);
if (isEnabled) {
// Set the value to match what we have defaulted to in the UI.
setScreenLockUsedSetting(isScreenLockUsed());
}
}
private boolean isScreenLockUsed() {
@@ -115,9 +119,13 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
return false;
}
}
setScreenLockUsedSetting(isEnabled);
return true;
}
private void setScreenLockUsedSetting(boolean isEnabled) {
Settings.Secure.putInt(getContentResolver(), Settings.Secure.LOCK_TO_APP_EXIT_LOCKED,
isEnabled ? 1 : 0);
return true;
}
@Override