blob: c2f7f5685b388378b55052eacc00310603471dd6 [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:
51 CameraDeviceClientBase(const sp<CameraService>& cameraService,
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080052 const sp<hardware::camera2::ICameraDeviceCallbacks>& remoteCallback,
Austin Borger1c1bee02023-06-01 16:51:35 -070053 const std::string& clientPackageName,
Jayant Chowdharyeb0169f2022-01-31 00:00:02 -080054 bool systemNativeClient,
Austin Borger1c1bee02023-06-01 16:51:35 -070055 const std::optional<std::string>& clientFeatureId,
56 const std::string& cameraId,
Yin-Chia Yehc3e9d6f2018-02-06 10:56:32 -080057 int api1CameraId,
Igor Murashkine7ee7632013-06-11 18:10:18 -070058 int cameraFacing,
Emilian Peev8b64f282021-03-25 16:49:57 -070059 int sensorOrientation,
Igor Murashkine7ee7632013-06-11 18:10:18 -070060 int clientPid,
61 uid_t clientUid,
Austin Borger18b30a72022-10-27 12:20:29 -070062 int servicePid,
63 bool overrideToPortrait);
Igor Murashkine7ee7632013-06-11 18:10:18 -070064
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080065 sp<hardware::camera2::ICameraDeviceCallbacks> mRemoteCallback;
Igor Murashkine7ee7632013-06-11 18:10:18 -070066};
67
68/**
69 * Implements the binder ICameraDeviceUser API,
70 * meant for HAL3-public implementation of
71 * android.hardware.photography.CameraDevice
72 */
73class CameraDeviceClient :
74 public Camera2ClientBase<CameraDeviceClientBase>,
Eino-Ville Talvala7b82efe2013-07-25 17:12:35 -070075 public camera2::FrameProcessorBase::FilteredListener
Igor Murashkine7ee7632013-06-11 18:10:18 -070076{
77public:
78 /**
79 * ICameraDeviceUser interface (see ICameraDeviceUser for details)
80 */
81
82 // Note that the callee gets a copy of the metadata.
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080083 virtual binder::Status submitRequest(
84 const hardware::camera2::CaptureRequest& request,
85 bool streaming = false,
86 /*out*/
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -080087 hardware::camera2::utils::SubmitInfo *submitInfo = nullptr) override;
Jianing Wei90e59c92014-03-12 18:29:36 -070088 // List of requests are copied.
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080089 virtual binder::Status submitRequestList(
90 const std::vector<hardware::camera2::CaptureRequest>& requests,
91 bool streaming = false,
92 /*out*/
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -080093 hardware::camera2::utils::SubmitInfo *submitInfo = nullptr) override;
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080094 virtual binder::Status cancelRequest(int requestId,
95 /*out*/
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -080096 int64_t* lastFrameNumber = NULL) override;
Igor Murashkine7ee7632013-06-11 18:10:18 -070097
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -080098 virtual binder::Status beginConfigure() override;
Ruben Brunkb2119af2014-05-09 19:57:56 -070099
Emilian Peev5fbe0ba2017-10-20 15:45:45 +0100100 virtual binder::Status endConfigure(int operatingMode,
Emilian Peevcc0b7952020-01-07 13:54:47 -0800101 const hardware::camera2::impl::CameraMetadataNative& sessionParams,
Shuzhen Wang316781a2020-08-18 18:11:01 -0700102 int64_t startTimeMs,
Emilian Peevcc0b7952020-01-07 13:54:47 -0800103 /*out*/
104 std::vector<int>* offlineStreamIds) override;
Ruben Brunkb2119af2014-05-09 19:57:56 -0700105
Emilian Peev35ae8262018-11-08 13:11:32 +0000106 // Verify specific session configuration.
107 virtual binder::Status isSessionConfigurationSupported(
108 const SessionConfiguration& sessionConfiguration,
109 /*out*/
110 bool* streamStatus) override;
111
Bharatt Kukreja6dddeb72023-11-21 10:06:25 +0000112 virtual binder::Status getSessionCharacteristics(
113 const SessionConfiguration& sessionConfiguration,
114 /*out*/
115 hardware::camera2::impl::CameraMetadataNative* sessionCharacteristics) override;
116
Yin-Chia Yeh5090c732017-07-20 16:05:29 -0700117 // Returns -EBUSY if device is not idle or in error state
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800118 virtual binder::Status deleteStream(int streamId) override;
Igor Murashkine7ee7632013-06-11 18:10:18 -0700119
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800120 virtual binder::Status createStream(
121 const hardware::camera2::params::OutputConfiguration &outputConfiguration,
122 /*out*/
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800123 int32_t* newStreamId = NULL) override;
Igor Murashkine7ee7632013-06-11 18:10:18 -0700124
Chien-Yu Chen618ff8a2015-03-13 11:27:17 -0700125 // Create an input stream of width, height, and format.
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800126 virtual binder::Status createInputStream(int width, int height, int format,
Shuzhen Wang83bff122020-11-20 15:51:39 -0800127 bool isMultiResolution,
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800128 /*out*/
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800129 int32_t* newStreamId = NULL) override;
Chien-Yu Chen618ff8a2015-03-13 11:27:17 -0700130
131 // Get the buffer producer of the input stream
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800132 virtual binder::Status getInputSurface(
133 /*out*/
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800134 view::Surface *inputSurface) override;
Chien-Yu Chen618ff8a2015-03-13 11:27:17 -0700135
Igor Murashkine7ee7632013-06-11 18:10:18 -0700136 // Create a request object from a template.
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800137 virtual binder::Status createDefaultRequest(int templateId,
138 /*out*/
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800139 hardware::camera2::impl::CameraMetadataNative* request) override;
Igor Murashkine7ee7632013-06-11 18:10:18 -0700140
141 // Get the static metadata for the camera
142 // -- Caller owns the newly allocated metadata
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800143 virtual binder::Status getCameraInfo(
144 /*out*/
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800145 hardware::camera2::impl::CameraMetadataNative* cameraCharacteristics) override;
Igor Murashkine7ee7632013-06-11 18:10:18 -0700146
Zhijun He2ab500c2013-07-23 08:02:53 -0700147 // Wait until all the submitted requests have finished processing
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800148 virtual binder::Status waitUntilIdle() override;
Eino-Ville Talvalaabaa51d2013-08-14 11:37:00 -0700149
150 // Flush all active and pending requests as fast as possible
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800151 virtual binder::Status flush(
152 /*out*/
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800153 int64_t* lastFrameNumber = NULL) override;
Eino-Ville Talvalaabaa51d2013-08-14 11:37:00 -0700154
Eino-Ville Talvala4d44cad2015-04-11 13:15:45 -0700155 // Prepare stream by preallocating its buffers
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800156 virtual binder::Status prepare(int32_t streamId) override;
Eino-Ville Talvala4d44cad2015-04-11 13:15:45 -0700157
Eino-Ville Talvalab25e3c82015-07-15 16:04:27 -0700158 // Tear down stream resources by freeing its unused buffers
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800159 virtual binder::Status tearDown(int32_t streamId) override;
Eino-Ville Talvalab25e3c82015-07-15 16:04:27 -0700160
Ruben Brunkc78ac262015-08-13 17:58:46 -0700161 // Prepare stream by preallocating up to maxCount of its buffers
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800162 virtual binder::Status prepare2(int32_t maxCount, int32_t streamId) override;
Ruben Brunkc78ac262015-08-13 17:58:46 -0700163
Emilian Peev40ead602017-09-26 15:46:36 +0100164 // Update an output configuration
165 virtual binder::Status updateOutputConfiguration(int streamId,
166 const hardware::camera2::params::OutputConfiguration &outputConfiguration) override;
167
Shuzhen Wang758c2152017-01-10 18:26:18 -0800168 // Finalize the output configurations with surfaces not added before.
169 virtual binder::Status finalizeOutputConfigurations(int32_t streamId,
Eino-Ville Talvalabbbbe842017-02-28 17:50:56 -0800170 const hardware::camera2::params::OutputConfiguration &outputConfiguration) override;
Zhijun He5d677d12016-05-29 16:52:39 -0700171
Yin-Chia Yehcfab4e12019-09-09 13:08:28 -0700172 virtual binder::Status setCameraAudioRestriction(int32_t mode) override;
173
174 virtual binder::Status getGlobalAudioRestriction(/*out*/int32_t* outMode) override;
Yin-Chia Yehdba03232019-08-19 15:54:28 -0700175
Yin-Chia Yehb978c382019-10-30 00:22:37 -0700176 virtual binder::Status switchToOffline(
177 const sp<hardware::camera2::ICameraDeviceCallbacks>& cameraCb,
Emilian Peevb2bc5a42019-11-20 16:02:14 -0800178 const std::vector<int>& offlineOutputIds,
Yin-Chia Yehb978c382019-10-30 00:22:37 -0700179 /*out*/
180 sp<hardware::camera2::ICameraOfflineSession>* session) override;
181
Igor Murashkine7ee7632013-06-11 18:10:18 -0700182 /**
183 * Interface used by CameraService
184 */
185
186 CameraDeviceClient(const sp<CameraService>& cameraService,
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800187 const sp<hardware::camera2::ICameraDeviceCallbacks>& remoteCallback,
Austin Borger74fca042022-05-23 12:41:21 -0700188 std::shared_ptr<CameraServiceProxyWrapper> cameraServiceProxyWrapper,
Austin Borger1c1bee02023-06-01 16:51:35 -0700189 const std::string& clientPackageName,
Jayant Chowdharyeb0169f2022-01-31 00:00:02 -0800190 bool clientPackageOverride,
Austin Borger1c1bee02023-06-01 16:51:35 -0700191 const std::optional<std::string>& clientFeatureId,
192 const std::string& cameraId,
Igor Murashkine7ee7632013-06-11 18:10:18 -0700193 int cameraFacing,
Emilian Peev8b64f282021-03-25 16:49:57 -0700194 int sensorOrientation,
Igor Murashkine7ee7632013-06-11 18:10:18 -0700195 int clientPid,
196 uid_t clientUid,
Shuzhen Wangd4abdf72021-05-28 11:22:50 -0700197 int servicePid,
Austin Borger18b30a72022-10-27 12:20:29 -0700198 bool overrideForPerfClass,
malikakash73125c62023-07-21 22:44:34 +0000199 bool overrideToPortrait,
200 const std::string& originalCameraId);
Igor Murashkine7ee7632013-06-11 18:10:18 -0700201 virtual ~CameraDeviceClient();
202
Emilian Peevbd8c5032018-02-14 23:05:40 +0000203 virtual status_t initialize(sp<CameraProviderManager> manager,
Austin Borger1c1bee02023-06-01 16:51:35 -0700204 const std::string& monitorTags) override;
Igor Murashkine7ee7632013-06-11 18:10:18 -0700205
Jayant Chowdhary44d5f622023-09-20 03:11:41 +0000206 virtual status_t setRotateAndCropOverride(uint8_t rotateAndCrop,
207 bool fromHal = false) override;
Eino-Ville Talvalaf2e37092020-01-07 15:32:32 -0800208
Bharatt Kukreja7146ced2022-10-25 15:45:29 +0000209 virtual status_t setAutoframingOverride(uint8_t autoframingValue) override;
210
Eino-Ville Talvala305cec62020-11-12 14:18:17 -0800211 virtual bool supportsCameraMute();
212 virtual status_t setCameraMute(bool enabled);
213
Shuzhen Wangaf22e912023-04-11 16:03:17 -0700214 virtual bool supportsZoomOverride() override;
215 virtual status_t setZoomOverride(int32_t zoomOverride) override;
216
Igor Murashkine7ee7632013-06-11 18:10:18 -0700217 virtual status_t dump(int fd, const Vector<String16>& args);
218
Eino-Ville Talvalac4003962016-01-13 10:07:04 -0800219 virtual status_t dumpClient(int fd, const Vector<String16>& args);
220
Austin Borger1c1bee02023-06-01 16:51:35 -0700221 virtual status_t startWatchingTags(const std::string &tags, int out);
Avichal Rakesh7e53cad2021-10-05 13:46:30 -0700222 virtual status_t stopWatchingTags(int out);
223 virtual status_t dumpWatchedEventsToVector(std::vector<std::string> &out);
224
Ravneetaeb20dc2022-03-30 05:33:03 +0000225 virtual status_t setCameraServiceWatchdog(bool enabled);
226
Shuzhen Wang16610a62022-12-15 22:38:07 -0800227 virtual void setStreamUseCaseOverrides(const std::vector<int64_t>& useCaseOverrides);
228 virtual void clearStreamUseCaseOverrides() override;
229
Igor Murashkine7ee7632013-06-11 18:10:18 -0700230 /**
Eino-Ville Talvalaf1e98d82013-09-06 09:32:43 -0700231 * Device listener interface
232 */
233
Shuzhen Wang316781a2020-08-18 18:11:01 -0700234 virtual void notifyIdle(int64_t requestCount, int64_t resultErrorCount, bool deviceError,
235 const std::vector<hardware::CameraStreamStats>& streamStats);
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800236 virtual void notifyError(int32_t errorCode,
Jianing Weicb0652e2014-03-12 18:29:36 -0700237 const CaptureResultExtras& resultExtras);
238 virtual void notifyShutter(const CaptureResultExtras& resultExtras, nsecs_t timestamp);
Eino-Ville Talvala4d44cad2015-04-11 13:15:45 -0700239 virtual void notifyPrepared(int streamId);
Shuzhen Wang9d066012016-09-30 11:30:20 -0700240 virtual void notifyRequestQueueEmpty();
Chien-Yu Chene8c535e2016-04-14 12:18:26 -0700241 virtual void notifyRepeatingRequestError(long lastFrameNumber);
Eino-Ville Talvalaf1e98d82013-09-06 09:32:43 -0700242
Shuzhen Wangabbcb6b2020-12-09 22:32:44 -0800243 void setImageDumpMask(int mask) { if (mDevice != nullptr) mDevice->setImageDumpMask(mask); }
Eino-Ville Talvalaf1e98d82013-09-06 09:32:43 -0700244 /**
Igor Murashkine7ee7632013-06-11 18:10:18 -0700245 * Interface used by independent components of CameraDeviceClient.
246 */
247protected:
248 /** FilteredListener implementation **/
Jianing Weicb0652e2014-03-12 18:29:36 -0700249 virtual void onResultAvailable(const CaptureResult& result);
Igor Murashkine7ee7632013-06-11 18:10:18 -0700250 virtual void detachDevice();
251
Igor Murashkinf8b2a6f2013-09-17 17:03:28 -0700252 // Calculate the ANativeWindow transform from android.sensor.orientation
Shuzhen Wang610d7b82022-02-08 14:37:22 -0800253 status_t getRotationTransformLocked(int mirrorMode, /*out*/int32_t* transform);
Igor Murashkinf8b2a6f2013-09-17 17:03:28 -0700254
Austin Borger1c1bee02023-06-01 16:51:35 -0700255 bool supportsUltraHighResolutionCapture(const std::string &cameraId);
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800256
257 bool isSensorPixelModeConsistent(const std::list<int> &streamIdList,
258 const CameraMetadata &settings);
259
Austin Borger1c1bee02023-06-01 16:51:35 -0700260 const CameraMetadata &getStaticInfo(const std::string &cameraId);
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800261
Igor Murashkine7ee7632013-06-11 18:10:18 -0700262private:
Shuzhen Wang0129d522016-10-30 22:43:41 -0700263 // StreamSurfaceId encapsulates streamId + surfaceId for a particular surface.
264 // streamId specifies the index of the stream the surface belongs to, and the
265 // surfaceId specifies the index of the surface within the stream. (one stream
266 // could contain multiple surfaces.)
267 class StreamSurfaceId final {
268 public:
269 StreamSurfaceId() {
270 mStreamId = -1;
271 mSurfaceId = -1;
272 }
273 StreamSurfaceId(int32_t streamId, int32_t surfaceId) {
274 mStreamId = streamId;
275 mSurfaceId = surfaceId;
276 }
277 int32_t streamId() const {
278 return mStreamId;
279 }
280 int32_t surfaceId() const {
281 return mSurfaceId;
282 }
283
284 private:
285 int32_t mStreamId;
286 int32_t mSurfaceId;
287
288 }; // class StreamSurfaceId
289
290private:
Igor Murashkine7ee7632013-06-11 18:10:18 -0700291 /** ICameraDeviceUser interface-related private members */
292
293 /** Preview callback related members */
Eino-Ville Talvala7b82efe2013-07-25 17:12:35 -0700294 sp<camera2::FrameProcessorBase> mFrameProcessor;
Igor Murashkine7ee7632013-06-11 18:10:18 -0700295
Emilian Peev00420d22018-02-05 21:33:13 +0000296 std::vector<int32_t> mSupportedPhysicalRequestKeys;
297
Eino-Ville Talvala2f09bac2016-12-13 11:29:54 -0800298 template<typename TProviderPtr>
Austin Borger1c1bee02023-06-01 16:51:35 -0700299 status_t initializeImpl(TProviderPtr providerPtr, const std::string& monitorTags);
Eino-Ville Talvala2f09bac2016-12-13 11:29:54 -0800300
Igor Murashkine7ee7632013-06-11 18:10:18 -0700301 /** Utility members */
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800302 binder::Status checkPidStatus(const char* checkLocation);
Igor Murashkine7ee7632013-06-11 18:10:18 -0700303 bool enforceRequestPermissions(CameraMetadata& metadata);
304
Zhijun He5d677d12016-05-29 16:52:39 -0700305 // Create an output stream with surface deferred for future.
306 binder::Status createDeferredSurfaceStreamLocked(
307 const hardware::camera2::params::OutputConfiguration &outputConfiguration,
Shuzhen Wang758c2152017-01-10 18:26:18 -0800308 bool isShared,
Zhijun He5d677d12016-05-29 16:52:39 -0700309 int* newStreamId = NULL);
310
311 // Set the stream transform flags to automatically rotate the camera stream for preview use
312 // cases.
Shuzhen Wang610d7b82022-02-08 14:37:22 -0800313 binder::Status setStreamTransformLocked(int streamId, int mirrorMode);
Zhijun He5d677d12016-05-29 16:52:39 -0700314
Yin-Chia Yeh4dfa4cc2017-11-10 20:00:09 -0800315 // Utility method to insert the surface into SurfaceMap
316 binder::Status insertGbpLocked(const sp<IGraphicBufferProducer>& gbp,
Emilian Peevf873aa52018-01-26 14:58:28 +0000317 /*out*/SurfaceMap* surfaceMap, /*out*/Vector<int32_t>* streamIds,
318 /*out*/int32_t* currentStreamId);
Yin-Chia Yeh4dfa4cc2017-11-10 20:00:09 -0800319
Shuzhen Wang0129d522016-10-30 22:43:41 -0700320 // IGraphicsBufferProducer binder -> Stream ID + Surface ID for output streams
321 KeyedVector<sp<IBinder>, StreamSurfaceId> mStreamMap;
Igor Murashkine7ee7632013-06-11 18:10:18 -0700322
Yin-Chia Yeh4dfa4cc2017-11-10 20:00:09 -0800323 // Stream ID -> OutputConfiguration. Used for looking up Surface by stream/surface index
324 KeyedVector<int32_t, hardware::camera2::params::OutputConfiguration> mConfiguredOutputs;
325
Emilian Peev2295df72021-11-12 18:14:10 -0800326 // Dynamic range profile id -> Supported dynamic profiles bitmap within an single capture
327 // request
Emilian Peevc81a7592022-02-14 17:38:18 -0800328 std::unordered_map<int64_t, int64_t> mDynamicProfileMap;
Emilian Peev2295df72021-11-12 18:14:10 -0800329
Chien-Yu Chen618ff8a2015-03-13 11:27:17 -0700330 struct InputStreamConfiguration {
331 bool configured;
332 int32_t width;
333 int32_t height;
334 int32_t format;
335 int32_t id;
336 } mInputStream;
337
Chien-Yu Chene8c535e2016-04-14 12:18:26 -0700338 // Streaming request ID
339 int32_t mStreamingRequestId;
Shuzhen Wangc9ca6782016-04-26 13:40:31 -0700340 Mutex mStreamingRequestIdLock;
Chien-Yu Chene8c535e2016-04-14 12:18:26 -0700341 static const int32_t REQUEST_ID_NONE = -1;
Igor Murashkine7ee7632013-06-11 18:10:18 -0700342
343 int32_t mRequestIdCounter;
Eino-Ville Talvala412fe562015-08-20 17:08:32 -0700344
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800345 std::vector<std::string> mPhysicalCameraIds;
346
Zhijun He5d677d12016-05-29 16:52:39 -0700347 // The list of output streams whose surfaces are deferred. We have to track them separately
348 // as there are no surfaces available and can not be put into mStreamMap. Once the deferred
349 // Surface is configured, the stream id will be moved to mStreamMap.
350 Vector<int32_t> mDeferredStreams;
Shuzhen Wang0129d522016-10-30 22:43:41 -0700351
Shuzhen Wang758c2152017-01-10 18:26:18 -0800352 // stream ID -> outputStreamInfo mapping
353 std::unordered_map<int32_t, OutputStreamInfo> mStreamInfoMap;
354
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800355 // map high resolution camera id (logical / physical) -> list of stream ids configured
356 std::unordered_map<std::string, std::unordered_set<int>> mHighResolutionCameraIdToStreamIdSet;
357
358 // set of high resolution camera id (logical / physical)
359 std::unordered_set<std::string> mHighResolutionSensors;
360
Emilian Peev2f5d6012022-01-19 16:16:50 -0800361 // Synchronize access to 'mCompositeStreamMap'
362 Mutex mCompositeLock;
Emilian Peev538c90e2018-12-17 18:03:19 +0000363 KeyedVector<sp<IBinder>, sp<CompositeStream>> mCompositeStreamMap;
364
Shuzhen Wang03d8cc12018-09-12 14:17:09 -0700365 sp<CameraProviderManager> mProviderManager;
Shuzhen Wangd4abdf72021-05-28 11:22:50 -0700366
367 // Override the camera characteristics for performance class primary cameras.
368 bool mOverrideForPerfClass;
Shuzhen Wangd26b1862022-03-07 12:05:05 -0800369
370 // The string representation of object passed into CaptureRequest.setTag.
371 std::string mUserTag;
Shuzhen Wang9372b0b2022-05-11 18:55:19 -0700372 // The last set video stabilization mode
373 int mVideoStabilizationMode = -1;
Eino-Ville Talvala6f1a9c12023-09-14 17:26:28 -0700374 // Whether a zoom_ratio < 1.0 has been used during this session
375 bool mUsedUltraWide = false;
Shuzhen Wang6e08d202023-10-24 20:27:14 +0000376 // Whether a zoom settings override has been used during this session
377 bool mUsedSettingsOverrideZoom = false;
malikakash73125c62023-07-21 22:44:34 +0000378
379 // This only exists in case of camera ID Remapping.
380 const std::string mOriginalCameraId;
Igor Murashkine7ee7632013-06-11 18:10:18 -0700381};
382
383}; // namespace android
384
385#endif