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 
21 import android.os.IBinder;
22 import android.view.RemoteAnimationAdapter;
23 import android.window.IDisplayAreaOrganizerController;
24 import android.window.ITaskFragmentOrganizerController;
25 import android.window.ITaskOrganizerController;
26 import android.window.ITransitionMetricsReporter;
27 import android.window.ITransitionPlayer;
28 import android.window.IWindowContainerTransactionCallback;
29 import android.window.WindowContainerToken;
30 import android.window.WindowContainerTransaction;
31 
32 /** @hide */
33 interface IWindowOrganizerController {
34 
35     /**
36      * Apply multiple WindowContainer operations at once.
37      * @param t The transaction to apply.
38      */
applyTransaction(in WindowContainerTransaction t)39     void applyTransaction(in WindowContainerTransaction t);
40 
41     /**
42      * Apply multiple WindowContainer operations at once.
43      * @param t The transaction to apply.
44      * @param callback This transaction will use the synchronization scheme described in
45      *        BLASTSyncEngine.java. The SurfaceControl transaction containing the effects of this
46      *        WindowContainer transaction will be passed to this callback when ready.
47      * @return An ID for the sync operation which will later be passed to transactionReady callback.
48      *         This lets the caller differentiate overlapping sync operations.
49      */
applySyncTransaction(in WindowContainerTransaction t, in IWindowContainerTransactionCallback callback)50     int applySyncTransaction(in WindowContainerTransaction t,
51             in IWindowContainerTransactionCallback callback);
52 
53     /**
54      * Starts a transition.
55      * @param type The transition type.
56      * @param transitionToken A token associated with the transition to start. If null, a new
57      *                        transition will be created of the provided type.
58      * @param t Operations that are part of the transition.
59      * @return a token representing the transition. This will just be transitionToken if it was
60      *         non-null.
61      */
startTransition(int type, in @nullable IBinder transitionToken, in @nullable WindowContainerTransaction t)62     IBinder startTransition(int type, in @nullable IBinder transitionToken,
63             in @nullable WindowContainerTransaction t);
64 
65     /**
66      * Starts a legacy transition.
67      * @param type The transition type.
68      * @param adapter The animation to use.
69      * @param syncCallback A sync callback for the contents of `t`
70      * @param t Operations that are part of the transition.
71      * @return sync-id or -1 if this no-op'd because a transition is already running.
72      */
startLegacyTransition(int type, in RemoteAnimationAdapter adapter, in IWindowContainerTransactionCallback syncCallback, in WindowContainerTransaction t)73     int startLegacyTransition(int type, in RemoteAnimationAdapter adapter,
74             in IWindowContainerTransactionCallback syncCallback, in WindowContainerTransaction t);
75 
76     /**
77      * Finishes a transition. This must be called for all created transitions.
78      * @param transitionToken Which transition to finish
79      * @param t Changes to make before finishing but in the same SF Transaction. Can be null.
80      * @param callback Called when t is finished applying.
81      * @return An ID for the sync operation (see {@link #applySyncTransaction}. This will be
82      *         negative if no sync transaction was attached (null t or callback)
83      */
finishTransition(in IBinder transitionToken, in @nullable WindowContainerTransaction t, in IWindowContainerTransactionCallback callback)84     int finishTransition(in IBinder transitionToken,
85             in @nullable WindowContainerTransaction t,
86             in IWindowContainerTransactionCallback callback);
87 
88     /** @return An interface enabling the management of task organizers. */
getTaskOrganizerController()89     ITaskOrganizerController getTaskOrganizerController();
90 
91     /** @return An interface enabling the management of display area organizers. */
getDisplayAreaOrganizerController()92     IDisplayAreaOrganizerController getDisplayAreaOrganizerController();
93 
94     /** @return An interface enabling the management of task fragment organizers. */
getTaskFragmentOrganizerController()95     ITaskFragmentOrganizerController getTaskFragmentOrganizerController();
96 
97     /**
98      * Registers a transition player with Core. There is only one of these at a time and calling
99      * this will replace the existing one if set.
100      */
registerTransitionPlayer(in ITransitionPlayer player)101     void registerTransitionPlayer(in ITransitionPlayer player);
102 
103     /** @return An interface enabling the transition players to report its metrics. */
getTransitionMetricsReporter()104     ITransitionMetricsReporter getTransitionMetricsReporter();
105 }
106