1 /* 2 * Copyright (C) 2019 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; 17 18 import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; 19 import static android.view.RemoteAnimationTarget.MODE_CLOSING; 20 21 import android.app.WindowConfiguration; 22 import android.graphics.Rect; 23 import android.view.RemoteAnimationTarget; 24 25 import com.android.quickstep.views.DesktopTaskView; 26 27 /** 28 * Extension of {@link RemoteAnimationTargets} with additional information about swipe 29 * up animation 30 */ 31 public class RecentsAnimationTargets extends RemoteAnimationTargets { 32 33 public final Rect homeContentInsets; 34 public final Rect minimizedHomeBounds; 35 RecentsAnimationTargets(RemoteAnimationTarget[] apps, RemoteAnimationTarget[] wallpapers, RemoteAnimationTarget[] nonApps, Rect homeContentInsets, Rect minimizedHomeBounds)36 public RecentsAnimationTargets(RemoteAnimationTarget[] apps, 37 RemoteAnimationTarget[] wallpapers, RemoteAnimationTarget[] nonApps, 38 Rect homeContentInsets, Rect minimizedHomeBounds) { 39 super(apps, wallpapers, nonApps, MODE_CLOSING); 40 this.homeContentInsets = homeContentInsets; 41 this.minimizedHomeBounds = minimizedHomeBounds; 42 } 43 hasTargets()44 public boolean hasTargets() { 45 return unfilteredApps.length != 0; 46 } 47 48 /** 49 * Check if target apps contain desktop tasks which have windowing mode set to {@link 50 * WindowConfiguration#WINDOWING_MODE_FREEFORM} 51 * 52 * @return {@code true} if at least one target app is a desktop task 53 */ hasDesktopTasks()54 public boolean hasDesktopTasks() { 55 if (!DesktopTaskView.DESKTOP_MODE_SUPPORTED) { 56 return false; 57 } 58 for (RemoteAnimationTarget target : apps) { 59 if (target.windowConfiguration.getWindowingMode() == WINDOWING_MODE_FREEFORM) { 60 return true; 61 } 62 } 63 return false; 64 } 65 } 66