Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0861012a authored by Silin Huang's avatar Silin Huang
Browse files

Use isServiceAvailable for wallet tile availability

Also update the title of the wallet tile, no longer read it from
gmscore.

Test: test on device
Fix: 180959290
Fix: 185159805
Change-Id: I1bc0bfdf1f8debdda0c44d1c7894bde424e69eae
parent e30c3b4e
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -138,12 +138,11 @@ public class QuickAccessWalletTile extends QSTileImpl<QSTile.State> {

    @Override
    protected void handleUpdateState(State state, Object arg) {
        CharSequence qawLabel = mQuickAccessWalletClient.getServiceLabel();
        state.label = qawLabel == null ? mLabel : qawLabel;
        state.label = mLabel;
        state.contentDescription = state.label;
        state.icon = ResourceIcon.get(R.drawable.ic_qs_wallet);
        boolean isDeviceLocked = !mKeyguardStateController.isUnlocked();
        if (mQuickAccessWalletClient.isWalletFeatureAvailable()) {
        if (mQuickAccessWalletClient.isWalletServiceAvailable()) {
            if (mHasCard) {
                if (isDeviceLocked) {
                    state.state = Tile.STATE_INACTIVE;
+4 −10
Original line number Diff line number Diff line
@@ -141,6 +141,7 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {
        when(mHost.getUiEventLogger()).thenReturn(mUiEventLogger);
        when(mFeatureFlags.isQuickAccessWalletEnabled()).thenReturn(true);
        when(mQuickAccessWalletClient.isWalletFeatureAvailable()).thenReturn(true);
        when(mQuickAccessWalletClient.isWalletServiceAvailable()).thenReturn(true);

        mTile = new QuickAccessWalletTile(
                mHost,
@@ -171,13 +172,7 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {
    }

    @Test
    public void testIsAvailable_qawServiceNotAvailable() {
        when(mQuickAccessWalletClient.isWalletServiceAvailable()).thenReturn(false);
        assertFalse(mTile.isAvailable());
    }

    @Test
    public void testIsAvailable_qawServiceAvailable() {
    public void testIsAvailable_qawFeatureAvailable() {
        when(mPackageManager.hasSystemFeature(FEATURE_NFC_HOST_CARD_EMULATION)).thenReturn(true);
        when(mPackageManager.hasSystemFeature("org.chromium.arc")).thenReturn(false);
        when(mSecureSettings.getString(NFC_PAYMENT_DEFAULT_COMPONENT)).thenReturn("Component");
@@ -229,11 +224,10 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {
    public void testHandleUpdateState_updateLabelAndIcon() {
        QSTile.State state = new QSTile.State();
        QSTile.Icon icon = QSTileImpl.ResourceIcon.get(R.drawable.ic_qs_wallet);
        when(mQuickAccessWalletClient.getServiceLabel()).thenReturn("QuickAccessWallet");

        mTile.handleUpdateState(state, null);

        assertEquals("QuickAccessWallet", state.label.toString());
        assertEquals(mContext.getString(R.string.wallet_title), state.label.toString());
        assertTrue(state.label.toString().contentEquals(state.contentDescription));
        assertEquals(icon, state.icon);
    }
@@ -288,7 +282,7 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {

    @Test
    public void testHandleUpdateState_qawFeatureUnavailable_tileUnavailable() {
        when(mQuickAccessWalletClient.isWalletFeatureAvailable()).thenReturn(false);
        when(mQuickAccessWalletClient.isWalletServiceAvailable()).thenReturn(false);
        QSTile.State state = new QSTile.State();

        mTile.handleUpdateState(state, null);