Loading packages/SystemUI/res/drawable/circle_wallet_primary_50dp.xml +2 −1 Original line number Diff line number Diff line Loading @@ -18,5 +18,6 @@ <size android:height="50dp" android:width="50dp" /> <solid android:color="#1A73E8" /> <solid android:color="@android:color/transparent" /> <stroke android:width="2dp" android:color="#AECBFA" /> </shape> packages/SystemUI/src/com/android/systemui/qs/tiles/QuickAccessWalletTile.java +18 −5 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import com.android.systemui.qs.tileimpl.QSTileImpl; import com.android.systemui.statusbar.FeatureFlags; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.util.settings.SecureSettings; import com.android.systemui.wallet.ui.WalletActivity; import java.util.List; import java.util.concurrent.Executor; Loading Loading @@ -117,9 +118,23 @@ public class QuickAccessWalletTile extends QSTileImpl<QSTile.State> { @Override protected void handleClick() { mUiHandler.post(() -> { mHost.collapsePanels(); if (mHasCard) { Intent intent = new Intent(mContext, WalletActivity.class) .setAction(Intent.ACTION_VIEW) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(intent); } else { if (mQuickAccessWalletClient.createWalletIntent() == null) { Log.w(TAG, "Could not get intent of the wallet app."); return; } mActivityStarter.postStartActivityDismissingKeyguard( mQuickAccessWalletClient.createWalletIntent(), /* delay= */ 0); } }); } @Override protected void handleUpdateState(State state, Object arg) { Loading Loading @@ -147,9 +162,7 @@ public class QuickAccessWalletTile extends QSTileImpl<QSTile.State> { } else { state.state = Tile.STATE_UNAVAILABLE; } if (!isDeviceLocked) { state.sideViewDrawable = mCardViewDrawable; } state.sideViewDrawable = isDeviceLocked ? null : mCardViewDrawable; } @Override Loading packages/SystemUI/src/com/android/systemui/wallet/ui/WalletActivity.java +20 −4 Original line number Diff line number Diff line Loading @@ -28,8 +28,10 @@ import androidx.annotation.NonNull; import com.android.systemui.R; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.settings.UserTracker; import com.android.systemui.statusbar.phone.KeyguardDismissUtil; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.util.LifecycleActivity; Loading @@ -44,6 +46,7 @@ public class WalletActivity extends LifecycleActivity { private final QuickAccessWalletClient mQuickAccessWalletClient; private final KeyguardStateController mKeyguardStateController; private final KeyguardDismissUtil mKeyguardDismissUtil; private final ActivityStarter mActivityStarter; private final Executor mExecutor; private final Handler mHandler; Loading @@ -54,12 +57,14 @@ public class WalletActivity extends LifecycleActivity { public WalletActivity( QuickAccessWalletClient quickAccessWalletClient, KeyguardStateController keyguardStateController, KeyguardDismissUtil keyguardDismissUtil, ActivityStarter activityStarter, @Background Executor executor, @Background Handler handler, @Main Handler handler, UserTracker userTracker) { mQuickAccessWalletClient = quickAccessWalletClient; mKeyguardStateController = keyguardStateController; mKeyguardDismissUtil = keyguardDismissUtil; mActivityStarter = activityStarter; mExecutor = executor; mHandler = handler; Loading Loading @@ -88,20 +93,30 @@ public class WalletActivity extends LifecycleActivity { mExecutor, mHandler, mUserTracker, !mKeyguardStateController.isUnlocked()); mKeyguardStateController); // Clicking the wallet button will open the wallet app if the device is unlocked; bring up // the security bouncer otherwise. walletView.getWalletButton().setOnClickListener( v -> mActivityStarter.startActivity( mQuickAccessWalletClient.createWalletIntent(), true)); v -> { if (mKeyguardStateController.isUnlocked()) { mActivityStarter.startActivity( mQuickAccessWalletClient.createWalletIntent(), true); } else { mKeyguardDismissUtil.executeWhenUnlocked(() -> false, false); } }); } @Override protected void onStart() { super.onStart(); mKeyguardStateController.addCallback(mWalletScreenController); } @Override protected void onResume() { super.onResume(); mWalletScreenController.queryWalletCards(); } @Override Loading @@ -116,6 +131,7 @@ public class WalletActivity extends LifecycleActivity { @Override protected void onDestroy() { mKeyguardStateController.removeCallback(mWalletScreenController); mWalletScreenController.onDismissed(); super.onDestroy(); } Loading packages/SystemUI/src/com/android/systemui/wallet/ui/WalletScreenController.java +21 −8 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.R; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.settings.UserTracker; import com.android.systemui.statusbar.policy.KeyguardStateController; import java.util.ArrayList; import java.util.List; Loading @@ -52,7 +53,8 @@ import java.util.concurrent.TimeUnit; public class WalletScreenController implements WalletCardCarousel.OnSelectionListener, QuickAccessWalletClient.OnWalletCardsRetrievedCallback, QuickAccessWalletClient.WalletServiceEventListener { QuickAccessWalletClient.WalletServiceEventListener, KeyguardStateController.Callback { private static final String TAG = "WalletScreenCtrl"; private static final String PREFS_HAS_CARDS = "has_cards"; Loading @@ -65,6 +67,7 @@ public class WalletScreenController implements private final ActivityStarter mActivityStarter; private final Executor mExecutor; private final Handler mHandler; private final KeyguardStateController mKeyguardStateController; private final Runnable mSelectionRunnable = this::selectCard; private final SharedPreferences mPrefs; private final WalletView mWalletView; Loading @@ -72,7 +75,6 @@ public class WalletScreenController implements @VisibleForTesting String mSelectedCardId; @VisibleForTesting boolean mIsDismissed; private boolean mIsDeviceLocked; private boolean mHasRegisteredListener; public WalletScreenController( Loading @@ -83,12 +85,13 @@ public class WalletScreenController implements Executor executor, Handler handler, UserTracker userTracker, boolean isDeviceLocked) { KeyguardStateController keyguardStateController) { mContext = context; mWalletClient = walletClient; mActivityStarter = activityStarter; mExecutor = executor; mHandler = handler; mKeyguardStateController = keyguardStateController; mPrefs = userTracker.getUserContext().getSharedPreferences(TAG, Context.MODE_PRIVATE); mWalletView = walletView; mWalletView.setMinimumHeight(getExpectedMinHeight()); Loading @@ -105,7 +108,6 @@ public class WalletScreenController implements // to decrease perceived latency. showEmptyStateView(); } mIsDeviceLocked = isDeviceLocked; } /** Loading @@ -122,11 +124,17 @@ public class WalletScreenController implements for (WalletCard card : walletCards) { data.add(new QAWalletCardViewInfo(mContext, card)); } // Get on main thread for UI updates. mHandler.post(() -> { if (mIsDismissed) { return; } if (data.isEmpty()) { showEmptyStateView(); } else { mWalletView.showCardCarousel(data, response.getSelectedIndex(), mIsDeviceLocked); mWalletView.showCardCarousel( data, response.getSelectedIndex(), !mKeyguardStateController.isUnlocked()); } // The empty state view will not be shown preemptively next time if cards were returned mPrefs.edit().putBoolean(PREFS_HAS_CARDS, !data.isEmpty()).apply(); Loading @@ -140,10 +148,10 @@ public class WalletScreenController implements */ @Override public void onWalletCardRetrievalError(@NonNull GetWalletCardsError error) { mHandler.post(() -> { if (mIsDismissed) { return; } mHandler.post(() -> { mWalletView.showErrorMessage(error.getMessage()); }); } Loading @@ -169,6 +177,11 @@ public class WalletScreenController implements } } @Override public void onKeyguardFadingAwayChanged() { queryWalletCards(); } @Override public void onCardSelected(@NonNull WalletCardViewInfo card) { if (mIsDismissed) { Loading packages/SystemUI/src/com/android/systemui/wallet/ui/WalletView.java +3 −2 Original line number Diff line number Diff line Loading @@ -103,7 +103,9 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard CharSequence centerCardText = centerCard.getLabel(); Drawable icon = centerCard.getIcon(); if (icon != null) { mIcon.setImageDrawable(resizeDrawable(getResources(), icon)); Drawable drawable = resizeDrawable(getResources(), icon); drawable.setTint(mContext.getColor(R.color.GM2_blue_600)); mIcon.setImageDrawable(drawable); mIcon.setVisibility(VISIBLE); } else { mIcon.setVisibility(INVISIBLE); Loading @@ -126,7 +128,6 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard mCardCarouselContainer.setVisibility(VISIBLE); mErrorView.setVisibility(GONE); if (isDeviceLocked) { // TODO(b/182964813): Add click action to prompt device unlock. mWalletButton.setText(R.string.wallet_button_label_device_locked); } else { mWalletButton.setText(R.string.wallet_button_label_device_unlocked); Loading Loading
packages/SystemUI/res/drawable/circle_wallet_primary_50dp.xml +2 −1 Original line number Diff line number Diff line Loading @@ -18,5 +18,6 @@ <size android:height="50dp" android:width="50dp" /> <solid android:color="#1A73E8" /> <solid android:color="@android:color/transparent" /> <stroke android:width="2dp" android:color="#AECBFA" /> </shape>
packages/SystemUI/src/com/android/systemui/qs/tiles/QuickAccessWalletTile.java +18 −5 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import com.android.systemui.qs.tileimpl.QSTileImpl; import com.android.systemui.statusbar.FeatureFlags; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.util.settings.SecureSettings; import com.android.systemui.wallet.ui.WalletActivity; import java.util.List; import java.util.concurrent.Executor; Loading Loading @@ -117,9 +118,23 @@ public class QuickAccessWalletTile extends QSTileImpl<QSTile.State> { @Override protected void handleClick() { mUiHandler.post(() -> { mHost.collapsePanels(); if (mHasCard) { Intent intent = new Intent(mContext, WalletActivity.class) .setAction(Intent.ACTION_VIEW) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(intent); } else { if (mQuickAccessWalletClient.createWalletIntent() == null) { Log.w(TAG, "Could not get intent of the wallet app."); return; } mActivityStarter.postStartActivityDismissingKeyguard( mQuickAccessWalletClient.createWalletIntent(), /* delay= */ 0); } }); } @Override protected void handleUpdateState(State state, Object arg) { Loading Loading @@ -147,9 +162,7 @@ public class QuickAccessWalletTile extends QSTileImpl<QSTile.State> { } else { state.state = Tile.STATE_UNAVAILABLE; } if (!isDeviceLocked) { state.sideViewDrawable = mCardViewDrawable; } state.sideViewDrawable = isDeviceLocked ? null : mCardViewDrawable; } @Override Loading
packages/SystemUI/src/com/android/systemui/wallet/ui/WalletActivity.java +20 −4 Original line number Diff line number Diff line Loading @@ -28,8 +28,10 @@ import androidx.annotation.NonNull; import com.android.systemui.R; import com.android.systemui.dagger.qualifiers.Background; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.settings.UserTracker; import com.android.systemui.statusbar.phone.KeyguardDismissUtil; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.util.LifecycleActivity; Loading @@ -44,6 +46,7 @@ public class WalletActivity extends LifecycleActivity { private final QuickAccessWalletClient mQuickAccessWalletClient; private final KeyguardStateController mKeyguardStateController; private final KeyguardDismissUtil mKeyguardDismissUtil; private final ActivityStarter mActivityStarter; private final Executor mExecutor; private final Handler mHandler; Loading @@ -54,12 +57,14 @@ public class WalletActivity extends LifecycleActivity { public WalletActivity( QuickAccessWalletClient quickAccessWalletClient, KeyguardStateController keyguardStateController, KeyguardDismissUtil keyguardDismissUtil, ActivityStarter activityStarter, @Background Executor executor, @Background Handler handler, @Main Handler handler, UserTracker userTracker) { mQuickAccessWalletClient = quickAccessWalletClient; mKeyguardStateController = keyguardStateController; mKeyguardDismissUtil = keyguardDismissUtil; mActivityStarter = activityStarter; mExecutor = executor; mHandler = handler; Loading Loading @@ -88,20 +93,30 @@ public class WalletActivity extends LifecycleActivity { mExecutor, mHandler, mUserTracker, !mKeyguardStateController.isUnlocked()); mKeyguardStateController); // Clicking the wallet button will open the wallet app if the device is unlocked; bring up // the security bouncer otherwise. walletView.getWalletButton().setOnClickListener( v -> mActivityStarter.startActivity( mQuickAccessWalletClient.createWalletIntent(), true)); v -> { if (mKeyguardStateController.isUnlocked()) { mActivityStarter.startActivity( mQuickAccessWalletClient.createWalletIntent(), true); } else { mKeyguardDismissUtil.executeWhenUnlocked(() -> false, false); } }); } @Override protected void onStart() { super.onStart(); mKeyguardStateController.addCallback(mWalletScreenController); } @Override protected void onResume() { super.onResume(); mWalletScreenController.queryWalletCards(); } @Override Loading @@ -116,6 +131,7 @@ public class WalletActivity extends LifecycleActivity { @Override protected void onDestroy() { mKeyguardStateController.removeCallback(mWalletScreenController); mWalletScreenController.onDismissed(); super.onDestroy(); } Loading
packages/SystemUI/src/com/android/systemui/wallet/ui/WalletScreenController.java +21 −8 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.R; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.settings.UserTracker; import com.android.systemui.statusbar.policy.KeyguardStateController; import java.util.ArrayList; import java.util.List; Loading @@ -52,7 +53,8 @@ import java.util.concurrent.TimeUnit; public class WalletScreenController implements WalletCardCarousel.OnSelectionListener, QuickAccessWalletClient.OnWalletCardsRetrievedCallback, QuickAccessWalletClient.WalletServiceEventListener { QuickAccessWalletClient.WalletServiceEventListener, KeyguardStateController.Callback { private static final String TAG = "WalletScreenCtrl"; private static final String PREFS_HAS_CARDS = "has_cards"; Loading @@ -65,6 +67,7 @@ public class WalletScreenController implements private final ActivityStarter mActivityStarter; private final Executor mExecutor; private final Handler mHandler; private final KeyguardStateController mKeyguardStateController; private final Runnable mSelectionRunnable = this::selectCard; private final SharedPreferences mPrefs; private final WalletView mWalletView; Loading @@ -72,7 +75,6 @@ public class WalletScreenController implements @VisibleForTesting String mSelectedCardId; @VisibleForTesting boolean mIsDismissed; private boolean mIsDeviceLocked; private boolean mHasRegisteredListener; public WalletScreenController( Loading @@ -83,12 +85,13 @@ public class WalletScreenController implements Executor executor, Handler handler, UserTracker userTracker, boolean isDeviceLocked) { KeyguardStateController keyguardStateController) { mContext = context; mWalletClient = walletClient; mActivityStarter = activityStarter; mExecutor = executor; mHandler = handler; mKeyguardStateController = keyguardStateController; mPrefs = userTracker.getUserContext().getSharedPreferences(TAG, Context.MODE_PRIVATE); mWalletView = walletView; mWalletView.setMinimumHeight(getExpectedMinHeight()); Loading @@ -105,7 +108,6 @@ public class WalletScreenController implements // to decrease perceived latency. showEmptyStateView(); } mIsDeviceLocked = isDeviceLocked; } /** Loading @@ -122,11 +124,17 @@ public class WalletScreenController implements for (WalletCard card : walletCards) { data.add(new QAWalletCardViewInfo(mContext, card)); } // Get on main thread for UI updates. mHandler.post(() -> { if (mIsDismissed) { return; } if (data.isEmpty()) { showEmptyStateView(); } else { mWalletView.showCardCarousel(data, response.getSelectedIndex(), mIsDeviceLocked); mWalletView.showCardCarousel( data, response.getSelectedIndex(), !mKeyguardStateController.isUnlocked()); } // The empty state view will not be shown preemptively next time if cards were returned mPrefs.edit().putBoolean(PREFS_HAS_CARDS, !data.isEmpty()).apply(); Loading @@ -140,10 +148,10 @@ public class WalletScreenController implements */ @Override public void onWalletCardRetrievalError(@NonNull GetWalletCardsError error) { mHandler.post(() -> { if (mIsDismissed) { return; } mHandler.post(() -> { mWalletView.showErrorMessage(error.getMessage()); }); } Loading @@ -169,6 +177,11 @@ public class WalletScreenController implements } } @Override public void onKeyguardFadingAwayChanged() { queryWalletCards(); } @Override public void onCardSelected(@NonNull WalletCardViewInfo card) { if (mIsDismissed) { Loading
packages/SystemUI/src/com/android/systemui/wallet/ui/WalletView.java +3 −2 Original line number Diff line number Diff line Loading @@ -103,7 +103,9 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard CharSequence centerCardText = centerCard.getLabel(); Drawable icon = centerCard.getIcon(); if (icon != null) { mIcon.setImageDrawable(resizeDrawable(getResources(), icon)); Drawable drawable = resizeDrawable(getResources(), icon); drawable.setTint(mContext.getColor(R.color.GM2_blue_600)); mIcon.setImageDrawable(drawable); mIcon.setVisibility(VISIBLE); } else { mIcon.setVisibility(INVISIBLE); Loading @@ -126,7 +128,6 @@ public class WalletView extends FrameLayout implements WalletCardCarousel.OnCard mCardCarouselContainer.setVisibility(VISIBLE); mErrorView.setVisibility(GONE); if (isDeviceLocked) { // TODO(b/182964813): Add click action to prompt device unlock. mWalletButton.setText(R.string.wallet_button_label_device_locked); } else { mWalletButton.setText(R.string.wallet_button_label_device_unlocked); Loading