Yin-Chia Yeh | 91e0778 | 2019-10-07 15:18:42 -0700 | [diff] [blame] | 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.hardware.camera.device@3.6; |
| 18 | |
| 19 | import android.hardware.camera.common@1.0::Status; |
| 20 | import @3.5::ICameraDeviceSession; |
| 21 | import @3.5::StreamConfiguration; |
| 22 | import ICameraOfflineSession; |
| 23 | |
| 24 | /** |
| 25 | * Camera device active session interface. |
| 26 | * |
| 27 | * Obtained via ICameraDevice::open(), this interface contains the methods to |
| 28 | * configure and request captures from an active camera device. |
| 29 | */ |
| 30 | interface ICameraDeviceSession extends @3.5::ICameraDeviceSession { |
| 31 | /** |
| 32 | * configureStreams_3_6: |
| 33 | * |
| 34 | * Identical to @3.5::ICameraDeviceSession.configureStreams, except that: |
| 35 | * |
| 36 | * - a boolean supportOffline is added to HalStreamConfiguration to indicate |
| 37 | * if this stream can be switched to offline mode later. |
| 38 | * |
| 39 | * @return status Status code for the operation, one of: |
| 40 | * OK: |
| 41 | * On successful stream configuration. |
| 42 | * INTERNAL_ERROR: |
| 43 | * If there has been a fatal error and the device is no longer |
| 44 | * operational. Only close() can be called successfully by the |
| 45 | * framework after this error is returned. |
| 46 | * ILLEGAL_ARGUMENT: |
| 47 | * If the requested stream configuration is invalid. Some examples |
| 48 | * of invalid stream configurations include: |
| 49 | * - Including more than 1 INPUT stream |
| 50 | * - Not including any OUTPUT streams |
| 51 | * - Including streams with unsupported formats, or an unsupported |
| 52 | * size for that format. |
| 53 | * - Including too many output streams of a certain format. |
| 54 | * - Unsupported rotation configuration |
| 55 | * - Stream sizes/formats don't satisfy the |
| 56 | * StreamConfigurationMode requirements |
| 57 | * for non-NORMAL mode, or the requested operation_mode is not |
| 58 | * supported by the HAL. |
| 59 | * - Unsupported usage flag |
| 60 | * The camera service cannot filter out all possible illegal stream |
| 61 | * configurations, since some devices may support more simultaneous |
| 62 | * streams or larger stream resolutions than the minimum required |
| 63 | * for a given camera device hardware level. The HAL must return an |
| 64 | * ILLEGAL_ARGUMENT for any unsupported stream set, and then be |
| 65 | * ready to accept a future valid stream configuration in a later |
| 66 | * configureStreams call. |
| 67 | * @return halConfiguration The stream parameters desired by the HAL for |
| 68 | * each stream, including maximum buffers, the usage flags, and the |
| 69 | * override format. |
| 70 | */ |
| 71 | configureStreams_3_6(@3.5::StreamConfiguration requestedConfiguration) |
| 72 | generates (Status status, HalStreamConfiguration halConfiguration); |
| 73 | |
| 74 | /** |
| 75 | * switchToOffline: |
| 76 | * |
| 77 | * Switch the current running session from actively streaming mode to the |
| 78 | * offline mode. See ICameraOfflineSession for more details. |
| 79 | * |
| 80 | * The streamsToKeep argument contains list of streams IDs where application |
| 81 | * still needs its output. For all streams application does not need anymore, |
| 82 | * camera HAL can send ERROR_BUFFER to speed up the transition, or even send |
| 83 | * ERROR_REQUEST if all output targets of a request is not needed. By the |
| 84 | * time this call returns, camera HAL must have returned all buffers coming |
| 85 | * from streams no longer needed and have erased buffer caches of such streams. |
| 86 | * |
| 87 | * For all requests that are going to be transferred to offline session, |
| 88 | * the ICameraDeviceSession is responsible to capture all input buffers from |
| 89 | * the image sensor before the switchToOffline call returns. Before |
| 90 | * switchToOffline returns, camera HAL must have completed all requests not |
| 91 | * switching to offline mode, and collected information on what streams and |
| 92 | * requests are going to continue in the offline session, in the |
| 93 | * offlineSessionInfo output argument. |
| 94 | * |
| 95 | * If there are no requests qualified to be transferred to offline session, |
| 96 | * the camera HAL must return a null ICameraOfflineSession object with OK |
| 97 | * status. In this scenario, the camera HAL still must flush all inflight |
| 98 | * requests and unconfigure all streams before returning this call. |
| 99 | * |
| 100 | * After switchToOffline returns, the ICameraDeviceSession must be back to |
| 101 | * unconfigured state as if it is just created and no streams are configured. |
| 102 | * Also, camera HAL must not call any methods in ICameraDeviceCallback since |
| 103 | * all unfinished requests are now transferred to the offline session. |
| 104 | * After the call returns, camera service may then call close to close |
| 105 | * the camera device, or call configureStream* again to reconfigure the |
| 106 | * camera and then send new capture requests with processCaptureRequest. In |
| 107 | * the latter case, it is legitimate for camera HAL to call methods in |
| 108 | * ICameraDeviceCallback again in response to the newly submitted capture |
| 109 | * requests. |
| 110 | * |
| 111 | * @return status Status code for the operation, one of: |
| 112 | * OK: |
| 113 | * On switching to offline session and unconfiguring streams |
| 114 | * successfully. |
| 115 | * ILLEGAL_ARGUMENT: |
| 116 | * If camera does not support offline mode in any one of streams |
| 117 | * in streamsToKeep argument. Note that the camera HAL must report |
| 118 | * if a stream supports offline mode in HalStreamConfiguration |
| 119 | * output of configureStreams_3_6 method. If all streams in |
| 120 | * streamsToKeep argument support offline mode, then the camera HAL |
| 121 | * must not return this error. |
| 122 | * |
| 123 | * |
| 124 | * @return offlineSessionInfo Information on what streams and requests will |
| 125 | * be transferred to offline session to continue processing. |
| 126 | * |
| 127 | * @return offlineSession The offline session object camera service will use |
| 128 | * to interact with. |
| 129 | */ |
| 130 | switchToOffline(vec<int32_t> streamsToKeep) generates (Status status, |
| 131 | CameraOfflineSessionInfo offlineSessionInfo, ICameraOfflineSession offlineSession); |
| 132 | }; |