Bug 1241810 - Bug 1251317 - Add telemetry for content notifications. r=mcomella,mfinkle

MozReview-Commit-ID: Hlh1sW0kHFg

--HG--
extra : rebase_source : af747da83fd0b0bba135c1e1d2cb4fe301cc3840
This commit is contained in:
Sebastian Kaspari 2016-03-03 14:16:17 +01:00
Родитель b7a571aec2
Коммит cc3b5d613e
6 изменённых файлов: 30 добавлений и 1 удалений

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

@ -27,6 +27,7 @@ import org.mozilla.gecko.favicons.Favicons;
import org.mozilla.gecko.favicons.OnFaviconLoadedListener;
import org.mozilla.gecko.favicons.decoders.IconDirectoryEntry;
import org.mozilla.gecko.feeds.FeedService;
import org.mozilla.gecko.feeds.action.CheckAction;
import org.mozilla.gecko.firstrun.FirstrunAnimationContainer;
import org.mozilla.gecko.gfx.DynamicToolbarAnimator;
import org.mozilla.gecko.gfx.DynamicToolbarAnimator.PinReason;
@ -3770,6 +3771,11 @@ public class BrowserApp extends GeckoApp
if (urls != null) {
openUrls(urls);
}
// Launched from a "content notification"
if (intent.hasExtra(CheckAction.EXTRA_CONTENT_NOTIFICATION)) {
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.NOTIFICATION, "content_update");
}
}
if (!mInitialized || !Intent.ACTION_MAIN.equals(action)) {

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

@ -182,6 +182,9 @@ public interface TelemetryContract {
// Action triggered from one of a series of views, such as ViewPager.
PANEL("panel"),
// Action triggered by a background service / automatic system making a decision.
SERVICE("service"),
// Action triggered from a settings screen.
SETTINGS("settings"),

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

@ -24,6 +24,8 @@ import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.BrowserApp;
import org.mozilla.gecko.GeckoApp;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.db.BrowserDB;
import org.mozilla.gecko.db.UrlAnnotations;
import org.mozilla.gecko.feeds.FeedFetcher;
@ -108,12 +110,17 @@ public class CheckAction implements BaseAction {
private void notify(List<Feed> updatedFeeds) {
final int feedCount = updatedFeeds.size();
if (feedCount == 0) {
return;
}
if (feedCount == 1) {
notifySingle(updatedFeeds.get(0));
} else if (feedCount > 1) {
} else {
notifyMultiple(updatedFeeds);
}
Telemetry.sendUIEvent(TelemetryContract.Event.SHOW, TelemetryContract.Method.NOTIFICATION, "content_update");
}
private void notifySingle(Feed feed) {

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

@ -10,6 +10,8 @@ import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.db.BrowserDB;
import org.mozilla.gecko.db.UrlAnnotations;
import org.mozilla.gecko.feeds.FeedFetcher;
@ -69,5 +71,7 @@ public class SubscribeAction implements BaseAction {
final FeedSubscription subscription = FeedSubscription.create(feedUrl, response);
urlAnnotations.insertFeedSubscription(context.getContentResolver(), subscription);
Telemetry.sendUIEvent(TelemetryContract.Event.SAVE, TelemetryContract.Method.SERVICE, "content_update");
}
}

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

@ -32,6 +32,7 @@ import org.mozilla.gecko.TelemetryContract.Method;
import org.mozilla.gecko.background.common.GlobalConstants;
import org.mozilla.gecko.db.BrowserContract.SuggestedSites;
import org.mozilla.gecko.feeds.FeedService;
import org.mozilla.gecko.feeds.action.CheckAction;
import org.mozilla.gecko.permissions.Permissions;
import org.mozilla.gecko.restrictions.Restrictable;
import org.mozilla.gecko.tabqueue.TabQueueHelper;
@ -385,6 +386,11 @@ OnSharedPreferenceChangeListener
NotificationManager notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(DataReportingNotification.ALERT_NAME_DATAREPORTING_NOTIFICATION.hashCode());
}
// Launched from "Notifications settings" action button in a notification.
if (intentExtras != null && intentExtras.containsKey(CheckAction.EXTRA_CONTENT_NOTIFICATION)) {
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, Method.BUTTON, "notification-settings");
}
}
/**

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

@ -224,6 +224,9 @@ Methods
``pageaction``
Action triggered from a pageaction, displayed in the URL bar.
``service``
Action triggered from an automatic system making a decision.
``settings``
Action triggered from a content page.