am 2924dc34: Merge "Adding metrics to overview." into mnc-dev

* commit '2924dc346654a22f72575eb8ae3ce2e714818bd2':
  Adding metrics to overview.
This commit is contained in:
Winson Chung
2015-07-07 00:31:42 +00:00
committed by Android Git Automerger
8 changed files with 79 additions and 1 deletions

View File

@@ -43,7 +43,7 @@ public class MetricsLogger implements MetricsConstants {
public static final int SYSTEM_ALERT_WINDOW_APPS = 221; public static final int SYSTEM_ALERT_WINDOW_APPS = 221;
public static final int DREAMING = 222; public static final int DREAMING = 222;
public static final int DOZING = 223; public static final int DOZING = 223;
public static final int OVERVIEW_ACTIVITY = 224;
// Temporary constants go here, to await migration to MetricsConstants. // Temporary constants go here, to await migration to MetricsConstants.
public static void visible(Context context, int category) throws IllegalArgumentException { public static void visible(Context context, int category) throws IllegalArgumentException {

View File

@@ -20,6 +20,14 @@ package com.android.systemui.recents;
* Constants * Constants
*/ */
public class Constants { public class Constants {
public static class Metrics {
// DO NOT MODIFY THE ORDER OF THESE METRICS
public static final int DismissSourceKeyboard = 0;
public static final int DismissSourceSwipeGesture = 1;
public static final int DismissSourceHeaderButton = 2;
}
public static class DebugFlags { public static class DebugFlags {
// Enable this with any other debug flag to see more info // Enable this with any other debug flag to see more info
public static final boolean Verbose = false; public static final boolean Verbose = false;

View File

@@ -39,6 +39,8 @@ import android.util.MutableBoolean;
import android.view.Display; import android.view.Display;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import com.android.internal.logging.MetricsLogger;
import com.android.systemui.Prefs; import com.android.systemui.Prefs;
import com.android.systemui.R; import com.android.systemui.R;
import com.android.systemui.RecentsComponent; import com.android.systemui.RecentsComponent;
@@ -453,6 +455,9 @@ public class Recents extends SystemUI
return; return;
} }
// Keep track of actually launched affiliated tasks
MetricsLogger.count(mContext, "overview_affiliated_task_launch", 1);
// Launch the task // Launch the task
if (toTask.isActive) { if (toTask.isActive) {
// Bring an active task to the foreground // Bring an active task to the foreground
@@ -465,11 +470,15 @@ public class Recents extends SystemUI
@Override @Override
public void showNextAffiliatedTask() { public void showNextAffiliatedTask() {
// Keep track of when the affiliated task is triggered
MetricsLogger.count(mContext, "overview_affiliated_task_next", 1);
showRelativeAffiliatedTask(true); showRelativeAffiliatedTask(true);
} }
@Override @Override
public void showPrevAffiliatedTask() { public void showPrevAffiliatedTask() {
// Keep track of when the affiliated task is triggered
MetricsLogger.count(mContext, "overview_affiliated_task_prev", 1);
showRelativeAffiliatedTask(false); showRelativeAffiliatedTask(false);
} }

View File

@@ -33,6 +33,8 @@ import android.view.View;
import android.view.ViewStub; import android.view.ViewStub;
import android.widget.Toast; import android.widget.Toast;
import com.android.internal.logging.MetricsConstants;
import com.android.internal.logging.MetricsLogger;
import com.android.systemui.Prefs; import com.android.systemui.Prefs;
import com.android.systemui.R; import com.android.systemui.R;
import com.android.systemui.recents.misc.Console; import com.android.systemui.recents.misc.Console;
@@ -224,6 +226,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
// Mark the task that is the launch target // Mark the task that is the launch target
int taskStackCount = stacks.size(); int taskStackCount = stacks.size();
int launchTaskIndexInStack = 0;
if (mConfig.launchedToTaskId != -1) { if (mConfig.launchedToTaskId != -1) {
for (int i = 0; i < taskStackCount; i++) { for (int i = 0; i < taskStackCount; i++) {
TaskStack stack = stacks.get(i); TaskStack stack = stacks.get(i);
@@ -233,6 +236,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
Task t = tasks.get(j); Task t = tasks.get(j);
if (t.key.id == mConfig.launchedToTaskId) { if (t.key.id == mConfig.launchedToTaskId) {
t.isLaunchTarget = true; t.isLaunchTarget = true;
launchTaskIndexInStack = tasks.size() - j - 1;
break; break;
} }
} }
@@ -259,6 +263,28 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
// Animate the SystemUI scrims into view // Animate the SystemUI scrims into view
mScrimViews.prepareEnterRecentsAnimation(); mScrimViews.prepareEnterRecentsAnimation();
// Keep track of whether we launched from the nav bar button or via alt-tab
if (mConfig.launchedWithAltTab) {
MetricsLogger.count(this, "overview_trigger_alttab", 1);
} else {
MetricsLogger.count(this, "overview_trigger_nav_btn", 1);
}
// Keep track of whether we launched from an app or from home
if (mConfig.launchedFromAppWithThumbnail) {
MetricsLogger.count(this, "overview_source_app", 1);
// If from an app, track the stack index of the app in the stack (for affiliated tasks)
MetricsLogger.histogram(this, "overview_source_app_index", launchTaskIndexInStack);
} else {
MetricsLogger.count(this, "overview_source_home", 1);
}
// Keep track of the total stack task count
int taskCount = 0;
for (int i = 0; i < stacks.size(); i++) {
TaskStack stack = stacks.get(i);
taskCount += stack.getTaskCount();
}
MetricsLogger.histogram(this, "overview_task_count", taskCount);
} }
/** Dismisses recents if we are already visible and the intent is to toggle the recents view */ /** Dismisses recents if we are already visible and the intent is to toggle the recents view */
@@ -374,6 +400,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
@Override @Override
protected void onStart() { protected void onStart() {
super.onStart(); super.onStart();
MetricsLogger.visible(this, MetricsLogger.OVERVIEW_ACTIVITY);
RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
SystemServicesProxy ssp = loader.getSystemServicesProxy(); SystemServicesProxy ssp = loader.getSystemServicesProxy();
Recents.notifyVisibilityChanged(this, ssp, true); Recents.notifyVisibilityChanged(this, ssp, true);
@@ -414,6 +441,7 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
@Override @Override
protected void onStop() { protected void onStop() {
super.onStop(); super.onStop();
MetricsLogger.hidden(this, MetricsLogger.OVERVIEW_ACTIVITY);
RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
SystemServicesProxy ssp = loader.getSystemServicesProxy(); SystemServicesProxy ssp = loader.getSystemServicesProxy();
Recents.notifyVisibilityChanged(this, ssp, false); Recents.notifyVisibilityChanged(this, ssp, false);
@@ -498,6 +526,9 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
case KeyEvent.KEYCODE_DEL: case KeyEvent.KEYCODE_DEL:
case KeyEvent.KEYCODE_FORWARD_DEL: { case KeyEvent.KEYCODE_FORWARD_DEL: {
mRecentsView.dismissFocusedTask(); mRecentsView.dismissFocusedTask();
// Keep track of deletions by keyboard
MetricsLogger.histogram(this, "overview_task_dismissed_source",
Constants.Metrics.DismissSourceKeyboard);
return true; return true;
} }
default: default:
@@ -591,6 +622,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
RecentsTaskLoader loader = RecentsTaskLoader.getInstance(); RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
SystemServicesProxy ssp = loader.getSystemServicesProxy(); SystemServicesProxy ssp = loader.getSystemServicesProxy();
Recents.startScreenPinning(this, ssp); Recents.startScreenPinning(this, ssp);
MetricsLogger.count(this, "overview_screen_pinned", 1);
} }
@Override @Override

View File

@@ -37,6 +37,7 @@ import android.view.WindowInsets;
import android.view.WindowManagerGlobal; import android.view.WindowManagerGlobal;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import com.android.internal.logging.MetricsLogger;
import com.android.systemui.R; import com.android.systemui.R;
import com.android.systemui.recents.Constants; import com.android.systemui.recents.Constants;
import com.android.systemui.recents.RecentsAppWidgetHostView; import com.android.systemui.recents.RecentsAppWidgetHostView;
@@ -589,11 +590,22 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
if (mCb != null) { if (mCb != null) {
mCb.onTaskLaunchFailed(); mCb.onTaskLaunchFailed();
} }
// Keep track of failed launches
MetricsLogger.count(getContext(), "overview_task_launch_failed", 1);
} }
} }
} }
}; };
// Keep track of the index of the task launch
int taskIndexFromFront = 0;
int taskIndex = stack.indexOfTask(task);
if (taskIndex > -1) {
taskIndexFromFront = stack.getTaskCount() - taskIndex - 1;
}
MetricsLogger.histogram(getContext(), "overview_task_launch_index", taskIndexFromFront);
// Launch the app right away if there is no task view, otherwise, animate the icon out first // Launch the app right away if there is no task view, otherwise, animate the icon out first
if (tv == null) { if (tv == null) {
launchRunnable.run(); launchRunnable.run();
@@ -644,6 +656,9 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
} }
mCb.onAllTaskViewsDismissed(); mCb.onAllTaskViewsDismissed();
// Keep track of all-deletions
MetricsLogger.count(getContext(), "overview_task_all_dismissed", 1);
} }
/** Final callback after Recents is finally hidden. */ /** Final callback after Recents is finally hidden. */

View File

@@ -29,6 +29,8 @@ import android.view.View;
import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import com.android.internal.logging.MetricsLogger;
import com.android.systemui.R; import com.android.systemui.R;
import com.android.systemui.recents.Constants; import com.android.systemui.recents.Constants;
import com.android.systemui.recents.RecentsConfiguration; import com.android.systemui.recents.RecentsConfiguration;
@@ -1361,6 +1363,9 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
public void onTaskViewAppInfoClicked(TaskView tv) { public void onTaskViewAppInfoClicked(TaskView tv) {
if (mCb != null) { if (mCb != null) {
mCb.onTaskViewAppInfoClicked(tv.getTask()); mCb.onTaskViewAppInfoClicked(tv.getTask());
// Keep track of app-info invocations
MetricsLogger.count(getContext(), "overview_app_info", 1);
} }
} }

View File

@@ -23,6 +23,7 @@ import android.view.VelocityTracker;
import android.view.View; import android.view.View;
import android.view.ViewConfiguration; import android.view.ViewConfiguration;
import android.view.ViewParent; import android.view.ViewParent;
import com.android.internal.logging.MetricsLogger;
import com.android.systemui.recents.Constants; import com.android.systemui.recents.Constants;
import com.android.systemui.recents.Recents; import com.android.systemui.recents.Recents;
import com.android.systemui.recents.RecentsConfiguration; import com.android.systemui.recents.RecentsConfiguration;
@@ -452,6 +453,9 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
tv.setTouchEnabled(true); tv.setTouchEnabled(true);
// Remove the task view from the stack // Remove the task view from the stack
mSv.onTaskViewDismissed(tv); mSv.onTaskViewDismissed(tv);
// Keep track of deletions by keyboard
MetricsLogger.histogram(tv.getContext(), "overview_task_dismissed_source",
Constants.Metrics.DismissSourceSwipeGesture);
} }
@Override @Override

View File

@@ -27,6 +27,7 @@ import android.view.View;
import android.view.ViewOutlineProvider; import android.view.ViewOutlineProvider;
import android.view.animation.AccelerateInterpolator; import android.view.animation.AccelerateInterpolator;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import com.android.internal.logging.MetricsLogger;
import com.android.systemui.R; import com.android.systemui.R;
import com.android.systemui.recents.Constants; import com.android.systemui.recents.Constants;
import com.android.systemui.recents.RecentsConfiguration; import com.android.systemui.recents.RecentsConfiguration;
@@ -741,6 +742,9 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
} }
} else if (v == mHeaderView.mDismissButton) { } else if (v == mHeaderView.mDismissButton) {
dismissTask(); dismissTask();
// Keep track of deletions by the dismiss button
MetricsLogger.histogram(getContext(), "overview_task_dismissed_source",
Constants.Metrics.DismissSourceHeaderButton);
} else if (v == mHeaderView.mMoveTaskButton) { } else if (v == mHeaderView.mMoveTaskButton) {
if (mCb != null) { if (mCb != null) {
mCb.onTaskResize(tv); mCb.onTaskResize(tv);