Merge "Fix maximum time to lock" into sc-dev

This commit is contained in:
Alex Johnston
2021-04-21 09:17:28 +00:00
committed by Android (Google) Code Review
2 changed files with 72 additions and 20 deletions

View File

@@ -159,6 +159,16 @@ public class ScreenTimeoutSettings extends RadioButtonPickerFragment implements
screen.addPreference(pref);
}
final long selectedTimeout = Long.parseLong(defaultKey);
final long maxTimeout = getMaxScreenTimeout(getContext());
if (!candidateList.isEmpty() && (selectedTimeout > maxTimeout)) {
// The selected time out value is longer than the max timeout allowed by the admin.
// Select the largest value from the list by default.
final RadioButtonPreference preferenceWithLargestTimeout =
(RadioButtonPreference) screen.getPreference(candidateList.size() - 1);
preferenceWithLargestTimeout.setChecked(true);
}
if (isScreenAttentionAvailable(getContext())) {
mAdaptiveSleepPermissionController.addToScreen(screen);
mAdaptiveSleepCameraStatePreferenceController.addToScreen(screen);