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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/metrics/LaunchFromNotificationUMA.java

Issue 1909483003: [MediaNotification] Add UMA to record user clicking media notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: renaming Created 4 years, 8 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/metrics/LaunchFromNotificationUMA.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/metrics/LaunchFromNotificationUMA.java b/chrome/android/java/src/org/chromium/chrome/browser/metrics/LaunchFromNotificationUMA.java
new file mode 100644
index 0000000000000000000000000000000000000000..6c141e0c49cbdfac478f907648ae299836b07895
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/metrics/LaunchFromNotificationUMA.java
@@ -0,0 +1,36 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.metrics;
+
+import android.content.Intent;
+
+/**
+ * Helper class to record which kind of notifications does the user click to go back to Chrome.
+ */
+public class LaunchFromNotificationUMA {
gone 2016/04/20 22:17:14 LaunchFromNotificationUma, not UMA. media/ unique
Zhiqiang Zhang (Slow) 2016/04/21 16:36:53 Done.
+ public static final int SOURCE_INVALID = -1;
+ public static final int SOURCE_MEDIA = 0;
+ public static final int SOURCE_PRESENTATION = 1;
+ public static final int SOURCE_MEDIA_FLING = 2;
+ public static final int SOURCE_MAX = 3;
+
+ public static final String INTENT_EXTRA_NAME = "Launch.NotificationSource";
gone 2016/04/20 22:17:14 This doesn't have to match the histogram name. Al
Zhiqiang Zhang (Slow) 2016/04/21 16:36:52 Done.
+
+ private static final LaunchMetrics
gone 2016/04/20 22:17:14 Formatting is super wacky here. can you import La
Zhiqiang Zhang (Slow) 2016/04/21 16:36:53 Done.
+ .EnumeratedHistogramSample sNotificationLaunchSourceHistogram =
+ new LaunchMetrics.EnumeratedHistogramSample("Launch.NotificationSource", SOURCE_MAX);
+
+ /**
+ * Record the UMA as specified by {@link intent}. The {@link intent} should contain intent extra
+ * of name {@link INTENT_EXTRA_NAME} indicating the type.
+ * @param intent The intent starting the activity.
+ */
+ public static void recordSource(Intent intent) {
+ if (intent == null) return;
+ int source = intent.getIntExtra(INTENT_EXTRA_NAME, SOURCE_INVALID);
+ if (source == SOURCE_INVALID) return;
gone 2016/04/20 22:17:14 if (source <= SOURCE_INVALID || source >= SOURCE_M
Zhiqiang Zhang (Slow) 2016/04/21 16:36:52 Done.
+ sNotificationLaunchSourceHistogram.record(source);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698