Provide lockdown of date/time device owners.
Fixed two minor issues with the screencapture as well.
Updated documentation and added enforceCrossUserPermission.
Bug:16948504
Change-Id: I9a645dcf480a4a044879ba481bce964d06fe5153
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 41bbb87..aa21167 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -1885,7 +1885,7 @@
* security exception will be thrown.
*
* @param admin Which {@link DeviceAdminReceiver} this request is associated with.
- * @param disabled Whether or not screen capture should be disabled.
+ * @param disabled Whether screen capture is disabled or not.
*/
public void setScreenCaptureDisabled(ComponentName admin, boolean disabled) {
if (mService != null) {
@@ -1920,6 +1920,42 @@
}
/**
+ * Called by a device owner to set whether auto time is required. If auto time is
+ * required the user cannot set the date and time, but has to use network date and time.
+ *
+ * <p>Note: if auto time is required the user can still manually set the time zone.
+ *
+ * <p>The calling device admin must be a device owner. If it is not, a security exception will
+ * be thrown.
+ *
+ * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
+ * @param required Whether auto time is set required or not.
+ */
+ public void setAutoTimeRequired(ComponentName admin, boolean required) {
+ if (mService != null) {
+ try {
+ mService.setAutoTimeRequired(admin, UserHandle.myUserId(), required);
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed talking with device policy service", e);
+ }
+ }
+ }
+
+ /**
+ * @return true if auto time is required.
+ */
+ public boolean getAutoTimeRequired() {
+ if (mService != null) {
+ try {
+ return mService.getAutoTimeRequired();
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed talking with device policy service", e);
+ }
+ }
+ return false;
+ }
+
+ /**
* Called by an application that is administering the device to disable keyguard customizations,
* such as widgets. After setting this, keyguard features will be disabled according to the
* provided feature list.