Commit 2baea13a authored by Ted Choc's avatar Ted Choc Committed by Commit Bot

Speculative fix for BadWindowToken when showing app menu.

BUG=844787

Change-Id: I966b385a928075c25eebdb7abfbdbbfb0ab2db95
Reviewed-on: https://chromium-review.googlesource.com/1067477Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: Ted Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560299}
parent 4c73f294
...@@ -1418,7 +1418,12 @@ public abstract class ChromeActivity extends AsyncInitializationActivity ...@@ -1418,7 +1418,12 @@ public abstract class ChromeActivity extends AsyncInitializationActivity
/** /**
* @return Whether the app menu should be shown. * @return Whether the app menu should be shown.
*/ */
@CallSuper
public boolean shouldShowAppMenu() { public boolean shouldShowAppMenu() {
if (isActivityDestroyed()) return false;
if (ApplicationStatus.getStateForActivity(this) != ActivityState.RESUMED) return false;
// Do not show the menu if Contextual Search panel is opened. // Do not show the menu if Contextual Search panel is opened.
if (mContextualSearchManager != null && mContextualSearchManager.isSearchPanelOpened()) { if (mContextualSearchManager != null && mContextualSearchManager.isSearchPanelOpened()) {
return false; return false;
......
...@@ -989,7 +989,9 @@ public class CustomTabActivity extends ChromeActivity { ...@@ -989,7 +989,9 @@ public class CustomTabActivity extends ChromeActivity {
@Override @Override
public boolean shouldShowAppMenu() { public boolean shouldShowAppMenu() {
return getActivityTab() != null && getToolbarManager().isInitialized(); if (getActivityTab() == null || !getToolbarManager().isInitialized()) return false;
return super.shouldShowAppMenu();
} }
@Override @Override
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment