diff options
author | Adrian Roos <roosa@google.com> | 2014-11-20 16:21:11 +0100 |
---|---|---|
committer | Adrian Roos <roosa@google.com> | 2014-11-20 21:45:04 +0100 |
commit | 50bfeec868157106e8b60abf8964cb24462af182 (patch) | |
tree | 38591fdb7288bc6cde58e1c2d6fa4c0a961c1ab3 /services/core/java/com/android/server/trust | |
parent | 6d0e2c9cb948a10137e6b5a4eb00e601622fe8ee (diff) | |
download | frameworks_base-50bfeec868157106e8b60abf8964cb24462af182.zip frameworks_base-50bfeec868157106e8b60abf8964cb24462af182.tar.gz frameworks_base-50bfeec868157106e8b60abf8964cb24462af182.tar.bz2 |
Update KeyguardManager.isDeviceLocked API
Bug: 18414067
Change-Id: I0715714c2c9a122f578ec0c6f508faae12e6f752
Diffstat (limited to 'services/core/java/com/android/server/trust')
-rw-r--r-- | services/core/java/com/android/server/trust/TrustManagerService.java | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/trust/TrustManagerService.java b/services/core/java/com/android/server/trust/TrustManagerService.java index 2388c85..361f0e6 100644 --- a/services/core/java/com/android/server/trust/TrustManagerService.java +++ b/services/core/java/com/android/server/trust/TrustManagerService.java @@ -61,6 +61,8 @@ import android.util.Log; import android.util.Slog; import android.util.SparseBooleanArray; import android.util.Xml; +import android.view.WindowManagerGlobal; +import android.view.WindowManagerInternal; import java.io.FileDescriptor; import java.io.IOException; @@ -590,13 +592,26 @@ public class TrustManagerService extends SystemService { } @Override - public boolean isTrusted(int userId) throws RemoteException { + public boolean isDeviceLocked(int userId) throws RemoteException { userId = ActivityManager.handleIncomingUser(getCallingPid(), getCallingUid(), userId, - false /* allowAll */, true /* requireFull */, "isTrusted", null); + false /* allowAll */, true /* requireFull */, "isDeviceLocked", null); userId = resolveProfileParent(userId); + + boolean isSecure = mLockPatternUtils.isSecure(userId); + + boolean isTrusted; synchronized (mUserIsTrusted) { - return mUserIsTrusted.get(userId); + isTrusted = mUserIsTrusted.get(userId); + } + + boolean isLocked; + if (ActivityManager.getCurrentUser() != userId) { + isLocked = true; + } else { + isLocked = WindowManagerGlobal.getWindowManagerService().isKeyguardLocked(); } + + return isSecure && isLocked && !isTrusted; } private void enforceReportPermission() { |