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 import android.view.SurfaceControl; 24 25 /** 26 * @see RemoteAnimationTarget 27 */ 28 public class RemoteAnimationTargetCompat { 29 30 public static final int MODE_OPENING = RemoteAnimationTarget.MODE_OPENING; 31 public static final int MODE_CLOSING = RemoteAnimationTarget.MODE_CLOSING; 32 public final int mode; 33 34 public static final int ACTIVITY_TYPE_UNDEFINED = WindowConfiguration.ACTIVITY_TYPE_UNDEFINED; 35 public static final int ACTIVITY_TYPE_STANDARD = WindowConfiguration.ACTIVITY_TYPE_STANDARD; 36 public static final int ACTIVITY_TYPE_HOME = WindowConfiguration.ACTIVITY_TYPE_HOME; 37 public static final int ACTIVITY_TYPE_RECENTS = WindowConfiguration.ACTIVITY_TYPE_RECENTS; 38 public static final int ACTIVITY_TYPE_ASSISTANT = WindowConfiguration.ACTIVITY_TYPE_ASSISTANT; 39 public final int activityType; 40 41 public final int taskId; 42 public final SurfaceControlCompat leash; 43 public final boolean isTranslucent; 44 public final Rect clipRect; 45 public final int prefixOrderIndex; 46 public final Point position; 47 public final Rect sourceContainerBounds; 48 public final boolean isNotInRecents; 49 public final Rect contentInsets; 50 51 private final SurfaceControl mStartLeash; 52 RemoteAnimationTargetCompat(RemoteAnimationTarget app)53 public RemoteAnimationTargetCompat(RemoteAnimationTarget app) { 54 taskId = app.taskId; 55 mode = app.mode; 56 leash = new SurfaceControlCompat(app.leash); 57 isTranslucent = app.isTranslucent; 58 clipRect = app.clipRect; 59 position = app.position; 60 sourceContainerBounds = app.sourceContainerBounds; 61 prefixOrderIndex = app.prefixOrderIndex; 62 isNotInRecents = app.isNotInRecents; 63 contentInsets = app.contentInsets; 64 activityType = app.windowConfiguration.getActivityType(); 65 66 mStartLeash = app.startLeash; 67 } 68 wrap(RemoteAnimationTarget[] apps)69 public static RemoteAnimationTargetCompat[] wrap(RemoteAnimationTarget[] apps) { 70 final RemoteAnimationTargetCompat[] appsCompat = 71 new RemoteAnimationTargetCompat[apps.length]; 72 for (int i = 0; i < apps.length; i++) { 73 appsCompat[i] = new RemoteAnimationTargetCompat(apps[i]); 74 } 75 return appsCompat; 76 } 77 78 /** 79 * @see SurfaceControl#release() 80 */ release()81 public void release() { 82 leash.mSurfaceControl.release(); 83 if (mStartLeash != null) { 84 mStartLeash.release(); 85 } 86 } 87 }