From c779bece315324b6a8363641f03be3ee87d8e2d2 Mon Sep 17 00:00:00 2001 From: Sudheer Shanka Date: Tue, 19 Apr 2016 22:48:26 -0700 Subject: [PATCH] Apply policy transparency to "Stay awake" in Development settings. Bug: 28271254 Change-Id: I203ce5c839e5f0201d287673ec3a48c8f835edc3 --- res/xml/development_prefs.xml | 6 +++-- .../android/settings/DevelopmentSettings.java | 24 ++++++++++++------- 2 files changed, 19 insertions(+), 11 deletions(-) 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();