Merge "[Overview Actions] Add actions to the task menu for in-place landscape." into ub-launcher3-rvc-dev
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
index 1e4a87c..05f4e91 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
@@ -607,6 +607,17 @@
}
}
+ /**
+ * Whether the Clear All button is hidden or fully visible. Used to determine if center
+ * displayed page is a task or the Clear All button.
+ *
+ * @return True = Clear All button not fully visible, center page is a task. False = Clear All
+ * button fully visible, center page is Clear All button.
+ */
+ public boolean isClearAllHidden() {
+ return mClearAllButton.getAlpha() != 1f;
+ }
+
@Override
protected void onPageBeginTransition() {
super.onPageBeginTransition();
@@ -616,7 +627,7 @@
@Override
protected void onPageEndTransition() {
super.onPageEndTransition();
- if (getScrollX() == getScrollForPage(getPageNearestToCenterOfScreen())) {
+ if (isClearAllHidden()) {
LayoutUtils.setViewEnabled(mActionsView, true);
}
if (getNextPage() > 0) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
index cadf6c4..e25c85b 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
@@ -425,13 +425,16 @@
}
private boolean showTaskMenu(int action) {
- getRecentsView().snapToPage(getRecentsView().indexOfChild(this));
- mMenuView = TaskMenuView.showForTask(this);
- mActivity.getStatsLogManager().log(LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS, buildProto());
- UserEventDispatcher.newInstance(getContext()).logActionOnItem(action, Direction.NONE,
- LauncherLogProto.ItemType.TASK_ICON);
- if (mMenuView != null) {
- mMenuView.addOnAttachStateChangeListener(mTaskMenuStateListener);
+ if (!getRecentsView().isClearAllHidden()) {
+ getRecentsView().snapToPage(getRecentsView().indexOfChild(this));
+ } else {
+ mMenuView = TaskMenuView.showForTask(this);
+ mActivity.getStatsLogManager().log(LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS, buildProto());
+ UserEventDispatcher.newInstance(getContext()).logActionOnItem(action, Direction.NONE,
+ LauncherLogProto.ItemType.TASK_ICON);
+ if (mMenuView != null) {
+ mMenuView.addOnAttachStateChangeListener(mTaskMenuStateListener);
+ }
}
return mMenuView != null;
}
diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
index be8eb48..390330f 100644
--- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
+++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
@@ -94,6 +94,11 @@
log(event, DEFAULT_INSTANCE_ID, info);
}
+ @Override
+ public void log(EventEnum event, ItemInfo itemInfo) {
+ logInternal(event, DEFAULT_INSTANCE_ID, itemInfo);
+ }
+
/**
* Logs an event and accompanying {@link InstanceId} and {@link LauncherAtom.ItemInfo}.
*/
@@ -135,6 +140,27 @@
logInternal(event, DEFAULT_INSTANCE_ID, info, srcState, dstState);
}
+ private void logInternal(EventEnum event, InstanceId instanceId, @Nullable ItemInfo info) {
+ LauncherAppState.getInstance(sContext).getModel().enqueueModelUpdateTask(
+ new BaseModelUpdateTask() {
+ @Override
+ public void execute(LauncherAppState app, BgDataModel dataModel,
+ AllAppsList apps) {
+ LauncherAtom.ItemInfo atomInfo = LauncherAtom.ItemInfo.getDefaultInstance();
+ if (info != null) {
+ if (info.container >= 0) {
+ atomInfo = info.buildProto(dataModel.folders.get(info.container));
+ } else {
+ atomInfo = info.buildProto();
+ }
+ }
+ logInternal(event, instanceId, atomInfo,
+ LAUNCHER_UICHANGED__DST_STATE__HOME,
+ LAUNCHER_UICHANGED__DST_STATE__BACKGROUND);
+ }
+ });
+ }
+
/**
* Logs an event and accompanying {@link InstanceId} and {@link LauncherAtom.ItemInfo}.
*/
@@ -143,14 +169,14 @@
info = info == null ? LauncherAtom.ItemInfo.getDefaultInstance() : info;
if (IS_VERBOSE) {
- String name = (event instanceof LauncherEvent) ? ((LauncherEvent) event).name() :
+ String name = (event instanceof Enum) ? ((Enum) event).name() :
event.getId() + "";
Log.d(TAG, instanceId == DEFAULT_INSTANCE_ID
? String.format("\n%s (State:%s->%s) \n%s", name, getStateString(srcState),
- getStateString(dstState), info)
- : String.format("\n%s (State:%s->%s) (InstanceId:%s)\n%s", name, instanceId,
- getStateString(srcState), getStateString(dstState), info));
+ getStateString(dstState), info)
+ : String.format("\n%s (State:%s->%s) (InstanceId:%s)\n%s", name,
+ getStateString(srcState), getStateString(dstState), instanceId, info));
}
if (!Utilities.ATLEAST_R) {
@@ -333,7 +359,7 @@
}
private static String getStateString(int state) {
- switch(state) {
+ switch (state) {
case LAUNCHER_UICHANGED__DST_STATE__BACKGROUND:
return "BACKGROUND";
case LAUNCHER_UICHANGED__DST_STATE__HOME:
diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java
index f216f81..6af0eef 100644
--- a/src/com/android/launcher3/logging/StatsLogManager.java
+++ b/src/com/android/launcher3/logging/StatsLogManager.java
@@ -127,7 +127,10 @@
LAUNCHER_SYSTEM_SHORTCUT_PIN_TAP(522),
@UiEvent(doc = "User is shown All Apps education view.")
- LAUNCHER_ALL_APPS_EDU_SHOWN(523);
+ LAUNCHER_ALL_APPS_EDU_SHOWN(523),
+
+ @UiEvent(doc = "User opened a folder.")
+ LAUNCHER_FOLDER_OPEN(551);
// ADD MORE
private final int mId;
@@ -195,6 +198,13 @@
}
/**
+ * Logs an event and accompanying {@link com.android.launcher3.model.data.ItemInfo}.
+ */
+ public void log(EventEnum event,
+ com.android.launcher3.model.data.ItemInfo itemInfo) {
+ }
+
+ /**
* Logs an event and accompanying {@link InstanceId} and {@link ItemInfo}.
*/
public void log(EventEnum event, InstanceId instanceId, @Nullable ItemInfo itemInfo) {
diff --git a/src/com/android/launcher3/touch/ItemClickHandler.java b/src/com/android/launcher3/touch/ItemClickHandler.java
index 6abca76..de16941 100644
--- a/src/com/android/launcher3/touch/ItemClickHandler.java
+++ b/src/com/android/launcher3/touch/ItemClickHandler.java
@@ -17,6 +17,7 @@
import static com.android.launcher3.Launcher.REQUEST_BIND_PENDING_APPWIDGET;
import static com.android.launcher3.Launcher.REQUEST_RECONFIGURE_APPWIDGET;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_OPEN;
import static com.android.launcher3.model.AppLaunchTracker.CONTAINER_ALL_APPS;
import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_BY_PUBLISHER;
import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_LOCKED_USER;
@@ -45,6 +46,7 @@
import com.android.launcher3.Utilities;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.folder.FolderIcon;
+import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.FolderInfo;
import com.android.launcher3.model.data.ItemInfo;
@@ -111,6 +113,7 @@
if (!folder.isOpen() && !folder.isDestroyed()) {
// Open the requested folder
folder.animateOpen();
+ StatsLogManager.newInstance(v.getContext()).log(LAUNCHER_FOLDER_OPEN, folder.mInfo);
}
}