Bug 1387026 - Fix Android browserAction corrupting legacy Addon menu items on overlapping menu item id. draft
authorLuca Greco <lgreco@mozilla.com>
Wed, 02 Aug 2017 21:29:18 +0200
changeset 621077 61824e5dcb05a56eff3424f58b4d00a4a63363b8
parent 621070 4d03b0fd5614270339d576441ea698a89ec5aa36
child 640891 bedabe4d6a5b51ed023eb4c98daa54d42a5ccd0b
push id72248
push userluca.greco@alcacoop.it
push dateFri, 04 Aug 2017 09:19:40 +0000
bugs1387026
milestone57.0a1
Bug 1387026 - Fix Android browserAction corrupting legacy Addon menu items on overlapping menu item id. MozReview-Commit-ID: FWkJdAWu5Td
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -252,16 +252,17 @@ public class BrowserApp extends GeckoApp
      */
     private ViewGroup mHomeScreenContainer;
     private int mCachedRecentTabsCount;
     private ActionModeCompat mActionMode;
     private TabHistoryController tabHistoryController;
 
     private static final int GECKO_TOOLS_MENU = -1;
     private static final int ADDON_MENU_OFFSET = 1000;
+    private static final int BROWSER_ACTION_MENU_OFFSET = 10000;
     public static final String TAB_HISTORY_FRAGMENT_TAG = "tabHistoryFragment";
 
     // When the static action bar is shown, only the real toolbar chrome should be
     // shown when the toolbar is visible. Causing the toolbar animator to also
     // show the snapshot causes the content to shift under the users finger.
     // See: Bug 1358554
     private boolean mShowingToolbarChromeForActionBar;
 
@@ -1856,17 +1857,17 @@ public class BrowserApp extends GeckoApp
 
             case "Menu:AddBrowserAction":
                 final BrowserActionItemInfo browserAction = new BrowserActionItemInfo();
                 browserAction.label = message.getString("name");
                 if (TextUtils.isEmpty(browserAction.label)) {
                     Log.e(LOGTAG, "Invalid browser action name");
                     return;
                 }
-                browserAction.id = message.getInt("id") + ADDON_MENU_OFFSET;
+                browserAction.id = message.getInt("id") + BROWSER_ACTION_MENU_OFFSET;
                 browserAction.uuid = message.getString("uuid");
                 addBrowserActionMenuItem(browserAction);
                 break;
 
             case "Menu:RemoveBrowserAction":
                 removeBrowserActionMenuItem(message.getString("uuid"));
                 break;