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

am: 4ace836

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

Change-Id: I2b6fe365bf3556d9fba5ac3c2c7580ded28dc644
This commit is contained in:
Ricky Wai
2016-04-25 13:20:37 +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. * 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. * @param userHandle The user handle of the profile to be queried.
* @return true if the profile is in quiet mode, false otherwise. * @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 // Turn off quite mode if it's enabled, only managed profile can return true for now, it
if (mUserManager.isQuietModeEnabled(new UserHandle(userId)) // will return false if it is not a managed profile.
&& mLockPatternUtils.isSeparateProfileChallengeEnabled(userId)) { if (mUserManager.isQuietModeEnabled(new UserHandle(userId))) {
mUserManager.setQuietModeEnabled(userId, false); mUserManager.setQuietModeEnabled(userId, false);
} }
@@ -729,6 +729,7 @@ 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);
} }

View File

@@ -691,9 +691,9 @@ public class UserManagerService extends IUserManager.Stub {
@Override @Override
public boolean trySetQuietModeDisabled(int userHandle, IntentSender target) { public boolean trySetQuietModeDisabled(int userHandle, IntentSender target) {
final int credentialOwnerUserId = getCredentialOwnerProfile(userHandle);
if (mContext.getSystemService(StorageManager.class).isUserKeyUnlocked(userHandle) if (mContext.getSystemService(StorageManager.class).isUserKeyUnlocked(userHandle)
|| !mLockPatternUtils.isSecure(userHandle) || !mLockPatternUtils.isSecure(credentialOwnerUserId)) {
|| !mLockPatternUtils.isSeparateProfileChallengeEnabled(userHandle)) {
// if the user is already unlocked, no need to show a profile challenge // if the user is already unlocked, no need to show a profile challenge
setQuietModeEnabled(userHandle, false); setQuietModeEnabled(userHandle, false);
return true; return true;
@@ -704,6 +704,9 @@ public class UserManagerService extends IUserManager.Stub {
// otherwise, we show a profile challenge to trigger decryption of the user // otherwise, we show a profile challenge to trigger decryption of the user
final KeyguardManager km = (KeyguardManager) mContext.getSystemService( final KeyguardManager km = (KeyguardManager) mContext.getSystemService(
Context.KEYGUARD_SERVICE); 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, final Intent unlockIntent = km.createConfirmDeviceCredentialIntent(null, null,
userHandle); userHandle);
if (unlockIntent == null) { if (unlockIntent == null) {