1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.quickstep.util; 18 19 import androidx.annotation.NonNull; 20 import androidx.annotation.Nullable; 21 22 import com.android.launcher3.util.SplitConfigurationOptions.StagedSplitBounds; 23 import com.android.systemui.shared.recents.model.Task; 24 25 /** 26 * A {@link Task} container that can contain one or two tasks, depending on if the two tasks 27 * are represented as an app-pair in the recents task list. 28 */ 29 public class GroupTask { 30 public @NonNull Task task1; 31 public @Nullable Task task2; 32 public @Nullable StagedSplitBounds mStagedSplitBounds; 33 GroupTask(@onNull Task t1, @Nullable Task t2, @Nullable StagedSplitBounds stagedSplitBounds)34 public GroupTask(@NonNull Task t1, @Nullable Task t2, 35 @Nullable StagedSplitBounds stagedSplitBounds) { 36 task1 = t1; 37 task2 = t2; 38 mStagedSplitBounds = stagedSplitBounds; 39 } 40 GroupTask(@onNull GroupTask group)41 public GroupTask(@NonNull GroupTask group) { 42 task1 = new Task(group.task1); 43 task2 = group.task2 != null 44 ? new Task(group.task2) 45 : null; 46 mStagedSplitBounds = group.mStagedSplitBounds; 47 } 48 containsTask(int taskId)49 public boolean containsTask(int taskId) { 50 return task1.key.id == taskId || (task2 != null && task2.key.id == taskId); 51 } 52 hasMultipleTasks()53 public boolean hasMultipleTasks() { 54 return task2 != null; 55 } 56 } 57