Loading api/current.txt +4 −4 Original line number Diff line number Diff line Loading @@ -6857,9 +6857,9 @@ package android.app.admin { method @Nullable public String getAlwaysOnVpnPackage(@NonNull android.content.ComponentName); method @NonNull @WorkerThread public android.os.Bundle getApplicationRestrictions(@Nullable android.content.ComponentName, String); method @Deprecated @Nullable public String getApplicationRestrictionsManagingPackage(@NonNull android.content.ComponentName); method public boolean getAutoTime(@NonNull android.content.ComponentName); method public boolean getAutoTimeEnabled(@NonNull android.content.ComponentName); method @Deprecated public boolean getAutoTimeRequired(); method public boolean getAutoTimeZone(@NonNull android.content.ComponentName); method public boolean getAutoTimeZoneEnabled(@NonNull android.content.ComponentName); method @NonNull public java.util.List<android.os.UserHandle> getBindDeviceAdminTargetUsers(@NonNull android.content.ComponentName); method public boolean getBluetoothContactSharingDisabled(@NonNull android.content.ComponentName); method public boolean getCameraDisabled(@Nullable android.content.ComponentName); Loading Loading @@ -6983,9 +6983,9 @@ package android.app.admin { method public boolean setApplicationHidden(@NonNull android.content.ComponentName, String, boolean); method @WorkerThread public void setApplicationRestrictions(@Nullable android.content.ComponentName, String, android.os.Bundle); method @Deprecated public void setApplicationRestrictionsManagingPackage(@NonNull android.content.ComponentName, @Nullable String) throws android.content.pm.PackageManager.NameNotFoundException; method public void setAutoTime(@NonNull android.content.ComponentName, boolean); method public void setAutoTimeEnabled(@NonNull android.content.ComponentName, boolean); method @Deprecated public void setAutoTimeRequired(@NonNull android.content.ComponentName, boolean); method public void setAutoTimeZone(@NonNull android.content.ComponentName, boolean); method public void setAutoTimeZoneEnabled(@NonNull android.content.ComponentName, boolean); method public void setBackupServiceEnabled(@NonNull android.content.ComponentName, boolean); method public void setBluetoothContactSharingDisabled(@NonNull android.content.ComponentName, boolean); method public void setCameraDisabled(@NonNull android.content.ComponentName, boolean); core/java/android/app/admin/DevicePolicyManager.java +10 −10 Original line number Diff line number Diff line Loading @@ -6001,7 +6001,7 @@ public class DevicePolicyManager { * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param required Whether auto time is set required or not. * @throws SecurityException if {@code admin} is not a device owner. * @deprecated From {@link android.os.Build.VERSION_CODES#R}. Use {@link #setAutoTime} * @deprecated From {@link android.os.Build.VERSION_CODES#R}. Use {@link #setAutoTimeEnabled} * to turn auto time on or off and use {@link UserManager#DISALLOW_CONFIG_DATE_TIME} * to prevent the user from changing this setting. */ Loading @@ -6019,7 +6019,7 @@ public class DevicePolicyManager { /** * @return true if auto time is required. * @deprecated From {@link android.os.Build.VERSION_CODES#R}. Use {@link #getAutoTime} * @deprecated From {@link android.os.Build.VERSION_CODES#R}. Use {@link #getAutoTimeEnabled} */ @Deprecated public boolean getAutoTimeRequired() { Loading Loading @@ -6049,10 +6049,10 @@ public class DevicePolicyManager { * @throws SecurityException if caller is not a device owner, a profile owner for the * primary user, or a profile owner of an organization-owned managed profile. */ public void setAutoTime(@NonNull ComponentName admin, boolean enabled) { public void setAutoTimeEnabled(@NonNull ComponentName admin, boolean enabled) { if (mService != null) { try { mService.setAutoTime(admin, enabled); mService.setAutoTimeEnabled(admin, enabled); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -6064,10 +6064,10 @@ public class DevicePolicyManager { * @throws SecurityException if caller is not a device owner, a profile owner for the * primary user, or a profile owner of an organization-owned managed profile. */ public boolean getAutoTime(@NonNull ComponentName admin) { public boolean getAutoTimeEnabled(@NonNull ComponentName admin) { if (mService != null) { try { return mService.getAutoTime(admin); return mService.getAutoTimeEnabled(admin); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -6090,11 +6090,11 @@ public class DevicePolicyManager { * @throws SecurityException if caller is not a device owner, a profile owner for the * primary user, or a profile owner of an organization-owned managed profile. */ public void setAutoTimeZone(@NonNull ComponentName admin, boolean enabled) { public void setAutoTimeZoneEnabled(@NonNull ComponentName admin, boolean enabled) { throwIfParentInstance("setAutoTimeZone"); if (mService != null) { try { mService.setAutoTimeZone(admin, enabled); mService.setAutoTimeZoneEnabled(admin, enabled); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -6106,11 +6106,11 @@ public class DevicePolicyManager { * @throws SecurityException if caller is not a device owner, a profile owner for the * primary user, or a profile owner of an organization-owned managed profile. */ public boolean getAutoTimeZone(@NonNull ComponentName admin) { public boolean getAutoTimeZoneEnabled(@NonNull ComponentName admin) { throwIfParentInstance("getAutoTimeZone"); if (mService != null) { try { return mService.getAutoTimeZone(admin); return mService.getAutoTimeZoneEnabled(admin); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading core/java/android/app/admin/IDevicePolicyManager.aidl +4 −4 Original line number Diff line number Diff line Loading @@ -308,11 +308,11 @@ interface IDevicePolicyManager { void setAutoTimeRequired(in ComponentName who, boolean required); boolean getAutoTimeRequired(); void setAutoTime(in ComponentName who, boolean enabled); boolean getAutoTime(in ComponentName who); void setAutoTimeEnabled(in ComponentName who, boolean enabled); boolean getAutoTimeEnabled(in ComponentName who); void setAutoTimeZone(in ComponentName who, boolean enabled); boolean getAutoTimeZone(in ComponentName who); void setAutoTimeZoneEnabled(in ComponentName who, boolean enabled); boolean getAutoTimeZoneEnabled(in ComponentName who); void setForceEphemeralUsers(in ComponentName who, boolean forceEpehemeralUsers); boolean getForceEphemeralUsers(in ComponentName who); Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +4 −4 Original line number Diff line number Diff line Loading @@ -7795,7 +7795,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { * Set whether auto time is enabled on the device. */ @Override public void setAutoTime(ComponentName who, boolean enabled) { public void setAutoTimeEnabled(ComponentName who, boolean enabled) { if (!mHasFeature) { return; } Loading @@ -7816,7 +7816,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { * Returns whether auto time is used on the device or not. */ @Override public boolean getAutoTime(ComponentName who) { public boolean getAutoTimeEnabled(ComponentName who) { if (!mHasFeature) { return false; } Loading @@ -7830,7 +7830,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { * Set whether auto time zone is enabled on the device. */ @Override public void setAutoTimeZone(ComponentName who, boolean enabled) { public void setAutoTimeZoneEnabled(ComponentName who, boolean enabled) { if (!mHasFeature) { return; } Loading @@ -7851,7 +7851,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { * Returns whether auto time zone is used on the device or not. */ @Override public boolean getAutoTimeZone(ComponentName who) { public boolean getAutoTimeZoneEnabled(ComponentName who) { if (!mHasFeature) { return false; } Loading services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java +23 −22 Original line number Diff line number Diff line Loading @@ -3872,79 +3872,80 @@ public class DevicePolicyManagerTest extends DpmTestBase { Settings.System.SCREEN_BRIGHTNESS, "0", DpmMockContext.CALLER_USER_HANDLE); } public void testSetAutoTimeModifiesSetting() throws Exception { public void testSetAutoTimeEnabledModifiesSetting() throws Exception { mContext.binder.callingUid = DpmMockContext.CALLER_SYSTEM_USER_UID; setupDeviceOwner(); dpm.setAutoTime(admin1, true); dpm.setAutoTimeEnabled(admin1, true); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME, 1); dpm.setAutoTime(admin1, false); dpm.setAutoTimeEnabled(admin1, false); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME, 0); } public void testSetAutoTimeWithPOOnUser0() throws Exception { public void testSetAutoTimeEnabledWithPOOnUser0() throws Exception { mContext.binder.callingUid = DpmMockContext.CALLER_SYSTEM_USER_UID; setupProfileOwnerOnUser0(); dpm.setAutoTime(admin1, true); dpm.setAutoTimeEnabled(admin1, true); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME, 1); dpm.setAutoTime(admin1, false); dpm.setAutoTimeEnabled(admin1, false); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME, 0); } public void testSetAutoTimeFailWithPONotOnUser0() throws Exception { public void testSetAutoTimeEnabledFailWithPONotOnUser0() throws Exception { setupProfileOwner(); assertExpectException(SecurityException.class, null, () -> dpm.setAutoTime(admin1, false)); assertExpectException(SecurityException.class, null, () -> dpm.setAutoTimeEnabled(admin1, false)); verify(getServices().settings, never()).settingsGlobalPutInt(Settings.Global.AUTO_TIME, 0); } public void testSetAutoTimeWithPOOfOrganizationOwnedDevice() throws Exception { public void testSetAutoTimeEnabledWithPOOfOrganizationOwnedDevice() throws Exception { setupProfileOwner(); configureProfileOwnerOfOrgOwnedDevice(admin1, DpmMockContext.CALLER_USER_HANDLE); dpm.setAutoTime(admin1, true); dpm.setAutoTimeEnabled(admin1, true); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME, 1); dpm.setAutoTime(admin1, false); dpm.setAutoTimeEnabled(admin1, false); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME, 0); } public void testSetAutoTimeZoneModifiesSetting() throws Exception { public void testSetAutoTimeZoneEnabledModifiesSetting() throws Exception { mContext.binder.callingUid = DpmMockContext.CALLER_SYSTEM_USER_UID; setupDeviceOwner(); dpm.setAutoTimeZone(admin1, true); dpm.setAutoTimeZoneEnabled(admin1, true); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME_ZONE, 1); dpm.setAutoTimeZone(admin1, false); dpm.setAutoTimeZoneEnabled(admin1, false); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME_ZONE, 0); } public void testSetAutoTimeZoneWithPOOnUser0() throws Exception { public void testSetAutoTimeZoneEnabledWithPOOnUser0() throws Exception { mContext.binder.callingUid = DpmMockContext.CALLER_SYSTEM_USER_UID; setupProfileOwnerOnUser0(); dpm.setAutoTimeZone(admin1, true); dpm.setAutoTimeZoneEnabled(admin1, true); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME_ZONE, 1); dpm.setAutoTimeZone(admin1, false); dpm.setAutoTimeZoneEnabled(admin1, false); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME_ZONE, 0); } public void testSetAutoTimeZoneFailWithPONotOnUser0() throws Exception { public void testSetAutoTimeZoneEnabledFailWithPONotOnUser0() throws Exception { setupProfileOwner(); assertExpectException(SecurityException.class, null, () -> dpm.setAutoTimeZone(admin1, false)); () -> dpm.setAutoTimeZoneEnabled(admin1, false)); verify(getServices().settings, never()).settingsGlobalPutInt(Settings.Global.AUTO_TIME_ZONE, 0); } public void testSetAutoTimeZoneWithPOOfOrganizationOwnedDevice() throws Exception { public void testSetAutoTimeZoneEnabledWithPOOfOrganizationOwnedDevice() throws Exception { setupProfileOwner(); configureProfileOwnerOfOrgOwnedDevice(admin1, DpmMockContext.CALLER_USER_HANDLE); dpm.setAutoTimeZone(admin1, true); dpm.setAutoTimeZoneEnabled(admin1, true); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME_ZONE, 1); dpm.setAutoTimeZone(admin1, false); dpm.setAutoTimeZoneEnabled(admin1, false); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME_ZONE, 0); } Loading Loading
api/current.txt +4 −4 Original line number Diff line number Diff line Loading @@ -6857,9 +6857,9 @@ package android.app.admin { method @Nullable public String getAlwaysOnVpnPackage(@NonNull android.content.ComponentName); method @NonNull @WorkerThread public android.os.Bundle getApplicationRestrictions(@Nullable android.content.ComponentName, String); method @Deprecated @Nullable public String getApplicationRestrictionsManagingPackage(@NonNull android.content.ComponentName); method public boolean getAutoTime(@NonNull android.content.ComponentName); method public boolean getAutoTimeEnabled(@NonNull android.content.ComponentName); method @Deprecated public boolean getAutoTimeRequired(); method public boolean getAutoTimeZone(@NonNull android.content.ComponentName); method public boolean getAutoTimeZoneEnabled(@NonNull android.content.ComponentName); method @NonNull public java.util.List<android.os.UserHandle> getBindDeviceAdminTargetUsers(@NonNull android.content.ComponentName); method public boolean getBluetoothContactSharingDisabled(@NonNull android.content.ComponentName); method public boolean getCameraDisabled(@Nullable android.content.ComponentName); Loading Loading @@ -6983,9 +6983,9 @@ package android.app.admin { method public boolean setApplicationHidden(@NonNull android.content.ComponentName, String, boolean); method @WorkerThread public void setApplicationRestrictions(@Nullable android.content.ComponentName, String, android.os.Bundle); method @Deprecated public void setApplicationRestrictionsManagingPackage(@NonNull android.content.ComponentName, @Nullable String) throws android.content.pm.PackageManager.NameNotFoundException; method public void setAutoTime(@NonNull android.content.ComponentName, boolean); method public void setAutoTimeEnabled(@NonNull android.content.ComponentName, boolean); method @Deprecated public void setAutoTimeRequired(@NonNull android.content.ComponentName, boolean); method public void setAutoTimeZone(@NonNull android.content.ComponentName, boolean); method public void setAutoTimeZoneEnabled(@NonNull android.content.ComponentName, boolean); method public void setBackupServiceEnabled(@NonNull android.content.ComponentName, boolean); method public void setBluetoothContactSharingDisabled(@NonNull android.content.ComponentName, boolean); method public void setCameraDisabled(@NonNull android.content.ComponentName, boolean);
core/java/android/app/admin/DevicePolicyManager.java +10 −10 Original line number Diff line number Diff line Loading @@ -6001,7 +6001,7 @@ public class DevicePolicyManager { * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param required Whether auto time is set required or not. * @throws SecurityException if {@code admin} is not a device owner. * @deprecated From {@link android.os.Build.VERSION_CODES#R}. Use {@link #setAutoTime} * @deprecated From {@link android.os.Build.VERSION_CODES#R}. Use {@link #setAutoTimeEnabled} * to turn auto time on or off and use {@link UserManager#DISALLOW_CONFIG_DATE_TIME} * to prevent the user from changing this setting. */ Loading @@ -6019,7 +6019,7 @@ public class DevicePolicyManager { /** * @return true if auto time is required. * @deprecated From {@link android.os.Build.VERSION_CODES#R}. Use {@link #getAutoTime} * @deprecated From {@link android.os.Build.VERSION_CODES#R}. Use {@link #getAutoTimeEnabled} */ @Deprecated public boolean getAutoTimeRequired() { Loading Loading @@ -6049,10 +6049,10 @@ public class DevicePolicyManager { * @throws SecurityException if caller is not a device owner, a profile owner for the * primary user, or a profile owner of an organization-owned managed profile. */ public void setAutoTime(@NonNull ComponentName admin, boolean enabled) { public void setAutoTimeEnabled(@NonNull ComponentName admin, boolean enabled) { if (mService != null) { try { mService.setAutoTime(admin, enabled); mService.setAutoTimeEnabled(admin, enabled); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -6064,10 +6064,10 @@ public class DevicePolicyManager { * @throws SecurityException if caller is not a device owner, a profile owner for the * primary user, or a profile owner of an organization-owned managed profile. */ public boolean getAutoTime(@NonNull ComponentName admin) { public boolean getAutoTimeEnabled(@NonNull ComponentName admin) { if (mService != null) { try { return mService.getAutoTime(admin); return mService.getAutoTimeEnabled(admin); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -6090,11 +6090,11 @@ public class DevicePolicyManager { * @throws SecurityException if caller is not a device owner, a profile owner for the * primary user, or a profile owner of an organization-owned managed profile. */ public void setAutoTimeZone(@NonNull ComponentName admin, boolean enabled) { public void setAutoTimeZoneEnabled(@NonNull ComponentName admin, boolean enabled) { throwIfParentInstance("setAutoTimeZone"); if (mService != null) { try { mService.setAutoTimeZone(admin, enabled); mService.setAutoTimeZoneEnabled(admin, enabled); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading @@ -6106,11 +6106,11 @@ public class DevicePolicyManager { * @throws SecurityException if caller is not a device owner, a profile owner for the * primary user, or a profile owner of an organization-owned managed profile. */ public boolean getAutoTimeZone(@NonNull ComponentName admin) { public boolean getAutoTimeZoneEnabled(@NonNull ComponentName admin) { throwIfParentInstance("getAutoTimeZone"); if (mService != null) { try { return mService.getAutoTimeZone(admin); return mService.getAutoTimeZoneEnabled(admin); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading
core/java/android/app/admin/IDevicePolicyManager.aidl +4 −4 Original line number Diff line number Diff line Loading @@ -308,11 +308,11 @@ interface IDevicePolicyManager { void setAutoTimeRequired(in ComponentName who, boolean required); boolean getAutoTimeRequired(); void setAutoTime(in ComponentName who, boolean enabled); boolean getAutoTime(in ComponentName who); void setAutoTimeEnabled(in ComponentName who, boolean enabled); boolean getAutoTimeEnabled(in ComponentName who); void setAutoTimeZone(in ComponentName who, boolean enabled); boolean getAutoTimeZone(in ComponentName who); void setAutoTimeZoneEnabled(in ComponentName who, boolean enabled); boolean getAutoTimeZoneEnabled(in ComponentName who); void setForceEphemeralUsers(in ComponentName who, boolean forceEpehemeralUsers); boolean getForceEphemeralUsers(in ComponentName who); Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +4 −4 Original line number Diff line number Diff line Loading @@ -7795,7 +7795,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { * Set whether auto time is enabled on the device. */ @Override public void setAutoTime(ComponentName who, boolean enabled) { public void setAutoTimeEnabled(ComponentName who, boolean enabled) { if (!mHasFeature) { return; } Loading @@ -7816,7 +7816,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { * Returns whether auto time is used on the device or not. */ @Override public boolean getAutoTime(ComponentName who) { public boolean getAutoTimeEnabled(ComponentName who) { if (!mHasFeature) { return false; } Loading @@ -7830,7 +7830,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { * Set whether auto time zone is enabled on the device. */ @Override public void setAutoTimeZone(ComponentName who, boolean enabled) { public void setAutoTimeZoneEnabled(ComponentName who, boolean enabled) { if (!mHasFeature) { return; } Loading @@ -7851,7 +7851,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { * Returns whether auto time zone is used on the device or not. */ @Override public boolean getAutoTimeZone(ComponentName who) { public boolean getAutoTimeZoneEnabled(ComponentName who) { if (!mHasFeature) { return false; } Loading
services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java +23 −22 Original line number Diff line number Diff line Loading @@ -3872,79 +3872,80 @@ public class DevicePolicyManagerTest extends DpmTestBase { Settings.System.SCREEN_BRIGHTNESS, "0", DpmMockContext.CALLER_USER_HANDLE); } public void testSetAutoTimeModifiesSetting() throws Exception { public void testSetAutoTimeEnabledModifiesSetting() throws Exception { mContext.binder.callingUid = DpmMockContext.CALLER_SYSTEM_USER_UID; setupDeviceOwner(); dpm.setAutoTime(admin1, true); dpm.setAutoTimeEnabled(admin1, true); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME, 1); dpm.setAutoTime(admin1, false); dpm.setAutoTimeEnabled(admin1, false); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME, 0); } public void testSetAutoTimeWithPOOnUser0() throws Exception { public void testSetAutoTimeEnabledWithPOOnUser0() throws Exception { mContext.binder.callingUid = DpmMockContext.CALLER_SYSTEM_USER_UID; setupProfileOwnerOnUser0(); dpm.setAutoTime(admin1, true); dpm.setAutoTimeEnabled(admin1, true); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME, 1); dpm.setAutoTime(admin1, false); dpm.setAutoTimeEnabled(admin1, false); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME, 0); } public void testSetAutoTimeFailWithPONotOnUser0() throws Exception { public void testSetAutoTimeEnabledFailWithPONotOnUser0() throws Exception { setupProfileOwner(); assertExpectException(SecurityException.class, null, () -> dpm.setAutoTime(admin1, false)); assertExpectException(SecurityException.class, null, () -> dpm.setAutoTimeEnabled(admin1, false)); verify(getServices().settings, never()).settingsGlobalPutInt(Settings.Global.AUTO_TIME, 0); } public void testSetAutoTimeWithPOOfOrganizationOwnedDevice() throws Exception { public void testSetAutoTimeEnabledWithPOOfOrganizationOwnedDevice() throws Exception { setupProfileOwner(); configureProfileOwnerOfOrgOwnedDevice(admin1, DpmMockContext.CALLER_USER_HANDLE); dpm.setAutoTime(admin1, true); dpm.setAutoTimeEnabled(admin1, true); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME, 1); dpm.setAutoTime(admin1, false); dpm.setAutoTimeEnabled(admin1, false); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME, 0); } public void testSetAutoTimeZoneModifiesSetting() throws Exception { public void testSetAutoTimeZoneEnabledModifiesSetting() throws Exception { mContext.binder.callingUid = DpmMockContext.CALLER_SYSTEM_USER_UID; setupDeviceOwner(); dpm.setAutoTimeZone(admin1, true); dpm.setAutoTimeZoneEnabled(admin1, true); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME_ZONE, 1); dpm.setAutoTimeZone(admin1, false); dpm.setAutoTimeZoneEnabled(admin1, false); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME_ZONE, 0); } public void testSetAutoTimeZoneWithPOOnUser0() throws Exception { public void testSetAutoTimeZoneEnabledWithPOOnUser0() throws Exception { mContext.binder.callingUid = DpmMockContext.CALLER_SYSTEM_USER_UID; setupProfileOwnerOnUser0(); dpm.setAutoTimeZone(admin1, true); dpm.setAutoTimeZoneEnabled(admin1, true); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME_ZONE, 1); dpm.setAutoTimeZone(admin1, false); dpm.setAutoTimeZoneEnabled(admin1, false); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME_ZONE, 0); } public void testSetAutoTimeZoneFailWithPONotOnUser0() throws Exception { public void testSetAutoTimeZoneEnabledFailWithPONotOnUser0() throws Exception { setupProfileOwner(); assertExpectException(SecurityException.class, null, () -> dpm.setAutoTimeZone(admin1, false)); () -> dpm.setAutoTimeZoneEnabled(admin1, false)); verify(getServices().settings, never()).settingsGlobalPutInt(Settings.Global.AUTO_TIME_ZONE, 0); } public void testSetAutoTimeZoneWithPOOfOrganizationOwnedDevice() throws Exception { public void testSetAutoTimeZoneEnabledWithPOOfOrganizationOwnedDevice() throws Exception { setupProfileOwner(); configureProfileOwnerOfOrgOwnedDevice(admin1, DpmMockContext.CALLER_USER_HANDLE); dpm.setAutoTimeZone(admin1, true); dpm.setAutoTimeZoneEnabled(admin1, true); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME_ZONE, 1); dpm.setAutoTimeZone(admin1, false); dpm.setAutoTimeZoneEnabled(admin1, false); verify(getServices().settings).settingsGlobalPutInt(Settings.Global.AUTO_TIME_ZONE, 0); } Loading