Merge "Add dismissImmediate to ListPopupWindow to prevent window leaks in GlobalActionsDialog." into rvc-dev

This commit is contained in:
Aran Ink
2020-04-27 17:57:15 +00:00
committed by Android (Google) Code Review
3 changed files with 18 additions and 6 deletions

View File

@@ -745,6 +745,15 @@ public class ListPopupWindow implements ShowableListMenu {
mHandler.removeCallbacks(mResizePopupRunnable); mHandler.removeCallbacks(mResizePopupRunnable);
} }
/**
* Remove existing exit transition from PopupWindow and force immediate dismissal.
* @hide
*/
public void dismissImmediate() {
mPopup.setExitTransition(null);
dismiss();
}
/** /**
* Set a listener to receive a callback when the popup is dismissed. * Set a listener to receive a callback when the popup is dismissed.
* *

View File

@@ -536,7 +536,7 @@ class ControlsUiControllerImpl @Inject constructor (
override fun hide() { override fun hide() {
Log.d(ControlsUiController.TAG, "hide()") Log.d(ControlsUiController.TAG, "hide()")
hidden = true hidden = true
popup?.dismiss() popup?.dismissImmediate()
activeDialog?.dismiss() activeDialog?.dismiss()
ControlActionCoordinator.closeDialog() ControlActionCoordinator.closeDialog()

View File

@@ -484,8 +484,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
*/ */
@VisibleForTesting @VisibleForTesting
protected int getMaxShownPowerItems() { protected int getMaxShownPowerItems() {
// TODO: Overflow disabled on keyguard while we solve for touch blocking issues. if (shouldUseControlsLayout()) {
if (shouldUseControlsLayout() && !mKeyguardShowing) {
return mResources.getInteger(com.android.systemui.R.integer.power_menu_max_columns); return mResources.getInteger(com.android.systemui.R.integer.power_menu_max_columns);
} else { } else {
return Integer.MAX_VALUE; return Integer.MAX_VALUE;
@@ -2246,7 +2245,7 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
mShowing = false; mShowing = false;
resetOrientation(); resetOrientation();
dismissPanel(); dismissPanel();
dismissOverflow(); dismissOverflow(true);
if (mControlsUiController != null) mControlsUiController.hide(); if (mControlsUiController != null) mControlsUiController.hide();
mNotificationShadeWindowController.setForceHasTopUi(mHadTopUi); mNotificationShadeWindowController.setForceHasTopUi(mHadTopUi);
mDepthController.updateGlobalDialogVisibility(0, null /* view */); mDepthController.updateGlobalDialogVisibility(0, null /* view */);
@@ -2259,11 +2258,15 @@ public class GlobalActionsDialog implements DialogInterface.OnDismissListener,
} }
} }
private void dismissOverflow() { private void dismissOverflow(boolean immediate) {
if (mOverflowPopup != null) { if (mOverflowPopup != null) {
if (immediate) {
mOverflowPopup.dismissImmediate();
} else {
mOverflowPopup.dismiss(); mOverflowPopup.dismiss();
} }
} }
}
private void setRotationSuggestionsEnabled(boolean enabled) { private void setRotationSuggestionsEnabled(boolean enabled) {
try { try {