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 static com.android.window.flags.Flags.enableDesktopWindowingMode; 22 23 import android.app.WindowConfiguration; 24 import android.graphics.Rect; 25 import android.os.Bundle; 26 import android.view.RemoteAnimationTarget; 27 28 import java.io.PrintWriter; 29 30 /** 31 * Extension of {@link RemoteAnimationTargets} with additional information about swipe 32 * up animation 33 */ 34 public class RecentsAnimationTargets extends RemoteAnimationTargets { 35 36 public final Rect homeContentInsets; 37 public final Rect minimizedHomeBounds; 38 RecentsAnimationTargets(RemoteAnimationTarget[] apps, RemoteAnimationTarget[] wallpapers, RemoteAnimationTarget[] nonApps, Rect homeContentInsets, Rect minimizedHomeBounds, Bundle extras)39 public RecentsAnimationTargets(RemoteAnimationTarget[] apps, 40 RemoteAnimationTarget[] wallpapers, RemoteAnimationTarget[] nonApps, 41 Rect homeContentInsets, Rect minimizedHomeBounds, Bundle extras) { 42 super(apps, wallpapers, nonApps, MODE_CLOSING, extras); 43 this.homeContentInsets = homeContentInsets; 44 this.minimizedHomeBounds = minimizedHomeBounds; 45 } 46 hasTargets()47 public boolean hasTargets() { 48 return unfilteredApps.length != 0; 49 } 50 51 /** 52 * Check if target apps contain desktop tasks which have windowing mode set to {@link 53 * WindowConfiguration#WINDOWING_MODE_FREEFORM} 54 * 55 * @return {@code true} if at least one target app is a desktop task 56 */ hasDesktopTasks()57 public boolean hasDesktopTasks() { 58 if (!enableDesktopWindowingMode()) { 59 return false; 60 } 61 for (RemoteAnimationTarget target : apps) { 62 if (target.windowConfiguration.getWindowingMode() == WINDOWING_MODE_FREEFORM) { 63 return true; 64 } 65 } 66 return false; 67 } 68 69 @Override dump(String prefix, PrintWriter pw)70 public void dump(String prefix, PrintWriter pw) { 71 super.dump(prefix, pw); 72 prefix += '\t'; 73 pw.println(prefix + "RecentsAnimationTargets:"); 74 75 pw.println(prefix + "\thomeContentInsets=" + homeContentInsets); 76 pw.println(prefix + "\tminimizedHomeBounds=" + minimizedHomeBounds); 77 } 78 } 79