From 146b86fc311b6aa49289c572ea12c2c47a525ca3 Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Mon, 22 Aug 2022 10:44:05 -0700 Subject: [PATCH 1/7] Finish recents animation to the matching state. ResetGestureInputConsumer was defaulting to finising the recents animation to app when the the state was set to home. This created a situation where the taskbar could become invisible. Updated ResetGestureInputConsumer to check the state. Fixes: 241204341 Test: tested on a large screen device using the repro steps Change-Id: If5c109810ae2882f8cdfc0248939feb7c0c53d0d --- .../launcher3/taskbar/TaskbarActivityContext.java | 4 ++++ .../android/quickstep/TouchInteractionService.java | 3 ++- .../inputconsumers/ResetGestureInputConsumer.java | 13 +++++++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index e1bcbe23bf..394155e5f7 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -850,6 +850,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext { btv.post(() -> mControllers.taskbarPopupController.showForIcon(btv)); } + public boolean isInApp() { + return mControllers.taskbarStashController.isInApp(); + } + protected void dumpLogs(String prefix, PrintWriter pw) { pw.println(prefix + "TaskbarActivityContext:"); diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index c46926ec00..3af3c544db 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -455,7 +455,8 @@ public class TouchInteractionService extends Service mOverviewComponentObserver = new OverviewComponentObserver(this, mDeviceState); mOverviewCommandHelper = new OverviewCommandHelper(this, mOverviewComponentObserver, mTaskAnimationManager); - mResetGestureInputConsumer = new ResetGestureInputConsumer(mTaskAnimationManager); + mResetGestureInputConsumer = new ResetGestureInputConsumer( + mTaskAnimationManager, mTaskbarManager::getCurrentActivityContext); mInputConsumer = InputConsumerController.getRecentsAnimationInputConsumer(); mInputConsumer.registerInputConsumer(); onSystemUiFlagsChanged(mDeviceState.getSystemUiStateFlags()); diff --git a/quickstep/src/com/android/quickstep/inputconsumers/ResetGestureInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/ResetGestureInputConsumer.java index d34b40bf0c..349f4d2f2f 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/ResetGestureInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/ResetGestureInputConsumer.java @@ -17,18 +17,25 @@ package com.android.quickstep.inputconsumers; import android.view.MotionEvent; +import com.android.launcher3.taskbar.TaskbarActivityContext; import com.android.quickstep.InputConsumer; import com.android.quickstep.TaskAnimationManager; +import java.util.function.Supplier; + /** * A NO_OP input consumer which also resets any pending gesture */ public class ResetGestureInputConsumer implements InputConsumer { private final TaskAnimationManager mTaskAnimationManager; + private final Supplier mActivityContextSupplier; - public ResetGestureInputConsumer(TaskAnimationManager taskAnimationManager) { + public ResetGestureInputConsumer( + TaskAnimationManager taskAnimationManager, + Supplier activityContextSupplier) { mTaskAnimationManager = taskAnimationManager; + mActivityContextSupplier = activityContextSupplier; } @Override @@ -40,7 +47,9 @@ public class ResetGestureInputConsumer implements InputConsumer { public void onMotionEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN && mTaskAnimationManager.isRecentsAnimationRunning()) { - mTaskAnimationManager.finishRunningRecentsAnimation(false /* toHome */); + TaskbarActivityContext tac = mActivityContextSupplier.get(); + mTaskAnimationManager.finishRunningRecentsAnimation( + /* toHome= */ tac != null && !tac.isInApp()); } } } From 119ae79e3cbc6a369848e1c9b75c0d6d586985b1 Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Thu, 1 Sep 2022 15:59:07 -0700 Subject: [PATCH 2/7] Enable input consumer selection reason logging and gesture navigation error detection. Bug: 227514916 Test: ran locally, tested multiple gestures and checked logs Change-Id: Iab0c9a21ee0141744cf82afd16ee941f2b49a9cc --- src/com/android/launcher3/config/FeatureFlags.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index 82a47b03f4..6ec7860255 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -65,12 +65,12 @@ public final class FeatureFlags { */ public static final BooleanFlag ENABLE_INPUT_CONSUMER_REASON_LOGGING = getDebugFlag( "ENABLE_INPUT_CONSUMER_REASON_LOGGING", - false, + true, "Log the reason why an Input Consumer was selected for a gesture."); public static final BooleanFlag ENABLE_GESTURE_ERROR_DETECTION = getDebugFlag( "ENABLE_GESTURE_ERROR_DETECTION", - false, + true, "Analyze gesture events and log detected errors"); // When enabled the promise icon is visible in all apps while installation an app. From 7af10ad02cc3e04cfe7480f97cdcbbc5c409b8b9 Mon Sep 17 00:00:00 2001 From: Jeremy Sim Date: Fri, 2 Sep 2022 14:18:09 -0700 Subject: [PATCH 3/7] Prevent Overview Actions from appearing during split from home Overview Actions will no longer erroneously appear when initiating a split from home. The bug occurred because split from home causes an irregular state where the user is in split select, yet there is still a focused (main) task in Overview. Overview Actions did not anticipate this state and had no case to handle it. Fixed by adding a check to Overview Actions so that they will never show when split selection is active. Fixes: 244499708 Test: Manual Change-Id: Idf1762c306dceb5048cefec8fa68ac9ca5468379 --- .../quickstep/views/OverviewActionsView.java | 40 ++++++++++++++++--- .../android/quickstep/views/RecentsView.java | 13 +++--- 2 files changed, 43 insertions(+), 10 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java index 62ec0ef1df..747ba2ce9f 100644 --- a/quickstep/src/com/android/quickstep/views/OverviewActionsView.java +++ b/quickstep/src/com/android/quickstep/views/OverviewActionsView.java @@ -53,7 +53,9 @@ public class OverviewActionsView extends FrameLayo HIDDEN_NON_ZERO_ROTATION, HIDDEN_NO_TASKS, HIDDEN_NO_RECENTS, - HIDDEN_SPLIT_SCREEN}) + HIDDEN_SPLIT_SCREEN, + HIDDEN_SPLIT_SELECT_ACTIVE + }) @Retention(RetentionPolicy.SOURCE) public @interface ActionsHiddenFlags { } @@ -61,6 +63,7 @@ public class OverviewActionsView extends FrameLayo public static final int HIDDEN_NO_TASKS = 1 << 1; public static final int HIDDEN_NO_RECENTS = 1 << 2; public static final int HIDDEN_SPLIT_SCREEN = 1 << 3; + public static final int HIDDEN_SPLIT_SELECT_ACTIVE = 1 << 4; @IntDef(flag = true, value = { DISABLED_SCROLLING, @@ -79,6 +82,11 @@ public class OverviewActionsView extends FrameLayo private static final int INDEX_HIDDEN_FLAGS_ALPHA = 3; private static final int INDEX_SHARE_TARGET_ALPHA = 4; + public @interface SplitButtonDisabledFlags { } + + public static final int FLAG_IS_NOT_TABLET = 1 << 0; + public static final int FLAG_SINGLE_TASK = 1 << 1; + private MultiValueAlpha mMultiValueAlpha; private Button mSplitButton; @@ -88,6 +96,9 @@ public class OverviewActionsView extends FrameLayo @ActionsDisabledFlags protected int mDisabledFlags; + @SplitButtonDisabledFlags + private int mSplitButtonDisabledFlags; + @Nullable protected T mCallbacks; @@ -182,6 +193,20 @@ public class OverviewActionsView extends FrameLayo LayoutUtils.setViewEnabled(this, isEnabled); } + /** + * Updates the proper flags to indicate whether the "Split screen" button should be enabled. + * + * @param flag The flag to update. + * @param enable Whether to enable the disable flag: True will cause view to be disabled. + */ + public void updateSplitButtonFlags(@SplitButtonDisabledFlags int flag, boolean enable) { + if (enable) { + mSplitButtonDisabledFlags |= flag; + } else { + mSplitButtonDisabledFlags &= ~flag; + } + } + public AlphaProperty getContentAlpha() { return mMultiValueAlpha.getProperty(INDEX_CONTENT_ALPHA); } @@ -263,12 +288,17 @@ public class OverviewActionsView extends FrameLayo 0, 0, 0); } - public void setSplitButtonVisible(boolean visible) { + /** + * Shows/hides the "Split" button based on the status of mHiddenFlags. + */ + public void updateSplitButtonVisibility() { if (mSplitButton == null) { return; } - - mSplitButton.setVisibility(visible ? VISIBLE : GONE); - findViewById(R.id.action_split_space).setVisibility(visible ? VISIBLE : GONE); + boolean shouldBeVisible = mSplitButtonDisabledFlags == 0 + // and neither of these flags are active + && (mHiddenFlags & (HIDDEN_SPLIT_SCREEN | HIDDEN_SPLIT_SELECT_ACTIVE)) == 0; + mSplitButton.setVisibility(shouldBeVisible ? VISIBLE : GONE); + findViewById(R.id.action_split_space).setVisibility(shouldBeVisible ? VISIBLE : GONE); } } diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index efaa644502..6938951589 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -52,10 +52,13 @@ import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITIO import static com.android.launcher3.util.SystemUiController.UI_STATE_FULLSCREEN_TASK; import static com.android.quickstep.TaskUtils.checkCurrentOrManagedUserId; import static com.android.quickstep.views.ClearAllButton.DISMISS_ALPHA; +import static com.android.quickstep.views.OverviewActionsView.FLAG_IS_NOT_TABLET; +import static com.android.quickstep.views.OverviewActionsView.FLAG_SINGLE_TASK; import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NON_ZERO_ROTATION; import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NO_RECENTS; import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NO_TASKS; import static com.android.quickstep.views.OverviewActionsView.HIDDEN_SPLIT_SCREEN; +import static com.android.quickstep.views.OverviewActionsView.HIDDEN_SPLIT_SELECT_ACTIVE; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -3387,11 +3390,11 @@ public abstract class RecentsView 1); + mActionsView.updateHiddenFlags(HIDDEN_SPLIT_SELECT_ACTIVE, isSplitSelectionActive()); + mActionsView.updateSplitButtonFlags(FLAG_IS_NOT_TABLET, + !mActivity.getDeviceProfile().isTablet); + mActionsView.updateSplitButtonFlags(FLAG_SINGLE_TASK, getTaskViewCount() <= 1); + mActionsView.updateSplitButtonVisibility(); } /** From e796a6816a0d4b955a646ff6f4832ea81b44929e Mon Sep 17 00:00:00 2001 From: Federico Baron Date: Tue, 6 Sep 2022 16:26:56 -0700 Subject: [PATCH 4/7] Fix pagination broken when opening folder after restart bug. The alpha wasn't initialized properly so the footer would show up before it was expected to. Alpha is now initalized in the XML file so that the footer starts to appear only once the animation begins. Test: Manual Fix: 233690408 Change-Id: I9e08547401cb37ce2f9e711fc4ba000250c49c2e --- res/layout/user_folder_icon_normalized.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/res/layout/user_folder_icon_normalized.xml b/res/layout/user_folder_icon_normalized.xml index 87bf33df8b..4dee6e7ec3 100644 --- a/res/layout/user_folder_icon_normalized.xml +++ b/res/layout/user_folder_icon_normalized.xml @@ -34,7 +34,8 @@ android:clipChildren="false" android:orientation="horizontal" android:paddingLeft="12dp" - android:paddingRight="12dp" > + android:paddingRight="12dp" + android:alpha="0"> Date: Wed, 31 Aug 2022 16:43:40 -0700 Subject: [PATCH 5/7] Filter out active freeform tasks from recents Freeform tasks will show up as a separate, single tile in recents. Filtering them out right now. Bug: 244348395 Test: atest RecentTasksControllerTest RecentTasksListTest Change-Id: Ifb197031076a8d8934cea78c6b68cb059477a81a --- .../com/android/quickstep/RecentTasksList.java | 16 ++++++++++------ .../android/quickstep/RecentTasksListTest.java | 6 +++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/quickstep/src/com/android/quickstep/RecentTasksList.java b/quickstep/src/com/android/quickstep/RecentTasksList.java index 813e687f34..5a9862ce0f 100644 --- a/quickstep/src/com/android/quickstep/RecentTasksList.java +++ b/quickstep/src/com/android/quickstep/RecentTasksList.java @@ -27,9 +27,9 @@ import android.util.SparseBooleanArray; import androidx.annotation.VisibleForTesting; -import com.android.quickstep.util.GroupTask; import com.android.launcher3.util.LooperExecutor; import com.android.launcher3.util.SplitConfigurationOptions; +import com.android.quickstep.util.GroupTask; import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.system.KeyguardManagerCompat; import com.android.wm.shell.recents.IRecentTasksListener; @@ -254,8 +254,12 @@ public class RecentTasksList { TaskLoadResult allTasks = new TaskLoadResult(requestId, loadKeysOnly, rawTasks.size()); for (GroupedRecentTaskInfo rawTask : rawTasks) { - ActivityManager.RecentTaskInfo taskInfo1 = rawTask.mTaskInfo1; - ActivityManager.RecentTaskInfo taskInfo2 = rawTask.mTaskInfo2; + if (rawTask.getType() == GroupedRecentTaskInfo.TYPE_FREEFORM) { + // TODO: add entry for freeform tasks + continue; + } + ActivityManager.RecentTaskInfo taskInfo1 = rawTask.getTaskInfo1(); + ActivityManager.RecentTaskInfo taskInfo2 = rawTask.getTaskInfo2(); Task.TaskKey task1Key = new Task.TaskKey(taskInfo1); Task task1 = loadKeysOnly ? new Task(task1Key) @@ -272,7 +276,7 @@ public class RecentTasksList { task2.setLastSnapshotData(taskInfo2); } final SplitConfigurationOptions.SplitBounds launcherSplitBounds = - convertSplitBounds(rawTask.mSplitBounds); + convertSplitBounds(rawTask.getSplitBounds()); allTasks.add(new GroupTask(task1, task2, launcherSplitBounds)); } @@ -310,8 +314,8 @@ public class RecentTasksList { mSysUiProxy.getRecentTasks(Integer.MAX_VALUE, currentUserId); writer.println(prefix + " rawTasks=["); for (GroupedRecentTaskInfo task : rawTasks) { - writer.println(prefix + " t1=" + task.mTaskInfo1.taskId - + " t2=" + (task.mTaskInfo2 != null ? task.mTaskInfo2.taskId : "-1")); + writer.println(prefix + " t1=" + task.getTaskInfo1().taskId + + " t2=" + (task.getTaskInfo2() != null ? task.getTaskInfo2().taskId : "-1")); } writer.println(prefix + " ]"); } diff --git a/quickstep/tests/src/com/android/quickstep/RecentTasksListTest.java b/quickstep/tests/src/com/android/quickstep/RecentTasksListTest.java index 4e497163b5..262dc37e75 100644 --- a/quickstep/tests/src/com/android/quickstep/RecentTasksListTest.java +++ b/quickstep/tests/src/com/android/quickstep/RecentTasksListTest.java @@ -70,7 +70,7 @@ public class RecentTasksListTest { @Test public void loadTasksInBackground_onlyKeys_noValidTaskDescription() { - GroupedRecentTaskInfo recentTaskInfos = new GroupedRecentTaskInfo( + GroupedRecentTaskInfo recentTaskInfos = GroupedRecentTaskInfo.forSplitTasks( new ActivityManager.RecentTaskInfo(), new ActivityManager.RecentTaskInfo(), null); when(mockSystemUiProxy.getRecentTasks(anyInt(), anyInt())) .thenReturn(new ArrayList<>(Collections.singletonList(recentTaskInfos))); @@ -90,8 +90,8 @@ public class RecentTasksListTest { task1.taskDescription = new ActivityManager.TaskDescription(taskDescription); ActivityManager.RecentTaskInfo task2 = new ActivityManager.RecentTaskInfo(); task2.taskDescription = new ActivityManager.TaskDescription(); - GroupedRecentTaskInfo recentTaskInfos = new GroupedRecentTaskInfo( - task1, task2, null); + GroupedRecentTaskInfo recentTaskInfos = GroupedRecentTaskInfo.forSplitTasks(task1, task2, + null); when(mockSystemUiProxy.getRecentTasks(anyInt(), anyInt())) .thenReturn(new ArrayList<>(Collections.singletonList(recentTaskInfos))); From 07211eaed48b8358594caa7566cb8aa4cabfc34a Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Wed, 7 Sep 2022 15:33:38 -0700 Subject: [PATCH 6/7] Add STATE_LAUNCHER_DRAWN printing Added loging to only print and/or track multistatecallback states Bug: 227514916 Test: tried various gestures and printed logs Change-Id: I487b09ca0660fb385c34b49523a2417f11fcde00 --- .../com/android/quickstep/AbsSwipeUpHandler.java | 2 ++ .../com/android/quickstep/MultiStateCallback.java | 8 +++++++- .../util/ActiveGestureErrorDetector.java | 15 ++++++++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index b7a50fc35e..81a5c1cb9d 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -340,6 +340,8 @@ public abstract class AbsSwipeUpHandler, return ActiveGestureErrorDetector.GestureEvent.STATE_CAPTURE_SCREENSHOT; } else if (stateFlag == STATE_HANDLER_INVALIDATED) { return ActiveGestureErrorDetector.GestureEvent.STATE_HANDLER_INVALIDATED; + } else if (stateFlag == STATE_LAUNCHER_DRAWN) { + return ActiveGestureErrorDetector.GestureEvent.STATE_LAUNCHER_DRAWN; } return null; } diff --git a/quickstep/src/com/android/quickstep/MultiStateCallback.java b/quickstep/src/com/android/quickstep/MultiStateCallback.java index 56e7fb5ea4..a68bea2cc0 100644 --- a/quickstep/src/com/android/quickstep/MultiStateCallback.java +++ b/quickstep/src/com/android/quickstep/MultiStateCallback.java @@ -116,7 +116,13 @@ public class MultiStateCallback { if (gestureEvent == null) { continue; } - ActiveGestureLog.INSTANCE.trackEvent(gestureEvent); + if (gestureEvent.mLogEvent && gestureEvent.mTrackEvent) { + ActiveGestureLog.INSTANCE.addLog(gestureEvent.name(), gestureEvent); + } else if (gestureEvent.mLogEvent) { + ActiveGestureLog.INSTANCE.addLog(gestureEvent.name()); + } else if (gestureEvent.mTrackEvent) { + ActiveGestureLog.INSTANCE.trackEvent(gestureEvent); + } } } diff --git a/quickstep/src/com/android/quickstep/util/ActiveGestureErrorDetector.java b/quickstep/src/com/android/quickstep/util/ActiveGestureErrorDetector.java index 54f632afdb..693ef100b6 100644 --- a/quickstep/src/com/android/quickstep/util/ActiveGestureErrorDetector.java +++ b/quickstep/src/com/android/quickstep/util/ActiveGestureErrorDetector.java @@ -46,7 +46,19 @@ public class ActiveGestureErrorDetector { STATE_GESTURE_STARTED, STATE_GESTURE_COMPLETED, STATE_GESTURE_CANCELLED, STATE_END_TARGET_ANIMATION_FINISHED, STATE_RECENTS_SCROLLING_FINISHED, STATE_CAPTURE_SCREENSHOT, STATE_SCREENSHOT_CAPTURED, STATE_HANDLER_INVALIDATED, - STATE_RECENTS_ANIMATION_CANCELED + STATE_RECENTS_ANIMATION_CANCELED, STATE_LAUNCHER_DRAWN(true, false); + + public final boolean mLogEvent; + public final boolean mTrackEvent; + + GestureEvent() { + this(false, true); + } + + GestureEvent(boolean logEvent, boolean trackEvent) { + mLogEvent = logEvent; + mTrackEvent = trackEvent; + } } private ActiveGestureErrorDetector() {} @@ -168,6 +180,7 @@ public class ActiveGestureErrorDetector { case STATE_END_TARGET_ANIMATION_FINISHED: case STATE_CAPTURE_SCREENSHOT: case STATE_HANDLER_INVALIDATED: + case STATE_LAUNCHER_DRAWN: default: // No-Op } From e6c1c0ebf62ddb5e12ab0be3024d5f532bb40567 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Wed, 7 Sep 2022 16:29:17 -0700 Subject: [PATCH 7/7] Disable split pair long press smart actions Fixes: 236891562 Test: Long press launches task on split pairs. Fullscreen overview tasks unchanged. Change-Id: I5ff5377ddbf2bad60b3158dfef7ed2a8073fa0c4 --- quickstep/src/com/android/quickstep/views/GroupedTaskView.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java index 2539ed6d26..0bed51dac4 100644 --- a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java +++ b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java @@ -250,8 +250,7 @@ public class GroupedTaskView extends TaskView { @Override public void setOverlayEnabled(boolean overlayEnabled) { - super.setOverlayEnabled(overlayEnabled); - mSnapshotView2.setOverlayEnabled(overlayEnabled); + // Intentional no-op to prevent setting smart actions overlay on thumbnails } @Override