+ * Return whether unlocking the device is currently not requiring a password
+ * because of a trust agent.
+ *
+ * @return true if the keyguard can currently be unlocked without entering credentials
+ * because the device is in a trusted environment.
+ */
+ public boolean isKeyguardInTrustedState() {
+ return isKeyguardInTrustedState(UserHandle.getCallingUserId());
+ }
+
+ /**
+ * Return whether unlocking the device is currently not requiring a password
+ * because of a trust agent.
+ *
+ * @param userId the user for which the trusted state should be reported.
+ * @return true if the keyguard can currently be unlocked without entering credentials
+ * because the device is in a trusted environment.
+ * @hide
+ */
+ public boolean isKeyguardInTrustedState(int userId) {
+ try {
+ return mTrustManager.isTrusted(userId);
+ } catch (RemoteException e) {
+ return false;
+ }
+ }
+
+ /**