Bug 1320730 - Send different panelID for topsites when AS is enabled r?sebastian
For homepanels we usually send a long ID string (see the list in HomeConfig). We
reuse the topsites panel to render ActivityStream, so topsites and AS have the
same panel ID. It seems simplest to just override the session name when showing
AS.
MozReview-Commit-ID: JqyyqY77Eo3
--- a/mobile/android/base/java/org/mozilla/gecko/home/HomeConfig.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/HomeConfig.java
@@ -1598,17 +1598,17 @@ public final class HomeConfig {
}
// UUIDs used to create PanelConfigs for default built-in panels. These are
// public because they can be used in "about:home?panel=UUID" query strings
// to open specific panels without querying the active Home Panel
// configuration. Because they don't consider the active configuration, it
// is only sensible to do this for built-in panels (and not for dynamic
// panels).
- private static final String TOP_SITES_PANEL_ID = "4becc86b-41eb-429a-a042-88fe8b5a094e";
+ /* package-private */ static final String TOP_SITES_PANEL_ID = "4becc86b-41eb-429a-a042-88fe8b5a094e";
private static final String BOOKMARKS_PANEL_ID = "7f6d419a-cd6c-4e34-b26f-f68b1b551907";
private static final String HISTORY_PANEL_ID = "f134bf20-11f7-4867-ab8b-e8e705d7fbe8";
private static final String COMBINED_HISTORY_PANEL_ID = "4d716ce2-e063-486d-9e7c-b190d7b04dc6";
private static final String RECENT_TABS_PANEL_ID = "5c2601a5-eedc-4477-b297-ce4cef52adf8";
private static final String REMOTE_TABS_PANEL_ID = "72429afd-8d8b-43d8-9189-14b779c563d0";
private static final String DEPRECATED_READING_LIST_PANEL_ID = "20f4549a-64ad-4c32-93e4-1dcef792733b";
private final HomeConfigBackend mBackend;
--- a/mobile/android/base/java/org/mozilla/gecko/home/HomePager.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/HomePager.java
@@ -8,16 +8,17 @@ package org.mozilla.gecko.home;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import org.mozilla.gecko.AppConstants.Versions;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
+import org.mozilla.gecko.activitystream.ActivityStream;
import org.mozilla.gecko.animation.PropertyAnimator;
import org.mozilla.gecko.animation.ViewHelper;
import org.mozilla.gecko.home.HomeAdapter.OnAddPanelListener;
import org.mozilla.gecko.home.HomeConfig.PanelConfig;
import org.mozilla.gecko.util.ThreadUtils;
import android.content.Context;
import android.graphics.Rect;
@@ -554,17 +555,27 @@ public class HomePager extends ViewPager
*
* @param panelId of panel to start a session for
*/
private void startNewPanelTelemetrySession(String panelId) {
// Stop the current panel's session if we have one.
stopCurrentPanelTelemetrySession();
mCurrentPanelSession = TelemetryContract.Session.HOME_PANEL;
- mCurrentPanelSessionSuffix = panelId;
+
+ if (HomeConfig.TOP_SITES_PANEL_ID.equals(panelId) &&
+ ActivityStream.isEnabled(getContext())) {
+ // Override the panel ID for Activity Stream: we're reusing the topsites panel to show
+ // Activity Stream, i.e. AS ends up havin the same panel ID. We override this for telemetry
+ // to distinguish between topsites and AS:
+ mCurrentPanelSessionSuffix = "activity_stream";
+ } else {
+ mCurrentPanelSessionSuffix = panelId;
+ }
+
Telemetry.startUISession(mCurrentPanelSession, mCurrentPanelSessionSuffix);
}
/**
* Stop the current panel telemetry session if one exists.
*/
private void stopCurrentPanelTelemetrySession() {
if (mCurrentPanelSession != null) {