Merge "Prevent re-use of dismissed wallet view" into rvc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e2ea331b60
@@ -148,6 +148,7 @@ import java.util.Set;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Provider;
|
||||
|
||||
/**
|
||||
* Helper to show the global actions dialog. Each item is an {@link Action} that may show depending
|
||||
@@ -401,7 +402,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
if (mDialog != null) {
|
||||
if (!mDialog.isShowingControls() && shouldShowControls()) {
|
||||
mDialog.showControls(mControlsUiControllerOptional.get());
|
||||
} else if (shouldShowLockMessage()) {
|
||||
} else if (shouldShowLockMessage(mDialog)) {
|
||||
mDialog.showLockMessage();
|
||||
}
|
||||
}
|
||||
@@ -698,19 +699,17 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
mPowerAdapter = new MyPowerOptionsAdapter();
|
||||
|
||||
mDepthController.setShowingHomeControls(true);
|
||||
GlobalActionsPanelPlugin.PanelViewController walletViewController =
|
||||
getWalletViewController();
|
||||
ControlsUiController uiController = null;
|
||||
if (mControlsUiControllerOptional.isPresent() && shouldShowControls()) {
|
||||
uiController = mControlsUiControllerOptional.get();
|
||||
}
|
||||
ActionsDialog dialog = new ActionsDialog(mContext, mAdapter, mOverflowAdapter,
|
||||
walletViewController, mDepthController, mSysuiColorExtractor,
|
||||
this::getWalletViewController, mDepthController, mSysuiColorExtractor,
|
||||
mStatusBarService, mNotificationShadeWindowController,
|
||||
controlsAvailable(), uiController,
|
||||
mSysUiState, this::onRotate, mKeyguardShowing, mPowerAdapter);
|
||||
|
||||
if (shouldShowLockMessage()) {
|
||||
if (shouldShowLockMessage(dialog)) {
|
||||
dialog.showLockMessage();
|
||||
}
|
||||
dialog.setCanceledOnTouchOutside(false); // Handled by the custom class.
|
||||
@@ -2124,7 +2123,8 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
private MultiListLayout mGlobalActionsLayout;
|
||||
private Drawable mBackgroundDrawable;
|
||||
private final SysuiColorExtractor mColorExtractor;
|
||||
private final GlobalActionsPanelPlugin.PanelViewController mWalletViewController;
|
||||
private final Provider<GlobalActionsPanelPlugin.PanelViewController> mWalletFactory;
|
||||
@Nullable private GlobalActionsPanelPlugin.PanelViewController mWalletViewController;
|
||||
private boolean mKeyguardShowing;
|
||||
private boolean mShowing;
|
||||
private float mScrimAlpha;
|
||||
@@ -2144,7 +2144,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
private TextView mLockMessage;
|
||||
|
||||
ActionsDialog(Context context, MyAdapter adapter, MyOverflowAdapter overflowAdapter,
|
||||
GlobalActionsPanelPlugin.PanelViewController walletViewController,
|
||||
Provider<GlobalActionsPanelPlugin.PanelViewController> walletFactory,
|
||||
NotificationShadeDepthController depthController,
|
||||
SysuiColorExtractor sysuiColorExtractor, IStatusBarService statusBarService,
|
||||
NotificationShadeWindowController notificationShadeWindowController,
|
||||
@@ -2165,6 +2165,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
mSysUiState = sysuiState;
|
||||
mOnRotateCallback = onRotateCallback;
|
||||
mKeyguardShowing = keyguardShowing;
|
||||
mWalletFactory = walletFactory;
|
||||
|
||||
// Window initialization
|
||||
Window window = getWindow();
|
||||
@@ -2187,7 +2188,6 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
window.getAttributes().setFitInsetsTypes(0 /* types */);
|
||||
setTitle(R.string.global_actions);
|
||||
|
||||
mWalletViewController = walletViewController;
|
||||
initializeLayout();
|
||||
}
|
||||
|
||||
@@ -2200,8 +2200,13 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
mControlsUiController.show(mControlsView, this::dismissForControlsActivity);
|
||||
}
|
||||
|
||||
private boolean isWalletViewAvailable() {
|
||||
return mWalletViewController != null && mWalletViewController.getPanelContent() != null;
|
||||
}
|
||||
|
||||
private void initializeWalletView() {
|
||||
if (mWalletViewController == null || mWalletViewController.getPanelContent() == null) {
|
||||
mWalletViewController = mWalletFactory.get();
|
||||
if (!isWalletViewAvailable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2507,6 +2512,8 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
private void dismissWallet() {
|
||||
if (mWalletViewController != null) {
|
||||
mWalletViewController.onDismissed();
|
||||
// The wallet controller should not be re-used after being dismissed.
|
||||
mWalletViewController = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2648,18 +2655,12 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
|
||||
&& !mControlsServiceInfos.isEmpty();
|
||||
}
|
||||
|
||||
private boolean walletViewAvailable() {
|
||||
GlobalActionsPanelPlugin.PanelViewController walletViewController =
|
||||
getWalletViewController();
|
||||
return walletViewController != null && walletViewController.getPanelContent() != null;
|
||||
}
|
||||
|
||||
private boolean shouldShowLockMessage() {
|
||||
private boolean shouldShowLockMessage(ActionsDialog dialog) {
|
||||
boolean isLockedAfterBoot = mLockPatternUtils.getStrongAuthForUser(getCurrentUser().id)
|
||||
== STRONG_AUTH_REQUIRED_AFTER_BOOT;
|
||||
return !mKeyguardStateController.isUnlocked()
|
||||
&& (!mShowLockScreenCardsAndControls || isLockedAfterBoot)
|
||||
&& (controlsAvailable() || walletViewAvailable());
|
||||
&& (controlsAvailable() || dialog.isWalletViewAvailable());
|
||||
}
|
||||
|
||||
private void onPowerMenuLockScreenSettingsChanged() {
|
||||
|
||||
Reference in New Issue
Block a user