Bug 813677 - Only send about:home telemetry pings when showing about:home. r=mfinkle

This commit is contained in:
Wes Johnston 2012-11-26 14:57:11 -08:00
parent 6cb2fce1f0
commit a200a3bb38
3 changed files with 12 additions and 7 deletions

View File

@ -58,6 +58,7 @@ abstract public class BrowserApp extends GeckoApp
public static BrowserToolbar mBrowserToolbar;
private AboutHomeContent mAboutHomeContent;
private Boolean mAboutHomeShowing = null;
protected Telemetry.Timer mAboutHomeStartupTimer = null;
private static final int ADDON_MENU_OFFSET = 1000;
private class MenuItemInfo {
@ -202,6 +203,8 @@ abstract public class BrowserApp extends GeckoApp
@Override
public void onCreate(Bundle savedInstanceState) {
mAboutHomeStartupTimer = new Telemetry.Timer("FENNEC_STARTUP_TIME_ABOUTHOME");
super.onCreate(savedInstanceState);
LinearLayout actionBar = (LinearLayout) getActionBarLayout();
@ -271,10 +274,12 @@ abstract public class BrowserApp extends GeckoApp
Tab tab = Tabs.getInstance().loadUrl("about:home", Tabs.LOADURL_NEW_TAB);
} else {
hideAboutHome();
mAboutHomeStartupTimer.cancel();
}
} else {
int flags = Tabs.LOADURL_NEW_TAB | Tabs.LOADURL_USER_ENTERED;
Tabs.getInstance().loadUrl(uri, flags);
mAboutHomeStartupTimer.cancel();
}
}
@ -670,9 +675,9 @@ abstract public class BrowserApp extends GeckoApp
}
});
mAboutHomeContent.setLoadCompleteCallback(new AboutHomeContent.VoidCallback() {
public void callback() {
mAboutHomeStartupTimer.stop();
}
public void callback() {
mAboutHomeStartupTimer.stop();
}
});
} else {
mAboutHomeContent.update(EnumSet.of(AboutHomeContent.UpdateFlags.TOP_SITES,

View File

@ -190,7 +190,6 @@ abstract public class GeckoApp
protected int mRestoreMode = RESTORE_NONE;
protected boolean mInitialized = false;
protected Telemetry.Timer mAboutHomeStartupTimer;
private Telemetry.Timer mJavaUiStartupTimer;
private Telemetry.Timer mGeckoReadyStartupTimer;
@ -1470,7 +1469,6 @@ abstract public class GeckoApp
// The clock starts...now. Better hurry!
mJavaUiStartupTimer = new Telemetry.Timer("FENNEC_STARTUP_TIME_JAVAUI");
mAboutHomeStartupTimer = new Telemetry.Timer("FENNEC_STARTUP_TIME_ABOUTHOME");
mGeckoReadyStartupTimer = new Telemetry.Timer("FENNEC_STARTUP_TIME_GECKOREADY");
((GeckoApplication)getApplication()).initialize();

View File

@ -27,8 +27,6 @@ public class Telemetry {
GeckoEvent event =
GeckoEvent.createBroadcastEvent("Telemetry:Add", jsonData.toString());
GeckoAppShell.sendEventToGecko(event);
Log.v(LOGTAG, "Sending telemetry: " + jsonData.toString());
} catch (JSONException e) {
Log.e(LOGTAG, "JSON exception: ", e);
}
@ -45,6 +43,10 @@ public class Telemetry {
mHasFinished = false;
}
public void cancel() {
mHasFinished = true;
}
public void stop() {
// Only the first stop counts.
if (mHasFinished) {