diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index 20762b9a70..335b637d8a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -275,6 +275,9 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba // taskbar, we use an OnLongClickListener on TaskbarView instead. return false; } + if (!canCurrentlyManuallyUnstash()) { + return false; + } if (updateAndAnimateIsManuallyStashedInApp(false)) { mControllers.taskbarActivityContext.getDragLayer().performHapticFeedback(LONG_PRESS); return true; @@ -282,6 +285,16 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba return false; } + /** + * Returns whether taskbar will unstash when long pressing it based on the current state. The + * only time this is true is if the user is in an app and the taskbar is only stashed because + * the user previously long pressed to manually stash (not due to other reasons like IME). + */ + private boolean canCurrentlyManuallyUnstash() { + return (mState & (FLAG_IN_APP | FLAGS_STASHED_IN_APP)) + == (FLAG_IN_APP | FLAG_STASHED_IN_APP_MANUAL); + } + /** * Updates whether we should stash the taskbar when in apps, and animates to the changed state. * @return Whether we started an animation to either be newly stashed or unstashed. @@ -423,6 +436,11 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba // Already unstashed, no need to hint in that direction. return; } + if (!canCurrentlyManuallyUnstash()) { + // If any other flags are causing us to be stashed, long press won't cause us to + // unstash, so don't hint that it will. + return; + } mTaskbarStashedHandleHintScale.animateToValue( animateForward ? UNSTASHED_TASKBAR_HANDLE_HINT_SCALE : 1) .setDuration(TASKBAR_HINT_STASH_DURATION).start(); diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java index a548408500..12a638a804 100644 --- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java +++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java @@ -571,13 +571,16 @@ public class StatsLogCompatManager extends StatsLogManager { } private static int getSearchAttributes(LauncherAtom.ItemInfo info) { - /* TODO(b/218973952):Uncomment the logic after broken test is fixed. - if (info.getContainerInfo().getExtendedContainers().getDeviceSearchResultContainer() - .hasSearchAttributes()) { - return searchAttributesToInt(info.getContainerInfo().getExtendedContainers() - .getDeviceSearchResultContainer().getSearchAttributes()); - } - */ + ContainerInfo containerInfo = info.getContainerInfo(); + if (containerInfo.getContainerCase() == EXTENDED_CONTAINERS + && containerInfo.getExtendedContainers().getContainerCase() + == DEVICE_SEARCH_RESULT_CONTAINER + && containerInfo.getExtendedContainers() + .getDeviceSearchResultContainer().hasSearchAttributes() + ) { + return searchAttributesToInt(containerInfo.getExtendedContainers() + .getDeviceSearchResultContainer().getSearchAttributes()); + } return 0; }