diff options
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaControlPanel.java | 13 | ||||
| -rw-r--r-- | packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/MediaControlPanelTest.kt | 13 |
2 files changed, 14 insertions, 12 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 4ddff530e658..638c4c408bb1 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 @@ -518,16 +518,15 @@ 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())); diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/MediaControlPanelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/MediaControlPanelTest.kt index fd353afff7c0..df13fddc5a28 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/MediaControlPanelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/MediaControlPanelTest.kt @@ -94,7 +94,6 @@ import com.android.systemui.util.mockito.KotlinArgumentCaptor import com.android.systemui.util.mockito.any import com.android.systemui.util.mockito.argumentCaptor import com.android.systemui.util.mockito.eq -import com.android.systemui.util.mockito.nullable import com.android.systemui.util.mockito.withArgCaptor import com.android.systemui.util.time.FakeSystemClock import com.google.common.truth.Truth.assertThat @@ -1763,7 +1762,7 @@ public class MediaControlPanelTest : SysuiTestCase() { fun tapContentView_showOverLockscreen_openActivity() { // WHEN we are on lockscreen and this activity can show over lockscreen whenever(keyguardStateController.isShowing).thenReturn(true) - whenever(activityIntentHelper.wouldShowOverLockscreen(any(), any())).thenReturn(true) + whenever(activityIntentHelper.wouldPendingShowOverLockscreen(any(), any())).thenReturn(true) val clickIntent = mock(Intent::class.java) val pendingIntent = mock(PendingIntent::class.java) @@ -1774,16 +1773,20 @@ public class MediaControlPanelTest : SysuiTestCase() { player.bindPlayer(data, KEY) verify(viewHolder.player).setOnClickListener(captor.capture()) - // THEN it shows without dismissing keyguard first + // THEN it sends the PendingIntent without dismissing keyguard first, + // and does not use the Intent directly (see b/271845008) captor.value.onClick(viewHolder.player) - verify(activityStarter).startActivity(eq(clickIntent), eq(true), nullable(), eq(true)) + verify(pendingIntent).send() + verify(pendingIntent, never()).getIntent() + verify(activityStarter, never()).postStartActivityDismissingKeyguard(eq(clickIntent), any()) } @Test fun tapContentView_noShowOverLockscreen_dismissKeyguard() { // WHEN we are on lockscreen and the activity cannot show over lockscreen whenever(keyguardStateController.isShowing).thenReturn(true) - whenever(activityIntentHelper.wouldShowOverLockscreen(any(), any())).thenReturn(false) + whenever(activityIntentHelper.wouldPendingShowOverLockscreen(any(), any())) + .thenReturn(false) val clickIntent = mock(Intent::class.java) val pendingIntent = mock(PendingIntent::class.java) |