From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Beth Thibodeau Date: Mon, 13 Mar 2023 16:59:33 -0500 Subject: [PATCH 06/10] Use PendingIntent for media click action over lockscreen The clickIntent is provided by apps as the notification's contentIntent, and it should be sent as is. This fixes the case where the intent called an activity that could show over lockscreen. Bug: 271845008 Test: atest MediaControlPanelTest Test: manually with test app (cherry picked from commit cb2904c7ff653a87cc98904bcb3bcb9c3b6e06ea) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:223e9c5839308d8cd2e14242315a0e27a5154258) Merged-In: I09d64452c46c4d21b9d958570020b2f5e6c2b23f Change-Id: I09d64452c46c4d21b9d958570020b2f5e6c2b23f --- .../media/controls/ui/MediaControlPanel.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaControlPanel.java b/packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaControlPanel.java index 15c34430f455..5cdfe73ad3aa 100644 --- a/packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaControlPanel.java +++ b/packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaControlPanel.java @@ -495,16 +495,16 @@ public class MediaControlPanel { mLogger.logTapContentView(mUid, mPackageName, mInstanceId); logSmartspaceCardReported(SMARTSPACE_CARD_CLICK_EVENT); - // See StatusBarNotificationActivityStarter#onNotificationClicked boolean showOverLockscreen = mKeyguardStateController.isShowing() - && mActivityIntentHelper.wouldShowOverLockscreen(clickIntent.getIntent(), + && mActivityIntentHelper.wouldPendingShowOverLockscreen(clickIntent, mLockscreenUserManager.getCurrentUserId()); if (showOverLockscreen) { - mActivityStarter.startActivity(clickIntent.getIntent(), - /* dismissShade */ true, - /* animationController */ null, - /* showOverLockscreenWhenLocked */ true); + try { + clickIntent.send(); + } catch (PendingIntent.CanceledException e) { + Log.e(TAG, "Pending intent for " + key + " was cancelled"); + } } else { mActivityStarter.postStartActivityDismissingKeyguard(clickIntent, buildLaunchAnimatorController(mMediaViewHolder.getPlayer()));