Merge "Post encryption notification after attempting to unlock profiles" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
dc90c9009b
@@ -601,21 +601,6 @@ public class LockSettingsService extends ILockSettings.Stub {
|
|||||||
// Hide notification first, as tie managed profile lock takes time
|
// Hide notification first, as tie managed profile lock takes time
|
||||||
hideEncryptionNotification(new UserHandle(userId));
|
hideEncryptionNotification(new UserHandle(userId));
|
||||||
|
|
||||||
// Now we have unlocked the parent user we should show notifications
|
|
||||||
// about any profiles that exist.
|
|
||||||
List<UserInfo> profiles = mUserManager.getProfiles(userId);
|
|
||||||
for (int i = 0; i < profiles.size(); i++) {
|
|
||||||
UserInfo profile = profiles.get(i);
|
|
||||||
final boolean isSecure = isUserSecure(profile.id);
|
|
||||||
if (isSecure && profile.isManagedProfile()) {
|
|
||||||
UserHandle userHandle = profile.getUserHandle();
|
|
||||||
if (!mUserManager.isUserUnlockingOrUnlocked(userHandle) &&
|
|
||||||
!mUserManager.isQuietModeEnabled(userHandle)) {
|
|
||||||
showEncryptionNotificationForProfile(userHandle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mUserManager.getUserInfo(userId).isManagedProfile()) {
|
if (mUserManager.getUserInfo(userId).isManagedProfile()) {
|
||||||
tieManagedProfileLockIfNecessary(userId, null);
|
tieManagedProfileLockIfNecessary(userId, null);
|
||||||
}
|
}
|
||||||
@@ -1205,6 +1190,7 @@ public class LockSettingsService extends ILockSettings.Stub {
|
|||||||
*/
|
*/
|
||||||
private void unlockUser(int userId, byte[] token, byte[] secret) {
|
private void unlockUser(int userId, byte[] token, byte[] secret) {
|
||||||
// TODO: make this method fully async so we can update UI with progress strings
|
// TODO: make this method fully async so we can update UI with progress strings
|
||||||
|
final boolean alreadyUnlocked = mUserManager.isUserUnlockingOrUnlocked(userId);
|
||||||
final CountDownLatch latch = new CountDownLatch(1);
|
final CountDownLatch latch = new CountDownLatch(1);
|
||||||
final IProgressListener listener = new IProgressListener.Stub() {
|
final IProgressListener listener = new IProgressListener.Stub() {
|
||||||
@Override
|
@Override
|
||||||
@@ -1235,20 +1221,33 @@ public class LockSettingsService extends ILockSettings.Stub {
|
|||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
if (!mUserManager.getUserInfo(userId).isManagedProfile()) {
|
if (mUserManager.getUserInfo(userId).isManagedProfile()) {
|
||||||
final List<UserInfo> profiles = mUserManager.getProfiles(userId);
|
return;
|
||||||
for (UserInfo pi : profiles) {
|
}
|
||||||
|
|
||||||
|
for (UserInfo profile : mUserManager.getProfiles(userId)) {
|
||||||
// Unlock managed profile with unified lock
|
// Unlock managed profile with unified lock
|
||||||
if (tiedManagedProfileReadyToUnlock(pi)) {
|
if (tiedManagedProfileReadyToUnlock(profile)) {
|
||||||
unlockChildProfile(pi.id, false /* ignoreUserNotAuthenticated */);
|
try {
|
||||||
}
|
unlockChildProfile(profile.id, false /* ignoreUserNotAuthenticated */);
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.d(TAG, "Failed to unlock child profile", e);
|
Log.d(TAG, "Failed to unlock child profile", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Now we have unlocked the parent user and attempted to unlock the profile we should
|
||||||
|
// show notifications if the profile is still locked.
|
||||||
|
if (!alreadyUnlocked) {
|
||||||
|
long ident = clearCallingIdentity();
|
||||||
|
try {
|
||||||
|
maybeShowEncryptionNotificationForUser(profile.id);
|
||||||
|
} finally {
|
||||||
|
restoreCallingIdentity(ident);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean tiedManagedProfileReadyToUnlock(UserInfo userInfo) {
|
private boolean tiedManagedProfileReadyToUnlock(UserInfo userInfo) {
|
||||||
return userInfo.isManagedProfile()
|
return userInfo.isManagedProfile()
|
||||||
|
|||||||
Reference in New Issue
Block a user