From 31a4c539d0aeee45549325fcd35685592f3052c2 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Fri, 11 Feb 2022 00:22:35 +0000 Subject: [PATCH 1/2] Only show unstash feedforward hint when long press will unstash Test: Long press to unstash while in an app still works and shows feedforward; long pressing handle while in overview, all apps, or when IME is showing doesn't show anything. Fixes: 218902248 Change-Id: I2c96570cab018c0e63c446793b84b210964bdb94 --- .../taskbar/TaskbarStashController.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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(); From 5ed87e4c96eaa79b3f6aa77e3a50ca66c7f24661 Mon Sep 17 00:00:00 2001 From: Thiru Ramasamy Date: Fri, 11 Feb 2022 14:32:57 -0800 Subject: [PATCH 2/2] Populate search attributes only if the atom's has DeviceSearchResultContainer. Bug: 199495917, 218973952 Test: https://android-build.googleplex.com/builds/abtd/run/L37100000953023420 Change-Id: I355b4ec0806755f6c72d59b04555b970ca1578f5 --- .../logging/StatsLogCompatManager.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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; }