diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml index e737ba8b178..6d1a9fc0d3b 100644 --- a/res/xml/development_prefs.xml +++ b/res/xml/development_prefs.xml @@ -15,6 +15,7 @@ --> - + android:summary="@string/keep_screen_on_summary" + settings:useAdditionalSummary="true" /> 0) { - // A DeviceAdmin has specified a maximum time until the device - // will lock... in this case we can't allow the user to turn - // on "stay awake when plugged in" because that would defeat the - // restriction. - mDisabledPrefs.add(mKeepScreenOn); - } else { + // A DeviceAdmin has specified a maximum time until the device + // will lock... in this case we can't allow the user to turn + // on "stay awake when plugged in" because that would defeat the + // restriction. + final EnforcedAdmin admin = RestrictedLockUtils.checkIfMaximumTimeToLockIsSet( + getActivity()); + mKeepScreenOn.setDisabledByAdmin(admin); + if (admin == null) { mDisabledPrefs.remove(mKeepScreenOn); + } else { + mDisabledPrefs.add(mKeepScreenOn); } final ContentResolver cr = getActivity().getContentResolver();