Bug 1219895 - Cleanup the 'share.1' telemetry probes by adding extra context. r=margaret, a=sylvestre
authorMark Finkle <mfinkle@mozilla.com>
Thu, 29 Oct 2015 18:44:44 -0400
changeset 296683 4640472b4c72
parent 296682 0b662011620c
child 296684 74993763ef07
push id5286
push usermfinkle@mozilla.com
push date2015-11-10 20:07 +0000
treeherdermozilla-beta@4640472b4c72 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret, sylvestre
bugs1219895
milestone43.0
Bug 1219895 - Cleanup the 'share.1' telemetry probes by adding extra context. r=margaret, a=sylvestre
mobile/android/base/BrowserApp.java
mobile/android/base/GeckoApp.java
mobile/android/base/home/HomeFragment.java
mobile/android/base/prompts/PromptListAdapter.java
mobile/android/base/widget/GeckoActionProvider.java
toolkit/components/reader/AboutReader.jsm
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -1520,38 +1520,16 @@ public class BrowserApp extends GeckoApp
         ThreadUtils.postToBackgroundThread(new Runnable() {
             @Override
             public void run() {
                 FennecTabsRepository.deleteNonLocalClientsAndTabs(getContext());
             }
         });
     }
 
-    private void shareCurrentUrl() {
-        Tab tab = Tabs.getInstance().getSelectedTab();
-        if (tab == null) {
-            return;
-        }
-
-        String url = tab.getURL();
-        if (url == null) {
-            return;
-        }
-
-        if (AboutPages.isAboutReader(url)) {
-            url = ReaderModeUtils.getUrlFromAboutReader(url);
-        }
-
-        GeckoAppShell.openUriExternal(url, "text/plain", "", "",
-                                      Intent.ACTION_SEND, tab.getDisplayTitle());
-
-        // Context: Sharing via chrome list (no explicit session is active)
-        Telemetry.sendUIEvent(TelemetryContract.Event.SHARE, TelemetryContract.Method.LIST);
-    }
-
     private void setToolbarMargin(int margin) {
         ((RelativeLayout.LayoutParams) mGeckoLayout.getLayoutParams()).topMargin = margin;
         mGeckoLayout.requestLayout();
     }
 
     @Override
     public void onTranslationChanged(float aToolbarTranslation, float aLayerViewTranslation) {
         if (mBrowserChrome == null) {
@@ -3388,17 +3366,30 @@ public class BrowserApp extends GeckoApp
                     item.setIcon(resolveReadingListIconID(true));
                     item.setTitle(resolveReadingListTitleID(true));
                 }
             }
             return true;
         }
 
         if (itemId == R.id.share) {
-            shareCurrentUrl();
+            tab = Tabs.getInstance().getSelectedTab();
+            if (tab != null) {
+                String url = tab.getURL();
+                if (url != null) {
+                    if (AboutPages.isAboutReader(url)) {
+                        url = ReaderModeUtils.getUrlFromAboutReader(url);
+                    }
+
+                    // Context: Sharing via chrome list (no explicit session is active)
+                    Telemetry.sendUIEvent(TelemetryContract.Event.SHARE, TelemetryContract.Method.LIST, "menu");
+
+                    GeckoAppShell.openUriExternal(url, "text/plain", "", "", Intent.ACTION_SEND, tab.getDisplayTitle(), false);
+                }
+            }
             return true;
         }
 
         if (itemId == R.id.reload) {
             tab = Tabs.getInstance().getSelectedTab();
             if (tab != null)
                 tab.doReload(false);
             return true;
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -636,17 +636,17 @@ public abstract class GeckoApp
             if (tab != null) {
                 title = tab.getDisplayTitle();
                 final String url = ReaderModeUtils.stripAboutReaderUrl(tab.getURL());
                 text += "\n\n" + url;
             }
             GeckoAppShell.openUriExternal(text, "text/plain", "", "", Intent.ACTION_SEND, title);
 
             // Context: Sharing via chrome list (no explicit session is active)
-            Telemetry.sendUIEvent(TelemetryContract.Event.SHARE, TelemetryContract.Method.LIST);
+            Telemetry.sendUIEvent(TelemetryContract.Event.SHARE, TelemetryContract.Method.LIST, "text");
 
         } else if ("SystemUI:Visibility".equals(event)) {
             setSystemUiVisible(message.getBoolean("visible"));
 
         } else if ("Toast:Show".equals(event)) {
             final String msg = message.getString("message");
             final String duration = message.getString("duration");
             final NativeJSObject button = message.optObject("button", null);
--- a/mobile/android/base/home/HomeFragment.java
+++ b/mobile/android/base/home/HomeFragment.java
@@ -201,17 +201,17 @@ public abstract class HomeFragment exten
             if (info.url == null) {
                 Log.e(LOGTAG, "Can't share because URL is null");
                 return false;
             } else {
                 GeckoAppShell.openUriExternal(info.url, SHARE_MIME_TYPE, "", "",
                                               Intent.ACTION_SEND, info.getDisplayTitle());
 
                 // Context: Sharing via chrome homepage contextmenu list (home session should be active)
-                Telemetry.sendUIEvent(TelemetryContract.Event.SHARE, TelemetryContract.Method.LIST);
+                Telemetry.sendUIEvent(TelemetryContract.Event.SHARE, TelemetryContract.Method.LIST, "home_contextmenu");
                 return true;
             }
         }
 
         if (itemId == R.id.home_add_to_launcher) {
             if (info.url == null) {
                 Log.e(LOGTAG, "Can't add to home screen because URL is null");
                 return false;
--- a/mobile/android/base/prompts/PromptListAdapter.java
+++ b/mobile/android/base/prompts/PromptListAdapter.java
@@ -212,17 +212,17 @@ public class PromptListAdapter extends A
                 final GeckoActionProvider provider = GeckoActionProvider.getForType(item.getIntent().getType(), getContext());
                 IntentChooserPrompt prompt = new IntentChooserPrompt(getContext(), provider);
                 prompt.show(item.label, getContext(), new IntentHandler() {
                     @Override
                     public void onIntentSelected(final Intent intent, final int p) {
                         provider.chooseActivity(p);
 
                         // Context: Sharing via content contextmenu list (no explicit session is active)
-                        Telemetry.sendUIEvent(TelemetryContract.Event.SHARE, TelemetryContract.Method.LIST);
+                        Telemetry.sendUIEvent(TelemetryContract.Event.SHARE, TelemetryContract.Method.LIST, "promptlist");
                     }
 
                     @Override
                     public void onCancelled() {
                         // do nothing
                     }
                 });
             }
--- a/mobile/android/base/widget/GeckoActionProvider.java
+++ b/mobile/android/base/widget/GeckoActionProvider.java
@@ -246,27 +246,27 @@ public class GeckoActionProvider {
             }
         }
 
         @Override
         public boolean onMenuItemClick(MenuItem item) {
             chooseActivity(item.getItemId());
 
             // Context: Sharing via chrome mainmenu list (no explicit session is active)
-            Telemetry.sendUIEvent(TelemetryContract.Event.SHARE, TelemetryContract.Method.LIST);
+            Telemetry.sendUIEvent(TelemetryContract.Event.SHARE, TelemetryContract.Method.LIST, "actionprovider");
             return true;
         }
 
         @Override
         public void onClick(View view) {
             Integer index = (Integer) view.getTag();
             chooseActivity(index);
 
             // Context: Sharing via chrome mainmenu and content contextmenu quickshare (no explicit session is active)
-            Telemetry.sendUIEvent(TelemetryContract.Event.SHARE, TelemetryContract.Method.BUTTON);
+            Telemetry.sendUIEvent(TelemetryContract.Event.SHARE, TelemetryContract.Method.BUTTON, "actionprovider");
         }
     }
 
     public enum ActionViewType {
         DEFAULT,
         QUICK_SHARE_ICON,
         CONTEXT_MENU,
     }
--- a/toolkit/components/reader/AboutReader.jsm
+++ b/toolkit/components/reader/AboutReader.jsm
@@ -324,17 +324,17 @@ AboutReader.prototype = {
   _onShare: function Reader_onShare() {
     if (!this._article)
       return;
 
     this._mm.sendAsyncMessage("Reader:Share", {
       url: this._article.url,
       title: this._article.title
     });
-    UITelemetry.addEvent("share.1", "list", null);
+    UITelemetry.addEvent("share.1", "list", null, "reader");
   },
 
   /**
    * To help introduce ReadingList, we want to automatically
    * open the Desktop sidebar the first time ReaderMode is used.
    */
   _showListIntro: function() {
     this._mm.sendAsyncMessage("ReadingList:ShowIntro");