summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorBenjamin Franz <bfranz@google.com>2015-04-14 11:12:31 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-04-14 11:12:32 +0000
commit12fdfa43ceefc1c32590a85118dacdb088188c71 (patch)
treed5067e245b14ed2b0221add7de08c0eacd883ce5 /core/java/android
parent1b4edc90688e3af37489a0b858776e83997a8099 (diff)
parente36087e5b6eeb92607f4ad5b3b1662bef9bafa4c (diff)
Merge "Introduce device owner API to disable the keyguard"
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/admin/DevicePolicyManager.java23
-rw-r--r--core/java/android/app/admin/IDevicePolicyManager.aidl2
2 files changed, 25 insertions, 0 deletions
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index dd6443673c58..a0a6c4cd678c 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -4187,4 +4187,27 @@ public class DevicePolicyManager {
}
return null;
}
+
+ /**
+ * Called by a device owner to disable the keyguard altogether.
+ *
+ * <p>Setting the keyguard to disabled has the same effect as choosing "None" as the screen
+ * lock type. However, this call has no effect if a password, pin or pattern is currently set.
+ * If a password, pin or pattern is set after the keyguard was disabled, the keyguard stops
+ * being disabled.
+ *
+ * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
+ * @param enabled New state of the keyguard.
+ *
+ * @return {@code false} if attempting to disable the keyguard while a lock password was in
+ * place. {@code true} otherwise."
+ */
+ public boolean setKeyguardEnabledState(ComponentName admin, boolean enabled) {
+ try {
+ return mService.setKeyguardEnabledState(admin, enabled);
+ } catch (RemoteException re) {
+ Log.w(TAG, "Failed talking with device policy service", re);
+ return false;
+ }
+ }
}
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index 332d59ed5eda..131b99cb4e4a 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -221,4 +221,6 @@ interface IDevicePolicyManager {
void sendDeviceInitializerStatus(int statusCode, String description);
void setOtaPolicy(in ComponentName who, in PersistableBundle policy);
PersistableBundle getOtaPolicy();
+
+ boolean setKeyguardEnabledState(in ComponentName admin, boolean enabled);
}