blob: 3431c3ecc310f166ddcba675397e94ff4723fc85 [file] [log] [blame]
Yunfan Chen02abf552019-12-05 14:51:09 +09001/*
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
17package android.view;
18
Adrian Roosc22eec92020-06-12 18:48:10 +020019import android.view.WindowInsets.Type.InsetsType;
Adrian Roosdb5b0c22020-02-12 15:05:27 -080020import android.view.WindowInsetsAnimation.Bounds;
Jorim Jaggia51168a2019-12-27 15:17:44 +010021
Yunfan Chen02abf552019-12-05 14:51:09 +090022/**
23 * Provide an interface to let InsetsAnimationControlImpl call back into its owner.
24 * @hide
25 */
26public interface InsetsAnimationControlCallbacks {
Jorim Jaggia51168a2019-12-27 15:17:44 +010027
Yunfan Chen02abf552019-12-05 14:51:09 +090028 /**
Jorim Jaggia51168a2019-12-27 15:17:44 +010029 * Executes the necessary code to start the animation in the correct order, including:
30 * <ul>
Adrian Roosdb5b0c22020-02-12 15:05:27 -080031 * <li>Dispatch {@link WindowInsetsAnimation.Callback#onPrepare}</li>
Jorim Jaggia51168a2019-12-27 15:17:44 +010032 * <li>Update insets state and run layout according to {@code layoutDuringAnimation}</li>
Adrian Roosdb5b0c22020-02-12 15:05:27 -080033 * <li>Dispatch {@link WindowInsetsAnimation.Callback#onStart}</li>
Jorim Jaggia51168a2019-12-27 15:17:44 +010034 * <li>Dispatch {@link WindowInsetsAnimationControlListener#onReady}</li>
35 * </ul>
Yunfan Chen02abf552019-12-05 14:51:09 +090036 */
Jorim Jaggia51168a2019-12-27 15:17:44 +010037 void startAnimation(InsetsAnimationControlImpl controller,
Adrian Roosdb5b0c22020-02-12 15:05:27 -080038 WindowInsetsAnimationControlListener listener, int types,
39 WindowInsetsAnimation animation,
Jorim Jaggi6d5c8012020-02-28 01:40:27 +010040 Bounds bounds);
Yunfan Chen02abf552019-12-05 14:51:09 +090041
42 /**
43 * Schedule the apply by posting the animation callback.
Adrian Roos6a4448f2020-04-01 15:01:08 +020044 *
45 * @param runner The runner that requested applying insets
Yunfan Chen02abf552019-12-05 14:51:09 +090046 */
Adrian Roos6a4448f2020-04-01 15:01:08 +020047 void scheduleApplyChangeInsets(InsetsAnimationControlRunner runner);
Yunfan Chen02abf552019-12-05 14:51:09 +090048
49 /**
50 * Finish the final steps after the animation.
Jorim Jaggi6d5c8012020-02-28 01:40:27 +010051 * @param runner The runner used to run the animation.
Yunfan Chen02abf552019-12-05 14:51:09 +090052 * @param shown {@code true} if the insets are shown.
53 */
Jorim Jaggi6d5c8012020-02-28 01:40:27 +010054 void notifyFinished(InsetsAnimationControlRunner runner, boolean shown);
Yunfan Chen02abf552019-12-05 14:51:09 +090055
56 /**
Yunfan Chen02abf552019-12-05 14:51:09 +090057 * Apply the new params to the surface.
58 * @param params The {@link android.view.SyncRtSurfaceTransactionApplier.SurfaceParams} to
59 * apply.
60 */
61 void applySurfaceParams(SyncRtSurfaceTransactionApplier.SurfaceParams... params);
Rob Carr3a367c42020-03-10 15:51:35 -070062
63 /**
64 * Post a message to release the Surface, guaranteed to happen after all
65 * previous calls to applySurfaceParams.
66 */
67 void releaseSurfaceControlFromRt(SurfaceControl sc);
Adrian Roosc22eec92020-06-12 18:48:10 +020068
69 /**
70 * Reports that the perceptibility of the given types has changed to the given value.
71 *
72 * A type is perceptible if it is not (almost) entirely off-screen and not (almost) entirely
73 * transparent.
74 *
75 * @param types the (public) types whose perceptibility has changed
76 * @param perceptible true, if the types are now perceptible, false if they are not perceptible
77 */
78 void reportPerceptible(@InsetsType int types, boolean perceptible);
Yunfan Chen02abf552019-12-05 14:51:09 +090079}