Bug 1383762 - Change the event timing for adding a new normal tab. r=maliu
authorcnevinc <cnevinc@livemail.tw>
Wed, 26 Jul 2017 00:30:22 +0800
changeset 370963 0f58f3281582
parent 370962 674770e65a4f
child 370964 ffda123f3679
push id32236
push usercbook@mozilla.com
push date2017-07-26 09:02 +0000
treeherdermozilla-central@4f821dab4306 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmaliu
bugs1383762
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1383762 - Change the event timing for adding a new normal tab. r=maliu MozReview-Commit-ID: Lyf7yeTFpzq
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
mobile/android/base/java/org/mozilla/gecko/Tabs.java
mobile/android/base/java/org/mozilla/gecko/tabs/TabStrip.java
mobile/android/base/java/org/mozilla/gecko/tabs/TabsPanel.java
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -176,17 +176,16 @@ import java.util.Arrays;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Locale;
 import java.util.regex.Pattern;
 
-import static org.mozilla.gecko.mma.MmaDelegate.NEW_TAB;
 public class BrowserApp extends GeckoApp
                         implements ActionModePresenter,
                                    AnchoredPopup.OnVisibilityChangeListener,
                                    BookmarkEditFragment.Callbacks,
                                    BrowserSearch.OnEditSuggestionListener,
                                    BrowserSearch.OnSearchListener,
                                    DynamicToolbarAnimator.MetricsListener,
                                    DynamicToolbarAnimator.ToolbarChromeProxy,
@@ -3714,20 +3713,18 @@ public class BrowserApp extends GeckoApp
         final int itemId = item.getItemId();
 
         // Track the menu action. We don't know much about the context, but we can use this to determine
         // the frequency of use for various actions.
         String extras = getResources().getResourceEntryName(itemId);
         if (TextUtils.equals(extras, "new_private_tab")) {
             // Mask private browsing
             extras = "new_tab";
-        } else {
-            // We only track opening normal tab
-            MmaDelegate.track(NEW_TAB);
         }
+
         Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.MENU, extras);
 
         mBrowserToolbar.cancelEdit();
 
         if (itemId == R.id.bookmark) {
             tab = Tabs.getInstance().getSelectedTab();
             if (tab != null) {
                 final String extra;
--- a/mobile/android/base/java/org/mozilla/gecko/Tabs.java
+++ b/mobile/android/base/java/org/mozilla/gecko/Tabs.java
@@ -46,16 +46,18 @@ import android.net.Uri;
 import android.os.Handler;
 import android.os.SystemClock;
 import android.provider.Browser;
 import android.support.annotation.UiThread;
 import android.support.v4.content.ContextCompat;
 import android.text.TextUtils;
 import android.util.Log;
 
+import static org.mozilla.gecko.mma.MmaDelegate.NEW_TAB;
+
 
 public class Tabs implements BundleEventListener {
     private static final String LOGTAG = "GeckoTabs";
 
     public static final String INTENT_EXTRA_TAB_ID = "TabId";
     public static final String INTENT_EXTRA_SESSION_UUID = "SessionUUID";
     private static final String PRIVATE_TAB_INTENT_EXTRA = "private_tab";
 
@@ -1045,16 +1047,17 @@ public class Tabs implements BundleEvent
         return tabToSelect;
     }
 
     /**
      * Opens a new tab and loads either about:home or, if PREFS_HOMEPAGE_FOR_EVERY_NEW_TAB is set,
      * the user's homepage.
      */
     public Tab addTab() {
+        MmaDelegate.track(NEW_TAB);
         return loadUrl(getHomepageForNewTab(mAppContext), Tabs.LOADURL_NEW_TAB);
     }
 
     public Tab addPrivateTab() {
         if (SkinConfig.isPhoton()) {
             return loadUrl(getHomepageForNewTab(mAppContext), Tabs.LOADURL_NEW_TAB | Tabs.LOADURL_PRIVATE);
         } else {
             return loadUrl(AboutPages.PRIVATEBROWSING, Tabs.LOADURL_NEW_TAB | Tabs.LOADURL_PRIVATE);
--- a/mobile/android/base/java/org/mozilla/gecko/tabs/TabStrip.java
+++ b/mobile/android/base/java/org/mozilla/gecko/tabs/TabStrip.java
@@ -16,21 +16,19 @@ import android.view.LayoutInflater;
 import android.view.TouchDelegate;
 import android.view.View;
 import android.view.ViewTreeObserver;
 
 import org.mozilla.gecko.BrowserApp.TabStripInterface;
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.Tab;
 import org.mozilla.gecko.Tabs;
-import org.mozilla.gecko.mma.MmaDelegate;
 import org.mozilla.gecko.widget.themed.ThemedImageButton;
 import org.mozilla.gecko.widget.themed.ThemedLinearLayout;
 
-import static org.mozilla.gecko.mma.MmaDelegate.NEW_TAB;
 
 public class TabStrip extends ThemedLinearLayout
                       implements TabStripInterface {
     private static final String LOGTAG = "GeckoTabStrip";
 
     private final TabStripView tabStripView;
     private final ThemedImageButton addTabButton;
 
@@ -56,17 +54,16 @@ public class TabStrip extends ThemedLine
         addTabButton.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 final Tabs tabs = Tabs.getInstance();
                 if (isPrivateMode()) {
                     tabs.addPrivateTab();
                 } else {
                     tabs.addTab();
-                    MmaDelegate.track(NEW_TAB);
                 }
             }
         });
 
         getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
                 @Override
                 public boolean onPreDraw() {
                     getViewTreeObserver().removeOnPreDrawListener(this);
--- a/mobile/android/base/java/org/mozilla/gecko/tabs/TabsPanel.java
+++ b/mobile/android/base/java/org/mozilla/gecko/tabs/TabsPanel.java
@@ -44,18 +44,16 @@ import android.widget.FrameLayout;
 import android.widget.ImageButton;
 import android.widget.LinearLayout;
 import android.widget.RelativeLayout;
 
 import org.mozilla.gecko.switchboard.SwitchBoard;
 
 import org.mozilla.gecko.widget.themed.ThemedImageButton;
 
-import static org.mozilla.gecko.mma.MmaDelegate.NEW_TAB;
-
 public class TabsPanel extends LinearLayout
                        implements GeckoPopupMenu.OnMenuItemClickListener,
                                   LightweightTheme.OnChangeListener,
                                   IconTabWidget.OnTabChangedListener,
                                   SharedPreferences.OnSharedPreferenceChangeListener {
     private static final String LOGTAG = "Gecko" + TabsPanel.class.getSimpleName();
 
     public enum Panel {
@@ -209,18 +207,16 @@ public class TabsPanel extends LinearLay
         mPopupMenu.show();
     }
 
     private void addTab() {
         Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.ACTIONBAR, "new_tab");
 
         if (mCurrentPanel == Panel.NORMAL_TABS) {
             mActivity.addTab();
-            // We only track opening normal tab
-            MmaDelegate.track(NEW_TAB);
         } else {
             mActivity.addPrivateTab();
         }
 
         mActivity.autoHideTabs();
     }
 
     @Override