Loading core/java/android/app/ActivityManagerInternal.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -248,7 +248,8 @@ public abstract class ActivityManagerInternal { /** /** * Returns whether the given user requires credential entry at this time. This is used to * Returns whether the given user requires credential entry at this time. This is used to * intercept activity launches for work apps when the Work Challenge is present. * intercept activity launches for locked work apps due to work challenge being triggered or * when the profile user is yet to be unlocked. */ */ public abstract boolean shouldConfirmCredentials(@UserIdInt int userId); public abstract boolean shouldConfirmCredentials(@UserIdInt int userId); Loading services/core/java/com/android/server/am/UserController.java +12 −8 Original line number Original line Diff line number Diff line Loading @@ -2218,19 +2218,23 @@ class UserController implements Handler.Callback { /** /** * Returns whether the given user requires credential entry at this time. This is used to * Returns whether the given user requires credential entry at this time. This is used to * intercept activity launches for work apps when the Work Challenge is present. * intercept activity launches for locked work apps due to work challenge being triggered * or when the profile user is yet to be unlocked. */ */ protected boolean shouldConfirmCredentials(@UserIdInt int userId) { protected boolean shouldConfirmCredentials(@UserIdInt int userId) { synchronized (mLock) { if (getStartedUserState(userId) == null) { if (mStartedUsers.get(userId) == null) { return false; return false; } } } if (!getUserInfo(userId).isManagedProfile()) { if (!mLockPatternUtils.isSeparateProfileChallengeEnabled(userId)) { return false; return false; } } if (mLockPatternUtils.isSeparateProfileChallengeEnabled(userId)) { final KeyguardManager km = mInjector.getKeyguardManager(); final KeyguardManager km = mInjector.getKeyguardManager(); return km.isDeviceLocked(userId) && km.isDeviceSecure(userId); return km.isDeviceLocked(userId) && km.isDeviceSecure(userId); } else { // For unified challenge, need to confirm credential if user is RUNNING_LOCKED. return isUserRunning(userId, ActivityManager.FLAG_AND_LOCKED); } } } boolean isLockScreenDisabled(@UserIdInt int userId) { boolean isLockScreenDisabled(@UserIdInt int userId) { Loading services/core/java/com/android/server/wm/ActivityStartInterceptor.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -178,7 +178,7 @@ class ActivityStartInterceptor { // before issuing the work challenge. // before issuing the work challenge. return true; return true; } } return interceptWorkProfileChallengeIfNeeded(); return interceptLockedManagedProfileIfNeeded(); } } private boolean hasCrossProfileAnimation() { private boolean hasCrossProfileAnimation() { Loading Loading @@ -296,7 +296,7 @@ class ActivityStartInterceptor { return true; return true; } } private boolean interceptWorkProfileChallengeIfNeeded() { private boolean interceptLockedManagedProfileIfNeeded() { final Intent interceptingIntent = interceptWithConfirmCredentialsIfNeeded(mAInfo, mUserId); final Intent interceptingIntent = interceptWithConfirmCredentialsIfNeeded(mAInfo, mUserId); if (interceptingIntent == null) { if (interceptingIntent == null) { return false; return false; Loading services/tests/wmtests/src/com/android/server/wm/ActivityStartInterceptorTest.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -246,7 +246,7 @@ public class ActivityStartInterceptorTest { } } @Test @Test public void testWorkChallenge() { public void testLockedManagedProfile() { // GIVEN that the user the activity is starting as is currently locked // GIVEN that the user the activity is starting as is currently locked when(mAmInternal.shouldConfirmCredentials(TEST_USER_ID)).thenReturn(true); when(mAmInternal.shouldConfirmCredentials(TEST_USER_ID)).thenReturn(true); Loading Loading
core/java/android/app/ActivityManagerInternal.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -248,7 +248,8 @@ public abstract class ActivityManagerInternal { /** /** * Returns whether the given user requires credential entry at this time. This is used to * Returns whether the given user requires credential entry at this time. This is used to * intercept activity launches for work apps when the Work Challenge is present. * intercept activity launches for locked work apps due to work challenge being triggered or * when the profile user is yet to be unlocked. */ */ public abstract boolean shouldConfirmCredentials(@UserIdInt int userId); public abstract boolean shouldConfirmCredentials(@UserIdInt int userId); Loading
services/core/java/com/android/server/am/UserController.java +12 −8 Original line number Original line Diff line number Diff line Loading @@ -2218,19 +2218,23 @@ class UserController implements Handler.Callback { /** /** * Returns whether the given user requires credential entry at this time. This is used to * Returns whether the given user requires credential entry at this time. This is used to * intercept activity launches for work apps when the Work Challenge is present. * intercept activity launches for locked work apps due to work challenge being triggered * or when the profile user is yet to be unlocked. */ */ protected boolean shouldConfirmCredentials(@UserIdInt int userId) { protected boolean shouldConfirmCredentials(@UserIdInt int userId) { synchronized (mLock) { if (getStartedUserState(userId) == null) { if (mStartedUsers.get(userId) == null) { return false; return false; } } } if (!getUserInfo(userId).isManagedProfile()) { if (!mLockPatternUtils.isSeparateProfileChallengeEnabled(userId)) { return false; return false; } } if (mLockPatternUtils.isSeparateProfileChallengeEnabled(userId)) { final KeyguardManager km = mInjector.getKeyguardManager(); final KeyguardManager km = mInjector.getKeyguardManager(); return km.isDeviceLocked(userId) && km.isDeviceSecure(userId); return km.isDeviceLocked(userId) && km.isDeviceSecure(userId); } else { // For unified challenge, need to confirm credential if user is RUNNING_LOCKED. return isUserRunning(userId, ActivityManager.FLAG_AND_LOCKED); } } } boolean isLockScreenDisabled(@UserIdInt int userId) { boolean isLockScreenDisabled(@UserIdInt int userId) { Loading
services/core/java/com/android/server/wm/ActivityStartInterceptor.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -178,7 +178,7 @@ class ActivityStartInterceptor { // before issuing the work challenge. // before issuing the work challenge. return true; return true; } } return interceptWorkProfileChallengeIfNeeded(); return interceptLockedManagedProfileIfNeeded(); } } private boolean hasCrossProfileAnimation() { private boolean hasCrossProfileAnimation() { Loading Loading @@ -296,7 +296,7 @@ class ActivityStartInterceptor { return true; return true; } } private boolean interceptWorkProfileChallengeIfNeeded() { private boolean interceptLockedManagedProfileIfNeeded() { final Intent interceptingIntent = interceptWithConfirmCredentialsIfNeeded(mAInfo, mUserId); final Intent interceptingIntent = interceptWithConfirmCredentialsIfNeeded(mAInfo, mUserId); if (interceptingIntent == null) { if (interceptingIntent == null) { return false; return false; Loading
services/tests/wmtests/src/com/android/server/wm/ActivityStartInterceptorTest.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -246,7 +246,7 @@ public class ActivityStartInterceptorTest { } } @Test @Test public void testWorkChallenge() { public void testLockedManagedProfile() { // GIVEN that the user the activity is starting as is currently locked // GIVEN that the user the activity is starting as is currently locked when(mAmInternal.shouldConfirmCredentials(TEST_USER_ID)).thenReturn(true); when(mAmInternal.shouldConfirmCredentials(TEST_USER_ID)).thenReturn(true); Loading