summaryrefslogtreecommitdiffstats
path: root/core/java/android/app/admin
diff options
context:
space:
mode:
authorSander Alewijnse <salewijnse@google.com>2014-08-26 11:18:26 +0100
committerSander Alewijnse <salewijnse@google.com>2014-08-26 14:44:53 +0100
commit0ced6272911f440843e9ff8e89b9fafdb49b243b (patch)
tree63ec43e06b796cc8155a5696b2832e6e05700333 /core/java/android/app/admin
parentffad70bb7efe08ab8f03cb93e783714232a101ac (diff)
downloadframeworks_base-0ced6272911f440843e9ff8e89b9fafdb49b243b.zip
frameworks_base-0ced6272911f440843e9ff8e89b9fafdb49b243b.tar.gz
frameworks_base-0ced6272911f440843e9ff8e89b9fafdb49b243b.tar.bz2
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
Diffstat (limited to 'core/java/android/app/admin')
-rw-r--r--core/java/android/app/admin/DevicePolicyManager.java38
-rw-r--r--core/java/android/app/admin/IDevicePolicyManager.aidl3
2 files changed, 40 insertions, 1 deletions
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 @@ public class DevicePolicyManager {
* 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 @@ public class DevicePolicyManager {
}
/**
+ * 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.
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index 1e17bb6..23f36fb 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -186,4 +186,7 @@ interface IDevicePolicyManager {
boolean addCrossProfileWidgetProvider(in ComponentName admin, String packageName);
boolean removeCrossProfileWidgetProvider(in ComponentName admin, String packageName);
List<String> getCrossProfileWidgetProviders(in ComponentName admin);
+
+ void setAutoTimeRequired(in ComponentName who, int userHandle, boolean required);
+ boolean getAutoTimeRequired();
}