Merge "Make "work mode on dialog" show personal challenge in unified work lock" into nyc-dev am: 4ace836

am: e4c8276

* commit 'e4c827662a39c7c31481f68d738dd9de01a831b1':
  Make "work mode on dialog" show personal challenge in unified work lock

Change-Id: If1fe100d177986abff459485a1683a66e38a8dc6
This commit is contained in:
Ricky Wai
2016-04-25 13:25:30 +00:00
committed by android-build-merger
3 changed files with 10 additions and 5 deletions

View File

@@ -1685,6 +1685,7 @@ public class UserManager {
/**
* Returns whether the given profile is in quiet mode or not.
* Notes: Quiet mode is only supported for managed profiles.
*
* @param userHandle The user handle of the profile to be queried.
* @return true if the profile is in quiet mode, false otherwise.

View File

@@ -705,9 +705,9 @@ public class LockSettingsService extends ILockSettings.Stub {
}
};
// Check if the user is currently in quiet mode and start it otherwise
if (mUserManager.isQuietModeEnabled(new UserHandle(userId))
&& mLockPatternUtils.isSeparateProfileChallengeEnabled(userId)) {
// 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);
}
@@ -729,6 +729,7 @@ public class LockSettingsService extends ILockSettings.Stub {
// Unlock managed profile with unified lock
if (pi.isManagedProfile()
&& !mLockPatternUtils.isSeparateProfileChallengeEnabled(pi.id)
&& !pi.isQuietModeEnabled()
&& mStorage.hasChildProfileLock(pi.id)) {
unlockChildProfile(pi.id);
}

View File

@@ -691,9 +691,9 @@ public class UserManagerService extends IUserManager.Stub {
@Override
public boolean trySetQuietModeDisabled(int userHandle, IntentSender target) {
final int credentialOwnerUserId = getCredentialOwnerProfile(userHandle);
if (mContext.getSystemService(StorageManager.class).isUserKeyUnlocked(userHandle)
|| !mLockPatternUtils.isSecure(userHandle)
|| !mLockPatternUtils.isSeparateProfileChallengeEnabled(userHandle)) {
|| !mLockPatternUtils.isSecure(credentialOwnerUserId)) {
// if the user is already unlocked, no need to show a profile challenge
setQuietModeEnabled(userHandle, false);
return true;
@@ -704,6 +704,9 @@ public class UserManagerService extends IUserManager.Stub {
// otherwise, we show a profile challenge to trigger decryption of the user
final KeyguardManager km = (KeyguardManager) mContext.getSystemService(
Context.KEYGUARD_SERVICE);
// We should use userHandle not credentialOwnerUserId here, as even if it is unified
// lock, confirm screenlock page will know and show personal challenge, and unlock
// work profile when personal challenge is correct
final Intent unlockIntent = km.createConfirmDeviceCredentialIntent(null, null,
userHandle);
if (unlockIntent == null) {