diff options
| author | 2022-05-10 10:08:13 -0700 | |
|---|---|---|
| committer | 2022-05-11 16:49:55 +0000 | |
| commit | 9d0b7d3f154047243b80c544c00c0c68f4e9ba3c (patch) | |
| tree | 446e881369a4471d3443d556d9d0fb59cfbf7f2c | |
| parent | b9a8ed8b70529a2a280c4dfb3026e36e28b41e2b (diff) | |
Remove @callbackExecutor from QAWController, because we don't have a dedicated CallbackExecutor in SysUI, it defaults to main or background.
Use BackgroundExecutor for QAWClient#getCards(), and fix the CalledFromIncorrectThreadException in caused in KeyguardBottomAreaView.
Test: manual
Bug: 230390636
Change-Id: I6a60117fe0946abf99e10efe91e11e49a363972c
3 files changed, 10 insertions, 11 deletions
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 347e05cc7f75..fd307df8d304 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -1198,15 +1198,19 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL if (tileIcon != null) { mWalletButton.setImageDrawable(tileIcon); } - updateWalletVisibility(); - updateAffordanceColors(); + post(() -> { + updateWalletVisibility(); + updateAffordanceColors(); + }); } @Override public void onWalletCardRetrievalError(@NonNull GetWalletCardsError error) { mHasCard = false; - updateWalletVisibility(); - updateAffordanceColors(); + post(() -> { + updateWalletVisibility(); + updateAffordanceColors(); + }); } } } diff --git a/packages/SystemUI/src/com/android/systemui/wallet/controller/QuickAccessWalletController.java b/packages/SystemUI/src/com/android/systemui/wallet/controller/QuickAccessWalletController.java index acff8712e92e..8c842f162e24 100644 --- a/packages/SystemUI/src/com/android/systemui/wallet/controller/QuickAccessWalletController.java +++ b/packages/SystemUI/src/com/android/systemui/wallet/controller/QuickAccessWalletController.java @@ -19,7 +19,6 @@ package com.android.systemui.wallet.controller; import static com.android.systemui.wallet.controller.QuickAccessWalletController.WalletChangeEvent.DEFAULT_PAYMENT_APP_CHANGE; import static com.android.systemui.wallet.controller.QuickAccessWalletController.WalletChangeEvent.WALLET_PREFERENCE_CHANGE; -import android.annotation.CallbackExecutor; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; @@ -65,7 +64,6 @@ public class QuickAccessWalletController { private static final long RECREATION_TIME_WINDOW = TimeUnit.MINUTES.toMillis(10L); private final Context mContext; private final Executor mExecutor; - private final Executor mCallbackExecutor; private final Executor mBgExecutor; private final SecureSettings mSecureSettings; private final SystemClock mClock; @@ -82,14 +80,12 @@ public class QuickAccessWalletController { public QuickAccessWalletController( Context context, @Main Executor executor, - @CallbackExecutor Executor callbackExecutor, @Background Executor bgExecutor, SecureSettings secureSettings, QuickAccessWalletClient quickAccessWalletClient, SystemClock clock) { mContext = context; mExecutor = executor; - mCallbackExecutor = callbackExecutor; mBgExecutor = bgExecutor; mSecureSettings = secureSettings; mQuickAccessWalletClient = quickAccessWalletClient; @@ -180,7 +176,7 @@ public class QuickAccessWalletController { int iconSizePx = mContext.getResources().getDimensionPixelSize(R.dimen.wallet_icon_size); GetWalletCardsRequest request = new GetWalletCardsRequest(cardWidth, cardHeight, iconSizePx, /* maxCards= */ 1); - mQuickAccessWalletClient.getWalletCards(mExecutor, request, cardsRetriever); + mQuickAccessWalletClient.getWalletCards(mBgExecutor, request, cardsRetriever); } /** @@ -212,7 +208,7 @@ public class QuickAccessWalletController { public void startQuickAccessUiIntent(ActivityStarter activityStarter, ActivityLaunchAnimator.Controller animationController, boolean hasCard) { - mQuickAccessWalletClient.getWalletPendingIntent(mCallbackExecutor, + mQuickAccessWalletClient.getWalletPendingIntent(mBgExecutor, walletPendingIntent -> { if (walletPendingIntent != null) { startQuickAccessViaPendingIntent(walletPendingIntent, activityStarter, diff --git a/packages/SystemUI/tests/src/com/android/systemui/wallet/controller/QuickAccessWalletControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/wallet/controller/QuickAccessWalletControllerTest.java index de2efc71b3a9..8e4f184f560e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/wallet/controller/QuickAccessWalletControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/wallet/controller/QuickAccessWalletControllerTest.java @@ -100,7 +100,6 @@ public class QuickAccessWalletControllerTest extends SysuiTestCase { mContext, MoreExecutors.directExecutor(), MoreExecutors.directExecutor(), - MoreExecutors.directExecutor(), mSecureSettings, mQuickAccessWalletClient, mClock); |