Bug 1245497 - (Part 1) Update FENNEC_GECKOAPP_STARTUP_ACTION to measure homescreen shortcut launches. r=mcomella
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -3950,19 +3950,22 @@ public class BrowserApp extends GeckoApp
sharedPrefs.edit().putInt(TelemetryConstants.PREF_SEQ_COUNT, seq + 1).apply();
}
public static interface Refreshable {
public void refresh();
}
@Override
- protected StartupAction getStartupAction(final String passedURL) {
+ 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;
}
+ 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
@@ -135,23 +135,24 @@ 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 static enum StartupAction {
+ public enum StartupAction {
NORMAL, /* normal application start */
URL, /* launched with a passed URL */
PREFETCH, /* launched with a passed URL that we prefetch */
WEBAPP, /* launched as a webapp runtime */
GUEST, /* launched in guest browsing */
- RESTRICTED /* launched with restricted profile */
+ 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";
@@ -1583,17 +1584,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);
+ final StartupAction startupAction = getStartupAction(passedUri, action);
Telemetry.addToHistogram("FENNEC_GECKOAPP_STARTUP_ACTION", startupAction.ordinal());
// 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);
@@ -2789,13 +2790,13 @@ 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) {
+ protected StartupAction getStartupAction(final String passedURL, final String action) {
// Default to NORMAL here. Subclasses can handle the other types.
return StartupAction.NORMAL;
}
}
--- a/mobile/android/base/java/org/mozilla/gecko/webapp/WebappImpl.java
+++ b/mobile/android/base/java/org/mozilla/gecko/webapp/WebappImpl.java
@@ -402,12 +402,12 @@ public class WebappImpl extends GeckoApp
}
// This is a legacy shortcut, which didn't provide a way to determine
// that the app is debuggable, so we say the app is not debuggable.
return false;
}
@Override
- protected StartupAction getStartupAction(final String passedURL) {
+ protected StartupAction getStartupAction(final String passedURL, final String action) {
return StartupAction.WEBAPP;
}
}
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -5112,17 +5112,17 @@
"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)",
+ "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,