Merge "Call unlockUserKey in a synchronized section" into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
735fa43314
@@ -927,32 +927,30 @@ final class UserController {
|
|||||||
|
|
||||||
boolean unlockUserCleared(final int userId, byte[] token, byte[] secret,
|
boolean unlockUserCleared(final int userId, byte[] token, byte[] secret,
|
||||||
IProgressListener listener) {
|
IProgressListener listener) {
|
||||||
final UserState uss;
|
|
||||||
synchronized (mService) {
|
synchronized (mService) {
|
||||||
// Bail if user isn't actually running, otherwise register the given
|
// Bail if user isn't actually running, otherwise register the given
|
||||||
// listener to watch for unlock progress
|
// listener to watch for unlock progress
|
||||||
uss = mStartedUsers.get(userId);
|
final UserState uss = mStartedUsers.get(userId);
|
||||||
if (uss == null) {
|
if (uss == null) {
|
||||||
notifyFinished(userId, listener);
|
notifyFinished(userId, listener);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
uss.mUnlockProgress.addListener(listener);
|
uss.mUnlockProgress.addListener(listener);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!StorageManager.isUserKeyUnlocked(userId)) {
|
// TODO Move this block outside of synchronized if it causes lock contention
|
||||||
final UserInfo userInfo = getUserInfo(userId);
|
if (!StorageManager.isUserKeyUnlocked(userId)) {
|
||||||
final IMountService mountService = getMountService();
|
final UserInfo userInfo = getUserInfo(userId);
|
||||||
try {
|
final IMountService mountService = getMountService();
|
||||||
mountService.unlockUserKey(userId, userInfo.serialNumber, token, secret);
|
try {
|
||||||
} catch (RemoteException | RuntimeException e) {
|
mountService.unlockUserKey(userId, userInfo.serialNumber, token, secret);
|
||||||
Slog.w(TAG, "Failed to unlock: " + e.getMessage());
|
} catch (RemoteException | RuntimeException e) {
|
||||||
notifyFinished(userId, listener);
|
Slog.w(TAG, "Failed to unlock: " + e.getMessage());
|
||||||
return false;
|
notifyFinished(userId, listener);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
synchronized (mService) {
|
|
||||||
finishUserUnlocking(uss);
|
finishUserUnlocking(uss);
|
||||||
|
|
||||||
// We just unlocked a user, so let's now attempt to unlock any
|
// We just unlocked a user, so let's now attempt to unlock any
|
||||||
|
|||||||
Reference in New Issue
Block a user