From e9ff9a0279ccc10c47ec4c5b371537bde503659f Mon Sep 17 00:00:00 2001 From: Alex Johnston Date: Thu, 24 Feb 2022 16:50:53 +0000 Subject: [PATCH] Allowing activity occludes keyguard if activity has showWhenLocked flag Manual testing steps: - Add showWhenLocked flag to an activity in the manifest - Start the activity from the managed profile when the device is locked - Verify the activity is shown without having to enter the device or work challenge Bug: 221389857 Test: com.android.server.am.ActivityManagerServiceTest Manual testing Change-Id: I26a3c27b0f8afa3c4b00a35a788f0b2900dde932 --- .../java/com/android/server/wm/ActivityStartInterceptor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/wm/ActivityStartInterceptor.java b/services/core/java/com/android/server/wm/ActivityStartInterceptor.java index 658a17bd9ec78..ff69deae471c6 100644 --- a/services/core/java/com/android/server/wm/ActivityStartInterceptor.java +++ b/services/core/java/com/android/server/wm/ActivityStartInterceptor.java @@ -358,10 +358,10 @@ class ActivityStartInterceptor { * @return The intercepting intent if needed. */ private Intent interceptWithConfirmCredentialsIfNeeded(ActivityInfo aInfo, int userId) { - if (!mService.mAmInternal.shouldConfirmCredentials(userId)) { + if ((aInfo.flags & ActivityInfo.FLAG_SHOW_WHEN_LOCKED) != 0 + || !mService.mAmInternal.shouldConfirmCredentials(userId)) { return null; } - // TODO(b/28935539): should allow certain activities to bypass work challenge final IntentSender target = createIntentSenderForOriginalIntent(mCallingUid, FLAG_CANCEL_CURRENT | FLAG_ONE_SHOT | FLAG_IMMUTABLE); final KeyguardManager km = (KeyguardManager) mServiceContext