Merge changes from topic "presubmit-am-361ce2f2beb3432cae0398341bab71ca" into sc-qpr1-dev am: 324903d93f am: c297a9eff8 am: e1e0ae15a9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22599577 Change-Id: I77a93c2fcf0c2f080c6f32f71f2e9f47f4b1f131 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.systemui.qs.tiles;
|
package com.android.systemui.qs.tiles;
|
||||||
|
|
||||||
|
import static android.graphics.drawable.Icon.TYPE_URI;
|
||||||
import static android.provider.Settings.Secure.NFC_PAYMENT_DEFAULT_COMPONENT;
|
import static android.provider.Settings.Secure.NFC_PAYMENT_DEFAULT_COMPONENT;
|
||||||
|
|
||||||
import static com.android.systemui.wallet.controller.QuickAccessWalletController.WalletChangeEvent.DEFAULT_PAYMENT_APP_CHANGE;
|
import static com.android.systemui.wallet.controller.QuickAccessWalletController.WalletChangeEvent.DEFAULT_PAYMENT_APP_CHANGE;
|
||||||
@@ -221,7 +222,12 @@ public class QuickAccessWalletTile extends QSTileImpl<QSTile.State> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mSelectedCard = cards.get(selectedIndex);
|
mSelectedCard = cards.get(selectedIndex);
|
||||||
mCardViewDrawable = mSelectedCard.getCardImage().loadDrawable(mContext);
|
android.graphics.drawable.Icon cardImageIcon = mSelectedCard.getCardImage();
|
||||||
|
if (cardImageIcon.getType() == TYPE_URI) {
|
||||||
|
mCardViewDrawable = null;
|
||||||
|
} else {
|
||||||
|
mCardViewDrawable = mSelectedCard.getCardImage().loadDrawable(mContext);
|
||||||
|
}
|
||||||
refreshState();
|
refreshState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -325,7 +325,12 @@ public class WalletScreenController implements
|
|||||||
*/
|
*/
|
||||||
QAWalletCardViewInfo(Context context, WalletCard walletCard) {
|
QAWalletCardViewInfo(Context context, WalletCard walletCard) {
|
||||||
mWalletCard = walletCard;
|
mWalletCard = walletCard;
|
||||||
mCardDrawable = mWalletCard.getCardImage().loadDrawable(context);
|
Icon cardImageIcon = mWalletCard.getCardImage();
|
||||||
|
if (cardImageIcon.getType() == Icon.TYPE_URI) {
|
||||||
|
mCardDrawable = null;
|
||||||
|
} else {
|
||||||
|
mCardDrawable = mWalletCard.getCardImage().loadDrawable(context);
|
||||||
|
}
|
||||||
Icon icon = mWalletCard.getCardIcon();
|
Icon icon = mWalletCard.getCardIcon();
|
||||||
mIconDrawable = icon == null ? null : icon.loadDrawable(context);
|
mIconDrawable = icon == null ? null : icon.loadDrawable(context);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,8 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {
|
|||||||
private static final String CARD_DESCRIPTION = "•••• 1234";
|
private static final String CARD_DESCRIPTION = "•••• 1234";
|
||||||
private static final Icon CARD_IMAGE =
|
private static final Icon CARD_IMAGE =
|
||||||
Icon.createWithBitmap(Bitmap.createBitmap(70, 50, Bitmap.Config.ARGB_8888));
|
Icon.createWithBitmap(Bitmap.createBitmap(70, 50, Bitmap.Config.ARGB_8888));
|
||||||
|
private static final int PRIMARY_USER_ID = 0;
|
||||||
|
private static final int SECONDARY_USER_ID = 10;
|
||||||
|
|
||||||
private final Drawable mTileIcon = mContext.getDrawable(R.drawable.ic_qs_wallet);
|
private final Drawable mTileIcon = mContext.getDrawable(R.drawable.ic_qs_wallet);
|
||||||
private final Intent mWalletIntent = new Intent(QuickAccessWalletService.ACTION_VIEW_WALLET)
|
private final Intent mWalletIntent = new Intent(QuickAccessWalletService.ACTION_VIEW_WALLET)
|
||||||
@@ -119,6 +121,8 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {
|
|||||||
private SecureSettings mSecureSettings;
|
private SecureSettings mSecureSettings;
|
||||||
@Mock
|
@Mock
|
||||||
private QuickAccessWalletController mController;
|
private QuickAccessWalletController mController;
|
||||||
|
@Mock
|
||||||
|
private Icon mCardImage;
|
||||||
@Captor
|
@Captor
|
||||||
ArgumentCaptor<QuickAccessWalletClient.OnWalletCardsRetrievedCallback> mCallbackCaptor;
|
ArgumentCaptor<QuickAccessWalletClient.OnWalletCardsRetrievedCallback> mCallbackCaptor;
|
||||||
|
|
||||||
@@ -142,6 +146,8 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {
|
|||||||
when(mQuickAccessWalletClient.isWalletServiceAvailable()).thenReturn(true);
|
when(mQuickAccessWalletClient.isWalletServiceAvailable()).thenReturn(true);
|
||||||
when(mQuickAccessWalletClient.isWalletFeatureAvailableWhenDeviceLocked()).thenReturn(true);
|
when(mQuickAccessWalletClient.isWalletFeatureAvailableWhenDeviceLocked()).thenReturn(true);
|
||||||
when(mController.getWalletClient()).thenReturn(mQuickAccessWalletClient);
|
when(mController.getWalletClient()).thenReturn(mQuickAccessWalletClient);
|
||||||
|
when(mCardImage.getType()).thenReturn(Icon.TYPE_URI);
|
||||||
|
when(mCardImage.loadDrawableAsUser(any(), eq(SECONDARY_USER_ID))).thenReturn(null);
|
||||||
|
|
||||||
mTile = new QuickAccessWalletTile(
|
mTile = new QuickAccessWalletTile(
|
||||||
mHost,
|
mHost,
|
||||||
@@ -374,6 +380,28 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {
|
|||||||
assertNotNull(mTile.getState().sideViewCustomDrawable);
|
assertNotNull(mTile.getState().sideViewCustomDrawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testQueryCards_notCurrentUser_hasCards_noSideViewDrawable() {
|
||||||
|
when(mKeyguardStateController.isUnlocked()).thenReturn(true);
|
||||||
|
|
||||||
|
PendingIntent pendingIntent =
|
||||||
|
PendingIntent.getActivity(mContext, 0, mWalletIntent, PendingIntent.FLAG_IMMUTABLE);
|
||||||
|
WalletCard walletCard =
|
||||||
|
new WalletCard.Builder(
|
||||||
|
CARD_ID, mCardImage, CARD_DESCRIPTION, pendingIntent).build();
|
||||||
|
GetWalletCardsResponse response =
|
||||||
|
new GetWalletCardsResponse(Collections.singletonList(walletCard), 0);
|
||||||
|
|
||||||
|
mTile.handleSetListening(true);
|
||||||
|
|
||||||
|
verify(mController).queryWalletCards(mCallbackCaptor.capture());
|
||||||
|
|
||||||
|
mCallbackCaptor.getValue().onWalletCardsRetrieved(response);
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
|
||||||
|
assertNull(mTile.getState().sideViewCustomDrawable);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQueryCards_noCards_notUpdateSideViewDrawable() {
|
public void testQueryCards_noCards_notUpdateSideViewDrawable() {
|
||||||
setUpWalletCard(/* hasCard= */ false);
|
setUpWalletCard(/* hasCard= */ false);
|
||||||
|
|||||||
Reference in New Issue
Block a user