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 com.android.car.internal.evs;
18 
19 import android.hardware.HardwareBuffer;
20 
21 /**
22  * Abstracts EVS HAL. This is used as an interface between updatable and builtin.
23  *
24  * @hide
25  */
26 public abstract class EvsHalWrapper {
27     /** Callback for events from HAL */
28     public interface HalEventCallback {
29         /** EVS stream event handler called after a native handler */
onHalEvent(int eventType)30         void onHalEvent(int eventType);
31 
32         /** EVS frame handler called after a native handler */
onFrameEvent(int id, HardwareBuffer buffer)33         void onFrameEvent(int id, HardwareBuffer buffer);
34 
35         /** EVS service death handler called after a native handler */
onHalDeath()36         void onHalDeath();
37     }
38 
39     /** Initialize HAL */
init()40     public boolean init() {
41         return false;
42     }
43 
44     /** Release HAL */
release()45     public void release() {
46     }
47 
48     /** is connected to HAL */
isConnected()49     public boolean isConnected() {
50         return false;
51     }
52 
53     /** Attempts to connect to the HAL service if it has not done yet */
connectToHalServiceIfNecessary()54     public boolean connectToHalServiceIfNecessary() {
55         return false;
56     }
57 
58     /** Attempts to disconnect from the HAL service */
disconnectFromHalService()59     public void disconnectFromHalService() {
60     }
61 
62     /** Attempts to open a target camera device */
openCamera(String cameraId)63     public boolean openCamera(String cameraId) {
64         return false;
65     }
66 
67     /** Requests to close a target camera device */
closeCamera()68     public void closeCamera() {
69     }
70 
71     /** Requests to start a video stream */
requestToStartVideoStream()72     public boolean requestToStartVideoStream() {
73         return false;
74     }
75 
76     /** Requests to stop a video stream */
requestToStopVideoStream()77     public void requestToStopVideoStream() {
78     }
79 
80     /** Request to return an used buffer */
doneWithFrame(int bufferId)81     public void doneWithFrame(int bufferId) {
82     }
83 }
84