blob: 564167b75bf07e7acadfd73754281658c4c52b8c [file] [log] [blame]
Zhijun He8486e412016-09-12 15:30:51 -07001/*
2 * Copyright (C) 2016 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
17package android.hardware.camera.provider@2.4;
18
19import ICameraProviderCallback;
20import android.hardware.camera.common@1.0::types;
21import android.hardware.camera.device@1.0::ICameraDevice;
22import android.hardware.camera.device@3.2::ICameraDevice;
23
24/**
25 * Camera provider HAL, which enumerates the available individual camera devices
26 * known to the provider, and provides updates about changes to device status,
27 * such as connection, disconnection, or torch mode enable/disable.
28 *
29 * The provider is responsible for generating a list of camera device service
30 * names that can then be opened via the hardware service manager.
31 *
32 * Multiple camera provider HALs may be present in a single system.
33 * For discovery, the service names, and process names, must be of the form
34 * "android.hardware.camera.provider@<major>.<minor>/<type>/<instance>"
35 * where
36 * - <major>/<minor> is the provider HAL HIDL version,
37 * - <type> is the type of devices this provider knows about, such as
38 * "internal", "legacy", "usb", or "remote"
39 * - <instance> is a non-negative integer starting from 0 to disambiguate
40 * between multiple HALs of the same type.
41 *
42 * The "legacy" type is only used for passthrough legacy HAL mode, and must
43 * not be used by a standalone binderized HAL.
44 *
45 * The device instance names enumerated by the provider must be of the form
46 * "device@<major>.<minor>/<type>/<id>" where
47 * <major>/<minor> is the HIDL version of the interface. <id> is either a small
48 * incrementing integer for "internal" device types, with 0 being the main
49 * back-facing camera and 1 being the main front-facing camera, if they exist.
50 * Or, for external devices such as type "usb", a unique serial number that can
51 * be used to identify the device reliably when it is disconnected and
52 * reconnected. Multiple providers may not enumerate the same device ID.
53 *
54 */
55interface ICameraProvider {
56
57 /**
58 * setCallback:
59 *
60 * Provide a callback interface to the HAL provider to inform framework of
61 * asynchronous camera events. The framework must call this function once
62 * during camera service startup, before any other calls to the provider
63 * (note that in case the camera service restarts, this method must be
64 * invoked again during its startup).
65 *
66 * @param callback
67 * A non-null callback interface to invoke when camera events occur.
68 * @return status
69 * Status code for the operation, one of:
70 * OK:
71 * On success
72 * INTERNAL_ERROR:
73 * An unexpected internal error occurred while setting the callbacks
74 * ILLEGAL_ARGUMENT:
75 * The callback argument is invalid (for example, null).
76 *
77 */
78 setCallback(ICameraProviderCallback callback) generates (Status status);
79
80 /**
81 * getVendorTags:
82 *
83 * Retrieve all vendor tags supported by devices discoverable through this
84 * provider. The tags are grouped into sections.
85 *
86 * @return status
87 * Status code for the operation, one of:
88 * OK:
89 * On success
90 * INTERNAL_ERROR:
91 * An unexpected internal error occurred while setting the callbacks
92 * @return sections
93 * The supported vendor tag sections; empty if there are no supported
94 * vendor tags, or status is not OK.
95 *
96 */
97 getVendorTags() generates (Status status, vec<VendorTagSection> sections);
98
99 /**
100 * getCameraDeviceList:
101 *
102 * Returns the list of internal camera device interfaces known to this
103 * camera provider. These devices can then be accessed via the hardware
104 * service manager.
105 *
106 * External camera devices (camera facing EXTERNAL) must be reported through
107 * the device status change callback, not in this list. Only devices with
108 * facing BACK or FRONT must be listed here.
109 *
110 * @return status Status code for the operation, one of:
111 * OK:
112 * On a succesful generation of camera ID list
113 * INTERNAL_ERROR:
114 * A camera ID list cannot be created. This may be due to
115 * a failure to initialize the camera subsystem, for example.
116 * @return cameraDeviceServiceNames The vector of internal camera device
117 * names known to this provider.
118 */
119 getCameraIdList()
120 generates (Status status, vec<string> cameraDeviceNames);
121
122 /**
123 * getCameraDeviceInterface_VN_x:
124 *
125 * Return a android.hardware.camera.device@N.x/ICameraDevice interface for
126 * the requested device name. This does not power on the camera device, but
127 * simply acquires the interface for querying the device static information,
128 * or to additionally open the device for active use.
129 *
130 * A separate method is required for each major revision of the camera device
131 * HAL interface, since they are not compatible with each other.
132 *
133 * Valid device names for this provider can be obtained via either
134 * getCameraIdList(), or via availability callbacks from
135 * ICameraProviderCallback::cameraDeviceStatusChange().
136 *
137 * The returned interface must be of the highest defined minor version for
138 * the major version; it's the responsibility of the HAL client to ensure
139 * they do not use methods/etc that are not valid for the actual minor
140 * version of the device.
141 *
142 * @param cameraDeviceName the name of the device to get an interface to.
143 * @return status Status code for the operation, one of:
144 * OK:
145 * On a succesful generation of camera ID list
146 * ILLEGAL_ARGUMENT:
147 * This device name is unknown, or has been disconnected
148 * OPERATION_NOT_SUPPORTED:
149 * The specified device does not support this major version of the
150 * HAL interface.
151 * INTERNAL_ERROR:
152 * A camera interface cannot be returned due to an unexpected
153 * internal error.
154 * @return device The inteface to this camera device, or null in case of
155 * error.
156 */
157 getCameraDeviceInterface_V1_x(string cameraDeviceName) generates
158 (Status status,
159 android.hardware.camera.device@1.0::ICameraDevice device);
160 getCameraDeviceInterface_V3_x(string cameraDeviceName) generates
161 (Status status,
162 android.hardware.camera.device@3.2::ICameraDevice device);
163
164};