diff options
author | Sander Alewijnse <salewijnse@google.com> | 2014-08-28 11:11:37 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-08-28 11:11:38 +0000 |
commit | ddc9b2ce2377edd7ce914813be374c91be150569 (patch) | |
tree | 3cfee9a1701bff0e520f12dfdacb883b4da53b39 | |
parent | e58fda7997fd2313f0592e4bb0477d22fe5b6fb4 (diff) | |
parent | fe4eff6a6584d760584c4e438f15bcf774c6fbf0 (diff) | |
download | packages_apps_Settings-ddc9b2ce2377edd7ce914813be374c91be150569.zip packages_apps_Settings-ddc9b2ce2377edd7ce914813be374c91be150569.tar.gz packages_apps_Settings-ddc9b2ce2377edd7ce914813be374c91be150569.tar.bz2 |
Merge "Disable auto time checkbox if date/time locked down by DO." into lmp-dev
-rw-r--r-- | src/com/android/settings/DateTimeSettings.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/com/android/settings/DateTimeSettings.java b/src/com/android/settings/DateTimeSettings.java index 77561bd..8eb9c52 100644 --- a/src/com/android/settings/DateTimeSettings.java +++ b/src/com/android/settings/DateTimeSettings.java @@ -16,6 +16,7 @@ package com.android.settings; +import android.app.admin.DevicePolicyManager; import android.app.Activity; import android.app.AlarmManager; import android.app.DatePickerDialog; @@ -89,12 +90,23 @@ public class DateTimeSettings extends SettingsPreferenceFragment boolean autoTimeEnabled = getAutoState(Settings.Global.AUTO_TIME); boolean autoTimeZoneEnabled = getAutoState(Settings.Global.AUTO_TIME_ZONE); + mAutoTimePref = (CheckBoxPreference) findPreference(KEY_AUTO_TIME); + + DevicePolicyManager dpm = (DevicePolicyManager) getSystemService(Context + .DEVICE_POLICY_SERVICE); + if (dpm.getAutoTimeRequired()) { + mAutoTimePref.setEnabled(false); + + // If Settings.Global.AUTO_TIME is false it will be set to true + // by the device policy manager very soon. + // Note that this app listens to that change. + } + Intent intent = getActivity().getIntent(); boolean isFirstRun = intent.getBooleanExtra(EXTRA_IS_FIRST_RUN, false); mDummyDate = Calendar.getInstance(); - mAutoTimePref = (CheckBoxPreference) findPreference(KEY_AUTO_TIME); mAutoTimePref.setChecked(autoTimeEnabled); mAutoTimeZonePref = (CheckBoxPreference) findPreference(KEY_AUTO_TIME_ZONE); // Override auto-timezone if it's a wifi-only device or if we're still in setup wizard. |