Bug 1006670 - Add UI Telemetry for 'Switch to native application' android icon r=liuche a=sylvestre
authorMark Finkle <mfinkle@mozilla.com>
Wed, 07 May 2014 22:53:50 -0400
changeset 199137 3dc38a7dfdbce91db14c3ec7445b80492f4e6c0b
parent 199136 805a76aa29247ed43aef48a63219afa60adbce74
child 199138 7234179747ab4b63ae7bcfa645ae409b68906b77
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersliuche, sylvestre
bugs1006670
milestone31.0a2
Bug 1006670 - Add UI Telemetry for 'Switch to native application' android icon r=liuche a=sylvestre
mobile/android/base/TelemetryContract.java
mobile/android/chrome/content/browser.js
--- a/mobile/android/base/TelemetryContract.java
+++ b/mobile/android/base/TelemetryContract.java
@@ -44,16 +44,20 @@ public interface TelemetryContract {
         // Note: Only used in JavaScript for now, but here for completeness.
         public static final String UNSAVE = "unsave.1";
 
         // Loading a URL.
         public static final String LOAD_URL = "loadurl.1";
 
         // Generic action, usually for tracking menu and toolbar actions.
         public static final String ACTION = "action.1";
+
+        // Launching (opening) an external application
+        // Note: Only used in JavaScript for now, but here for completeness.
+        public static final String LAUNCH = "launch.1";
     }
 
     /**
      * Holds event methods. Intended for use in
      * Telemetry.sendUIEvent() as the "method" parameter.
      */
     public interface Method {
         // Action triggered from a list.
@@ -77,16 +81,20 @@ public interface TelemetryContract {
         // Action triggered from a view grid item, like a thumbnail.
         public static final String GRID_ITEM = "griditem";
 
         // Action triggered from a view list item, like a row of a list.
         public static final String LIST_ITEM = "listitem";
 
         // Action triggered from a suggestion provided to the user.
         public static final String SUGGESTION = "suggestion";
+
+        // Action triggered from a pageaction in the URLBar.
+        // Note: Only used in JavaScript for now, but here for completeness.
+        public static final String PAGEACTION = "pageaction";
     }
 
     /**
      * Holds session names. Intended for use with
      * Telemetry.startUISession() as the "sessionName" parameter.
      */
     public interface Session {
         // Started when a user enters about:home.
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -8083,16 +8083,20 @@ var ExternalApps = {
     if (this._pageActionId != undefined)
       return;
 
     this._pageActionId = NativeWindow.pageactions.add({
       title: Strings.browser.GetStringFromName("openInApp.pageAction"),
       icon: "drawable://icon_openinapp",
 
       clickCallback: () => {
+        // Create a relative timestamp for telemetry
+        let uptime = Date.now() - Services.startup.getStartupInfo().linkerInitialized;
+        UITelemetry.addEvent("launch.1", "pageaction", uptime, "helper");
+
         if (apps.length > 1) {
           // Use the HelperApps prompt here to filter out any Http handlers
           HelperApps.prompt(apps, {
             title: Strings.browser.GetStringFromName("openInApp.pageAction"),
             buttons: [
               Strings.browser.GetStringFromName("openInApp.ok"),
               Strings.browser.GetStringFromName("openInApp.cancel")
             ]