1 /*
2  * Copyright (C) 2019 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.media.eco;
18 
19 import android.media.eco.ECOData;
20 import android.media.eco.IECOServiceStatsProvider;
21 import android.media.eco.IECOServiceInfoListener;
22 
23 /**
24  * Binder interface for ECO Session.
25  * @hide
26  */
27 interface IECOSession {
28     /**
29      * All ECO session Binder calls may return a ServiceSpecificException with the following error
30      * codes.
31      */
32     const int ERROR_PERMISSION_DENIED = 1;
33     const int ERROR_ALREADY_EXISTS = 2;
34     const int ERROR_ILLEGAL_ARGUMENT = 3;
35     const int ERROR_DISCONNECTED = 4;
36     const int ERROR_INVALID_OPERATION = 5;
37     const int ERROR_UNSUPPORTED = 6;
38 
39     /**
40      * Adds an ECOServiceStasProvider.
41      *
42      * <p>This is called by ECOServiceStasProvider to add itself to the ECOSession.</p>
43      *
44      * @param provider Provider that implements IECOServiceStatsProvider interface.
45      * @param config  Config that specifies the types of the stats that the provider is going to
46      *                provide. The ECOData must be of type DATA_TYPE_STATS_PROVIDER_CONFIG. Note:
47      *                The provider must specify the following keys when adding itself:
48      *                KEY_PROVIDER_NAME in string and KEY_PROVIDER_TYPE as specified in
49      *                IECOServiceStatsProvider.
50      *
51      * @return true if the provider was successfully added, false otherwise.
52      */
addStatsProvider(IECOServiceStatsProvider provider, in ECOData config)53     boolean addStatsProvider(IECOServiceStatsProvider provider, in ECOData config);
54 
55     /**
56      * Removes an ECOServiceStasProvider from ECOSession.
57      *
58      * @param provider Provider that implements IECOServiceStatsProvider interface.
59      *
60      * @return true if the provider was successfully removed, false otherwise.
61      */
removeStatsProvider(IECOServiceStatsProvider provider)62     boolean removeStatsProvider(IECOServiceStatsProvider provider);
63 
64     /**
65      * Registers an ECOServiceInfoListener.
66      *
67      * <p>This is called by IECOServiceInfoListener to add itself to the ECOSession.</p>
68      *
69      * @param listener Listener that implements IECOServiceInfoListener interface.
70      * @param config  Config that specifies the condition for the data that the listener is
71      *                interested in.
72      *
73      * @return true if the listener was successfully added, false otherwise.
74      */
addInfoListener(IECOServiceInfoListener listener, in ECOData config)75     boolean addInfoListener(IECOServiceInfoListener listener, in ECOData config);
76 
77     /**
78      * Removes an ECOServiceInfoListener from ECOSession.
79      *
80      * @param listener Listener that implements IECOServiceInfoListener interface.
81      *
82      * @return true if the listener was successfully removed, false otherwise.
83      */
removeInfoListener(IECOServiceInfoListener listener)84     boolean removeInfoListener(IECOServiceInfoListener listener);
85 
86     /**
87      * Push new stats to the ECOSession. This should only be called by IECOServiceStatsProvider.
88      */
pushNewStats(in ECOData newStats)89     boolean pushNewStats(in ECOData newStats);
90 
91     /**
92      * Return the width in pixels.
93      */
getWidth()94     int getWidth();
95 
96     /**
97      * Return the height in pixels.
98      */
getHeight()99     int getHeight();
100 
101     /**
102      * Return whether the session is for camera recording.
103      */
getIsCameraRecording()104     boolean getIsCameraRecording();
105 
106     /**
107      * Query the number of listeners that a session has.
108      */
getNumOfListeners()109     int getNumOfListeners();
110 
111     /**
112      * Query the number of providers that a session has.
113      */
getNumOfProviders()114     int getNumOfProviders();
115 }
116