Merge changes from topic "am-49ab0b6a-0408-47fb-8ced-f83558d65fe3" into ub-launcher3-master
* changes:
[automerger] Make fling thresholds consistent am: 0f640b6c1b
Make fling thresholds consistent
diff --git a/protos/launcher_log.proto b/protos/launcher_log.proto
index cd404d6..065663d 100644
--- a/protos/launcher_log.proto
+++ b/protos/launcher_log.proto
@@ -90,6 +90,7 @@
TASKSWITCHER = 12; // Recents UI Container (QuickStep)
APP = 13; // Foreground activity is another app (QuickStep)
TIP = 14; // Onboarding texts (QuickStep)
+ SIDELOADED_LAUNCHER = 15;
}
// Used to define what type of control a Target would represent.
@@ -148,11 +149,12 @@
enum Command {
HOME_INTENT = 0;
BACK = 1;
- ENTRY = 2; // Indicates entry to one of Launcher container type target
- // not using the HOME_INTENT
- CANCEL = 3; // Indicates that a confirmation screen was cancelled
- CONFIRM = 4; // Indicates thata confirmation screen was accepted
- STOP = 5; // Indicates onStop() was called (screen time out, power off)
+ ENTRY = 2; // Indicates entry to one of Launcher container type target
+ // not using the HOME_INTENT
+ CANCEL = 3; // Indicates that a confirmation screen was cancelled
+ CONFIRM = 4; // Indicates thata confirmation screen was accepted
+ STOP = 5; // Indicates onStop() was called (screen time out, power off)
+ RECENTS_BUTTON = 6; // Indicates that Recents button was pressed
}
optional Type type = 1;
diff --git a/quickstep/src/com/android/quickstep/ActivityControlHelper.java b/quickstep/src/com/android/quickstep/ActivityControlHelper.java
index f9dcee0..ae0affe 100644
--- a/quickstep/src/com/android/quickstep/ActivityControlHelper.java
+++ b/quickstep/src/com/android/quickstep/ActivityControlHelper.java
@@ -48,6 +48,7 @@
import com.android.launcher3.allapps.DiscoveryBounce;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.dragndrop.DragLayer;
+import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.util.RemoteAnimationProvider;
@@ -99,7 +100,7 @@
RecentsView getVisibleRecentsView();
@UiThread
- boolean switchToRecentsIfVisible();
+ boolean switchToRecentsIfVisible(boolean fromRecentsButton);
Rect getOverviewWindowBounds(Rect homeBounds, RemoteAnimationTargetCompat target);
@@ -120,6 +121,11 @@
*/
LongSwipeHelper getLongSwipeController(T activity, RemoteAnimationTargetSet targetSet);
+ /**
+ * Used for containerType in {@link com.android.launcher3.logging.UserEventDispatcher}
+ */
+ int getContainerType();
+
class LauncherActivityControllerHelper implements ActivityControlHelper<Launcher> {
@Override
@@ -277,9 +283,15 @@
}
@Override
- public boolean switchToRecentsIfVisible() {
+ public boolean switchToRecentsIfVisible(boolean fromRecentsButton) {
Launcher launcher = getVisibleLaucher();
if (launcher != null) {
+ if (fromRecentsButton) {
+ launcher.getUserEventDispatcher().logActionCommand(
+ LauncherLogProto.Action.Command.RECENTS_BUTTON,
+ getContainerType(),
+ LauncherLogProto.ContainerType.TASKSWITCHER);
+ }
launcher.getStateManager().goToState(OVERVIEW);
return true;
}
@@ -319,6 +331,13 @@
public AlphaProperty getAlphaProperty(Launcher activity) {
return activity.getDragLayer().getAlphaProperty(DragLayer.ALPHA_INDEX_SWIPE_UP);
}
+
+ @Override
+ public int getContainerType() {
+ final Launcher launcher = getVisibleLaucher();
+ return launcher != null ? launcher.getStateManager().getState().containerType
+ : LauncherLogProto.ContainerType.APP;
+ }
}
class FallbackActivityControllerHelper implements ActivityControlHelper<RecentsActivity> {
@@ -457,7 +476,7 @@
}
@Override
- public boolean switchToRecentsIfVisible() {
+ public boolean switchToRecentsIfVisible(boolean fromRecentsButton) {
return false;
}
@@ -495,6 +514,10 @@
return activity.getDragLayer().getAlphaProperty(0);
}
+ @Override
+ public int getContainerType() {
+ return LauncherLogProto.ContainerType.SIDELOADED_LAUNCHER;
+ }
}
interface LayoutListener {
diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
index 81a73fc..7b29323 100644
--- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
+++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
@@ -52,6 +52,8 @@
import com.android.launcher3.MainThreadExecutor;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.logging.UserEventDispatcher;
+import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
+import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.quickstep.ActivityControlHelper.ActivityInitListener;
import com.android.quickstep.ActivityControlHelper.AnimationFactory;
import com.android.quickstep.ActivityControlHelper.FallbackActivityControllerHelper;
@@ -224,6 +226,7 @@
private T mActivity;
private RecentsView mRecentsView;
private final long mToggleClickedTime = SystemClock.uptimeMillis();
+ private boolean mUserEventLogged;
public RecentsActivityCommand() {
mHelper = getActivityControlHelper();
@@ -241,7 +244,7 @@
if (!handleCommand(elapsedTime)) {
// Start overview
- if (!mHelper.switchToRecentsIfVisible()) {
+ if (!mHelper.switchToRecentsIfVisible(true)) {
mListener = mHelper.createActivityInitListener(this::onActivityReady);
mListener.registerAndStartActivity(overviewIntent, this::createWindowAnimation,
mContext, mMainThreadExecutor.getHandler(), RECENTS_LAUNCH_DURATION);
@@ -284,6 +287,11 @@
mActivity = activity;
mRecentsView = mActivity.getOverviewPanel();
mRecentsView.setRunningTaskIconScaledDown(true /* isScaledDown */, false /* animate */);
+ if (!mUserEventLogged) {
+ activity.getUserEventDispatcher().logActionCommand(Action.Command.RECENTS_BUTTON,
+ mHelper.getContainerType(), ContainerType.TASKSWITCHER);
+ mUserEventLogged = true;
+ }
return false;
}
diff --git a/quickstep/src/com/android/quickstep/QuickScrubController.java b/quickstep/src/com/android/quickstep/QuickScrubController.java
index 5ddd904..28b06fb 100644
--- a/quickstep/src/com/android/quickstep/QuickScrubController.java
+++ b/quickstep/src/com/android/quickstep/QuickScrubController.java
@@ -133,7 +133,7 @@
*/
private void breakOutOfQuickScrub() {
if (mRecentsView.getChildCount() == 0 || mActivityControlHelper == null
- || !mActivityControlHelper.switchToRecentsIfVisible()) {
+ || !mActivityControlHelper.switchToRecentsIfVisible(false)) {
mActivity.onBackPressed();
}
}
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 68432ab..6a4698f 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -418,7 +418,6 @@
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) {
@@ -444,17 +443,6 @@
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() {
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index 0ddeae7..82aa45a 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -110,6 +110,15 @@
public TaskView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
+ setOnClickListener((view) -> {
+ if (getTask() == null) {
+ return;
+ }
+ launchTask(true /* animate */);
+ BaseActivity.fromContext(context).getUserEventDispatcher().logTaskLaunchOrDismiss(
+ Touch.TAP, Direction.NONE, ((RecentsView) getParent()).indexOfChild(this),
+ TaskUtils.getComponentKeyForTask(getTask().key));
+ });
setOutlineProvider(new TaskOutlineProvider(getResources()));
}