Bug 1061409: Telemetry for share overlays. r=rnewman

This commit is contained in:
Chris Kitching 2014-09-06 20:30:50 -07:00
parent bbbe482310
commit dae8f3bf40
3 changed files with 29 additions and 0 deletions

View File

@ -79,6 +79,9 @@ public interface TelemetryContract {
// Sharing content.
SHARE("share.1"),
// Show a UI element.
SHOW("show.1"),
// Undoing a user action.
// Note: Only used in JavaScript for now, but here for completeness.
UNDO("undo.1"),
@ -161,6 +164,9 @@ public interface TelemetryContract {
// Action triggered from a settings screen.
SETTINGS("settings"),
// Actions triggered from the share overlay.
SHARE_OVERLAY("shareoverlay"),
// Action triggered from a suggestion provided to the user.
SUGGESTION("suggestion"),

View File

@ -12,6 +12,8 @@ import java.util.Arrays;
import org.mozilla.gecko.Assert;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.overlays.service.sharemethods.ParcelableClientRecord;
import android.app.AlertDialog;
@ -143,6 +145,12 @@ public class SendTabList extends ListView {
public void onClick(DialogInterface dialog, int index) {
listener.onSendTabTargetSelected(records[index].guid);
}
})
.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
Telemetry.sendUIEvent(TelemetryContract.Event.CANCEL, TelemetryContract.Method.SHARE_OVERLAY, "device_selection_cancel");
}
});
return builder.create();

View File

@ -12,6 +12,8 @@ import org.mozilla.gecko.Assert;
import org.mozilla.gecko.GeckoProfile;
import org.mozilla.gecko.LocaleAware;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.db.LocalBrowserDB;
import org.mozilla.gecko.overlays.OverlayConstants;
import org.mozilla.gecko.overlays.service.OverlayActionService;
@ -147,12 +149,17 @@ public class ShareDialog extends LocaleAware.LocaleAwareActivity implements Send
// If provided, we use the subject text to give us something nice to display.
// If not, we wing it with the URL.
// TODO: Consider polling Fennec databases to find better information to display.
String subjectText = intent.getStringExtra(Intent.EXTRA_SUBJECT);
String telemetryExtras = "title=" + (subjectText != null);
if (subjectText != null) {
((TextView) findViewById(R.id.title)).setText(subjectText);
}
Telemetry.sendUIEvent(TelemetryContract.Event.SHOW, TelemetryContract.Method.SHARE_OVERLAY, telemetryExtras);
title = subjectText;
url = pageUrl;
@ -321,16 +328,22 @@ public class ShareDialog extends LocaleAware.LocaleAwareActivity implements Send
startService(serviceIntent);
slideOut();
Telemetry.sendUIEvent(TelemetryContract.Event.SHARE, TelemetryContract.Method.SHARE_OVERLAY, "sendtab");
}
public void addToReadingList() {
startService(getServiceIntent(ShareMethod.Type.ADD_TO_READING_LIST));
slideOut();
Telemetry.sendUIEvent(TelemetryContract.Event.SAVE, TelemetryContract.Method.SHARE_OVERLAY, "reading_list");
}
public void addBookmark() {
startService(getServiceIntent(ShareMethod.Type.ADD_BOOKMARK));
slideOut();
Telemetry.sendUIEvent(TelemetryContract.Event.SAVE, TelemetryContract.Method.SHARE_OVERLAY, "bookmark");
}
public void launchBrowser() {
@ -386,6 +399,7 @@ public class ShareDialog extends LocaleAware.LocaleAwareActivity implements Send
@Override
public void onBackPressed() {
slideOut();
Telemetry.sendUIEvent(TelemetryContract.Event.CANCEL, TelemetryContract.Method.SHARE_OVERLAY);
}
/**
@ -394,6 +408,7 @@ public class ShareDialog extends LocaleAware.LocaleAwareActivity implements Send
@Override
public boolean onTouchEvent(MotionEvent event) {
slideOut();
Telemetry.sendUIEvent(TelemetryContract.Event.CANCEL, TelemetryContract.Method.SHARE_OVERLAY);
return true;
}
}