From 102272d0f30263dc9ae9a554adcecd25a3268fca Mon Sep 17 00:00:00 2001 From: Chenxia Liu Date: Wed, 25 Jun 2014 09:29:07 -0700 Subject: [PATCH] Bug 1007130 - Add UI telemetry for 'Adding a new search engine' button. r=mfinkle --- mobile/android/base/BrowserApp.java | 7 ++++++- mobile/android/chrome/content/browser.js | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mobile/android/base/BrowserApp.java b/mobile/android/base/BrowserApp.java index d69b02bbc044..871677f04e7a 100644 --- a/mobile/android/base/BrowserApp.java +++ b/mobile/android/base/BrowserApp.java @@ -13,9 +13,9 @@ import java.util.List; import java.util.Locale; import java.util.Vector; -import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; + import org.mozilla.gecko.DynamicToolbar.PinReason; import org.mozilla.gecko.DynamicToolbar.VisibilityTransition; import org.mozilla.gecko.GeckoProfileDirectories.NoMozillaDirectoryException; @@ -790,6 +790,7 @@ public class BrowserApp extends GeckoApp } if (itemId == R.id.add_search_engine) { + // This can be selected from either the browser menu or the contextmenu, depending on the size and version (v11+) of the phone. Tab tab = Tabs.getInstance().getSelectedTab(); if (tab != null && tab.hasOpenSearch()) { JSONObject args = new JSONObject(); @@ -800,6 +801,10 @@ public class BrowserApp extends GeckoApp return true; } GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("SearchEngines:Add", args.toString())); + + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { + Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.CONTEXT_MENU, "add_search_engine"); + } } return true; } diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index 84af9e8120ed..ea4d3954fc4b 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -6820,6 +6820,7 @@ var SearchEngines = { icon: "drawable://ab_add_search_engine", selector: filter, action: function(aElement) { + UITelemetry.addEvent("action.1", "actionbar", null, "add_search_engine"); SearchEngines.addEngine(aElement); } });