Replace setAutoTimeRequired and getAutoTimeRequired with setAutoTime and getAutoTime
* Deprecate setAutoTimeRequired and getAutoTimeRequired.
* Added new API methods setAutoTime and getAutoTime.
* These new APIS use the DISALLOW_CONFIG_DATE_TIME user restriction to prevent the user from setting auto time.
* Updated Settings AutoTimePreferenceController to look at the DISALLOW_CONFIG_DATE_TIME restriction
Bug: 138709470
Test: Manual testing with testdpc and the set auto time toggle
DevicePolicyManagerTest
DeviceAndProfileOwnerTest
DevicePolicyLoggingTest
AutoTimePreferenceControllerTest
Change-Id: I55b44840089a0b701ca4d5572a0e91deb40152ed
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
package com.android.settings.datetime;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
@@ -75,6 +77,8 @@ public class AutoTimePreferenceController extends AbstractPreferenceController
|
||||
}
|
||||
|
||||
private RestrictedLockUtils.EnforcedAdmin getEnforcedAdminProperty() {
|
||||
return RestrictedLockUtilsInternal.checkIfAutoTimeRequired(mContext);
|
||||
return RestrictedLockUtilsInternal.checkIfRestrictionEnforced(
|
||||
mContext, UserManager.DISALLOW_CONFIG_DATE_TIME,
|
||||
UserHandle.myUserId());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user