Bug 1256415 - Replace FENNEC_GECKOAPP_STARTUP_ACTION histogram with UI telemetry. r=mfinkle
MozReview-Commit-ID: ElmELmp7baV
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -4086,22 +4086,28 @@ public class BrowserApp extends GeckoApp
public void refresh();
void setOnTabChangedListener(OnTabAddedOrRemovedListener listener);
interface OnTabAddedOrRemovedListener {
void onTabChanged();
}
}
@Override
- protected StartupAction getStartupAction(final String passedURL, final String action) {
- final boolean inGuestMode = GeckoProfile.get(this).inGuestMode();
- if (inGuestMode) {
- return StartupAction.GUEST;
+ protected void recordStartupActionTelemetry(final String passedURL, final String action) {
+ final TelemetryContract.Method method;
+ if (ACTION_HOMESCREEN_SHORTCUT.equals(action)) {
+ // 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 (Restrictions.isRestrictedProfile(this)) {
- return StartupAction.RESTRICTED;
+
+ if (GeckoProfile.get(this).inGuestMode()) {
+ Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH, method, "guest");
+ } else if (Restrictions.isRestrictedProfile(this)) {
+ Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH, method, "restricted");
}
- if (ACTION_HOMESCREEN_SHORTCUT.equals(action)) {
- return StartupAction.SHORTCUT;
- }
- return (passedURL == null ? StartupAction.NORMAL : StartupAction.URL);
}
}
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -133,25 +133,16 @@ public abstract class GeckoApp
NativeEventListener,
SensorEventListener,
Tabs.OnTabsChangedListener,
ViewTreeObserver.OnGlobalLayoutListener {
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";
public static final String ACTION_LAUNCH_SETTINGS = "org.mozilla.gecko.SETTINGS";
public static final String ACTION_LOAD = "org.mozilla.gecko.LOAD";
public static final String ACTION_INIT_PW = "org.mozilla.gecko.INIT_PW";
public static final String EXTRA_STATE_BUNDLE = "stateBundle";
@@ -1529,18 +1520,17 @@ public abstract class GeckoApp
}
// If we're not restoring, move the session file so it can be read for
// the last tabs section.
if (!mShouldRestore) {
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)) {
Intent settingsIntent = new Intent(GeckoApp.this, GeckoPreferences.class);
// Copy extras.
settingsIntent.putExtras(intent.getUnsafe());
startActivity(settingsIntent);
}
@@ -1877,18 +1867,17 @@ public abstract class GeckoApp
} else if (ACTION_LAUNCH_SETTINGS.equals(action)) {
// Check if launched from data reporting notification.
Intent settingsIntent = new Intent(GeckoApp.this, GeckoPreferences.class);
// Copy extras.
settingsIntent.putExtras(intent.getUnsafe());
startActivity(settingsIntent);
}
- final StartupAction startupAction = getStartupAction(passedUri, action);
- Telemetry.addToHistogram("FENNEC_GECKOAPP_STARTUP_ACTION", startupAction.ordinal());
+ recordStartupActionTelemetry(passedUri, action);
}
/**
* Handles getting a URI from an intent in a way that is backwards-
* compatible with our previous implementations.
*/
protected String getURIFromIntent(SafeIntent intent) {
final String action = intent.getAction();
@@ -2692,13 +2681,11 @@ public abstract class GeckoApp
final EventDispatcher dispatcher,
final String osLocale,
final String appLocale,
final SessionInformation previousSession) {
// GeckoApp does not need to record any health information - return a stub.
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) {
}
}
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -5222,23 +5222,16 @@
"expires_in_version": "never",
"kind": "exponential",
"low": 10,
"high": 20000,
"n_buckets": 20,
"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",
"n_values": 30,
"description": "Whether various restrictions are set, keyed by restiction name",
"keyed": true,
"bug_numbers": [1218942],
"alert_emails": ["mobile-frontend@mozilla.com"]