Jorim Jaggi | 21c39a7 | 2017-10-20 15:47:51 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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.server.wm; |
| 18 | |
| 19 | import android.annotation.ColorInt; |
| 20 | import android.graphics.Point; |
| 21 | import android.view.SurfaceControl; |
| 22 | import android.view.SurfaceControl.Transaction; |
| 23 | import android.view.animation.Animation; |
| 24 | |
| 25 | import com.android.server.wm.SurfaceAnimator.OnAnimationFinishedCallback; |
| 26 | |
| 27 | /** |
| 28 | * Interface that describes an animation and bridges the animation start to the component |
| 29 | * responsible for running the animation. |
| 30 | */ |
| 31 | interface AnimationAdapter { |
| 32 | |
Jorim Jaggi | f5f9e12 | 2017-10-24 18:21:09 +0200 | [diff] [blame] | 33 | long STATUS_BAR_TRANSITION_DURATION = 120L; |
| 34 | |
Jorim Jaggi | 21c39a7 | 2017-10-20 15:47:51 +0200 | [diff] [blame] | 35 | /** |
| 36 | * @return Whether we should detach the wallpaper during the animation. |
| 37 | * @see Animation#setDetachWallpaper |
| 38 | */ |
| 39 | boolean getDetachWallpaper(); |
| 40 | |
| 41 | /** |
Jorim Jaggi | 82c1786 | 2018-02-21 17:50:18 +0100 | [diff] [blame] | 42 | * @return Whether we should show the wallpaper during the animation. |
| 43 | * @see Animation#getShowWallpaper() |
| 44 | */ |
| 45 | boolean getShowWallpaper(); |
| 46 | |
| 47 | /** |
Jorim Jaggi | 21c39a7 | 2017-10-20 15:47:51 +0200 | [diff] [blame] | 48 | * @return The background color behind the animation. |
| 49 | */ |
| 50 | @ColorInt int getBackgroundColor(); |
| 51 | |
| 52 | /** |
| 53 | * Requests to start the animation. |
| 54 | * |
| 55 | * @param animationLeash The surface to run the animation on. See {@link SurfaceAnimator} for an |
| 56 | * overview of the mechanism. This surface needs to be released by the |
| 57 | * component running the animation after {@code finishCallback} has been |
| 58 | * invoked, or after the animation was cancelled. |
| 59 | * @param t The Transaction to apply the initial frame of the animation. |
| 60 | * @param finishCallback The callback to be invoked when the animation has finished. |
| 61 | */ |
| 62 | void startAnimation(SurfaceControl animationLeash, Transaction t, |
| 63 | OnAnimationFinishedCallback finishCallback); |
| 64 | |
| 65 | /** |
| 66 | * Called when the animation that was started with {@link #startAnimation} was cancelled by the |
| 67 | * window manager. |
| 68 | * |
| 69 | * @param animationLeash The leash passed to {@link #startAnimation}. |
| 70 | */ |
| 71 | void onAnimationCancelled(SurfaceControl animationLeash); |
| 72 | |
| 73 | /** |
| 74 | * @return The approximate duration of the animation, in milliseconds. |
| 75 | */ |
| 76 | long getDurationHint(); |
Jorim Jaggi | f5f9e12 | 2017-10-24 18:21:09 +0200 | [diff] [blame] | 77 | |
| 78 | /** |
| 79 | * If this animation is run as an app opening animation, this calculates the start time for all |
| 80 | * status bar transitions that happen as part of the app opening animation, which will be |
| 81 | * forwarded to SystemUI. |
| 82 | * |
| 83 | * @return the desired start time of the status bar transition, in uptime millis |
| 84 | */ |
| 85 | long getStatusBarTransitionsStartTime(); |
Jorim Jaggi | 21c39a7 | 2017-10-20 15:47:51 +0200 | [diff] [blame] | 86 | } |