Merge "Unlock work profile storage even work mode is off" into nyc-dev
am: f420c413b9
* commit 'f420c413b9abd58dcbea881535da5b603f7f7afc':
Unlock work profile storage even work mode is off
Change-Id: Id0d15aca6b8f8d519910c38e03bf4c82894b8e37
This commit is contained in:
@@ -747,12 +747,6 @@ public class LockSettingsService extends ILockSettings.Stub {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Turn off quite mode if it's enabled, only managed profile can return true for now, it
|
|
||||||
// will return false if it is not a managed profile.
|
|
||||||
if (mUserManager.isQuietModeEnabled(new UserHandle(userId))) {
|
|
||||||
mUserManager.setQuietModeEnabled(userId, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ActivityManagerNative.getDefault().unlockUser(userId, token, secret, listener);
|
ActivityManagerNative.getDefault().unlockUser(userId, token, secret, listener);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
@@ -771,7 +765,6 @@ public class LockSettingsService extends ILockSettings.Stub {
|
|||||||
// Unlock managed profile with unified lock
|
// Unlock managed profile with unified lock
|
||||||
if (pi.isManagedProfile()
|
if (pi.isManagedProfile()
|
||||||
&& !mLockPatternUtils.isSeparateProfileChallengeEnabled(pi.id)
|
&& !mLockPatternUtils.isSeparateProfileChallengeEnabled(pi.id)
|
||||||
&& !pi.isQuietModeEnabled()
|
|
||||||
&& mStorage.hasChildProfileLock(pi.id)) {
|
&& mStorage.hasChildProfileLock(pi.id)) {
|
||||||
unlockChildProfile(pi.id);
|
unlockChildProfile(pi.id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -938,6 +938,17 @@ 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) {
|
||||||
synchronized (mService) {
|
synchronized (mService) {
|
||||||
|
// TODO Move this block outside of synchronized if it causes lock contention
|
||||||
|
if (!StorageManager.isUserKeyUnlocked(userId)) {
|
||||||
|
final UserInfo userInfo = getUserInfo(userId);
|
||||||
|
final IMountService mountService = getMountService();
|
||||||
|
try {
|
||||||
|
// We always want to unlock user storage, even user is not started yet
|
||||||
|
mountService.unlockUserKey(userId, userInfo.serialNumber, token, secret);
|
||||||
|
} catch (RemoteException | RuntimeException e) {
|
||||||
|
Slog.w(TAG, "Failed to unlock: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
// 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
|
||||||
final UserState uss = mStartedUsers.get(userId);
|
final UserState uss = mStartedUsers.get(userId);
|
||||||
@@ -948,19 +959,6 @@ final class UserController {
|
|||||||
uss.mUnlockProgress.addListener(listener);
|
uss.mUnlockProgress.addListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Move this block outside of synchronized if it causes lock contention
|
|
||||||
if (!StorageManager.isUserKeyUnlocked(userId)) {
|
|
||||||
final UserInfo userInfo = getUserInfo(userId);
|
|
||||||
final IMountService mountService = getMountService();
|
|
||||||
try {
|
|
||||||
mountService.unlockUserKey(userId, userInfo.serialNumber, token, secret);
|
|
||||||
} catch (RemoteException | RuntimeException e) {
|
|
||||||
Slog.w(TAG, "Failed to unlock: " + e.getMessage());
|
|
||||||
notifyFinished(userId, listener);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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