From 3eb4efac95571eb5837ca66cae840033fc5fd893 Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Tue, 11 Jun 2024 15:52:55 -0400 Subject: [PATCH] Exclude home and recents activity types when overriding recents-excluded tasks These tasks could point to overview itself, causing a very confusing screenshot. By excluding these tasks, we will default to using the task preview Flag: NONE bug fix Fixes: 336334715 Test: used circle to search from home, swiped to home, then pressed "select" overview action button. also checked temp logs Change-Id: I0b0ca50585413b479e4830f06b57b8b5e19670a8 --- quickstep/src/com/android/quickstep/TopTaskTracker.java | 6 ++++-- .../src/com/android/quickstep/TouchInteractionService.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/quickstep/TopTaskTracker.java b/quickstep/src/com/android/quickstep/TopTaskTracker.java index 3a6b8042cd..8ffb84edec 100644 --- a/quickstep/src/com/android/quickstep/TopTaskTracker.java +++ b/quickstep/src/com/android/quickstep/TopTaskTracker.java @@ -242,7 +242,7 @@ public class TopTaskTracker extends ISplitScreenListener.Stub * If the given task holds an activity that is excluded from recents, and there * is another running task that is not excluded from recents, returns that underlying task. */ - public @Nullable CachedTaskInfo otherVisibleTaskThisIsExcludedOver() { + public @Nullable CachedTaskInfo getVisibleNonExcludedTask() { if (mTopTask == null || (mTopTask.baseIntent.getFlags() & FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) == 0) { // Not an excluded task. @@ -250,7 +250,9 @@ public class TopTaskTracker extends ISplitScreenListener.Stub } List visibleNonExcludedTasks = mAllCachedTasks.stream() .filter(t -> t.isVisible - && (t.baseIntent.getFlags() & FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) == 0) + && (t.baseIntent.getFlags() & FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) == 0 + && t.getActivityType() != ACTIVITY_TYPE_HOME + && t.getActivityType() != ACTIVITY_TYPE_RECENTS) .toList(); return visibleNonExcludedTasks.isEmpty() ? null : new CachedTaskInfo(visibleNonExcludedTasks); diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index 4599f180b1..b66a6dee40 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -1174,7 +1174,7 @@ public class TouchInteractionService extends Service { // running activity as the task behind the overlay. TopTaskTracker.CachedTaskInfo otherVisibleTask = runningTask == null ? null - : runningTask.otherVisibleTaskThisIsExcludedOver(); + : runningTask.getVisibleNonExcludedTask(); if (otherVisibleTask != null) { ActiveGestureLog.INSTANCE.addLog(new CompoundString("Changing active task to ") .append(otherVisibleTask.getPackageName())