summaryrefslogtreecommitdiffstats
path: root/quickstep
diff options
context:
space:
mode:
authorHyunyoung Song <hyunyoungs@google.com>2018-05-15 21:46:51 -0700
committerHyunyoung Song <hyunyoungs@google.com>2018-05-16 11:26:35 -0700
commit1241e61a4568bfda63c731fba78286898eaba008 (patch)
tree6b5d426cb6f1a9ccdb40197e7ad8f839d8ee1def /quickstep
parentd9a1337b40fcb1041bba48cd59d7f358f5b7895f (diff)
downloadandroid_packages_apps_Trebuchet-1241e61a4568bfda63c731fba78286898eaba008.tar.gz
android_packages_apps_Trebuchet-1241e61a4568bfda63c731fba78286898eaba008.tar.bz2
android_packages_apps_Trebuchet-1241e61a4568bfda63c731fba78286898eaba008.zip
Improve Task user event logging
Bug: 79539824 Bug: 79541772 (1) Added page index of the TASK that is being launched (2) Covers all three cases of task launch (tap, swipe down, quick scrub) UserEvent: action:FLING direction=DOWN UserEvent: Source child:TASK, packageHash=-1598699687, componentHash=1952702153, pageIdx=0 UserEvent: action:DRAGDROP UserEvent: Source child:TASK, packageHash=-744307622, componentHash=-515832044, pageIdx=4 (3) Avoid double logging (When onStop is called, it is not logged if the cause of onStop is APP or TASK launch) Change-Id: Ic5db7d6a640d43bfb5cd667b49e37dd0ed127d5c
Diffstat (limited to 'quickstep')
-rw-r--r--quickstep/src/com/android/quickstep/QuickScrubController.java9
-rw-r--r--quickstep/src/com/android/quickstep/views/RecentsView.java24
-rw-r--r--quickstep/src/com/android/quickstep/views/TaskView.java7
3 files changed, 22 insertions, 18 deletions
diff --git a/quickstep/src/com/android/quickstep/QuickScrubController.java b/quickstep/src/com/android/quickstep/QuickScrubController.java
index 8398c48d9..5ddd904df 100644
--- a/quickstep/src/com/android/quickstep/QuickScrubController.java
+++ b/quickstep/src/com/android/quickstep/QuickScrubController.java
@@ -26,9 +26,8 @@ import com.android.launcher3.Alarm;
import com.android.launcher3.BaseActivity;
import com.android.launcher3.OnAlarmListener;
import com.android.launcher3.Utilities;
+import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
-import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
-import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
@@ -124,9 +123,9 @@ public class QuickScrubController implements OnAlarmListener {
mOnFinishedTransitionToQuickScrubRunnable = launchTaskRunnable;
}
}
- mActivity.getUserEventDispatcher().logActionOnControl(Touch.DRAGDROP,
- ControlType.QUICK_SCRUB_BUTTON, null, mStartedFromHome ?
- ContainerType.WORKSPACE : ContainerType.APP);
+ mActivity.getUserEventDispatcher().logTaskLaunchOrDismiss(Touch.DRAGDROP,
+ LauncherLogProto.Action.Direction.NONE, page,
+ TaskUtils.getComponentKeyForTask(mRecentsView.getPageAt(page).getTask().key));
}
/**
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 5c7118f05..68432abfc 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -418,6 +418,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
final int requiredChildCount = tasks.size();
for (int i = getChildCount(); i < requiredChildCount; i++) {
final TaskView taskView = (TaskView) inflater.inflate(R.layout.task, this, false);
+ taskView.setOnClickListener(this::onTaskClicked);
addView(taskView);
}
while (getChildCount() > requiredChildCount) {
@@ -443,6 +444,17 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
onTaskStackUpdated();
}
+ private void onTaskClicked(View v) {
+ TaskView taskView = (TaskView) v;
+ if (taskView.getTask() == null) {
+ return;
+ }
+ taskView.launchTask(true /* animate */);
+ mActivity.getUserEventDispatcher().logTaskLaunchOrDismiss(
+ Touch.TAP, Direction.NONE, indexOfChild(taskView),
+ TaskUtils.getComponentKeyForTask(taskView.getTask().key));
+ }
+
protected void onTaskStackUpdated() { }
public void resetTaskVisuals() {
@@ -745,13 +757,13 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
duration, LINEAR, anim);
}
- private void removeTask(Task task, PendingAnimation.OnEndListener onEndListener,
- boolean shouldLog) {
+ private void removeTask(Task task, int index, PendingAnimation.OnEndListener onEndListener,
+ boolean shouldLog) {
if (task != null) {
ActivityManagerWrapper.getInstance().removeTask(task.key.id);
if (shouldLog) {
mActivity.getUserEventDispatcher().logTaskLaunchOrDismiss(
- onEndListener.logAction, Direction.UP,
+ onEndListener.logAction, Direction.UP, index,
TaskUtils.getComponentKeyForTask(task.key));
}
}
@@ -836,7 +848,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
mPendingAnimation.addEndListener((onEndListener) -> {
if (onEndListener.isSuccess) {
if (shouldRemoveTask) {
- removeTask(taskView.getTask(), onEndListener, true);
+ removeTask(taskView.getTask(), draggedIndex, onEndListener, true);
}
int pageToSnapTo = mCurrentPage;
if (draggedIndex < pageToSnapTo) {
@@ -872,7 +884,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
if (onEndListener.isSuccess) {
while (getChildCount() != 0) {
TaskView taskView = getPageAt(getChildCount() - 1);
- removeTask(taskView.getTask(), onEndListener, false);
+ removeTask(taskView.getTask(), -1, onEndListener, false);
removeView(taskView);
}
onAllTasksRemoved();
@@ -1204,7 +1216,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
Task task = tv.getTask();
if (task != null) {
mActivity.getUserEventDispatcher().logTaskLaunchOrDismiss(
- onEndListener.logAction, Direction.DOWN,
+ onEndListener.logAction, Direction.DOWN, indexOfChild(tv),
TaskUtils.getComponentKeyForTask(task.key));
}
} else {
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index 4b2ca45e5..0ddeae73d 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -110,13 +110,6 @@ public class TaskView extends FrameLayout implements TaskCallbacks, PageCallback
public TaskView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
- setOnClickListener((view) -> {
- if (mTask != null) {
- launchTask(true /* animate */);
- BaseActivity.fromContext(context).getUserEventDispatcher().logTaskLaunchOrDismiss(
- Touch.TAP, Direction.NONE, TaskUtils.getComponentKeyForTask(mTask.key));
- }
- });
setOutlineProvider(new TaskOutlineProvider(getResources()));
}