1/* 2 * Copyright (C) 2018 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 [email protected]; 18 19import [email protected]::Status; 20import @3.2::CameraMetadata; 21import @3.4::ICameraDeviceSession; 22import @3.4::HalStreamConfiguration; 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 */ 30interface ICameraDeviceSession extends @3.4::ICameraDeviceSession { 31 32 /** 33 * configureStreams_3_5: 34 * 35 * Identical to @3.4::ICameraDeviceSession.configureStreams, except that: 36 * 37 * - a streamConfigCounter counter is provided to check for race condition 38 * between configureStreams_3_5 and signalStreamFlush call. 39 * - In case the HAL overrides dataspace or format for 40 * IMPLEMENTATION_DEFINED pixel format, camera framework must use original 41 * dataspace and format in subsequent configureStreams_3_5 calls for the same 42 * stream. HAL is allowed to change the overriding behavior of format or 43 * dataspace for reconfiguration of the same stream depending on the stream 44 * combination. 45 * 46 * @return status Status code for the operation, one of: 47 * OK: 48 * On successful stream configuration. 49 * INTERNAL_ERROR: 50 * If there has been a fatal error and the device is no longer 51 * operational. Only close() can be called successfully by the 52 * framework after this error is returned. 53 * ILLEGAL_ARGUMENT: 54 * If the requested stream configuration is invalid. Some examples 55 * of invalid stream configurations include: 56 * - Including more than 1 INPUT stream 57 * - Not including any OUTPUT streams 58 * - Including streams with unsupported formats, or an unsupported 59 * size for that format. 60 * - Including too many output streams of a certain format. 61 * - Unsupported rotation configuration 62 * - Stream sizes/formats don't satisfy the 63 * StreamConfigurationMode requirements 64 * for non-NORMAL mode, or the requested operation_mode is not 65 * supported by the HAL. 66 * - Unsupported usage flag 67 * The camera service cannot filter out all possible illegal stream 68 * configurations, since some devices may support more simultaneous 69 * streams or larger stream resolutions than the minimum required 70 * for a given camera device hardware level. The HAL must return an 71 * ILLEGAL_ARGUMENT for any unsupported stream set, and then be 72 * ready to accept a future valid stream configuration in a later 73 * configureStreams call. 74 * @return halConfiguration The stream parameters desired by the HAL for 75 * each stream, including maximum buffers, the usage flags, and the 76 * override format. 77 */ 78 configureStreams_3_5(@3.5::StreamConfiguration requestedConfiguration) 79 generates (Status status, 80 @3.4::HalStreamConfiguration halConfiguration); 81 82 83 /** 84 * signalStreamFlush: 85 * 86 * Signaling HAL camera service is about to perform configureStreams_3_5 and 87 * HAL must return all buffers of designated streams. HAL must finish 88 * inflight requests normally and return all buffers that belongs to the 89 * designated streams through processCaptureResult or returnStreamBuffer 90 * API in a timely manner, or camera service will run into a fatal error. 91 * 92 * Note that this call serves as an optional hint and camera service may 93 * skip sending this call if all buffers are already returned. 94 * 95 * @param streamIds The ID of streams camera service need all of its 96 * buffers returned. 97 * 98 * @param streamConfigCounter Note that due to concurrency nature, it is 99 * possible the signalStreamFlush call arrives later than the 100 * corresponding configureStreams_3_5 call, HAL must check 101 * streamConfigCounter for such race condition. If the counter is less 102 * than the counter in the last configureStreams_3_5 call HAL last 103 * received, the call is stale and HAL should just return this call. 104 */ 105 oneway signalStreamFlush( 106 vec<int32_t> streamIds, 107 uint32_t streamConfigCounter 108 ); 109 110 /** 111 * isReconfigurationRequired: 112 * 113 * Check whether complete stream reconfiguration is required for possible new session 114 * parameter values. 115 * 116 * This method must be called by the camera framework in case the client changes 117 * the value of any advertised session parameters. Depending on the specific values 118 * the HAL can decide whether a complete stream reconfiguration is required. In case 119 * the HAL returns false, the camera framework must skip the internal reconfiguration. 120 * In case Hal returns true, the framework must reconfigure the streams and pass the 121 * new session parameter values accordingly. 122 * This call may be done by the framework some time before the request with new parameters 123 * is submitted to the HAL, and the request may be cancelled before it ever gets submitted. 124 * Therefore, the HAL must not use this query as an indication to change its behavior in any 125 * way. 126 * ------------------------------------------------------------------------ 127 * 128 * Preconditions: 129 * 130 * The framework can call this method at any time after active 131 * session configuration. There must be no impact on the performance of 132 * pending camera requests in any way. In particular there must not be 133 * any glitches or delays during normal camera streaming. 134 * 135 * Performance requirements: 136 * HW and SW camera settings must not be changed and there must not be 137 * a user-visible impact on camera performance. 138 * 139 * @param oldSessionParams Before session parameters, usually the current session parameters. 140 * @param newSessionParams The new session parameters which may be set by client. 141 * 142 * @return Status Status code for the operation, one of: 143 * OK: 144 * On successful reconfiguration required query. 145 * METHOD_NOT_SUPPORTED: 146 * The camera device does not support the reconfiguration query. 147 * INTERNAL_ERROR: 148 * The reconfiguration query cannot complete due to internal 149 * error. 150 * @return true in case the stream reconfiguration is required, false otherwise. 151 */ 152 isReconfigurationRequired(CameraMetadata oldSessionParams, CameraMetadata newSessionParams) 153 generates(Status status, bool reconfigurationNeeded); 154}; 155