blob: a8cf451e2b73a6d1b7a5b729b14ce6530d25378a [file] [log] [blame]
Igor Murashkine7ee7632013-06-11 18:10:18 -07001/*
Shuzhen Wangc28189a2017-11-27 23:05:10 -08002 * Copyright (C) 2013-2018 The Android Open Source Project
Igor Murashkine7ee7632013-06-11 18:10:18 -07003 *
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#ifndef ANDROID_SERVERS_CAMERA_PHOTOGRAPHY_CAMERADEVICECLIENT_H
18#define ANDROID_SERVERS_CAMERA_PHOTOGRAPHY_CAMERADEVICECLIENT_H
19
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080020#include <android/hardware/camera2/BnCameraDeviceUser.h>
21#include <android/hardware/camera2/ICameraDeviceCallbacks.h>
Yin-Chia Yehb97babb2015-03-12 13:42:44 -070022#include <camera/camera2/OutputConfiguration.h>
Emilian Peev35ae8262018-11-08 13:11:32 +000023#include <camera/camera2/SessionConfiguration.h>
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080024#include <camera/camera2/SubmitInfo.h>
Emilian Peev2295df72021-11-12 18:14:10 -080025#include <unordered_map>
Eino-Ville Talvala7b82efe2013-07-25 17:12:35 -070026
Yin-Chia Yehb978c382019-10-30 00:22:37 -070027#include "CameraOfflineSessionClient.h"
Igor Murashkine7ee7632013-06-11 18:10:18 -070028#include "CameraService.h"
Eino-Ville Talvala7b82efe2013-07-25 17:12:35 -070029#include "common/FrameProcessorBase.h"
30#include "common/Camera2ClientBase.h"
Emilian Peev538c90e2018-12-17 18:03:19 +000031#include "CompositeStream.h"
Austin Borger74fca042022-05-23 12:41:21 -070032#include "utils/CameraServiceProxyWrapper.h"
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -080033#include "utils/SessionConfigurationUtils.h"
Igor Murashkine7ee7632013-06-11 18:10:18 -070034
Emilian Peev40ead602017-09-26 15:46:36 +010035using android::camera3::OutputStreamInfo;
Emilian Peev538c90e2018-12-17 18:03:19 +000036using android::camera3::CompositeStream;
Emilian Peev40ead602017-09-26 15:46:36 +010037
Igor Murashkine7ee7632013-06-11 18:10:18 -070038namespace android {
39
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080040struct CameraDeviceClientBase :
41 public CameraService::BasicClient,
42 public hardware::camera2::BnCameraDeviceUser
Igor Murashkine7ee7632013-06-11 18:10:18 -070043{
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080044 typedef hardware::camera2::ICameraDeviceCallbacks TCamCallbacks;
Igor Murashkine7ee7632013-06-11 18:10:18 -070045
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080046 const sp<hardware::camera2::ICameraDeviceCallbacks>& getRemoteCallback() {
Igor Murashkine7ee7632013-06-11 18:10:18 -070047 return mRemoteCallback;
48 }
49
50protected:
Austin Borger2e772b82024-10-11 16:09:57 -070051 CameraDeviceClientBase(
52 const sp<CameraService>& cameraService,
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080053 const sp<hardware::camera2::ICameraDeviceCallbacks>& remoteCallback,
Austin Borger249e6592024-03-10 22:28:11 -070054 std::shared_ptr<AttributionAndPermissionUtils> attributionAndPermissionUtils,
Austin Borger2e772b82024-10-11 16:09:57 -070055 const AttributionSourceState& clientAttribution, int callingPid,
56 bool systemNativeClient, const std::string& cameraId, int api1CameraId,
Jyoti Bhayana1f9600b2024-10-29 20:25:32 -070057 int cameraFacing, int sensorOrientation, int servicePid, int rotationOverride,
58 bool sharedMode);
Igor Murashkine7ee7632013-06-11 18:10:18 -070059
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080060 sp<hardware::camera2::ICameraDeviceCallbacks> mRemoteCallback;
Igor Murashkine7ee7632013-06-11 18:10:18 -070061};
62
63/**
64 * Implements the binder ICameraDeviceUser API,
65 * meant for HAL3-public implementation of
66 * android.hardware.photography.CameraDevice
67 */
68class CameraDeviceClient :
69 public Camera2ClientBase<CameraDeviceClientBase>,
Eino-Ville Talvala7b82efe2013-07-25 17:12:35 -070070 public camera2::FrameProcessorBase::FilteredListener
Igor Murashkine7ee7632013-06-11 18:10:18 -070071{
72public:
73 /**
74 * ICameraDeviceUser interface (see ICameraDeviceUser for details)
75 */
76
77 // Note that the callee gets a copy of the metadata.
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080078 virtual binder::Status submitRequest(
79 const hardware::camera2::CaptureRequest& request,
80 bool streaming = false,
81 /*out*/
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -080082 hardware::camera2::utils::SubmitInfo *submitInfo = nullptr) override;
Jianing Wei90e59c92014-03-12 18:29:36 -070083 // List of requests are copied.
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080084 virtual binder::Status submitRequestList(
85 const std::vector<hardware::camera2::CaptureRequest>& requests,
86 bool streaming = false,
87 /*out*/
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -080088 hardware::camera2::utils::SubmitInfo *submitInfo = nullptr) override;
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080089 virtual binder::Status cancelRequest(int requestId,
90 /*out*/
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -080091 int64_t* lastFrameNumber = NULL) override;
Igor Murashkine7ee7632013-06-11 18:10:18 -070092
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -080093 virtual binder::Status beginConfigure() override;
Ruben Brunkb2119af2014-05-09 19:57:56 -070094
Emilian Peev5fbe0ba2017-10-20 15:45:45 +010095 virtual binder::Status endConfigure(int operatingMode,
Emilian Peevcc0b7952020-01-07 13:54:47 -080096 const hardware::camera2::impl::CameraMetadataNative& sessionParams,
Shuzhen Wang316781a2020-08-18 18:11:01 -070097 int64_t startTimeMs,
Emilian Peevcc0b7952020-01-07 13:54:47 -080098 /*out*/
99 std::vector<int>* offlineStreamIds) override;
Ruben Brunkb2119af2014-05-09 19:57:56 -0700100
Emilian Peev35ae8262018-11-08 13:11:32 +0000101 // Verify specific session configuration.
102 virtual binder::Status isSessionConfigurationSupported(
103 const SessionConfiguration& sessionConfiguration,
104 /*out*/
105 bool* streamStatus) override;
106
Yin-Chia Yeh5090c732017-07-20 16:05:29 -0700107 // Returns -EBUSY if device is not idle or in error state
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800108 virtual binder::Status deleteStream(int streamId) override;
Igor Murashkine7ee7632013-06-11 18:10:18 -0700109
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800110 virtual binder::Status createStream(
111 const hardware::camera2::params::OutputConfiguration &outputConfiguration,
112 /*out*/
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800113 int32_t* newStreamId = NULL) override;
Igor Murashkine7ee7632013-06-11 18:10:18 -0700114
Chien-Yu Chen618ff8a2015-03-13 11:27:17 -0700115 // Create an input stream of width, height, and format.
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800116 virtual binder::Status createInputStream(int width, int height, int format,
Shuzhen Wang83bff122020-11-20 15:51:39 -0800117 bool isMultiResolution,
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800118 /*out*/
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800119 int32_t* newStreamId = NULL) override;
Chien-Yu Chen618ff8a2015-03-13 11:27:17 -0700120
121 // Get the buffer producer of the input stream
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800122 virtual binder::Status getInputSurface(
123 /*out*/
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800124 view::Surface *inputSurface) override;
Chien-Yu Chen618ff8a2015-03-13 11:27:17 -0700125
Igor Murashkine7ee7632013-06-11 18:10:18 -0700126 // Create a request object from a template.
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800127 virtual binder::Status createDefaultRequest(int templateId,
128 /*out*/
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800129 hardware::camera2::impl::CameraMetadataNative* request) override;
Igor Murashkine7ee7632013-06-11 18:10:18 -0700130
131 // Get the static metadata for the camera
132 // -- Caller owns the newly allocated metadata
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800133 virtual binder::Status getCameraInfo(
134 /*out*/
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800135 hardware::camera2::impl::CameraMetadataNative* cameraCharacteristics) override;
Igor Murashkine7ee7632013-06-11 18:10:18 -0700136
Zhijun He2ab500c2013-07-23 08:02:53 -0700137 // Wait until all the submitted requests have finished processing
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800138 virtual binder::Status waitUntilIdle() override;
Eino-Ville Talvalaabaa51d2013-08-14 11:37:00 -0700139
140 // Flush all active and pending requests as fast as possible
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800141 virtual binder::Status flush(
142 /*out*/
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800143 int64_t* lastFrameNumber = NULL) override;
Eino-Ville Talvalaabaa51d2013-08-14 11:37:00 -0700144
Eino-Ville Talvala4d44cad2015-04-11 13:15:45 -0700145 // Prepare stream by preallocating its buffers
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800146 virtual binder::Status prepare(int32_t streamId) override;
Eino-Ville Talvala4d44cad2015-04-11 13:15:45 -0700147
Eino-Ville Talvalab25e3c82015-07-15 16:04:27 -0700148 // Tear down stream resources by freeing its unused buffers
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800149 virtual binder::Status tearDown(int32_t streamId) override;
Eino-Ville Talvalab25e3c82015-07-15 16:04:27 -0700150
Ruben Brunkc78ac262015-08-13 17:58:46 -0700151 // Prepare stream by preallocating up to maxCount of its buffers
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800152 virtual binder::Status prepare2(int32_t maxCount, int32_t streamId) override;
Ruben Brunkc78ac262015-08-13 17:58:46 -0700153
Emilian Peev40ead602017-09-26 15:46:36 +0100154 // Update an output configuration
155 virtual binder::Status updateOutputConfiguration(int streamId,
156 const hardware::camera2::params::OutputConfiguration &outputConfiguration) override;
157
Shuzhen Wang758c2152017-01-10 18:26:18 -0800158 // Finalize the output configurations with surfaces not added before.
159 virtual binder::Status finalizeOutputConfigurations(int32_t streamId,
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800160 const hardware::camera2::params::OutputConfiguration &outputConfiguration) override;
Zhijun He5d677d12016-05-29 16:52:39 -0700161
Yin-Chia Yehcfab4e12019-09-09 13:08:28 -0700162 virtual binder::Status setCameraAudioRestriction(int32_t mode) override;
163
164 virtual binder::Status getGlobalAudioRestriction(/*out*/int32_t* outMode) override;
Yin-Chia Yehdba03232019-08-19 15:54:28 -0700165
Yin-Chia Yehb978c382019-10-30 00:22:37 -0700166 virtual binder::Status switchToOffline(
167 const sp<hardware::camera2::ICameraDeviceCallbacks>& cameraCb,
Emilian Peevb2bc5a42019-11-20 16:02:14 -0800168 const std::vector<int>& offlineOutputIds,
Yin-Chia Yehb978c382019-10-30 00:22:37 -0700169 /*out*/
170 sp<hardware::camera2::ICameraOfflineSession>* session) override;
171
Jyoti Bhayana1f9600b2024-10-29 20:25:32 -0700172 virtual binder::Status isPrimaryClient(/*out*/bool* isPrimary) override;
173
Igor Murashkine7ee7632013-06-11 18:10:18 -0700174 /**
175 * Interface used by CameraService
176 */
177
178 CameraDeviceClient(const sp<CameraService>& cameraService,
Austin Borger2e772b82024-10-11 16:09:57 -0700179 const sp<hardware::camera2::ICameraDeviceCallbacks>& remoteCallback,
180 std::shared_ptr<CameraServiceProxyWrapper> cameraServiceProxyWrapper,
181 std::shared_ptr<AttributionAndPermissionUtils> attributionAndPermissionUtils,
182 const AttributionSourceState& clientAttribution, int callingPid,
183 bool clientPackageOverride, const std::string& cameraId, int cameraFacing,
184 int sensorOrientation, int servicePid, bool overrideForPerfClass,
Jyoti Bhayana1f9600b2024-10-29 20:25:32 -0700185 int rotationOverride, const std::string& originalCameraId, bool sharedMode);
Igor Murashkine7ee7632013-06-11 18:10:18 -0700186 virtual ~CameraDeviceClient();
187
Emilian Peevbd8c5032018-02-14 23:05:40 +0000188 virtual status_t initialize(sp<CameraProviderManager> manager,
Austin Borger1c1bee02023-06-01 16:51:35 -0700189 const std::string& monitorTags) override;
Igor Murashkine7ee7632013-06-11 18:10:18 -0700190
Jayant Chowdhary44d5f622023-09-20 03:11:41 +0000191 virtual status_t setRotateAndCropOverride(uint8_t rotateAndCrop,
192 bool fromHal = false) override;
Eino-Ville Talvalaf2e37092020-01-07 15:32:32 -0800193
Bharatt Kukreja7146ced2022-10-25 15:45:29 +0000194 virtual status_t setAutoframingOverride(uint8_t autoframingValue) override;
195
Eino-Ville Talvala305cec62020-11-12 14:18:17 -0800196 virtual bool supportsCameraMute();
197 virtual status_t setCameraMute(bool enabled);
198
Shuzhen Wangaf22e912023-04-11 16:03:17 -0700199 virtual bool supportsZoomOverride() override;
200 virtual status_t setZoomOverride(int32_t zoomOverride) override;
201
Igor Murashkine7ee7632013-06-11 18:10:18 -0700202 virtual status_t dump(int fd, const Vector<String16>& args);
203
Eino-Ville Talvalac4003962016-01-13 10:07:04 -0800204 virtual status_t dumpClient(int fd, const Vector<String16>& args);
205
Austin Borger1c1bee02023-06-01 16:51:35 -0700206 virtual status_t startWatchingTags(const std::string &tags, int out);
Avichal Rakesh7e53cad2021-10-05 13:46:30 -0700207 virtual status_t stopWatchingTags(int out);
208 virtual status_t dumpWatchedEventsToVector(std::vector<std::string> &out);
209
Ravneetaeb20dc2022-03-30 05:33:03 +0000210 virtual status_t setCameraServiceWatchdog(bool enabled);
211
Shuzhen Wang16610a62022-12-15 22:38:07 -0800212 virtual void setStreamUseCaseOverrides(const std::vector<int64_t>& useCaseOverrides);
213 virtual void clearStreamUseCaseOverrides() override;
214
Igor Murashkine7ee7632013-06-11 18:10:18 -0700215 /**
Eino-Ville Talvalaf1e98d82013-09-06 09:32:43 -0700216 * Device listener interface
217 */
218
Shuzhen Wang316781a2020-08-18 18:11:01 -0700219 virtual void notifyIdle(int64_t requestCount, int64_t resultErrorCount, bool deviceError,
Eino-Ville Talvalaffc186b2024-04-09 18:10:47 -0700220 std::pair<int32_t, int32_t> mostRequestedFpsRange,
Shuzhen Wang316781a2020-08-18 18:11:01 -0700221 const std::vector<hardware::CameraStreamStats>& streamStats);
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800222 virtual void notifyError(int32_t errorCode,
Jianing Weicb0652e2014-03-12 18:29:36 -0700223 const CaptureResultExtras& resultExtras);
224 virtual void notifyShutter(const CaptureResultExtras& resultExtras, nsecs_t timestamp);
Eino-Ville Talvala4d44cad2015-04-11 13:15:45 -0700225 virtual void notifyPrepared(int streamId);
Shuzhen Wang9d066012016-09-30 11:30:20 -0700226 virtual void notifyRequestQueueEmpty();
Chien-Yu Chene8c535e2016-04-14 12:18:26 -0700227 virtual void notifyRepeatingRequestError(long lastFrameNumber);
Jyoti Bhayana1f9600b2024-10-29 20:25:32 -0700228 virtual void notifyClientSharedAccessPriorityChanged(bool primaryClient);
Eino-Ville Talvalaf1e98d82013-09-06 09:32:43 -0700229
Shuzhen Wangabbcb6b2020-12-09 22:32:44 -0800230 void setImageDumpMask(int mask) { if (mDevice != nullptr) mDevice->setImageDumpMask(mask); }
Eino-Ville Talvalaf1e98d82013-09-06 09:32:43 -0700231 /**
Igor Murashkine7ee7632013-06-11 18:10:18 -0700232 * Interface used by independent components of CameraDeviceClient.
233 */
234protected:
235 /** FilteredListener implementation **/
Jianing Weicb0652e2014-03-12 18:29:36 -0700236 virtual void onResultAvailable(const CaptureResult& result);
Igor Murashkine7ee7632013-06-11 18:10:18 -0700237 virtual void detachDevice();
238
Austin Borger1c1bee02023-06-01 16:51:35 -0700239 bool supportsUltraHighResolutionCapture(const std::string &cameraId);
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800240
241 bool isSensorPixelModeConsistent(const std::list<int> &streamIdList,
242 const CameraMetadata &settings);
243
Austin Borger1c1bee02023-06-01 16:51:35 -0700244 const CameraMetadata &getStaticInfo(const std::string &cameraId);
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800245
Igor Murashkine7ee7632013-06-11 18:10:18 -0700246private:
Shuzhen Wang0129d522016-10-30 22:43:41 -0700247 // StreamSurfaceId encapsulates streamId + surfaceId for a particular surface.
248 // streamId specifies the index of the stream the surface belongs to, and the
249 // surfaceId specifies the index of the surface within the stream. (one stream
250 // could contain multiple surfaces.)
251 class StreamSurfaceId final {
252 public:
253 StreamSurfaceId() {
254 mStreamId = -1;
255 mSurfaceId = -1;
256 }
257 StreamSurfaceId(int32_t streamId, int32_t surfaceId) {
258 mStreamId = streamId;
259 mSurfaceId = surfaceId;
260 }
261 int32_t streamId() const {
262 return mStreamId;
263 }
264 int32_t surfaceId() const {
265 return mSurfaceId;
266 }
267
268 private:
269 int32_t mStreamId;
270 int32_t mSurfaceId;
271
272 }; // class StreamSurfaceId
273
274private:
Igor Murashkine7ee7632013-06-11 18:10:18 -0700275 /** ICameraDeviceUser interface-related private members */
276
277 /** Preview callback related members */
Eino-Ville Talvala7b82efe2013-07-25 17:12:35 -0700278 sp<camera2::FrameProcessorBase> mFrameProcessor;
Igor Murashkine7ee7632013-06-11 18:10:18 -0700279
Emilian Peev00420d22018-02-05 21:33:13 +0000280 std::vector<int32_t> mSupportedPhysicalRequestKeys;
281
Eino-Ville Talvala2f09bac2016-12-13 11:29:54 -0800282 template<typename TProviderPtr>
Austin Borger1c1bee02023-06-01 16:51:35 -0700283 status_t initializeImpl(TProviderPtr providerPtr, const std::string& monitorTags);
Eino-Ville Talvala2f09bac2016-12-13 11:29:54 -0800284
Igor Murashkine7ee7632013-06-11 18:10:18 -0700285 /** Utility members */
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800286 binder::Status checkPidStatus(const char* checkLocation);
Igor Murashkine7ee7632013-06-11 18:10:18 -0700287 bool enforceRequestPermissions(CameraMetadata& metadata);
288
Zhijun He5d677d12016-05-29 16:52:39 -0700289 // Create an output stream with surface deferred for future.
290 binder::Status createDeferredSurfaceStreamLocked(
291 const hardware::camera2::params::OutputConfiguration &outputConfiguration,
Shuzhen Wang758c2152017-01-10 18:26:18 -0800292 bool isShared,
Zhijun He5d677d12016-05-29 16:52:39 -0700293 int* newStreamId = NULL);
294
Yin-Chia Yeh4dfa4cc2017-11-10 20:00:09 -0800295 // Utility method to insert the surface into SurfaceMap
296 binder::Status insertGbpLocked(const sp<IGraphicBufferProducer>& gbp,
Emilian Peevf873aa52018-01-26 14:58:28 +0000297 /*out*/SurfaceMap* surfaceMap, /*out*/Vector<int32_t>* streamIds,
298 /*out*/int32_t* currentStreamId);
Yin-Chia Yeh4dfa4cc2017-11-10 20:00:09 -0800299
Shuzhen Wang0129d522016-10-30 22:43:41 -0700300 // IGraphicsBufferProducer binder -> Stream ID + Surface ID for output streams
301 KeyedVector<sp<IBinder>, StreamSurfaceId> mStreamMap;
Igor Murashkine7ee7632013-06-11 18:10:18 -0700302
Yin-Chia Yeh4dfa4cc2017-11-10 20:00:09 -0800303 // Stream ID -> OutputConfiguration. Used for looking up Surface by stream/surface index
304 KeyedVector<int32_t, hardware::camera2::params::OutputConfiguration> mConfiguredOutputs;
305
Emilian Peev2295df72021-11-12 18:14:10 -0800306 // Dynamic range profile id -> Supported dynamic profiles bitmap within an single capture
307 // request
Emilian Peevc81a7592022-02-14 17:38:18 -0800308 std::unordered_map<int64_t, int64_t> mDynamicProfileMap;
Emilian Peev2295df72021-11-12 18:14:10 -0800309
Chien-Yu Chen618ff8a2015-03-13 11:27:17 -0700310 struct InputStreamConfiguration {
311 bool configured;
312 int32_t width;
313 int32_t height;
314 int32_t format;
315 int32_t id;
316 } mInputStream;
317
Chien-Yu Chene8c535e2016-04-14 12:18:26 -0700318 // Streaming request ID
319 int32_t mStreamingRequestId;
Shuzhen Wangc9ca6782016-04-26 13:40:31 -0700320 Mutex mStreamingRequestIdLock;
Chien-Yu Chene8c535e2016-04-14 12:18:26 -0700321 static const int32_t REQUEST_ID_NONE = -1;
Igor Murashkine7ee7632013-06-11 18:10:18 -0700322
323 int32_t mRequestIdCounter;
Eino-Ville Talvala412fe562015-08-20 17:08:32 -0700324
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800325 std::vector<std::string> mPhysicalCameraIds;
326
Zhijun He5d677d12016-05-29 16:52:39 -0700327 // The list of output streams whose surfaces are deferred. We have to track them separately
328 // as there are no surfaces available and can not be put into mStreamMap. Once the deferred
329 // Surface is configured, the stream id will be moved to mStreamMap.
330 Vector<int32_t> mDeferredStreams;
Shuzhen Wang0129d522016-10-30 22:43:41 -0700331
Shuzhen Wang758c2152017-01-10 18:26:18 -0800332 // stream ID -> outputStreamInfo mapping
333 std::unordered_map<int32_t, OutputStreamInfo> mStreamInfoMap;
334
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800335 // map high resolution camera id (logical / physical) -> list of stream ids configured
336 std::unordered_map<std::string, std::unordered_set<int>> mHighResolutionCameraIdToStreamIdSet;
337
338 // set of high resolution camera id (logical / physical)
339 std::unordered_set<std::string> mHighResolutionSensors;
340
Emilian Peev2f5d6012022-01-19 16:16:50 -0800341 // Synchronize access to 'mCompositeStreamMap'
342 Mutex mCompositeLock;
Emilian Peev538c90e2018-12-17 18:03:19 +0000343 KeyedVector<sp<IBinder>, sp<CompositeStream>> mCompositeStreamMap;
344
Shuzhen Wang03d8cc12018-09-12 14:17:09 -0700345 sp<CameraProviderManager> mProviderManager;
Shuzhen Wangd4abdf72021-05-28 11:22:50 -0700346
347 // Override the camera characteristics for performance class primary cameras.
348 bool mOverrideForPerfClass;
Shuzhen Wangd26b1862022-03-07 12:05:05 -0800349
Eino-Ville Talvalaffc186b2024-04-09 18:10:47 -0700350 // Various fields used to collect session statistics
351 struct RunningSessionStats {
352 // The string representation of object passed into CaptureRequest.setTag.
353 std::string mUserTag;
354 // The last set video stabilization mode
355 int mVideoStabilizationMode = -1;
356 // Whether a zoom_ratio < 1.0 has been used during this session
357 bool mUsedUltraWide = false;
358 // Whether a zoom settings override has been used during this session
359 bool mUsedSettingsOverrideZoom = false;
360 } mRunningSessionStats;
malikakash73125c62023-07-21 22:44:34 +0000361
362 // This only exists in case of camera ID Remapping.
363 const std::string mOriginalCameraId;
Igor Murashkine7ee7632013-06-11 18:10:18 -0700364};
365
366}; // namespace android
367
368#endif