From 57b7e5f8b409387719ede04b69b8d8f37b5272f1 Mon Sep 17 00:00:00 2001 From: Silin Huang Date: Tue, 4 Jan 2022 07:29:46 -0800 Subject: [PATCH] Fix LaunchAnyWheere via an Evil Card in QuickAccessWallet. Use pendingIntent.send() instead. Bug: 202506934 Test: manual Change-Id: Ia48edf1e14883b068fd34048f660d3c2f1f744e2 --- .../systemui/wallet/ui/WalletScreenController.java | 3 +-- .../wallet/ui/WalletScreenControllerTest.java | 11 ++++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletScreenController.java b/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletScreenController.java index 2e183b38a7dcc..ba9b638fac99b 100644 --- a/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletScreenController.java +++ b/packages/SystemUI/src/com/android/systemui/wallet/ui/WalletScreenController.java @@ -223,8 +223,7 @@ public class WalletScreenController implements } mUiEventLogger.log(WalletUiEvent.QAW_CLICK_CARD); - mActivityStarter.startActivity( - ((QAWalletCardViewInfo) cardInfo).mWalletCard.getPendingIntent().getIntent(), true); + mActivityStarter.startPendingIntentDismissingKeyguard(cardInfo.getPendingIntent()); } @Override diff --git a/packages/SystemUI/tests/src/com/android/systemui/wallet/ui/WalletScreenControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/wallet/ui/WalletScreenControllerTest.java index e3b07b3e8bd7b..01769e52c8d39 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/wallet/ui/WalletScreenControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/wallet/ui/WalletScreenControllerTest.java @@ -21,7 +21,6 @@ import static android.view.View.VISIBLE; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -96,7 +95,7 @@ public class WalletScreenControllerTest extends SysuiTestCase { @Mock UiEventLogger mUiEventLogger; @Captor - ArgumentCaptor mIntentCaptor; + ArgumentCaptor mIntentCaptor; @Captor ArgumentCaptor mCallbackCaptor; private WalletScreenController mController; @@ -374,10 +373,12 @@ public class WalletScreenControllerTest extends SysuiTestCase { mController.onCardClicked(walletCardViewInfo); - verify(mActivityStarter).startActivity(mIntentCaptor.capture(), eq(true)); + verify(mActivityStarter).startPendingIntentDismissingKeyguard(mIntentCaptor.capture()); - assertEquals(mWalletIntent.getAction(), mIntentCaptor.getValue().getAction()); - assertEquals(mWalletIntent.getComponent(), mIntentCaptor.getValue().getComponent()); + Intent actualIntent = mIntentCaptor.getValue().getIntent(); + + assertEquals(mWalletIntent.getAction(), actualIntent.getAction()); + assertEquals(mWalletIntent.getComponent(), actualIntent.getComponent()); verify(mUiEventLogger, times(1)).log(WalletUiEvent.QAW_CLICK_CARD); }