Bug 1057613 - Telemetry for search widget buttons. r=margaret

This commit is contained in:
Tristan Pollitt 2014-09-03 22:10:17 +01:00
parent fccbef4359
commit 2c04333cc7
2 changed files with 11 additions and 0 deletions

View File

@ -168,6 +168,9 @@ public interface TelemetryContract {
// Note: Only used in JavaScript for now, but here for completeness.
TOAST("toast"),
// Action triggerred by pressing a SearchWidget button
WIDGET("widget"),
// VALUES BELOW THIS LINE ARE EXCLUSIVE TO TESTING.
_TEST1("_test_method_1"),
_TEST2("_test_method_2"),

View File

@ -6,6 +6,8 @@
package org.mozilla.search;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import android.annotation.SuppressLint;
import android.app.PendingIntent;
@ -67,16 +69,22 @@ public class SearchWidget extends AppWidgetProvider {
AppConstants.ANDROID_PACKAGE_NAME,
AppConstants.BROWSER_INTENT_CLASS_NAME,
intent);
Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH,
TelemetryContract.Method.WIDGET, "browser");
} else if (intent.getAction().equals(ACTION_LAUNCH_NEW_TAB)) {
redirect = buildRedirectIntent(Intent.ACTION_VIEW,
AppConstants.ANDROID_PACKAGE_NAME,
AppConstants.BROWSER_INTENT_CLASS_NAME,
intent);
Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH,
TelemetryContract.Method.WIDGET, "new-tab");
} else if (intent.getAction().equals(ACTION_LAUNCH_SEARCH)) {
redirect = buildRedirectIntent(Intent.ACTION_VIEW,
AppConstants.SEARCH_PACKAGE_NAME,
AppConstants.SEARCH_INTENT_CLASS_NAME,
intent);
Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH,
TelemetryContract.Method.WIDGET, "search");
} else {
redirect = null;
}