summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorAdrian Roos <roosa@google.com>2015-04-13 23:53:56 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-04-13 23:53:57 +0000
commit7d8f2c25df8d017c5fb57cfe844500e3aeb8f321 (patch)
tree91a14f36acc6301c304250e74d5d35b9738a68f7 /core/java
parent1dc22fa9ea2b36d2474fede56d0ae789e747d001 (diff)
parent82893681ad6530eec8f2a9b4ecd2e039addf48b7 (diff)
Merge "Add KeyguardManager.isDeviceSecure"
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/KeyguardManager.java26
-rw-r--r--core/java/android/app/trust/ITrustManager.aidl1
2 files changed, 27 insertions, 0 deletions
diff --git a/core/java/android/app/KeyguardManager.java b/core/java/android/app/KeyguardManager.java
index ddd21e62e2c5..56cd53e20049 100644
--- a/core/java/android/app/KeyguardManager.java
+++ b/core/java/android/app/KeyguardManager.java
@@ -253,6 +253,32 @@ public class KeyguardManager {
}
/**
+ * Returns whether the device is secured with a PIN, pattern or
+ * password.
+ *
+ * @return true if a PIN, pattern or password was set.
+ */
+ public boolean isDeviceSecure() {
+ return isDeviceSecure(UserHandle.getCallingUserId());
+ }
+
+ /**
+ * Returns whether the device is secured with a PIN, pattern or
+ * password.
+ *
+ * @param userId the user for which the secure state should be reported.
+ * @return true if a PIN, pattern or password was set.
+ * @hide
+ */
+ public boolean isDeviceSecure(int userId) {
+ try {
+ return mTrustManager.isDeviceSecure(userId);
+ } catch (RemoteException e) {
+ return false;
+ }
+ }
+
+ /**
* @deprecated Use {@link android.view.WindowManager.LayoutParams#FLAG_DISMISS_KEYGUARD}
* and/or {@link android.view.WindowManager.LayoutParams#FLAG_SHOW_WHEN_LOCKED}
* instead; this allows you to seamlessly hide the keyguard as your application
diff --git a/core/java/android/app/trust/ITrustManager.aidl b/core/java/android/app/trust/ITrustManager.aidl
index 68ea0aaed497..17cff5c3cf69 100644
--- a/core/java/android/app/trust/ITrustManager.aidl
+++ b/core/java/android/app/trust/ITrustManager.aidl
@@ -31,4 +31,5 @@ interface ITrustManager {
void unregisterTrustListener(in ITrustListener trustListener);
void reportKeyguardShowingChanged();
boolean isDeviceLocked(int userId);
+ boolean isDeviceSecure(int userId);
}