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 new transition.
55      * @param type The transition type.
56      * @param t Operations that are part of the transition.
57      * @return a token representing the transition.
58      */
startNewTransition(int type, in @nullable WindowContainerTransaction t)59     IBinder startNewTransition(int type, in @nullable WindowContainerTransaction t);
60 
61     /**
62      * Starts the given transition.
63      * @param transitionToken A token associated with the transition to start.
64      * @param t Operations that are part of the transition.
65      */
startTransition(IBinder transitionToken, in @nullable WindowContainerTransaction t)66     void startTransition(IBinder transitionToken, in @nullable WindowContainerTransaction t);
67 
68     /**
69      * Starts a legacy transition.
70      * @param type The transition type.
71      * @param adapter The animation to use.
72      * @param syncCallback A sync callback for the contents of `t`
73      * @param t Operations that are part of the transition.
74      * @return sync-id or -1 if this no-op'd because a transition is already running.
75      */
startLegacyTransition(int type, in RemoteAnimationAdapter adapter, in IWindowContainerTransactionCallback syncCallback, in WindowContainerTransaction t)76     int startLegacyTransition(int type, in RemoteAnimationAdapter adapter,
77             in IWindowContainerTransactionCallback syncCallback, in WindowContainerTransaction t);
78 
79     /**
80      * Finishes a transition. This must be called for all created transitions.
81      * @param transitionToken Which transition to finish
82      * @param t Changes to make before finishing but in the same SF Transaction. Can be null.
83      */
finishTransition(in IBinder transitionToken, in @nullable WindowContainerTransaction t)84     void finishTransition(in IBinder transitionToken, in @nullable WindowContainerTransaction t);
85 
86     /** @return An interface enabling the management of task organizers. */
getTaskOrganizerController()87     ITaskOrganizerController getTaskOrganizerController();
88 
89     /** @return An interface enabling the management of display area organizers. */
getDisplayAreaOrganizerController()90     IDisplayAreaOrganizerController getDisplayAreaOrganizerController();
91 
92     /** @return An interface enabling the management of task fragment organizers. */
getTaskFragmentOrganizerController()93     ITaskFragmentOrganizerController getTaskFragmentOrganizerController();
94 
95     /**
96      * Registers a transition player with Core. There is only one of these active at a time so
97      * calling this will replace the existing one (if set) until it is unregistered.
98      */
registerTransitionPlayer(in ITransitionPlayer player)99     void registerTransitionPlayer(in ITransitionPlayer player);
100 
101     /**
102      * Un-registers a transition player from Core. This will restore whichever player was active
103      * prior to registering this one.
104      */
unregisterTransitionPlayer(in ITransitionPlayer player)105     void unregisterTransitionPlayer(in ITransitionPlayer player);
106 
107     /** @return An interface enabling the transition players to report its metrics. */
getTransitionMetricsReporter()108     ITransitionMetricsReporter getTransitionMetricsReporter();
109 
110     /** @return The transaction queue token used by WM. */
getApplyToken()111     IBinder getApplyToken();
112 }
113