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 |
32 private static final int WEBAPK_OPEN_MAX = 3; | 46 private static final int WEBAPK_OPEN_MAX = 3; |
33 public static final int WEBAPK_OPEN_LAUNCH_SUCCESS = 0; | 47 public static final int WEBAPK_OPEN_LAUNCH_SUCCESS = 0; |
34 public static final int WEBAPK_OPEN_NO_LAUNCH_INTENT = 1; | 48 public static final int WEBAPK_OPEN_NO_LAUNCH_INTENT = 1; |
35 public static final int WEBAPK_OPEN_ACTIVITY_NOT_FOUND = 2; | 49 public static final int WEBAPK_OPEN_ACTIVITY_NOT_FOUND = 2; |
36 | 50 |
(...skipping 19 matching lines...) Expand all Loading... |
56 | 70 |
57 /** | 71 /** |
58 * When a user presses on the "Open WebAPK" menu item, this records whether
the WebAPK was | 72 * When a user presses on the "Open WebAPK" menu item, this records whether
the WebAPK was |
59 * opened successfully. | 73 * opened successfully. |
60 * @param type Result of trying to open WebAPK. | 74 * @param type Result of trying to open WebAPK. |
61 */ | 75 */ |
62 public static void recordWebApkOpenAttempt(int type) { | 76 public static void recordWebApkOpenAttempt(int type) { |
63 assert type >= 0 && type < WEBAPK_OPEN_MAX; | 77 assert type >= 0 && type < WEBAPK_OPEN_MAX; |
64 RecordHistogram.recordEnumeratedHistogram("WebApk.OpenFromMenu", type, W
EBAPK_OPEN_MAX); | 78 RecordHistogram.recordEnumeratedHistogram("WebApk.OpenFromMenu", type, W
EBAPK_OPEN_MAX); |
65 } | 79 } |
| 80 |
| 81 /** |
| 82 * Records whether installing a WebAPK from Google Play succeeded. If not, r
ecords the reason |
| 83 * that the install failed. |
| 84 */ |
| 85 public static void recordGooglePlayInstallResult(int result) { |
| 86 assert result >= 0 && result < GOOGLE_PLAY_INSTALL_RESULT_MAX; |
| 87 RecordHistogram.recordEnumeratedHistogram( |
| 88 "WebApk.Install.GooglePlayInstallResult", result, GOOGLE_PLAY_IN
STALL_RESULT_MAX); |
| 89 } |
66 } | 90 } |
OLD | NEW |