commit | 2a339992d3696a067c3f25d233c5e5808fab8f6a | [log] [tgz] |
---|---|---|
author | Neil Fuller <nfuller@google.com> | Wed Apr 10 19:10:14 2024 +0100 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Fri Apr 12 21:23:49 2024 +0000 |
tree | 8686eec30bb1fd468759c67799348c2a5b274801 | |
parent | ca5ff1a5e02004d8d1e21ee865eb92583783ce98 [diff] |
Restore enterprise policy checks Restore enterprise policy checks removed by commit fdab44f9e71f78a0c2809c03a8dd654c7dd3dd70 and not since restored by other changes. Bug: 325886855 Bug: 316584466 Bug: 235445309 Test: Treehugger only (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5d80553a155524e73713348fc11b9f98bee0308b) Merged-In: Id3d79805bb2289b84ad34ac05a97e50f0410502f Change-Id: Id3d79805bb2289b84ad34ac05a97e50f0410502f
diff --git a/src/com/android/settings/datetime/DatePreferenceController.java b/src/com/android/settings/datetime/DatePreferenceController.java index 02aba6e..f9e3b8f 100644 --- a/src/com/android/settings/datetime/DatePreferenceController.java +++ b/src/com/android/settings/datetime/DatePreferenceController.java
@@ -34,6 +34,7 @@ import androidx.preference.Preference; import com.android.settings.core.BasePreferenceController; +import com.android.settingslib.RestrictedPreference; import java.util.Calendar; @@ -68,6 +69,11 @@ @Override public void updateState(Preference preference) { super.updateState(preference); + + if (preference instanceof RestrictedPreference + && ((RestrictedPreference) preference).isDisabledByAdmin()) { + return; + } preference.setEnabled(isEnabled()); }
diff --git a/src/com/android/settings/datetime/TimePreferenceController.java b/src/com/android/settings/datetime/TimePreferenceController.java index 1923d55..f0a69ea 100644 --- a/src/com/android/settings/datetime/TimePreferenceController.java +++ b/src/com/android/settings/datetime/TimePreferenceController.java
@@ -32,6 +32,7 @@ import androidx.preference.Preference; import com.android.settings.core.BasePreferenceController; +import com.android.settingslib.RestrictedPreference; import java.util.Calendar; @@ -66,6 +67,11 @@ @Override public void updateState(Preference preference) { super.updateState(preference); + + if (preference instanceof RestrictedPreference + && ((RestrictedPreference) preference).isDisabledByAdmin()) { + return; + } preference.setEnabled(isEnabled()); }