From 9022c7129ec763c9485f3a2de67b1e19eb77f462 Mon Sep 17 00:00:00 2001 From: Oren Blasberg Date: Tue, 5 Apr 2016 14:59:36 -0700 Subject: [PATCH] Fix top level menu lingering when submenu opens. We should be calling close(false), not dismiss(), when the submenu is opened. This change brings the code closer to what it was before the prior change to StandardMenuPopup, but preserves the ondismiss behavior we want for popup menus. The net change so far is that StandardMenuPopup, not MenuBuilder#performItemAction, handles closing the top level menu when a submenu is opened. But nonetheless, the onDismiss is not called when a submenu is opened; only when an actual real "dismiss" occurs. Bug: 28001958 Change-Id: Ia0f89f8fd4bc5494f6a048c993792adfe42d88ec --- .../com/android/internal/view/menu/StandardMenuPopup.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/java/com/android/internal/view/menu/StandardMenuPopup.java b/core/java/com/android/internal/view/menu/StandardMenuPopup.java index 8ced36f78d75b..2000915d5ec1e 100644 --- a/core/java/com/android/internal/view/menu/StandardMenuPopup.java +++ b/core/java/com/android/internal/view/menu/StandardMenuPopup.java @@ -208,7 +208,7 @@ final class StandardMenuPopup extends MenuPopup implements OnDismissListener, On @Override public void show() { if (!tryShow()) { - throw new IllegalStateException("MenuPopupHelper cannot be used without an anchor"); + throw new IllegalStateException("StandardMenuPopup cannot be used without an anchor"); } } @@ -273,7 +273,7 @@ final class StandardMenuPopup extends MenuPopup implements OnDismissListener, On mOnDismissListener = null; // Close this menu popup to make room for the submenu popup. - dismiss(); + mMenu.close(false /* closeAllMenus */); // Show the new sub-menu popup at the same location as this popup. if (subPopup.tryShow(mXOffset, mYOffset)) {