Bug 997487 - Add awesomescreen session and cancel button UITelemetry. r=liuche f=mfinkle

This commit is contained in:
Michael Comella 2014-05-14 11:29:42 -07:00
parent 5a2728852d
commit 9c26d2d9a7
3 changed files with 28 additions and 10 deletions

View File

@ -658,12 +658,6 @@ abstract public class BrowserApp extends GeckoApp
if (isHomePagerVisible()) {
mHomePager.onToolbarFocusChange(hasFocus);
}
if (hasFocus) {
Telemetry.startUISession(TelemetryContract.Session.URLBAR_FOCUSED);
} else {
Telemetry.stopUISession(TelemetryContract.Session.URLBAR_FOCUSED);
}
}
});
@ -1610,6 +1604,7 @@ abstract public class BrowserApp extends GeckoApp
showHomePagerWithAnimator(panelId, animator);
animator.start();
Telemetry.startUISession(TelemetryContract.Session.AWESOMESCREEN);
}
private void commitEditingMode() {
@ -1617,6 +1612,9 @@ abstract public class BrowserApp extends GeckoApp
return;
}
Telemetry.stopUISession(TelemetryContract.Session.AWESOMESCREEN,
TelemetryContract.Reason.COMMIT);
final String url = mBrowserToolbar.commitEdit();
// HACK: We don't know the url that will be loaded when hideHomePager is initially called

View File

@ -22,6 +22,9 @@ public interface TelemetryContract {
// Generic action, usually for tracking menu and toolbar actions.
public static final String ACTION = "action.1";
// Cancel a state, action, etc.
public static final String CANCEL = "cancel.1";
// Launching (opening) an external application.
// Note: Only used in JavaScript for now, but here for completeness.
public static final String LAUNCH = "launch.1";
@ -71,6 +74,12 @@ public interface TelemetryContract {
// Action triggered from a list.
public static final String LIST = "list";
// Action triggered from the action bar (including the toolbar).
public static final String ACTIONBAR = "actionbar";
// Action triggered by hitting the Android back button.
public static final String BACK = "back";
// Action triggered from a button.
public static final String BUTTON = "button";
@ -105,6 +114,9 @@ public interface TelemetryContract {
* Telemetry.startUISession() as the "sessionName" parameter.
*/
public interface Session {
// Awesomescreen (including frecency search) is active.
public static final String AWESOMESCREEN = "awesomescreen.1";
// Started when a user enters about:home.
public static final String HOME = "home.1";
@ -116,9 +128,6 @@ public interface TelemetryContract {
// Note: Only used in JavaScript for now, but here for completeness.
public static final String READER = "reader.1";
// URL bar focused.
public static final String URLBAR_FOCUSED = "urlbar.1";
// Awesomescreen frecency search is active.
public static final String FRECENCY = "frecency.1";
@ -130,5 +139,8 @@ public interface TelemetryContract {
* Holds reasons for stopping a session. Intended for use in
* Telemetry.stopUISession() as the "reason" parameter.
*/
public interface Reason {}
public interface Reason {
// Changes were committed.
public static final String COMMIT = "commit";
}
}

View File

@ -20,6 +20,8 @@ import org.mozilla.gecko.LightweightTheme;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.animation.PropertyAnimator;
import org.mozilla.gecko.animation.PropertyAnimator.PropertyAnimationListener;
import org.mozilla.gecko.animation.ViewHelper;
@ -375,6 +377,9 @@ public class BrowserToolbar extends ThemedRelativeLayout
editCancel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Telemetry.sendUIEvent(TelemetryContract.Event.CANCEL,
TelemetryContract.Method.ACTIONBAR,
Integer.toString(editCancel.getId()));
cancelEdit();
}
});
@ -403,6 +408,8 @@ public class BrowserToolbar extends ThemedRelativeLayout
public boolean onBackPressed() {
if (isEditing()) {
Telemetry.sendUIEvent(TelemetryContract.Event.CANCEL,
TelemetryContract.Method.BACK);
cancelEdit();
return true;
}
@ -1075,6 +1082,7 @@ public class BrowserToolbar extends ThemedRelativeLayout
* @return the url that was entered
*/
public String cancelEdit() {
Telemetry.stopUISession(TelemetryContract.Session.AWESOMESCREEN);
return stopEditing();
}