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 android.car.evs;
18 
19 import android.car.evs.CarEvsBufferDescriptor;
20 import android.car.evs.CarEvsStatus;
21 import android.car.evs.ICarEvsStatusListener;
22 import android.car.evs.ICarEvsStreamCallback;
23 import android.os.IBinder;
24 
25 /**
26  * @hide
27  */
28 interface ICarEvsService {
29 
30     /**
31      * Registers a listener to receive changes in CarEvsManager's status.
32      */
registerStatusListener(in ICarEvsStatusListener listener)33     void registerStatusListener(in ICarEvsStatusListener listener);
34 
35     /**
36      * Unregisters a service listener.
37      */
unregisterStatusListener(in ICarEvsStatusListener listener)38     void unregisterStatusListener(in ICarEvsStatusListener listener);
39 
40     /**
41      * Requests to start a video stream.
42      */
startVideoStream(int serviceType, in IBinder token, in ICarEvsStreamCallback callback)43     int startVideoStream(int serviceType, in IBinder token, in ICarEvsStreamCallback callback);
44 
45     /**
46      * Requests to stop an active video stream.
47      */
stopVideoStream(in ICarEvsStreamCallback callback)48     void stopVideoStream(in ICarEvsStreamCallback callback);
49 
50     /**
51      * Requests to stop an active video stream from a given service type.
52      */
stopVideoStreamFrom(in int serviceType, in ICarEvsStreamCallback callback)53     void stopVideoStreamFrom(in int serviceType, in ICarEvsStreamCallback callback);
54 
55     /**
56      * Returns the buffer when its usages are done.
57      */
returnFrameBuffer(in CarEvsBufferDescriptor buffer)58     void returnFrameBuffer(in CarEvsBufferDescriptor buffer);
59 
60     /**
61      * Returns a current status of a given CarEvsService type.
62      */
getCurrentStatus(in int serviceType)63     CarEvsStatus getCurrentStatus(in int serviceType);
64 
65     /**
66      * Returns a generated session token.
67      */
generateSessionToken()68     IBinder generateSessionToken();
69 
70     /**
71      * Requests to start a camera previewing activity for a given service type.
72      */
startActivity(int type)73     int startActivity(int type);
74 
75     /**
76      * Requests to stop a camera previewing activity, which was launched via startActivity().
77      */
stopActivity()78     void stopActivity();
79 
80     /**
81      * Returns whether or not a given service type is supported.
82      */
isSupported(int type)83     boolean isSupported(int type);
84 }
85