1 /* 2 * Copyright (C) 2018 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 package com.android.quickstep.util; 17 18 import com.android.systemui.shared.system.RemoteAnimationTargetCompat; 19 20 import java.util.ArrayList; 21 22 /** 23 * Holds a collection of RemoteAnimationTargets, filtered by different properties. 24 */ 25 public class RemoteAnimationTargetSet { 26 27 public final RemoteAnimationTargetCompat[] unfilteredApps; 28 public final RemoteAnimationTargetCompat[] apps; 29 30 public RemoteAnimationTargetSet(RemoteAnimationTargetCompat[] apps, int targetMode) { 31 ArrayList<RemoteAnimationTargetCompat> filteredApps = new ArrayList<>(); 32 if (apps != null) { 33 for (RemoteAnimationTargetCompat target : apps) { 34 if (target.mode == targetMode) { 35 filteredApps.add(target); 36 } 37 } 38 } 39 40 this.unfilteredApps = apps; 41 this.apps = filteredApps.toArray(new RemoteAnimationTargetCompat[filteredApps.size()]); 42 } 43 44 public RemoteAnimationTargetCompat findTask(int taskId) { 45 for (RemoteAnimationTargetCompat target : apps) { 46 if (target.taskId == taskId) { 47 return target; 48 } 49 } 50 return null; 51 } 52 53 public boolean isAnimatingHome() { 54 for (RemoteAnimationTargetCompat target : apps) { 55 if (target.activityType == RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME) { 56 return true; 57 } 58 } 59 return false; 60 } 61 } 62