Bug 1380854 - Track Sign in and sync finished events in LP.r=petru
authorVlad Baicu <vlad.baicu@softvision.ro>
Fri, 08 Mar 2019 13:49:09 +0000
changeset 521043 1d82c648684d
parent 521042 8413368a95eb
child 521044 817410ffd7f2
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspetru
bugs1380854
milestone67.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 1380854 - Track Sign in and sync finished events in LP.r=petru Differential Revision: https://phabricator.services.mozilla.com/D22703
mobile/android/base/java/org/mozilla/gecko/AccountsHelper.java
mobile/android/base/java/org/mozilla/gecko/mma/MmaDelegate.java
mobile/android/docs/mma.rst
mobile/android/services/src/main/java/org/mozilla/gecko/fxa/sync/FxAccountSyncStatusHelper.java
--- a/mobile/android/base/java/org/mozilla/gecko/AccountsHelper.java
+++ b/mobile/android/base/java/org/mozilla/gecko/AccountsHelper.java
@@ -17,16 +17,17 @@ import android.util.Log;
 
 import org.json.JSONException;
 import org.mozilla.gecko.background.fxa.FxAccountUtils;
 import org.mozilla.gecko.fxa.FirefoxAccounts;
 import org.mozilla.gecko.fxa.FxAccountConstants;
 import org.mozilla.gecko.fxa.authenticator.AndroidFxAccount;
 import org.mozilla.gecko.fxa.login.Engaged;
 import org.mozilla.gecko.fxa.login.State;
+import org.mozilla.gecko.mma.MmaDelegate;
 import org.mozilla.gecko.restrictions.Restrictable;
 import org.mozilla.gecko.restrictions.Restrictions;
 import org.mozilla.gecko.sync.SyncConfiguration;
 import org.mozilla.gecko.sync.Utils;
 import org.mozilla.gecko.util.BundleEventListener;
 import org.mozilla.gecko.util.EventCallback;
 import org.mozilla.gecko.util.GeckoBundle;
 import org.mozilla.gecko.util.ThreadUtils;
@@ -140,16 +141,19 @@ public class AccountsHelper implements B
                      UnsupportedEncodingException e) {
                 Log.w(LOGTAG, "Got exception creating Firefox Account from JSON; ignoring.", e);
                 if (callback != null) {
                     callback.sendError("Could not create Firefox Account from JSON: " +
                                        e.toString());
                     return;
                 }
             }
+
+            MmaDelegate.track(MmaDelegate.USER_SIGNED_IN_TO_FXA);
+
             if (callback != null) {
                 callback.sendSuccess(fxAccount != null);
             }
 
         } else if ("Accounts:UpdateFirefoxAccountFromJSON".equals(event)) {
             final Account account = FirefoxAccounts.getFirefoxAccount(mContext);
             if (account == null) {
                 if (callback != null) {
@@ -195,16 +199,18 @@ public class AccountsHelper implements B
             fxAccount.updateFirstRunScope(mContext);
             // This will force a device registration later.
             fxAccount.resetDeviceRegistrationVersion();
             fxAccount.setDeviceRegistrationTimestamp(0L);
             // Trigger a sync to try to update the device registration and
             // upload a fresh client record.
             fxAccount.requestImmediateSync(null, null, false);
 
+            MmaDelegate.track(MmaDelegate.USER_SIGNED_IN_TO_FXA);
+
             if (callback != null) {
                 callback.sendSuccess(true);
             }
 
         } else if ("Accounts:Create".equals(event)) {
             // Do exactly the same thing as if you tapped 'Sync' in Settings.
             final Intent intent = new Intent(FxAccountConstants.ACTION_FXA_GET_STARTED);
             intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
--- a/mobile/android/base/java/org/mozilla/gecko/mma/MmaDelegate.java
+++ b/mobile/android/base/java/org/mozilla/gecko/mma/MmaDelegate.java
@@ -48,16 +48,19 @@ public class MmaDelegate {
     public static final String SCREENSHOT = "E_Screenshot";
     public static final String SAVED_LOGIN_AND_PASSWORD = "E_Saved_Login_And_Password";
     public static final String RESUMED_FROM_BACKGROUND = "E_Resumed_From_Background";
     public static final String NEW_TAB = "E_Opened_New_Tab";
     public static final String DISMISS_ONBOARDING = "E_Dismiss_Onboarding";
     public static final String ONBOARDING_DEFAULT_VALUES = "E_Onboarding_With_Default_Values";
     public static final String ONBOARDING_REMOTE_VALUES = "E_Onboarding_With_Remote_Values";
 
+    public static final String USER_SIGNED_IN_TO_FXA = "E_User_Signed_In_To_FxA";
+    public static final String USER_FINISHED_SYNC = "E_User_Finished_Sync";
+
     private static final String LAUNCH_BUT_NOT_DEFAULT_BROWSER = "E_Launch_But_Not_Default_Browser";
     private static final String LAUNCH_BROWSER = "E_Launch_Browser";
     private static final String CHANGED_DEFAULT_TO_FENNEC = "E_Changed_Default_To_Fennec";
     private static final String INSTALLED_FOCUS = "E_Just_Installed_Focus";
     private static final String INSTALLED_KLAR = "E_Just_Installed_Klar";
 
     private static final String USER_ATT_FOCUS_INSTALLED = "Focus Installed";
     private static final String USER_ATT_KLAR_INSTALLED = "Klar Installed";
--- a/mobile/android/docs/mma.rst
+++ b/mobile/android/docs/mma.rst
@@ -151,16 +151,24 @@ List of current Events related data that
 * General app start event
 {
   "event" : "E_Launch_Browser"
 }
 * The user just dismissed on-boarding
 {
   "event" : "E_Dismiss_Onboarding"
 }
+* Sign in Firefox Account
+{
+  "event" : "E_User_Signed_In_To_FxA"
+}
+* Firefox Sync finished event
+{
+  "event" : "E_User_Finished_Sync"
+}
 * The user just resumed the app from background
 {
   "event" : "E_Resumed_From_Background"
 }
 * User set Fennec as default browser and resumed the app
 {
   "event" : "E_Changed_Default_To_Fennec"
 }
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/sync/FxAccountSyncStatusHelper.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/sync/FxAccountSyncStatusHelper.java
@@ -5,16 +5,17 @@
 package org.mozilla.gecko.fxa.sync;
 
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.WeakHashMap;
 
 import org.mozilla.gecko.fxa.SyncStatusListener;
 import org.mozilla.gecko.fxa.authenticator.AndroidFxAccount;
+import org.mozilla.gecko.mma.MmaDelegate;
 import org.mozilla.gecko.util.ThreadUtils;
 
 import android.content.ContentResolver;
 import android.content.SyncStatusObserver;
 
 /**
  * Abstract away some details of Android's SyncStatusObserver.
  * <p>
@@ -62,16 +63,17 @@ public class FxAccountSyncStatusHelper i
       }
 
       if (!active && wasActiveLastTime) {
         // We've finished a sync.
         ThreadUtils.postToUiThread(new Runnable() {
           @Override
           public void run() {
             delegate.onSyncFinished();
+            MmaDelegate.track(MmaDelegate.USER_FINISHED_SYNC);
           }
         });
       }
     }
   }
 
   protected void addListener() {
     final int mask = ContentResolver.SYNC_OBSERVER_TYPE_ACTIVE;