Bug 1210283 - Add more UI Telemetry probes for managing Home Panels r=liuche
authorMark Finkle <mfinkle@mozilla.com>
Sat, 03 Oct 2015 00:37:48 -0400
changeset 265898 dcbe3158d29d1cae799de5a1febd83fc137c1156
parent 265897 be9f3f152aae2a404906df852fdadb0db2963d0c
child 265899 bce73b114fdc0c6a845bcc1ed3288918f54622b0
push id29471
push userphilringnalda@gmail.com
push dateSat, 03 Oct 2015 22:50:31 +0000
treeherdermozilla-central@8464f02a2798 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersliuche
bugs1210283
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1210283 - Add more UI Telemetry probes for managing Home Panels r=liuche
mobile/android/base/TelemetryContract.java
mobile/android/base/preferences/PanelsPreferenceCategory.java
--- a/mobile/android/base/TelemetryContract.java
+++ b/mobile/android/base/TelemetryContract.java
@@ -44,18 +44,30 @@ public interface TelemetryContract {
 
         // Loading a URL.
         LOAD_URL("loadurl.1"),
 
         LOCALE_BROWSER_RESET("locale.browser.reset.1"),
         LOCALE_BROWSER_SELECTED("locale.browser.selected.1"),
         LOCALE_BROWSER_UNSELECTED("locale.browser.unselected.1"),
 
-        // Set default panel.
-        PANEL_SET_DEFAULT("setdefault.1"),
+        // Hide a built-in home panel.
+        PANEL_HIDE("panel.hide.1"),
+
+        // Move a home panel up or down.
+        PANEL_MOVE("panel.move.1"),
+
+        // Remove a custom home panel.
+        PANEL_REMOVE("panel.remove.1"),
+
+        // Set default home panel.
+        PANEL_SET_DEFAULT("panel.setdefault.1"),
+
+        // Show a hidden built-in home panel.
+        PANEL_SHOW("panel.show.1"),
 
         // Pinning an item.
         PIN("pin.1"),
 
         // Outcome of data policy notification: can be true or false.
         POLICY_NOTIFICATION_SUCCESS("policynotification.success.1"),
 
         // Sanitizing private data.
--- a/mobile/android/base/preferences/PanelsPreferenceCategory.java
+++ b/mobile/android/base/preferences/PanelsPreferenceCategory.java
@@ -160,65 +160,81 @@ public class PanelsPreferenceCategory ex
         final String defaultPanelId = mConfigEditor.getDefaultPanelId();
         if (defaultPanelId != null && defaultPanelId.equals(id)) {
             return;
         }
 
         mConfigEditor.setDefault(id);
         mConfigEditor.apply();
 
-        Telemetry.sendUIEvent(TelemetryContract.Event.PANEL_SET_DEFAULT, Method.NONE, id);
+        Telemetry.sendUIEvent(TelemetryContract.Event.PANEL_SET_DEFAULT, Method.DIALOG, id);
     }
 
     @Override
     protected void onPrepareForRemoval() {
         if (mLoadTask != null) {
             mLoadTask.cancel();
         }
     }
 
     @Override
     public void uninstall(CustomListPreference pref) {
-        mConfigEditor.uninstall(pref.getKey());
+        final String id = pref.getKey();
+        mConfigEditor.uninstall(id);
         mConfigEditor.apply();
 
+        Telemetry.sendUIEvent(TelemetryContract.Event.PANEL_REMOVE, Method.DIALOG, id);
+
         super.uninstall(pref);
     }
 
     public void moveUp(PanelsPreference pref) {
         final int panelIndex = pref.getIndex();
         if (panelIndex > 0) {
             final String panelKey = pref.getKey();
             mConfigEditor.moveTo(panelKey, panelIndex - 1);
             final State state = mConfigEditor.apply();
+
+            Telemetry.sendUIEvent(TelemetryContract.Event.PANEL_MOVE, Method.DIALOG, panelKey);
+
             refresh(state, panelKey);
         }
     }
 
     public void moveDown(PanelsPreference pref) {
         final int panelIndex = pref.getIndex();
         if (panelIndex < getPreferenceCount() - 1) {
             final String panelKey = pref.getKey();
             mConfigEditor.moveTo(panelKey, panelIndex + 1);
             final State state = mConfigEditor.apply();
+
+            Telemetry.sendUIEvent(TelemetryContract.Event.PANEL_MOVE, Method.DIALOG, panelKey);
+
             refresh(state, panelKey);
         }
     }
 
     /**
      * Update the hide/show state of the preference and save the HomeConfig
      * changes.
      *
      * @param pref Preference to update
      * @param toHide New hidden state of the preference
      */
     protected void setHidden(PanelsPreference pref, boolean toHide) {
-        mConfigEditor.setDisabled(pref.getKey(), toHide);
+        final String id = pref.getKey();
+        mConfigEditor.setDisabled(id, toHide);
         mConfigEditor.apply();
 
+        if (toHide) {
+            Telemetry.sendUIEvent(TelemetryContract.Event.PANEL_HIDE, Method.DIALOG, id);
+        } else {
+            Telemetry.sendUIEvent(TelemetryContract.Event.PANEL_SHOW, Method.DIALOG, id);
+        }
+
         pref.setHidden(toHide);
         setDefaultFromConfig();
     }
 
     /**
      * When the default panel is removed or disabled, find an enabled panel
      * if possible and set it as mDefaultReference.
      */