From 9ece805213b1458ef87c4bd31c4d11c975f62035 Mon Sep 17 00:00:00 2001 From: Margaret Leibovic Date: Fri, 18 Mar 2016 19:07:18 -0400 Subject: [PATCH] Bug 1256415 - Replace FENNEC_GECKOAPP_STARTUP_ACTION histogram with UI telemetry. r=mfinkle a=ritu MozReview-Commit-ID: ElmELmp7baV --- .../java/org/mozilla/gecko/BrowserApp.java | 26 ++++++++++++------- .../base/java/org/mozilla/gecko/GeckoApp.java | 19 +++----------- toolkit/components/telemetry/Histograms.json | 7 ----- 3 files changed, 19 insertions(+), 33 deletions(-) diff --git a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java index b9a20a6c047..e8eafd9ec09 100644 --- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java @@ -4123,17 +4123,23 @@ public class BrowserApp extends GeckoApp } @Override - protected StartupAction getStartupAction(final String passedURL, final String action) { - final boolean inGuestMode = GeckoProfile.get(this).inGuestMode(); - if (inGuestMode) { - return StartupAction.GUEST; - } - if (Restrictions.isRestrictedProfile(this)) { - return StartupAction.RESTRICTED; - } + protected void recordStartupActionTelemetry(final String passedURL, final String action) { + final TelemetryContract.Method method; if (ACTION_HOMESCREEN_SHORTCUT.equals(action)) { - return StartupAction.SHORTCUT; + // This action is also recorded via "loadurl.1" > "homescreen". + method = TelemetryContract.Method.HOMESCREEN; + } else if (passedURL == null) { + Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH, TelemetryContract.Method.HOMESCREEN, "launcher"); + method = TelemetryContract.Method.HOMESCREEN; + } else { + // This is action is also recorded via "loadurl.1" > "intent". + method = TelemetryContract.Method.INTENT; + } + + if (GeckoProfile.get(this).inGuestMode()) { + Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH, method, "guest"); + } else if (Restrictions.isRestrictedProfile(this)) { + Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH, method, "restricted"); } - return (passedURL == null ? StartupAction.NORMAL : StartupAction.URL); } } diff --git a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java index 3eefac3f796..87732f0557a 100644 --- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java @@ -138,15 +138,6 @@ public abstract class GeckoApp private static final String LOGTAG = "GeckoApp"; private static final int ONE_DAY_MS = 1000*60*60*24; - public enum StartupAction { - NORMAL, /* normal application start */ - URL, /* launched with a passed URL */ - PREFETCH, /* launched with a passed URL that we prefetch */ - GUEST, /* launched in guest browsing */ - RESTRICTED, /* launched with restricted profile */ - SHORTCUT /* launched from a homescreen shortcut */ - } - public static final String ACTION_ALERT_CALLBACK = "org.mozilla.gecko.ACTION_ALERT_CALLBACK"; public static final String ACTION_HOMESCREEN_SHORTCUT = "org.mozilla.gecko.BOOKMARK"; public static final String ACTION_DEBUG = "org.mozilla.gecko.DEBUG"; @@ -1585,8 +1576,7 @@ public abstract class GeckoApp getProfile().moveSessionFile(); } - final StartupAction startupAction = getStartupAction(passedUri, action); - Telemetry.addToHistogram("FENNEC_GECKOAPP_STARTUP_ACTION", startupAction.ordinal()); + recordStartupActionTelemetry(passedUri, action); // Check if launched from data reporting notification. if (ACTION_LAUNCH_SETTINGS.equals(action)) { @@ -1939,8 +1929,7 @@ public abstract class GeckoApp startActivity(settingsIntent); } - final StartupAction startupAction = getStartupAction(passedUri, action); - Telemetry.addToHistogram("FENNEC_GECKOAPP_STARTUP_ACTION", startupAction.ordinal()); + recordStartupActionTelemetry(passedUri, action); } /** @@ -2754,8 +2743,6 @@ public abstract class GeckoApp return new StubbedHealthRecorder(); } - protected StartupAction getStartupAction(final String passedURL, final String action) { - // Default to NORMAL here. Subclasses can handle the other types. - return StartupAction.NORMAL; + protected void recordStartupActionTelemetry(final String passedURL, final String action) { } } diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 80e2ad4b35e..b40f7e7486b 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -5184,13 +5184,6 @@ "description": "Time for a URL bar DB search to return (ms)", "cpp_guard": "ANDROID" }, - "FENNEC_GECKOAPP_STARTUP_ACTION": { - "expires_in_version": "never", - "kind": "enumerated", - "n_values": 10, - "description": "The way the GeckoApp was launched. (Normal, URL, Prefetch, WebApp, Guest, Restricted, Shortcut)", - "cpp_guard": "ANDROID" - }, "FENNEC_RESTRICTED_PROFILE_RESTRICTIONS": { "expires_in_version": "50", "kind": "enumerated",