Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4632)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerCategoryView.java

Issue 2915863002: Photo Picker dialog: Add UMA statistics. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerCategoryView.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerCategoryView.java b/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerCategoryView.java
index 24bdc226e65f2ba107dbd0408fd2e8f48bb92f06..81f6f7115fe98afa11d396d5bc17728e779fc698 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerCategoryView.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerCategoryView.java
@@ -19,6 +19,7 @@ import android.widget.Button;
import android.widget.RelativeLayout;
import org.chromium.base.VisibleForTesting;
+import org.chromium.base.metrics.RecordHistogram;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.widget.selection.SelectableListLayout;
import org.chromium.chrome.browser.widget.selection.SelectionDelegate;
@@ -37,6 +38,18 @@ public class PickerCategoryView extends RelativeLayout
DecoderServiceHost.ServiceReadyCallback, View.OnClickListener {
private static final int KILOBYTE = 1024;
+ // The UMA key for tracking the actions taken in the dialog.
+ private static final String HISTOGRAM_NAME = "Android.PhotoPicker.DialogAction";
Theresa 2017/05/31 18:40:02 optional nit: The downside to using a static final
Finnur 2017/06/01 15:13:55 Done.
+
+ // Note: these values must match the PhotoPickerDialogAction enum values in histograms.xml.
+ // Only add new values at the end, right before ACTIONS. We depend on these specific values in
+ // UMA histograms.
+ private static final int ACTION_CANCEL = 0;
+ private static final int ACTION_PHOTO_PICKED = 1;
+ private static final int ACTION_NEW_PHOTO = 2;
+ private static final int ACTION_BROWSE = 3;
+ private static final int NUM_ACTIONS = 4;
Theresa 2017/05/31 18:40:02 nit: ACTIONS_BOUNDARY is more consistent with how
Finnur 2017/06/01 15:13:55 Done.
+
// The dialog that owns us.
private PhotoPickerDialog mDialog;
@@ -195,6 +208,8 @@ public class PickerCategoryView extends RelativeLayout
mDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
+ RecordHistogram.recordEnumeratedHistogram(
+ HISTOGRAM_NAME, ACTION_CANCEL, NUM_ACTIONS);
mListener.onPickerUserAction(PhotoPickerListener.Action.CANCEL, null);
}
});
@@ -232,8 +247,11 @@ public class PickerCategoryView extends RelativeLayout
@Override
public void onClick(View view) {
if (view.getId() == R.id.done) {
+ RecordHistogram.recordEnumeratedHistogram(
+ HISTOGRAM_NAME, ACTION_PHOTO_PICKED, NUM_ACTIONS);
notifyPhotosSelected();
} else {
+ RecordHistogram.recordEnumeratedHistogram(HISTOGRAM_NAME, ACTION_CANCEL, NUM_ACTIONS);
mListener.onPickerUserAction(PhotoPickerListener.Action.CANCEL, null);
}
@@ -284,6 +302,7 @@ public class PickerCategoryView extends RelativeLayout
* Notifies the listener that the user selected to launch the gallery.
*/
public void showGallery() {
+ RecordHistogram.recordEnumeratedHistogram(HISTOGRAM_NAME, ACTION_BROWSE, NUM_ACTIONS);
mListener.onPickerUserAction(PhotoPickerListener.Action.LAUNCH_GALLERY, null);
}
@@ -291,6 +310,7 @@ public class PickerCategoryView extends RelativeLayout
* Notifies the listener that the user selected to launch the camera intent.
*/
public void showCamera() {
+ RecordHistogram.recordEnumeratedHistogram(HISTOGRAM_NAME, ACTION_NEW_PHOTO, NUM_ACTIONS);
mListener.onPickerUserAction(PhotoPickerListener.Action.LAUNCH_CAMERA, null);
}

Powered by Google App Engine
This is Rietveld 408576698