Bug 1261830 - Content notifications: Stamp telemetry events with experiment session. r=margaret

MozReview-Commit-ID: 8Nsdfbe6x74

--HG--
extra : rebase_source : d59f567531b3abc873a2ef519785a1970bb2a19d
This commit is contained in:
Sebastian Kaspari 2016-04-11 11:25:39 +02:00
Родитель 745278c09a
Коммит 4690264be5
6 изменённых файлов: 29 добавлений и 0 удалений

Просмотреть файл

@ -3720,8 +3720,12 @@ public class BrowserApp extends GeckoApp
// Launched from a "content notification" // Launched from a "content notification"
if (intent.hasExtra(CheckForUpdatesAction.EXTRA_CONTENT_NOTIFICATION)) { if (intent.hasExtra(CheckForUpdatesAction.EXTRA_CONTENT_NOTIFICATION)) {
Telemetry.startUISession(TelemetryContract.Session.EXPERIMENT, FeedService.getEnabledExperiment(this));
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.NOTIFICATION, "content_update"); Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.NOTIFICATION, "content_update");
Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.INTENT, "content_update"); Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.INTENT, "content_update");
Telemetry.stopUISession(TelemetryContract.Session.EXPERIMENT, FeedService.getEnabledExperiment(this));
} }
} }

Просмотреть файл

@ -148,6 +148,20 @@ public class FeedService extends IntentService {
SwitchBoard.isInExperiment(context, Experiments.CONTENT_NOTIFICATIONS_8AM); SwitchBoard.isInExperiment(context, Experiments.CONTENT_NOTIFICATIONS_8AM);
} }
public static String getEnabledExperiment(Context context) {
String experiment = null;
if (SwitchBoard.isInExperiment(context, Experiments.CONTENT_NOTIFICATIONS_12HRS)) {
experiment = Experiments.CONTENT_NOTIFICATIONS_12HRS;
} else if (SwitchBoard.isInExperiment(context, Experiments.CONTENT_NOTIFICATIONS_8AM)) {
experiment = Experiments.CONTENT_NOTIFICATIONS_8AM;
} else if (SwitchBoard.isInExperiment(context, Experiments.CONTENT_NOTIFICATIONS_5PM)) {
experiment = Experiments.CONTENT_NOTIFICATIONS_5PM;
}
return experiment;
}
private boolean isPreferenceEnabled() { private boolean isPreferenceEnabled() {
return GeckoSharedPrefs.forApp(this).getBoolean(GeckoPreferences.PREFS_NOTIFICATIONS_CONTENT, true); return GeckoSharedPrefs.forApp(this).getBoolean(GeckoPreferences.PREFS_NOTIFICATIONS_CONTENT, true);
} }

Просмотреть файл

@ -28,6 +28,7 @@ import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.db.BrowserDB; import org.mozilla.gecko.db.BrowserDB;
import org.mozilla.gecko.db.UrlAnnotations; import org.mozilla.gecko.db.UrlAnnotations;
import org.mozilla.gecko.feeds.FeedFetcher; import org.mozilla.gecko.feeds.FeedFetcher;
import org.mozilla.gecko.feeds.FeedService;
import org.mozilla.gecko.feeds.parser.Feed; import org.mozilla.gecko.feeds.parser.Feed;
import org.mozilla.gecko.feeds.subscriptions.FeedSubscription; import org.mozilla.gecko.feeds.subscriptions.FeedSubscription;
import org.mozilla.gecko.preferences.GeckoPreferences; import org.mozilla.gecko.preferences.GeckoPreferences;
@ -119,7 +120,9 @@ public class CheckForUpdatesAction extends FeedAction {
showNotificationForMultipleUpdates(updatedFeeds); showNotificationForMultipleUpdates(updatedFeeds);
} }
Telemetry.startUISession(TelemetryContract.Session.EXPERIMENT, FeedService.getEnabledExperiment(context));
Telemetry.sendUIEvent(TelemetryContract.Event.SHOW, TelemetryContract.Method.NOTIFICATION, "content_update"); Telemetry.sendUIEvent(TelemetryContract.Event.SHOW, TelemetryContract.Method.NOTIFICATION, "content_update");
Telemetry.stopUISession(TelemetryContract.Session.EXPERIMENT, FeedService.getEnabledExperiment(context));
} }
private void showNotificationForSingleUpdate(Feed feed) { private void showNotificationForSingleUpdate(Feed feed) {

Просмотреть файл

@ -14,6 +14,7 @@ import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.db.BrowserDB; import org.mozilla.gecko.db.BrowserDB;
import org.mozilla.gecko.db.UrlAnnotations; import org.mozilla.gecko.db.UrlAnnotations;
import org.mozilla.gecko.feeds.FeedFetcher; import org.mozilla.gecko.feeds.FeedFetcher;
import org.mozilla.gecko.feeds.FeedService;
import org.mozilla.gecko.feeds.subscriptions.FeedSubscription; import org.mozilla.gecko.feeds.subscriptions.FeedSubscription;
/** /**
@ -71,6 +72,8 @@ public class SubscribeToFeedAction extends FeedAction {
urlAnnotations.insertFeedSubscription(context.getContentResolver(), subscription); urlAnnotations.insertFeedSubscription(context.getContentResolver(), subscription);
Telemetry.startUISession(TelemetryContract.Session.EXPERIMENT, FeedService.getEnabledExperiment(context));
Telemetry.sendUIEvent(TelemetryContract.Event.SAVE, TelemetryContract.Method.SERVICE, "content_update"); Telemetry.sendUIEvent(TelemetryContract.Event.SAVE, TelemetryContract.Method.SERVICE, "content_update");
Telemetry.stopUISession(TelemetryContract.Session.EXPERIMENT, FeedService.getEnabledExperiment(context));
} }
} }

Просмотреть файл

@ -16,6 +16,7 @@ import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.db.BrowserContract; import org.mozilla.gecko.db.BrowserContract;
import org.mozilla.gecko.db.BrowserDB; import org.mozilla.gecko.db.BrowserDB;
import org.mozilla.gecko.db.UrlAnnotations; import org.mozilla.gecko.db.UrlAnnotations;
import org.mozilla.gecko.feeds.FeedService;
import org.mozilla.gecko.feeds.subscriptions.FeedSubscription; import org.mozilla.gecko.feeds.subscriptions.FeedSubscription;
/** /**
@ -84,7 +85,9 @@ public class WithdrawSubscriptionsAction extends FeedAction {
urlAnnotations.deleteFeedSubscription(resolver, subscription); urlAnnotations.deleteFeedSubscription(resolver, subscription);
Telemetry.startUISession(TelemetryContract.Session.EXPERIMENT, FeedService.getEnabledExperiment(context));
Telemetry.sendUIEvent(TelemetryContract.Event.UNSAVE, TelemetryContract.Method.SERVICE, "content_update"); Telemetry.sendUIEvent(TelemetryContract.Event.UNSAVE, TelemetryContract.Method.SERVICE, "content_update");
Telemetry.stopUISession(TelemetryContract.Session.EXPERIMENT, FeedService.getEnabledExperiment(context));
} }
} }
} catch (JSONException e) { } catch (JSONException e) {

Просмотреть файл

@ -387,7 +387,9 @@ OnSharedPreferenceChangeListener
// Launched from "Notifications settings" action button in a notification. // Launched from "Notifications settings" action button in a notification.
if (intentExtras != null && intentExtras.containsKey(CheckForUpdatesAction.EXTRA_CONTENT_NOTIFICATION)) { if (intentExtras != null && intentExtras.containsKey(CheckForUpdatesAction.EXTRA_CONTENT_NOTIFICATION)) {
Telemetry.startUISession(TelemetryContract.Session.EXPERIMENT, FeedService.getEnabledExperiment(this));
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, Method.BUTTON, "notification-settings"); Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, Method.BUTTON, "notification-settings");
Telemetry.stopUISession(TelemetryContract.Session.EXPERIMENT, FeedService.getEnabledExperiment(this));
} }
} }