Snap for 8178706 from 1c51edcef3 to tm-release

Change-Id: Ia572d5c4902127c096f82968cd40a272c5006a67
This commit is contained in:
Android Build Coastguard Worker
2022-02-13 00:08:41 +00:00
2 changed files with 28 additions and 7 deletions
@@ -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();
@@ -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;
}