summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2022-02-08 05:56:08 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2022-02-08 05:56:08 +0000
commit68b0ca053d8bcdb3afe5788b51518f4992e5a0ab (patch)
treea8751a8d6b87cdd3bf44f124c1515a0baf1edf30
parentcaba19f3f6137cf96d0c63eeef19dadf6833bf7c (diff)
parentc61633ee7e3a98b3c2b6045a253de371fc28bcf7 (diff)
Merge "Call the startQuickAccessUiIntent of QuickAccessWalletController for QAWTile and Lockscreen wallet icon."
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/QuickAccessWalletTile.java23
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java18
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/qs/tiles/QuickAccessWalletTileTest.java63
3 files changed, 16 insertions, 88 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/QuickAccessWalletTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/QuickAccessWalletTile.java
index 247f02b120db..5ed9ab9c4f65 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/QuickAccessWalletTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/QuickAccessWalletTile.java
@@ -53,7 +53,6 @@ import com.android.systemui.qs.tileimpl.QSTileImpl;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.settings.SecureSettings;
import com.android.systemui.wallet.controller.QuickAccessWalletController;
-import com.android.systemui.wallet.ui.WalletActivity;
import java.util.List;
@@ -128,25 +127,9 @@ public class QuickAccessWalletTile extends QSTileImpl<QSTile.State> {
view == null ? null : ActivityLaunchAnimator.Controller.fromView(view,
InteractionJankMonitor.CUJ_SHADE_APP_LAUNCH_FROM_QS_TILE);
- mUiHandler.post(() -> {
- if (mSelectedCard != null) {
- Intent intent = new Intent(mContext, WalletActivity.class)
- .setAction(Intent.ACTION_VIEW)
- .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
- mActivityStarter.startActivity(intent, true /* dismissShade */,
- animationController, true /* showOverLockscreenWhenLocked */);
- } else {
- Intent intent = mController.getWalletClient().createWalletIntent();
- if (intent == null) {
- Log.w(TAG, "Could not get intent of the wallet app.");
- return;
- }
- mActivityStarter.postStartActivityDismissingKeyguard(
- intent,
- /* delay= */ 0,
- animationController);
- }
- });
+ mUiHandler.post(
+ () -> mController.startQuickAccessUiIntent(
+ mActivityStarter, animationController, mSelectedCard != null));
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
index 88fe1cae2d76..94ee0cc76548 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
@@ -107,7 +107,6 @@ import com.android.systemui.statusbar.policy.PreviewInflater;
import com.android.systemui.tuner.LockscreenFragment.LockButtonFactory;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.wallet.controller.QuickAccessWalletController;
-import com.android.systemui.wallet.ui.WalletActivity;
import java.util.List;
@@ -1149,21 +1148,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
}
ActivityLaunchAnimator.Controller animationController = createLaunchAnimationController(v);
- if (mHasCard) {
- Intent intent = new Intent(mContext, WalletActivity.class)
- .setAction(Intent.ACTION_VIEW)
- .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
- mActivityStarter.startActivity(intent, true /* dismissShade */, animationController,
- true /* showOverLockscreenWhenLocked */);
- } else {
- if (mQuickAccessWalletController.getWalletClient().createWalletIntent() == null) {
- Log.w(TAG, "Could not get intent of the wallet app.");
- return;
- }
- mActivityStarter.postStartActivityDismissingKeyguard(
- mQuickAccessWalletController.getWalletClient().createWalletIntent(),
- /* delay= */ 0, animationController);
- }
+ mQuickAccessWalletController.startQuickAccessUiIntent(
+ mActivityStarter, animationController, mHasCard);
}
protected ActivityLaunchAnimator.Controller createLaunchAnimationController(View view) {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/QuickAccessWalletTileTest.java b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/QuickAccessWalletTileTest.java
index 8922b43b7447..1e5acde8bef5 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/QuickAccessWalletTileTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/QuickAccessWalletTileTest.java
@@ -28,7 +28,6 @@ import static junit.framework.TestCase.assertNull;
import static junit.framework.TestCase.assertTrue;
import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.spy;
@@ -62,7 +61,6 @@ import com.android.internal.logging.UiEventLogger;
import com.android.internal.logging.testing.UiEventLoggerFake;
import com.android.systemui.R;
import com.android.systemui.SysuiTestCase;
-import com.android.systemui.animation.ActivityLaunchAnimator;
import com.android.systemui.classifier.FalsingManagerFake;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.qs.QSTile;
@@ -120,8 +118,6 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {
@Mock
private QuickAccessWalletController mController;
@Captor
- ArgumentCaptor<Intent> mIntentCaptor;
- @Captor
ArgumentCaptor<QuickAccessWalletClient.OnWalletCardsRetrievedCallback> mCallbackCaptor;
private Context mSpiedContext;
@@ -196,66 +192,29 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {
}
@Test
- public void testHandleClick_noCards_hasIntent_openWalletApp() {
- Intent intent = new Intent("WalletIntent");
- when(mQuickAccessWalletClient.createWalletIntent()).thenReturn(intent);
- setUpWalletCard(/* hasCard= */ false);
-
- mTile.handleClick(null /* view */);
- mTestableLooper.processAllMessages();
-
- verify(mActivityStarter, times(1))
- .postStartActivityDismissingKeyguard(eq(intent), anyInt(),
- eq(null) /* animationController */);
- }
-
- @Test
- public void testHandleClick_noCards_noIntent_doNothing() {
- when(mQuickAccessWalletClient.createWalletIntent()).thenReturn(null);
+ public void testHandleClick_startQuickAccessUiIntent_noCard() {
setUpWalletCard(/* hasCard= */ false);
- mTile.handleClick(null /* view */);
- mTestableLooper.processAllMessages();
-
- verifyZeroInteractions(mActivityStarter);
- }
-
- @Test
- public void testHandleClick_hasCards_deviceLocked_startWalletActivity() {
- when(mKeyguardStateController.isUnlocked()).thenReturn(false);
- setUpWalletCard(/* hasCard= */ true);
-
- mTile.handleClick(null /* view */);
+ mTile.handleClick(/* view= */ null);
mTestableLooper.processAllMessages();
- verify(mActivityStarter).startActivity(mIntentCaptor.capture(), eq(true) /* dismissShade */,
- (ActivityLaunchAnimator.Controller) eq(null),
- eq(true) /* showOverLockscreenWhenLocked */);
-
- Intent nextStartedIntent = mIntentCaptor.getValue();
- String walletClassName = "com.android.systemui.wallet.ui.WalletActivity";
-
- assertNotNull(nextStartedIntent);
- assertThat(nextStartedIntent.getComponent().getClassName()).isEqualTo(walletClassName);
+ verify(mController).startQuickAccessUiIntent(
+ eq(mActivityStarter),
+ eq(null),
+ /* hasCard= */ eq(false));
}
@Test
- public void testHandleClick_hasCards_deviceUnlocked_startWalletActivity() {
- when(mKeyguardStateController.isUnlocked()).thenReturn(true);
+ public void testHandleClick_startQuickAccessUiIntent_hasCard() {
setUpWalletCard(/* hasCard= */ true);
mTile.handleClick(null /* view */);
mTestableLooper.processAllMessages();
- verify(mActivityStarter).startActivity(mIntentCaptor.capture(), eq(true) /* dismissShade */,
- (ActivityLaunchAnimator.Controller) eq(null),
- eq(true) /* showOverLockscreenWhenLocked */);
-
- Intent nextStartedIntent = mIntentCaptor.getValue();
- String walletClassName = "com.android.systemui.wallet.ui.WalletActivity";
-
- assertNotNull(nextStartedIntent);
- assertThat(nextStartedIntent.getComponent().getClassName()).isEqualTo(walletClassName);
+ verify(mController).startQuickAccessUiIntent(
+ eq(mActivityStarter),
+ eq(null),
+ /* hasCard= */ eq(true));
}
@Test