Loading core/java/android/service/quickaccesswallet/QuickAccessWalletClientImpl.java +2 −2 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ import java.util.concurrent.Executor; public class QuickAccessWalletClientImpl implements QuickAccessWalletClient, ServiceConnection { private static final String TAG = "QAWalletSClient"; public static final String SETTING_KEY = "lockscreen_show_wallet"; private final Handler mHandler; private final Context mContext; private final Queue<ApiCaller> mRequestQueue; Loading Loading @@ -96,13 +97,12 @@ public class QuickAccessWalletClientImpl implements QuickAccessWalletClient, Ser int currentUser = ActivityManager.getCurrentUser(); return currentUser == UserHandle.USER_SYSTEM && checkUserSetupComplete() && checkSecureSetting(Settings.Secure.GLOBAL_ACTIONS_PANEL_ENABLED) && !new LockPatternUtils(mContext).isUserInLockdown(currentUser); } @Override public boolean isWalletFeatureAvailableWhenDeviceLocked() { return checkSecureSetting(Settings.Secure.POWER_MENU_LOCKED_SHOW_CONTENT); return checkSecureSetting(SETTING_KEY); } @Override Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +37 −3 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.res.Configuration; import android.database.ContentObserver; import android.graphics.drawable.Drawable; import android.os.AsyncTask; import android.os.Bundle; Loading @@ -48,11 +49,13 @@ import android.os.Messenger; import android.os.RemoteException; import android.os.UserHandle; import android.provider.MediaStore; import android.provider.Settings; import android.service.media.CameraPrewarmService; import android.service.quickaccesswallet.GetWalletCardsError; import android.service.quickaccesswallet.GetWalletCardsRequest; import android.service.quickaccesswallet.GetWalletCardsResponse; import android.service.quickaccesswallet.QuickAccessWalletClient; import android.service.quickaccesswallet.QuickAccessWalletClientImpl; import android.telecom.TelecomManager; import android.text.TextUtils; import android.util.AttributeSet; Loading Loading @@ -94,6 +97,7 @@ import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.PreviewInflater; import com.android.systemui.tuner.LockscreenFragment.LockButtonFactory; import com.android.systemui.tuner.TunerService; import com.android.systemui.util.settings.SecureSettings; import com.android.systemui.wallet.ui.WalletActivity; import java.util.concurrent.Executor; Loading Loading @@ -189,6 +193,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private int mBurnInYOffset; private ActivityIntentHelper mActivityIntentHelper; private KeyguardUpdateMonitor mKeyguardUpdateMonitor; private ContentObserver mWalletPreferenceObserver; private SecureSettings mSecureSettings; public KeyguardBottomAreaView(Context context) { this(context, null); Loading Loading @@ -319,6 +325,10 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL mLeftExtension.destroy(); getContext().unregisterReceiver(mDevicePolicyReceiver); mKeyguardUpdateMonitor.removeCallback(mUpdateMonitorCallback); if (mWalletPreferenceObserver != null) { mSecureSettings.unregisterContentObserver(mWalletPreferenceObserver); } } private void initAccessibility() { Loading Loading @@ -560,7 +570,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL } }); } else { // We need to delay starting the activity because ResolverActivity finishes itself if // launched behind lockscreen. mActivityStarter.startActivity(intent, false /* dismissShade */, Loading Loading @@ -914,15 +923,40 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL /** * Initialize the wallet feature, only enabling if the feature is enabled within the platform. */ public void initWallet(QuickAccessWalletClient client, Executor uiExecutor, boolean enabled) { public void initWallet(QuickAccessWalletClient client, Executor uiExecutor, SecureSettings secureSettings) { mQuickAccessWalletClient = client; mWalletEnabled = enabled && client.isWalletFeatureAvailable(); mSecureSettings = secureSettings; setupWalletPreferenceObserver(); updateWalletPreference(); mUiExecutor = uiExecutor; queryWalletCards(); updateWalletVisibility(); } private void setupWalletPreferenceObserver() { if (mWalletPreferenceObserver == null) { mWalletPreferenceObserver = new ContentObserver(null /* handler */) { @Override public void onChange(boolean selfChange) { mUiExecutor.execute(() -> updateWalletPreference()); } }; mSecureSettings.registerContentObserver( Settings.Secure.getUriFor(QuickAccessWalletClientImpl.SETTING_KEY), false /* notifyForDescendants */, mWalletPreferenceObserver); } } private void updateWalletPreference() { mWalletEnabled = mQuickAccessWalletClient.isWalletFeatureAvailable() && mQuickAccessWalletClient.isWalletFeatureAvailableWhenDeviceLocked(); } private void queryWalletCards() { if (!mWalletEnabled || mUiExecutor == null) { return; Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +9 −3 Original line number Diff line number Diff line Loading @@ -151,6 +151,7 @@ import com.android.systemui.statusbar.policy.KeyguardUserSwitcherController; import com.android.systemui.statusbar.policy.KeyguardUserSwitcherView; import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener; import com.android.systemui.util.Utils; import com.android.systemui.util.settings.SecureSettings; import com.android.wm.shell.animation.FlingAnimationUtils; import java.io.FileDescriptor; Loading Loading @@ -530,6 +531,7 @@ public class NotificationPanelViewController extends PanelViewController { private final QuickAccessWalletClient mQuickAccessWalletClient; private final Executor mUiExecutor; private final SecureSettings mSecureSettings; private int mLockScreenMode = KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL; private KeyguardMediaController mKeyguardMediaController; Loading Loading @@ -605,7 +607,8 @@ public class NotificationPanelViewController extends PanelViewController { QuickAccessWalletClient quickAccessWalletClient, KeyguardMediaController keyguardMediaController, PrivacyDotViewController privacyDotViewController, @Main Executor uiExecutor) { @Main Executor uiExecutor, SecureSettings secureSettings) { super(view, falsingManager, dozeLog, keyguardStateController, (SysuiStatusBarStateController) statusBarStateController, vibratorHelper, statusBarKeyguardViewManager, latencyTracker, flingAnimationUtilsBuilder.get(), Loading Loading @@ -657,6 +660,7 @@ public class NotificationPanelViewController extends PanelViewController { mMediaDataManager = mediaDataManager; mQuickAccessWalletClient = quickAccessWalletClient; mUiExecutor = uiExecutor; mSecureSettings = secureSettings; pulseExpansionHandler.setPulseExpandAbortListener(() -> { if (mQs != null) { mQs.animateHeaderSlidingOut(); Loading Loading @@ -1033,8 +1037,10 @@ public class NotificationPanelViewController extends PanelViewController { mKeyguardBottomArea.setStatusBar(mStatusBar); mKeyguardBottomArea.setUserSetupComplete(mUserSetupComplete); mKeyguardBottomArea.setFalsingManager(mFalsingManager); mKeyguardBottomArea.initWallet(mQuickAccessWalletClient, mUiExecutor, mFeatureFlags.isQuickAccessWalletEnabled()); if (mFeatureFlags.isQuickAccessWalletEnabled()) { mKeyguardBottomArea.initWallet(mQuickAccessWalletClient, mUiExecutor, mSecureSettings); } } private void updateMaxDisplayedNotifications(boolean recompute) { Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +5 −1 Original line number Diff line number Diff line Loading @@ -102,6 +102,7 @@ import com.android.systemui.statusbar.notification.stack.NotificationStackScroll import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.util.concurrency.FakeExecutor; import com.android.systemui.util.settings.SecureSettings; import com.android.systemui.util.time.FakeSystemClock; import com.android.wm.shell.animation.FlingAnimationUtils; Loading Loading @@ -246,6 +247,8 @@ public class NotificationPanelViewTest extends SysuiTestCase { private KeyguardMediaController mKeyguardMediaController; @Mock private PrivacyDotViewController mPrivacyDotViewController; @Mock private SecureSettings mSecureSettings; private SysuiStatusBarStateController mStatusBarStateController; private NotificationPanelViewController mNotificationPanelViewController; Loading Loading @@ -355,7 +358,8 @@ public class NotificationPanelViewTest extends SysuiTestCase { mQuickAccessWalletClient, mKeyguardMediaController, mPrivacyDotViewController, new FakeExecutor(new FakeSystemClock())); new FakeExecutor(new FakeSystemClock()), mSecureSettings); mNotificationPanelViewController.initDependencies( mStatusBar, mNotificationShelfController); Loading Loading
core/java/android/service/quickaccesswallet/QuickAccessWalletClientImpl.java +2 −2 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ import java.util.concurrent.Executor; public class QuickAccessWalletClientImpl implements QuickAccessWalletClient, ServiceConnection { private static final String TAG = "QAWalletSClient"; public static final String SETTING_KEY = "lockscreen_show_wallet"; private final Handler mHandler; private final Context mContext; private final Queue<ApiCaller> mRequestQueue; Loading Loading @@ -96,13 +97,12 @@ public class QuickAccessWalletClientImpl implements QuickAccessWalletClient, Ser int currentUser = ActivityManager.getCurrentUser(); return currentUser == UserHandle.USER_SYSTEM && checkUserSetupComplete() && checkSecureSetting(Settings.Secure.GLOBAL_ACTIONS_PANEL_ENABLED) && !new LockPatternUtils(mContext).isUserInLockdown(currentUser); } @Override public boolean isWalletFeatureAvailableWhenDeviceLocked() { return checkSecureSetting(Settings.Secure.POWER_MENU_LOCKED_SHOW_CONTENT); return checkSecureSetting(SETTING_KEY); } @Override Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +37 −3 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.res.Configuration; import android.database.ContentObserver; import android.graphics.drawable.Drawable; import android.os.AsyncTask; import android.os.Bundle; Loading @@ -48,11 +49,13 @@ import android.os.Messenger; import android.os.RemoteException; import android.os.UserHandle; import android.provider.MediaStore; import android.provider.Settings; import android.service.media.CameraPrewarmService; import android.service.quickaccesswallet.GetWalletCardsError; import android.service.quickaccesswallet.GetWalletCardsRequest; import android.service.quickaccesswallet.GetWalletCardsResponse; import android.service.quickaccesswallet.QuickAccessWalletClient; import android.service.quickaccesswallet.QuickAccessWalletClientImpl; import android.telecom.TelecomManager; import android.text.TextUtils; import android.util.AttributeSet; Loading Loading @@ -94,6 +97,7 @@ import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.PreviewInflater; import com.android.systemui.tuner.LockscreenFragment.LockButtonFactory; import com.android.systemui.tuner.TunerService; import com.android.systemui.util.settings.SecureSettings; import com.android.systemui.wallet.ui.WalletActivity; import java.util.concurrent.Executor; Loading Loading @@ -189,6 +193,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL private int mBurnInYOffset; private ActivityIntentHelper mActivityIntentHelper; private KeyguardUpdateMonitor mKeyguardUpdateMonitor; private ContentObserver mWalletPreferenceObserver; private SecureSettings mSecureSettings; public KeyguardBottomAreaView(Context context) { this(context, null); Loading Loading @@ -319,6 +325,10 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL mLeftExtension.destroy(); getContext().unregisterReceiver(mDevicePolicyReceiver); mKeyguardUpdateMonitor.removeCallback(mUpdateMonitorCallback); if (mWalletPreferenceObserver != null) { mSecureSettings.unregisterContentObserver(mWalletPreferenceObserver); } } private void initAccessibility() { Loading Loading @@ -560,7 +570,6 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL } }); } else { // We need to delay starting the activity because ResolverActivity finishes itself if // launched behind lockscreen. mActivityStarter.startActivity(intent, false /* dismissShade */, Loading Loading @@ -914,15 +923,40 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL /** * Initialize the wallet feature, only enabling if the feature is enabled within the platform. */ public void initWallet(QuickAccessWalletClient client, Executor uiExecutor, boolean enabled) { public void initWallet(QuickAccessWalletClient client, Executor uiExecutor, SecureSettings secureSettings) { mQuickAccessWalletClient = client; mWalletEnabled = enabled && client.isWalletFeatureAvailable(); mSecureSettings = secureSettings; setupWalletPreferenceObserver(); updateWalletPreference(); mUiExecutor = uiExecutor; queryWalletCards(); updateWalletVisibility(); } private void setupWalletPreferenceObserver() { if (mWalletPreferenceObserver == null) { mWalletPreferenceObserver = new ContentObserver(null /* handler */) { @Override public void onChange(boolean selfChange) { mUiExecutor.execute(() -> updateWalletPreference()); } }; mSecureSettings.registerContentObserver( Settings.Secure.getUriFor(QuickAccessWalletClientImpl.SETTING_KEY), false /* notifyForDescendants */, mWalletPreferenceObserver); } } private void updateWalletPreference() { mWalletEnabled = mQuickAccessWalletClient.isWalletFeatureAvailable() && mQuickAccessWalletClient.isWalletFeatureAvailableWhenDeviceLocked(); } private void queryWalletCards() { if (!mWalletEnabled || mUiExecutor == null) { return; Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +9 −3 Original line number Diff line number Diff line Loading @@ -151,6 +151,7 @@ import com.android.systemui.statusbar.policy.KeyguardUserSwitcherController; import com.android.systemui.statusbar.policy.KeyguardUserSwitcherView; import com.android.systemui.statusbar.policy.OnHeadsUpChangedListener; import com.android.systemui.util.Utils; import com.android.systemui.util.settings.SecureSettings; import com.android.wm.shell.animation.FlingAnimationUtils; import java.io.FileDescriptor; Loading Loading @@ -530,6 +531,7 @@ public class NotificationPanelViewController extends PanelViewController { private final QuickAccessWalletClient mQuickAccessWalletClient; private final Executor mUiExecutor; private final SecureSettings mSecureSettings; private int mLockScreenMode = KeyguardUpdateMonitor.LOCK_SCREEN_MODE_NORMAL; private KeyguardMediaController mKeyguardMediaController; Loading Loading @@ -605,7 +607,8 @@ public class NotificationPanelViewController extends PanelViewController { QuickAccessWalletClient quickAccessWalletClient, KeyguardMediaController keyguardMediaController, PrivacyDotViewController privacyDotViewController, @Main Executor uiExecutor) { @Main Executor uiExecutor, SecureSettings secureSettings) { super(view, falsingManager, dozeLog, keyguardStateController, (SysuiStatusBarStateController) statusBarStateController, vibratorHelper, statusBarKeyguardViewManager, latencyTracker, flingAnimationUtilsBuilder.get(), Loading Loading @@ -657,6 +660,7 @@ public class NotificationPanelViewController extends PanelViewController { mMediaDataManager = mediaDataManager; mQuickAccessWalletClient = quickAccessWalletClient; mUiExecutor = uiExecutor; mSecureSettings = secureSettings; pulseExpansionHandler.setPulseExpandAbortListener(() -> { if (mQs != null) { mQs.animateHeaderSlidingOut(); Loading Loading @@ -1033,8 +1037,10 @@ public class NotificationPanelViewController extends PanelViewController { mKeyguardBottomArea.setStatusBar(mStatusBar); mKeyguardBottomArea.setUserSetupComplete(mUserSetupComplete); mKeyguardBottomArea.setFalsingManager(mFalsingManager); mKeyguardBottomArea.initWallet(mQuickAccessWalletClient, mUiExecutor, mFeatureFlags.isQuickAccessWalletEnabled()); if (mFeatureFlags.isQuickAccessWalletEnabled()) { mKeyguardBottomArea.initWallet(mQuickAccessWalletClient, mUiExecutor, mSecureSettings); } } private void updateMaxDisplayedNotifications(boolean recompute) { Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +5 −1 Original line number Diff line number Diff line Loading @@ -102,6 +102,7 @@ import com.android.systemui.statusbar.notification.stack.NotificationStackScroll import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.util.concurrency.FakeExecutor; import com.android.systemui.util.settings.SecureSettings; import com.android.systemui.util.time.FakeSystemClock; import com.android.wm.shell.animation.FlingAnimationUtils; Loading Loading @@ -246,6 +247,8 @@ public class NotificationPanelViewTest extends SysuiTestCase { private KeyguardMediaController mKeyguardMediaController; @Mock private PrivacyDotViewController mPrivacyDotViewController; @Mock private SecureSettings mSecureSettings; private SysuiStatusBarStateController mStatusBarStateController; private NotificationPanelViewController mNotificationPanelViewController; Loading Loading @@ -355,7 +358,8 @@ public class NotificationPanelViewTest extends SysuiTestCase { mQuickAccessWalletClient, mKeyguardMediaController, mPrivacyDotViewController, new FakeExecutor(new FakeSystemClock())); new FakeExecutor(new FakeSystemClock()), mSecureSettings); mNotificationPanelViewController.initDependencies( mStatusBar, mNotificationShelfController); Loading