Bug 1002318 - Add UI Telemetry for sanitizing private data r=liuche, bnicholson
authorMark Finkle <mfinkle@mozilla.com>
Tue, 29 Apr 2014 08:04:10 -0400
changeset 181219 6fcc6dae54098bf313ebe86e1600f378e3fcaadc
parent 181135 79989d4a8d24a5135fa5b02bedf1ce0c24052f30
child 181220 ce243803cab78ec6a96b2f6735a3f0ce8ef18a2a
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersliuche, bnicholson
bugs1002318
milestone32.0a1
Bug 1002318 - Add UI Telemetry for sanitizing private data r=liuche, bnicholson
mobile/android/base/TelemetryContract.java
mobile/android/base/preferences/PrivateDataPreference.java
--- a/mobile/android/base/TelemetryContract.java
+++ b/mobile/android/base/TelemetryContract.java
@@ -24,23 +24,29 @@ public interface TelemetryContract {
         // Top site un-pinned.
         public static final String TOP_SITES_UNPIN = "unpin.1";
 
         // Top site edited.
         public static final String TOP_SITES_EDIT = "edit.1";
 
         // Set default panel.
         public static final String PANEL_SET_DEFAULT = "setdefault.1";
+
+        // Sanitizing private data.
+        public static final String SANITIZE = "sanitize.1";
     }
 
     /**
      * Holds event methods. Intended for use in
      * Telemetry.sendUIEvent() as the "method" parameter.
      */
-    public interface Method {}
+    public interface Method {
+        // Action triggered from a dialog.
+        public static final String DIALOG = "dialog";
+    }
 
     /**
      * Holds session names. Intended for use with
      * Telemetry.startUISession() as the "sessionName" parameter.
      */
     public interface Session {
         // Started when a user enters about:home.
         public static final String HOME = "home.1";
--- a/mobile/android/base/preferences/PrivateDataPreference.java
+++ b/mobile/android/base/preferences/PrivateDataPreference.java
@@ -2,16 +2,18 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.preferences;
 
 import org.mozilla.gecko.GeckoAppShell;
 import org.mozilla.gecko.GeckoEvent;
+import org.mozilla.gecko.Telemetry;
+import org.mozilla.gecko.TelemetryContract;
 
 import org.json.JSONException;
 import org.json.JSONObject;
 
 import android.content.Context;
 import android.util.AttributeSet;
 import android.util.Log;
 
@@ -28,16 +30,18 @@ class PrivateDataPreference extends Mult
 
     @Override
     protected void onDialogClosed(boolean positiveResult) {
         super.onDialogClosed(positiveResult);
 
         if (!positiveResult)
             return;
 
+        Telemetry.sendUIEvent(TelemetryContract.Event.SANITIZE, TelemetryContract.Method.DIALOG);
+
         CharSequence keys[] = getEntryKeys();
         boolean values[] = getValues();
         JSONObject json = new JSONObject();
 
         for (int i = 0; i < keys.length; i++) {
             // Privacy pref checkbox values are stored in Android prefs to
             // remember their check states. The key names are private.data.X,
             // where X is a string from Gecko sanitization. This prefix is