1 /*
2  * Copyright (C) 2021 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.os.IBinder;
20 import android.view.SurfaceControl;
21 import android.window.TransitionInfo;
22 
23 /** Interface for something that runs a remote transition animation. */
24 public interface RemoteTransitionRunner {
25     /**
26      * Starts a transition animation. Once complete, the implementation should call
27      * `finishCallback`.
28      */
startAnimation(IBinder transition, TransitionInfo info, SurfaceControl.Transaction t, Runnable finishCallback)29     void startAnimation(IBinder transition, TransitionInfo info, SurfaceControl.Transaction t,
30             Runnable finishCallback);
31 
32     /**
33      * Attempts to merge a transition into the currently-running animation. If merge is not
34      * possible/supported, this should do nothing. Otherwise, the implementation should call
35      * `finishCallback` immediately to indicate that it merged the transition.
36      *
37      * @param transition The transition that wants to be merged into the running animation.
38      * @param mergeTarget The transition to merge into (that this runner is currently animating).
39      */
mergeAnimation(IBinder transition, TransitionInfo info, SurfaceControl.Transaction t, IBinder mergeTarget, Runnable finishCallback)40     default void mergeAnimation(IBinder transition, TransitionInfo info,
41             SurfaceControl.Transaction t, IBinder mergeTarget, Runnable finishCallback) { }
42 }
43