OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.metrics; | 5 package org.chromium.chrome.browser.metrics; |
6 | 6 |
7 import org.chromium.base.metrics.RecordHistogram; | 7 import org.chromium.base.metrics.RecordHistogram; |
8 | 8 |
9 /** | 9 /** |
10 * Centralizes UMA data collection for WebAPKs. NOTE: Histogram names and values are defined in | 10 * Centralizes UMA data collection for WebAPKs. NOTE: Histogram names and values are defined in |
11 * tools/metrics/histograms/histograms.xml. Please update that file if any chang e is made. | 11 * tools/metrics/histograms/histograms.xml. Please update that file if any chang e is made. |
12 */ | 12 */ |
13 public class WebApkUma { | 13 public class WebApkUma { |
14 // This enum is used to back UMA histograms, and should therefore be treated as append-only. | 14 // This enum is used to back UMA histograms, and should therefore be treated as append-only. |
15 public static final int UPDATE_REQUEST_SENT_FIRST_TRY = 0; | 15 public static final int UPDATE_REQUEST_SENT_FIRST_TRY = 0; |
16 public static final int UPDATE_REQUEST_SENT_ONSTOP = 1; | 16 public static final int UPDATE_REQUEST_SENT_ONSTOP = 1; |
17 public static final int UPDATE_REQUEST_SENT_WHILE_WEBAPK_IN_FOREGROUND = 2; | 17 public static final int UPDATE_REQUEST_SENT_WHILE_WEBAPK_IN_FOREGROUND = 2; |
18 public static final int UPDATE_REQUEST_SENT_MAX = 3; | 18 public static final int UPDATE_REQUEST_SENT_MAX = 3; |
19 | 19 |
20 // This enum is used to back UMA histograms, and should therefore be treated as append-only. | 20 // This enum is used to back UMA histograms, and should therefore be treated as append-only. |
21 // The queued request times shouldn't exceed three. | 21 // The queued request times shouldn't exceed three. |
22 public static final int UPDATE_REQUEST_QUEUED_ONCE = 0; | 22 public static final int UPDATE_REQUEST_QUEUED_ONCE = 0; |
23 public static final int UPDATE_REQUEST_QUEUED_TWICE = 1; | 23 public static final int UPDATE_REQUEST_QUEUED_TWICE = 1; |
24 public static final int UPDATE_REQUEST_QUEUED_THREE_TIMES = 2; | 24 public static final int UPDATE_REQUEST_QUEUED_THREE_TIMES = 2; |
25 public static final int UPDATE_REQUEST_QUEUED_MAX = 3; | 25 public static final int UPDATE_REQUEST_QUEUED_MAX = 3; |
26 | 26 |
27 // This enum is used to back UMA histograms, and should therefore be treated as append-only. | |
28 public static final int GOOGLE_PLAY_INSTALL_SUCCESS = 0; | |
29 public static final int GOOGLE_PLAY_INSTALL_FAILED_NO_DELEGATE = 1; | |
30 public static final int GOOGLE_PLAY_INSTALL_FAILED_TO_CONNECT_TO_SERVICE = 2 ; | |
31 public static final int GOOGLE_PLAY_INSTALL_FAILED_CALLER_VERIFICATION_FAILU RE = 3; | |
32 public static final int GOOGLE_PLAY_INSTALL_FAILED_POLICY_VIOLATION = 4; | |
33 public static final int GOOGLE_PLAY_INSTALL_FAILED_API_DISABLED = 5; | |
34 public static final int GOOGLE_PLAY_INSTALL_FAILED_REQUEST_FAILED = 6; | |
35 public static final int GOOGLE_PLAY_INSTALL_FAILED_DOWNLOAD_CANCELLED = 7; | |
36 public static final int GOOGLE_PLAY_INSTALL_FAILED_DOWNLOAD_ERROR = 8; | |
37 public static final int GOOGLE_PLAY_INSTALL_FAILED_INSTALL_ERROR = 9; | |
38 public static final int GOOGLE_PLAY_INSTALL_FAILED_INSTALL_TIMEOUT = 10; | |
39 public static final int GOOGLE_PLAY_INSTALL_RESULT_MAX = 11; | |
40 | |
27 public static final String HISTOGRAM_UPDATE_REQUEST_SENT = | 41 public static final String HISTOGRAM_UPDATE_REQUEST_SENT = |
28 "WebApk.Update.RequestSent"; | 42 "WebApk.Update.RequestSent"; |
29 | 43 |
30 public static final String HISTOGRAM_UPDATE_REQUEST_QUEUED = "WebApk.Update. RequestQueued"; | 44 public static final String HISTOGRAM_UPDATE_REQUEST_QUEUED = "WebApk.Update. RequestQueued"; |
31 | 45 |
46 public static final String HISTOGRAM_GOOGLE_PLAY_INSTALL_RESULT = | |
47 "WebApk.Install.GooglePlayInstallResult"; | |
48 | |
32 private static final int WEBAPK_OPEN_MAX = 3; | 49 private static final int WEBAPK_OPEN_MAX = 3; |
33 public static final int WEBAPK_OPEN_LAUNCH_SUCCESS = 0; | 50 public static final int WEBAPK_OPEN_LAUNCH_SUCCESS = 0; |
34 public static final int WEBAPK_OPEN_NO_LAUNCH_INTENT = 1; | 51 public static final int WEBAPK_OPEN_NO_LAUNCH_INTENT = 1; |
35 public static final int WEBAPK_OPEN_ACTIVITY_NOT_FOUND = 2; | 52 public static final int WEBAPK_OPEN_ACTIVITY_NOT_FOUND = 2; |
36 | 53 |
37 /** | 54 /** |
38 * Records the time point when a request to update a WebAPK is sent to the W ebAPK Server. | 55 * Records the time point when a request to update a WebAPK is sent to the W ebAPK Server. |
39 * @param type representing when the update request is sent to the WebAPK se rver. | 56 * @param type representing when the update request is sent to the WebAPK se rver. |
40 */ | 57 */ |
41 public static void recordUpdateRequestSent(int type) { | 58 public static void recordUpdateRequestSent(int type) { |
(...skipping 14 matching lines...) Expand all Loading... | |
56 | 73 |
57 /** | 74 /** |
58 * When a user presses on the "Open WebAPK" menu item, this records whether the WebAPK was | 75 * When a user presses on the "Open WebAPK" menu item, this records whether the WebAPK was |
59 * opened successfully. | 76 * opened successfully. |
60 * @param type Result of trying to open WebAPK. | 77 * @param type Result of trying to open WebAPK. |
61 */ | 78 */ |
62 public static void recordWebApkOpenAttempt(int type) { | 79 public static void recordWebApkOpenAttempt(int type) { |
63 assert type >= 0 && type < WEBAPK_OPEN_MAX; | 80 assert type >= 0 && type < WEBAPK_OPEN_MAX; |
64 RecordHistogram.recordEnumeratedHistogram("WebApk.OpenFromMenu", type, W EBAPK_OPEN_MAX); | 81 RecordHistogram.recordEnumeratedHistogram("WebApk.OpenFromMenu", type, W EBAPK_OPEN_MAX); |
65 } | 82 } |
83 | |
84 /** | |
85 * Records whether installing WebAPKs from Google Play succeeded. If not, re cords the reason of | |
86 * failures sent by Google Play. | |
pkotwicz
2017/03/21 16:59:39
Nit: "the reason of failures" -> "the failure reas
Xi Han
2017/03/21 18:43:45
Done.
| |
87 */ | |
88 public static void recordGooglePlayIntallResult(int result) { | |
89 assert result >= 0 && result < GOOGLE_PLAY_INSTALL_RESULT_MAX; | |
90 RecordHistogram.recordEnumeratedHistogram( | |
91 HISTOGRAM_GOOGLE_PLAY_INSTALL_RESULT, result, GOOGLE_PLAY_INSTAL L_RESULT_MAX); | |
pkotwicz
2017/03/21 16:59:39
Nit: You can just inline the histogram name ("WebA
Xi Han
2017/03/21 18:43:45
Done.
| |
92 } | |
66 } | 93 } |
OLD | NEW |