From 99adef95b3e121a9c90f905589fa68d293425fe6 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Thu, 1 Jul 2021 10:30:59 -0700 Subject: [PATCH] Do not switch to screenshot and finish recents animation for menu options that already do so The issue is that in landscape mode we add overview shortcuts (e.g. screenshot) to the task view menu, where we switch to screenshot and finish recents animation before executing the shortcut action. However for shortcut actions like screenshot, we do the same, resulting in two chained "switch to screenshot and finish". This is a temporary fix for S given it's late in the cycle and we don't want to introduce unwanted regressions. Fixes: 192272546 Test: manual Change-Id: I7ef596e8bce6c15aa4a27163197beac12359b691 --- .../src/com/android/quickstep/TaskOverlayFactory.java | 2 ++ .../src/com/android/quickstep/views/TaskMenuView.java | 2 +- src/com/android/launcher3/popup/SystemShortcut.java | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java index c1c85de413..2bcc229fff 100644 --- a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java +++ b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java @@ -88,6 +88,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride { SystemShortcut screenshotShortcut = TaskShortcutFactory.SCREENSHOT .getShortcut(activity, taskView); if (screenshotShortcut != null) { + screenshotShortcut.setHasFinishRecentsInAction(true); shortcuts.add(screenshotShortcut); } @@ -96,6 +97,7 @@ public class TaskOverlayFactory implements ResourceBasedOverride { SystemShortcut modalShortcut = TaskShortcutFactory.MODAL .getShortcut(activity, taskView); if (modalShortcut != null) { + modalShortcut.setHasFinishRecentsInAction(true); shortcuts.add(modalShortcut); } } diff --git a/quickstep/src/com/android/quickstep/views/TaskMenuView.java b/quickstep/src/com/android/quickstep/views/TaskMenuView.java index c97225ec17..f5f25f491d 100644 --- a/quickstep/src/com/android/quickstep/views/TaskMenuView.java +++ b/quickstep/src/com/android/quickstep/views/TaskMenuView.java @@ -212,7 +212,7 @@ public class TaskMenuView extends AbstractFloatingView implements OnScrollChange menuOptionView.setEnabled(menuOption.isEnabled()); menuOptionView.setAlpha(menuOption.isEnabled() ? 1 : 0.5f); menuOptionView.setOnClickListener(view -> { - if (LIVE_TILE.get()) { + if (LIVE_TILE.get() && !menuOption.hasFinishRecentsInAction()) { RecentsView recentsView = mTaskView.getRecentsView(); recentsView.switchToScreenshot(null, () -> recentsView.finishRecentsAnimation(true /* toRecents */, diff --git a/src/com/android/launcher3/popup/SystemShortcut.java b/src/com/android/launcher3/popup/SystemShortcut.java index e5424cfe0a..d3f4909296 100644 --- a/src/com/android/launcher3/popup/SystemShortcut.java +++ b/src/com/android/launcher3/popup/SystemShortcut.java @@ -50,6 +50,8 @@ public abstract class SystemShortcut extends Ite */ private boolean isEnabled = true; + private boolean mHasFinishRecentsInAction = false; + public SystemShortcut(int iconResId, int labelResId, T target, ItemInfo itemInfo) { mIconResId = iconResId; mLabelResId = labelResId; @@ -100,6 +102,14 @@ public abstract class SystemShortcut extends Ite return mAccessibilityActionId == action; } + public void setHasFinishRecentsInAction(boolean hasFinishRecentsInAction) { + mHasFinishRecentsInAction = hasFinishRecentsInAction; + } + + public boolean hasFinishRecentsInAction() { + return mHasFinishRecentsInAction; + } + public interface Factory { @Nullable SystemShortcut getShortcut(T activity, ItemInfo itemInfo);