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 17 package com.android.systemui.shared.system; 18 19 import android.app.WindowConfiguration; 20 import android.graphics.Point; 21 import android.graphics.Rect; 22 import android.view.RemoteAnimationTarget; 23 24 /** 25 * @see RemoteAnimationTarget 26 */ 27 public class RemoteAnimationTargetCompat { 28 29 public static final int MODE_OPENING = RemoteAnimationTarget.MODE_OPENING; 30 public static final int MODE_CLOSING = RemoteAnimationTarget.MODE_CLOSING; 31 public final int mode; 32 33 public static final int ACTIVITY_TYPE_UNDEFINED = WindowConfiguration.ACTIVITY_TYPE_UNDEFINED; 34 public static final int ACTIVITY_TYPE_STANDARD = WindowConfiguration.ACTIVITY_TYPE_STANDARD; 35 public static final int ACTIVITY_TYPE_HOME = WindowConfiguration.ACTIVITY_TYPE_HOME; 36 public static final int ACTIVITY_TYPE_RECENTS = WindowConfiguration.ACTIVITY_TYPE_RECENTS; 37 public static final int ACTIVITY_TYPE_ASSISTANT = WindowConfiguration.ACTIVITY_TYPE_ASSISTANT; 38 public final int activityType; 39 40 public final int taskId; 41 public final SurfaceControlCompat leash; 42 public final boolean isTranslucent; 43 public final Rect clipRect; 44 public final int prefixOrderIndex; 45 public final Point position; 46 public final Rect sourceContainerBounds; 47 public final boolean isNotInRecents; 48 public final Rect contentInsets; 49 RemoteAnimationTargetCompat(RemoteAnimationTarget app)50 public RemoteAnimationTargetCompat(RemoteAnimationTarget app) { 51 taskId = app.taskId; 52 mode = app.mode; 53 leash = new SurfaceControlCompat(app.leash); 54 isTranslucent = app.isTranslucent; 55 clipRect = app.clipRect; 56 position = app.position; 57 sourceContainerBounds = app.sourceContainerBounds; 58 prefixOrderIndex = app.prefixOrderIndex; 59 isNotInRecents = app.isNotInRecents; 60 contentInsets = app.contentInsets; 61 activityType = app.windowConfiguration.getActivityType(); 62 } 63 wrap(RemoteAnimationTarget[] apps)64 public static RemoteAnimationTargetCompat[] wrap(RemoteAnimationTarget[] apps) { 65 final RemoteAnimationTargetCompat[] appsCompat = 66 new RemoteAnimationTargetCompat[apps.length]; 67 for (int i = 0; i < apps.length; i++) { 68 appsCompat[i] = new RemoteAnimationTargetCompat(apps[i]); 69 } 70 return appsCompat; 71 } 72 }