Bug 1490670 - Add telemetry for launching a PWA; r=sdaswani a=pascalc
authorPetru Lingurar <petru.lingurar@softvision.ro>
Fri, 14 Sep 2018 08:36:48 +0000
changeset 492534 0688aa3e1cdb54260ee8b94e97f9c91f090333cf
parent 492533 5101b8689c73f155d6f1c30d3d503f5bf7b6289a
child 492535 9f768de318d59dcc981b319d54e737470ae2b324
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssdaswani, pascalc
bugs1490670
milestone63.0
Bug 1490670 - Add telemetry for launching a PWA; r=sdaswani a=pascalc Differential Revision: https://phabricator.services.mozilla.com/D5672
mobile/android/base/java/org/mozilla/gecko/TelemetryContract.java
mobile/android/base/java/org/mozilla/gecko/webapps/WebAppActivity.java
mobile/android/docs/uitelemetry.rst
--- a/mobile/android/base/java/org/mozilla/gecko/TelemetryContract.java
+++ b/mobile/android/base/java/org/mozilla/gecko/TelemetryContract.java
@@ -102,16 +102,19 @@ public interface TelemetryContract {
         UNPIN("unpin.1"),
 
         // Stop holding a resource (reader, bookmark, etc) for viewing later.
         UNSAVE("unsave.1"),
 
         // When the user performs actions on the in-content network error page.
         NETERROR("neterror.1"),
 
+        // User actions related to a Progressive Web Application
+        PWA("pwa.1"),
+
         // VALUES BELOW THIS LINE ARE EXCLUSIVE TO TESTING.
         _TEST1("_test_event_1.1"),
         _TEST2("_test_event_2.1"),
         _TEST3("_test_event_3.1"),
         _TEST4("_test_event_4.1"),
         ;
 
         private final String string;
--- a/mobile/android/base/java/org/mozilla/gecko/webapps/WebAppActivity.java
+++ b/mobile/android/base/java/org/mozilla/gecko/webapps/WebAppActivity.java
@@ -24,16 +24,18 @@ import android.widget.Toast;
 import org.mozilla.gecko.ActivityHandlerHelper;
 import org.mozilla.gecko.AppConstants;
 import org.mozilla.gecko.BrowserApp;
 import org.mozilla.gecko.DoorHangerPopup;
 import org.mozilla.gecko.FormAssistPopup;
 import org.mozilla.gecko.GeckoApplication;
 import org.mozilla.gecko.GeckoScreenOrientation;
 import org.mozilla.gecko.R;
+import org.mozilla.gecko.Telemetry;
+import org.mozilla.gecko.TelemetryContract;
 import org.mozilla.gecko.customtabs.CustomTabsActivity;
 import org.mozilla.gecko.permissions.Permissions;
 import org.mozilla.gecko.prompts.PromptService;
 import org.mozilla.gecko.text.TextSelection;
 import org.mozilla.gecko.util.ActivityUtils;
 import org.mozilla.gecko.util.ColorUtil;
 import org.mozilla.gecko.widget.ActionModePresenter;
 import org.mozilla.geckoview.GeckoResult;
@@ -81,16 +83,18 @@ public class WebAppActivity extends AppC
             // annoying habit of never updating its stored intent after our initial creation,
             // even if we've been subsequently started with a new intent.
 
             // This below is needed if we should ever decide to store a custom class as intent extra.
             savedInstanceState.setClassLoader(getClass().getClassLoader());
 
             Intent lastLaunchIntent = savedInstanceState.getParcelable(SAVED_INTENT);
             setIntent(lastLaunchIntent);
+        } else {
+            Telemetry.sendUIEvent(TelemetryContract.Event.PWA, TelemetryContract.Method.HOMESCREEN);
         }
 
         super.onCreate(savedInstanceState);
         setContentView(R.layout.webapp_activity);
         mGeckoView = (GeckoView) findViewById(R.id.pwa_gecko_view);
 
         final GeckoSessionSettings settings = new GeckoSessionSettings();
         settings.setBoolean(GeckoSessionSettings.USE_MULTIPROCESS, false);
--- a/mobile/android/docs/uitelemetry.rst
+++ b/mobile/android/docs/uitelemetry.rst
@@ -172,16 +172,19 @@ Events
 
 ``pin.1``, ``unpin.1``
   Sent when the user pinned or unpinned a top site.
 
 ``policynotification.success.1:true``
   Sent when a user has accepted the data notification policy. Can be ``false``
   instead of ``true`` if an error occurs.
 
+``pwa.1``
+  When the user interacts with a Progressive Web Application
+
 ``sanitize.1``
   Sent when the user chooses to clear private data.
 
 ``save.1``, ``unsave.1``
   Saving or unsaving a resource (reader, bookmark, etc.) for viewing later.
 
 ``search.1``
   Sent when the user performs a search. Currently used in the search activity.