• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 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 android.window;
18 
19 import android.view.SurfaceControl;
20 import android.window.IRemoteTransitionFinishedCallback;
21 import android.window.TransitionInfo;
22 import android.window.WindowAnimationState;
23 
24 /**
25  * Interface allowing remote processes to play transition animations.
26  * The usage flow is as follows:
27  * <p><ol>
28  *  <li>The remote tags a lifecycle event with an IRemoteTransition (via a parameter in
29  *      ActivityOptions#makeRemoteAnimation) or a transition matches a filter registered via
30  *      Transitions#registerRemote.
31  *  <li>Shell then associates the transition for the event with the IRemoteTransition
32  *  <li>Shell receives onTransitionReady and delegates the animation to the IRemoteTransition
33  *      via {@link #startAnimation}.
34  *  <li>Once the IRemoteTransition is done animating, it will call the finishCallback.
35  *  <li>Shell/Core finish-up the transition.
36  * </ul>
37  *
38  * {@hide}
39  */
40 oneway interface IRemoteTransition {
41     /**
42      * Starts a transition animation. Once complete, the implementation should call
43      * `finishCallback`.
44      *
45      * @param token An identifier for the transition that should be animated.
46      */
startAnimation(in IBinder token, in TransitionInfo info, in SurfaceControl.Transaction t, in IRemoteTransitionFinishedCallback finishCallback)47     void startAnimation(in IBinder token, in TransitionInfo info, in SurfaceControl.Transaction t,
48             in IRemoteTransitionFinishedCallback finishCallback);
49 
50     /**
51      * Attempts to merge a transition animation into the animation that is currently
52      * being played by this remote. If merge is not possible/supported, this should be a no-op.
53      * If it *is* merged, the implementation should call `finishCallback` immediately.
54      *
55      * @param transition An identifier for the transition that wants to be merged.
56      * @param mergeTarget The transition that is currently being animated by this remote.
57      *                    If it can be merged, call `finishCallback`; otherwise, do
58      *                    nothing.
59      */
mergeAnimation(in IBinder transition, in TransitionInfo info, in SurfaceControl.Transaction t, in IBinder mergeTarget, in IRemoteTransitionFinishedCallback finishCallback)60     void mergeAnimation(in IBinder transition, in TransitionInfo info,
61             in SurfaceControl.Transaction t, in IBinder mergeTarget,
62             in IRemoteTransitionFinishedCallback finishCallback);
63 
64     /**
65      * Takes over the animation of the windows from an existing transition. Once complete, the
66      * implementation should call `finishCallback`.
67      *
68      * @param transition An identifier for the transition to be taken over.
69      * @param states The animation states of the windows involved in the transition. These must be
70      *               sorted in the same way as the Changes inside `info`, and each state may be
71      *               null.
72      */
takeOverAnimation(in IBinder transition, in TransitionInfo info, in SurfaceControl.Transaction t, in IRemoteTransitionFinishedCallback finishCallback, in WindowAnimationState[] states)73     void takeOverAnimation(in IBinder transition, in TransitionInfo info,
74             in SurfaceControl.Transaction t, in IRemoteTransitionFinishedCallback finishCallback,
75             in WindowAnimationState[] states);
76 
77     /**
78      * Called when a different handler has consumed the transition
79      *
80      * @param transition An identifier for the transition that was consumed.
81      * @param aborted Whether the transition is aborted or not.
82      */
onTransitionConsumed(in IBinder transition, in boolean aborted)83     void onTransitionConsumed(in IBinder transition, in boolean aborted);
84 }
85