am bae196df: Merge change 6811 into donut
Merge commit 'bae196df36929647356d03e35cbfbdb453e3833b'
* commit 'bae196df36929647356d03e35cbfbdb453e3833b':
Fix #1953520. When MENU is down, consume the key in the BrowserActivity which are not shortcut keys. So it won't trigger the search panel. If a shortcut action is taken, reset the mMenuIsDown as it has been used once.
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 95e1996..30c8c3d 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -1548,6 +1548,13 @@
if (null == mTabOverview && null == getTopWindow()) {
return false;
}
+ if (mMenuIsDown) {
+ // The shortcut action consumes the MENU. Even if it is still down,
+ // it won't trigger the next shortcut action. In the case of the
+ // shortcut action triggering a new activity, like Bookmarks, we
+ // won't get onKeyUp for MENU. So it is important to reset it here.
+ mMenuIsDown = false;
+ }
switch (item.getItemId()) {
// -- Main menu
case R.id.goto_menu_id: {
@@ -2706,6 +2713,11 @@
@Override public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_MENU) {
mMenuIsDown = true;
+ } else if (mMenuIsDown) {
+ // The default key mode is DEFAULT_KEYS_SEARCH_LOCAL. As the MENU is
+ // still down, we don't want to trigger the search. Pretend to
+ // consume the key and do nothing.
+ return true;
}
boolean handled = mKeyTracker.doKeyDown(keyCode, event);
if (!handled) {