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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarDelegate.java

Issue 1915393003: [Custom Tabs] Postpone RecordAction until native libray is loaded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/metrics/LaunchMetrics.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarDelegate.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarDelegate.java
index 4a0556df9eb3c5f7c707171a000d94cb4d7c3854..f90e78630f1a38a80383f18adeef8ab967fffae5 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarDelegate.java
@@ -22,9 +22,11 @@ import android.widget.LinearLayout;
import android.widget.RemoteViews;
import org.chromium.base.Log;
+import org.chromium.base.library_loader.LibraryLoader;
import org.chromium.base.metrics.RecordUserAction;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeActivity;
+import org.chromium.chrome.browser.metrics.LaunchMetrics;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.ui.interpolators.BakedBezierInterpolator;
@@ -35,6 +37,8 @@ import java.util.List;
*/
class CustomTabBottomBarDelegate {
private static final String TAG = "CustomTab";
+ private static final String REMOTE_VIEWS_SHOWN = "CustomTabsRemoteViewsShown";
+ private static final String REMOTE_VIEWS_UPDATED = "CustomTabsRemoteViewsUpdated";
private static final int SLIDE_ANIMATION_DURATION_MS = 400;
private ChromeActivity mActivity;
private ViewGroup mBottomBarView;
@@ -66,7 +70,7 @@ class CustomTabBottomBarDelegate {
RemoteViews remoteViews = mDataProvider.getBottomBarRemoteViews();
if (remoteViews != null) {
- RecordUserAction.record("CustomTabsRemoteViewsShown");
+ new LaunchMetrics.ActionEvent(REMOTE_VIEWS_SHOWN);
mClickableIDs = mDataProvider.getClickableViewIDs();
mClickPendingIntent = mDataProvider.getRemoteViewsPendingIntent();
showRemoteViews(remoteViews);
@@ -117,8 +121,13 @@ class CustomTabBottomBarDelegate {
PendingIntent pendingIntent) {
// Update only makes sense if we are already showing a RemoteViews.
if (mDataProvider.getBottomBarRemoteViews() == null) return false;
-
- RecordUserAction.record("CustomTabsRemoteViewsUpdated");
+ // UMA requires native library to be loaded. Since we do not know when the client might call
+ // updateVisuals(), guard the UMA with checking to avoid crashes.
+ if (LibraryLoader.isInitialized()) {
+ RecordUserAction.record(REMOTE_VIEWS_UPDATED);
+ } else {
+ new LaunchMetrics.ActionEvent(REMOTE_VIEWS_UPDATED);
+ }
if (remoteViews == null) {
if (mBottomBarView == null) return false;
hideBottomBar();
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/metrics/LaunchMetrics.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698