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