Loading services/camera/libcameraservice/common/Camera2ClientBase.cpp +23 −0 Original line number Diff line number Diff line Loading @@ -342,6 +342,29 @@ void Camera2ClientBase<TClientBase>::notifyError( resultExtras.requestId); } template <typename TClientBase> void Camera2ClientBase<TClientBase>::notifyPhysicalCameraChange(const std::string &physicalId) { // We're only interested in this notification if overrideToPortrait is turned on. if (!TClientBase::mOverrideToPortrait) { return; } String8 physicalId8(physicalId.c_str()); auto physicalCameraMetadata = mDevice->infoPhysical(physicalId8); auto orientationEntry = physicalCameraMetadata.find(ANDROID_SENSOR_ORIENTATION); if (orientationEntry.count == 1) { int orientation = orientationEntry.data.i32[0]; int rotateAndCropMode = ANDROID_SCALER_ROTATE_AND_CROP_NONE; if (orientation == 0 || orientation == 180) { rotateAndCropMode = ANDROID_SCALER_ROTATE_AND_CROP_90; } static_cast<TClientBase *>(this)->setRotateAndCropOverride(rotateAndCropMode); } } template <typename TClientBase> status_t Camera2ClientBase<TClientBase>::notifyActive(float maxPreviewFps) { if (!mDeviceActive) { Loading services/camera/libcameraservice/common/Camera2ClientBase.h +1 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ public: virtual void notifyError(int32_t errorCode, const CaptureResultExtras& resultExtras); virtual void notifyPhysicalCameraChange(const std::string &physicalId) override; // Returns errors on app ops permission failures virtual status_t notifyActive(float maxPreviewFps); virtual void notifyIdle(int64_t /*requestCount*/, int64_t /*resultErrorCount*/, Loading services/camera/libcameraservice/common/CameraOfflineSessionBase.h +4 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,10 @@ class NotificationListener : public virtual RefBase { // Required for API 1 and 2 virtual void notifyError(int32_t errorCode, const CaptureResultExtras &resultExtras) = 0; // Optional for API 1 and 2 virtual void notifyPhysicalCameraChange(const std::string &/*physicalId*/) {} // May return an error since it checks appops virtual status_t notifyActive(float maxPreviewFps) = 0; virtual void notifyIdle(int64_t requestCount, int64_t resultError, bool deviceError, Loading services/camera/libcameraservice/device3/Camera3Device.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -96,7 +96,8 @@ Camera3Device::Camera3Device(const String8 &id, bool overrideForPerfClass, bool mLastTemplateId(-1), mNeedFixupMonochromeTags(false), mOverrideForPerfClass(overrideForPerfClass), mOverrideToPortrait(overrideToPortrait) mOverrideToPortrait(overrideToPortrait), mActivePhysicalId("") { ATRACE_CALL(); ALOGV("%s: Created device for camera %s", __FUNCTION__, mId.string()); Loading services/camera/libcameraservice/device3/Camera3Device.h +3 −0 Original line number Diff line number Diff line Loading @@ -1357,6 +1357,9 @@ class Camera3Device : // app compatibility reasons. bool mOverrideToPortrait; // Current active physical id of the logical multi-camera, if any std::string mActivePhysicalId; // The current minimum expected frame duration based on AE_TARGET_FPS_RANGE nsecs_t mMinExpectedDuration = 0; // Whether the camera device runs at fixed frame rate based on AE_MODE and Loading Loading
services/camera/libcameraservice/common/Camera2ClientBase.cpp +23 −0 Original line number Diff line number Diff line Loading @@ -342,6 +342,29 @@ void Camera2ClientBase<TClientBase>::notifyError( resultExtras.requestId); } template <typename TClientBase> void Camera2ClientBase<TClientBase>::notifyPhysicalCameraChange(const std::string &physicalId) { // We're only interested in this notification if overrideToPortrait is turned on. if (!TClientBase::mOverrideToPortrait) { return; } String8 physicalId8(physicalId.c_str()); auto physicalCameraMetadata = mDevice->infoPhysical(physicalId8); auto orientationEntry = physicalCameraMetadata.find(ANDROID_SENSOR_ORIENTATION); if (orientationEntry.count == 1) { int orientation = orientationEntry.data.i32[0]; int rotateAndCropMode = ANDROID_SCALER_ROTATE_AND_CROP_NONE; if (orientation == 0 || orientation == 180) { rotateAndCropMode = ANDROID_SCALER_ROTATE_AND_CROP_90; } static_cast<TClientBase *>(this)->setRotateAndCropOverride(rotateAndCropMode); } } template <typename TClientBase> status_t Camera2ClientBase<TClientBase>::notifyActive(float maxPreviewFps) { if (!mDeviceActive) { Loading
services/camera/libcameraservice/common/Camera2ClientBase.h +1 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ public: virtual void notifyError(int32_t errorCode, const CaptureResultExtras& resultExtras); virtual void notifyPhysicalCameraChange(const std::string &physicalId) override; // Returns errors on app ops permission failures virtual status_t notifyActive(float maxPreviewFps); virtual void notifyIdle(int64_t /*requestCount*/, int64_t /*resultErrorCount*/, Loading
services/camera/libcameraservice/common/CameraOfflineSessionBase.h +4 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,10 @@ class NotificationListener : public virtual RefBase { // Required for API 1 and 2 virtual void notifyError(int32_t errorCode, const CaptureResultExtras &resultExtras) = 0; // Optional for API 1 and 2 virtual void notifyPhysicalCameraChange(const std::string &/*physicalId*/) {} // May return an error since it checks appops virtual status_t notifyActive(float maxPreviewFps) = 0; virtual void notifyIdle(int64_t requestCount, int64_t resultError, bool deviceError, Loading
services/camera/libcameraservice/device3/Camera3Device.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -96,7 +96,8 @@ Camera3Device::Camera3Device(const String8 &id, bool overrideForPerfClass, bool mLastTemplateId(-1), mNeedFixupMonochromeTags(false), mOverrideForPerfClass(overrideForPerfClass), mOverrideToPortrait(overrideToPortrait) mOverrideToPortrait(overrideToPortrait), mActivePhysicalId("") { ATRACE_CALL(); ALOGV("%s: Created device for camera %s", __FUNCTION__, mId.string()); Loading
services/camera/libcameraservice/device3/Camera3Device.h +3 −0 Original line number Diff line number Diff line Loading @@ -1357,6 +1357,9 @@ class Camera3Device : // app compatibility reasons. bool mOverrideToPortrait; // Current active physical id of the logical multi-camera, if any std::string mActivePhysicalId; // The current minimum expected frame duration based on AE_TARGET_FPS_RANGE nsecs_t mMinExpectedDuration = 0; // Whether the camera device runs at fixed frame rate based on AE_MODE and Loading