summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Rubin Xu <rubinxu@google.com> 2016-08-24 14:23:42 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2016-08-24 14:23:44 +0000
commit4d826638ab1ba3f90a67d0cf4d9256d4e88ee002 (patch)
tree8ebf26398fbb9e3f62d95b7e80d98696fd2ccb78
parent473c683ca6dda567f1fa4cb8538ff87fa23e0271 (diff)
parent9201a30a959491e144d7df510163da69c93981ac (diff)
Merge "Set DeviceLockedForUser state synchronously" into nyc-mr1-dev
-rw-r--r--services/core/java/com/android/server/trust/TrustManagerService.java42
1 files changed, 19 insertions, 23 deletions
diff --git a/services/core/java/com/android/server/trust/TrustManagerService.java b/services/core/java/com/android/server/trust/TrustManagerService.java
index d9c42541f9f4..a7b9cf44bae6 100644
--- a/services/core/java/com/android/server/trust/TrustManagerService.java
+++ b/services/core/java/com/android/server/trust/TrustManagerService.java
@@ -102,9 +102,8 @@ public class TrustManagerService extends SystemService {
private static final int MSG_START_USER = 7;
private static final int MSG_CLEANUP_USER = 8;
private static final int MSG_SWITCH_USER = 9;
- private static final int MSG_SET_DEVICE_LOCKED = 10;
- private static final int MSG_FLUSH_TRUST_USUALLY_MANAGED = 11;
- private static final int MSG_UNLOCK_USER = 12;
+ private static final int MSG_FLUSH_TRUST_USUALLY_MANAGED = 10;
+ private static final int MSG_UNLOCK_USER = 11;
private static final int TRUST_USUALLY_MANAGED_FLUSH_DELAY = 2 * 60 * 1000;
@@ -317,20 +316,6 @@ public class TrustManagerService extends SystemService {
}
}
- public void setDeviceLockedForUser(int userId, boolean locked) {
- if (mLockPatternUtils.isSeparateProfileChallengeEnabled(userId)) {
- synchronized (mDeviceLockedForUser) {
- mDeviceLockedForUser.put(userId, locked);
- }
- if (locked) {
- try {
- ActivityManagerNative.getDefault().notifyLockedProfile(userId);
- } catch (RemoteException e) {
- }
- }
- }
- }
-
boolean isDeviceLockedInner(int userId) {
synchronized (mDeviceLockedForUser) {
return mDeviceLockedForUser.get(userId, true);
@@ -838,10 +823,24 @@ public class TrustManagerService extends SystemService {
}
@Override
- public void setDeviceLockedForUser(int userId, boolean value) {
+ public void setDeviceLockedForUser(int userId, boolean locked) {
enforceReportPermission();
- mHandler.obtainMessage(MSG_SET_DEVICE_LOCKED, value ? 1 : 0, userId)
- .sendToTarget();
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ if (mLockPatternUtils.isSeparateProfileChallengeEnabled(userId)) {
+ synchronized (mDeviceLockedForUser) {
+ mDeviceLockedForUser.put(userId, locked);
+ }
+ if (locked) {
+ try {
+ ActivityManagerNative.getDefault().notifyLockedProfile(userId);
+ } catch (RemoteException e) {
+ }
+ }
+ }
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
}
@Override
@@ -917,9 +916,6 @@ public class TrustManagerService extends SystemService {
mCurrentUser = msg.arg1;
refreshDeviceLockedForUser(UserHandle.USER_ALL);
break;
- case MSG_SET_DEVICE_LOCKED:
- setDeviceLockedForUser(msg.arg2, msg.arg1 != 0);
- break;
case MSG_FLUSH_TRUST_USUALLY_MANAGED:
SparseBooleanArray usuallyManaged;
synchronized (mTrustUsuallyManagedForUser) {