Merge "Don't show split option if device in "Lock task mode"" into sc-v2-dev

This commit is contained in:
TreeHugger Robot 2022-01-06 23:20:54 +00:00 committed by Android (Google) Code Review
commit 19b3b93e5c
1 changed files with 9 additions and 2 deletions

View File

@ -23,6 +23,7 @@ import static com.android.quickstep.views.OverviewActionsView.DISABLED_NO_THUMBN
import static com.android.quickstep.views.OverviewActionsView.DISABLED_ROTATED; import static com.android.quickstep.views.OverviewActionsView.DISABLED_ROTATED;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.content.Context; import android.content.Context;
import android.graphics.Insets; import android.graphics.Insets;
import android.graphics.Matrix; import android.graphics.Matrix;
@ -54,6 +55,7 @@ import com.android.quickstep.views.TaskView;
import com.android.quickstep.views.TaskView.TaskIdAttributeContainer; import com.android.quickstep.views.TaskView.TaskIdAttributeContainer;
import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -115,8 +117,9 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
* Does NOT add split options in the following scenarios: * Does NOT add split options in the following scenarios:
* * The taskView to add split options is already showing split screen tasks * * The taskView to add split options is already showing split screen tasks
* * There aren't at least 2 tasks in overview to show split options for * * There aren't at least 2 tasks in overview to show split options for
* * Device is in "Lock task mode"
* * The taskView to show split options for is the focused task AND we haven't started * * The taskView to show split options for is the focused task AND we haven't started
* scrolling in overview (if we haven't scrolled, there's a split overview action so * scrolling in overview (if we haven't scrolled, there's a split overview action button so
* we don't need this menu option) * we don't need this menu option)
*/ */
private static void addSplitOptions(List<SystemShortcut> outShortcuts, private static void addSplitOptions(List<SystemShortcut> outShortcuts,
@ -130,7 +133,11 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
boolean isFocusedTask = deviceProfile.overviewShowAsGrid && taskView.isFocusedTask(); boolean isFocusedTask = deviceProfile.overviewShowAsGrid && taskView.isFocusedTask();
boolean isTaskInExpectedScrollPosition = boolean isTaskInExpectedScrollPosition =
recentsView.isTaskInExpectedScrollPosition(recentsView.indexOfChild(taskView)); recentsView.isTaskInExpectedScrollPosition(recentsView.indexOfChild(taskView));
if (taskViewHasMultipleTasks || notEnoughTasksToSplit || ActivityManager activityManager =
(ActivityManager) taskView.getContext().getSystemService(Context.ACTIVITY_SERVICE);
boolean isLockTaskMode = activityManager.isInLockTaskMode();
if (taskViewHasMultipleTasks || notEnoughTasksToSplit || isLockTaskMode ||
(isFocusedTask && isTaskInExpectedScrollPosition)) { (isFocusedTask && isTaskInExpectedScrollPosition)) {
return; return;
} }