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 android.animation.AnimatorSet; 19 import android.view.RemoteAnimationTarget; 20 21 public abstract class RemoteAnimationProvider { 22 createWindowAnimation(RemoteAnimationTarget[] appTargets, RemoteAnimationTarget[] wallpaperTargets)23 public abstract AnimatorSet createWindowAnimation(RemoteAnimationTarget[] appTargets, 24 RemoteAnimationTarget[] wallpaperTargets); 25 26 /** 27 * @return the target with the lowest opaque layer for a certain app animation, or null. 28 */ findLowestOpaqueLayerTarget( RemoteAnimationTarget[] appTargets, int mode)29 public static RemoteAnimationTarget findLowestOpaqueLayerTarget( 30 RemoteAnimationTarget[] appTargets, int mode) { 31 int lowestLayer = Integer.MAX_VALUE; 32 int lowestLayerIndex = -1; 33 for (int i = appTargets.length - 1; i >= 0; i--) { 34 RemoteAnimationTarget target = appTargets[i]; 35 if (target.mode == mode && !target.isTranslucent) { 36 int layer = target.prefixOrderIndex; 37 if (layer < lowestLayer) { 38 lowestLayer = layer; 39 lowestLayerIndex = i; 40 } 41 } 42 } 43 return lowestLayerIndex != -1 44 ? appTargets[lowestLayerIndex] 45 : null; 46 } 47 } 48