1 /*
2  * Copyright (C) 2022 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.os.IBinder;
20 
21 /**
22  * An ISurfaceSyncGroup that can be added to another ISurfaceSyncGroup or is the root
23  * ISurfaceSyncGroup.
24  *
25  * See SurfaceSyncGroup.md
26  *
27  * {@hide}
28  */
29 interface ISurfaceSyncGroup {
30     /**
31      * Called when the ISurfaceSyncGroup is ready to begin handling a sync request. When invoked,
32      * the implementor should set up the {@link android.window.ITransactionReadyCallback}, either
33      * via system server or in the local process.
34      *
35      * @param parentSyncGroup The parent that added this ISurfaceSyncGroup
36      * @param parentSyncGroupMerge true if the ISurfaceSyncGroup is added because its child was
37      *                             added to a new SurfaceSyncGroup.
38      * @return true if it was successfully added to the sync, false otherwise.
39      */
onAddedToSyncGroup(in IBinder parentSyncGroupToken, boolean parentSyncGroupMerge)40     boolean onAddedToSyncGroup(in IBinder parentSyncGroupToken, boolean parentSyncGroupMerge);
41 
42     /**
43      * Call to add a ISurfaceSyncGroup to this ISurfaceSyncGroup. This is adding a child
44      * ISurfaceSyncGroup so this group can't complete until the child does.
45      *
46      * @param The child ISurfaceSyncGroup to add to this ISurfaceSyncGroup.
47      * @param parentSyncGroupMerge true if the current ISurfaceSyncGroup is added because its child
48      *                             was added to a new SurfaceSyncGroup. That would require the code
49      *                             to call newParent.addToSync(oldParent). When this occurs, we need
50      *                             to reverse the merge order because the oldParent should always be
51      *                             considered older than any other SurfaceSyncGroups.
52      * @return true if it was successfully added to the sync, false otherwise.
53      */
addToSync(in ISurfaceSyncGroup surfaceSyncGroup, boolean parentSyncGroupMerge)54     boolean addToSync(in ISurfaceSyncGroup surfaceSyncGroup, boolean parentSyncGroupMerge);
55 }