Loading camera/ndk/include/camera/NdkCameraMetadataTags.h +2 −2 Original line number Diff line number Diff line Loading @@ -9224,10 +9224,10 @@ typedef enum acamera_metadata_enum_acamera_sensor_test_pattern_mode { * respective color channel provided in * ACAMERA_SENSOR_TEST_PATTERN_DATA.</p> * <p>For example:</p> * <pre><code>android.control.testPatternData = [0, 0xFFFFFFFF, 0xFFFFFFFF, 0] * <pre><code>ACAMERA_SENSOR_TEST_PATTERN_DATA = [0, 0xFFFFFFFF, 0xFFFFFFFF, 0] * </code></pre> * <p>All green pixels are 100% green. All red/blue pixels are black.</p> * <pre><code>android.control.testPatternData = [0xFFFFFFFF, 0, 0xFFFFFFFF, 0] * <pre><code>ACAMERA_SENSOR_TEST_PATTERN_DATA = [0xFFFFFFFF, 0, 0xFFFFFFFF, 0] * </code></pre> * <p>All red pixels are 100% red. Only the odd green pixels * are 100% green. All blue pixels are 100% black.</p> Loading services/audiopolicy/engine/config/src/EngineConfig.cpp +31 −22 Original line number Diff line number Diff line Loading @@ -139,11 +139,24 @@ struct VolumeGroupTraits : public BaseSerializerTraits<VolumeGroup, VolumeGroups Collection &collection); }; using xmlCharUnique = std::unique_ptr<xmlChar, decltype(xmlFree)>; template <class T> constexpr void (*xmlDeleter)(T* t); template <> constexpr auto xmlDeleter<xmlDoc> = xmlFreeDoc; template <> constexpr auto xmlDeleter<xmlChar> = [](xmlChar *s) { xmlFree(s); }; /** @return a unique_ptr with the correct deleter for the libxml2 object. */ template <class T> constexpr auto make_xmlUnique(T *t) { // Wrap deleter in lambda to enable empty base optimization auto deleter = [](T *t) { xmlDeleter<T>(t); }; return std::unique_ptr<T, decltype(deleter)>{t, deleter}; } std::string getXmlAttribute(const xmlNode *cur, const char *attribute) { xmlCharUnique charPtr(xmlGetProp(cur, reinterpret_cast<const xmlChar *>(attribute)), xmlFree); auto charPtr = make_xmlUnique(xmlGetProp(cur, reinterpret_cast<const xmlChar *>(attribute))); if (charPtr == NULL) { return ""; } Loading Loading @@ -441,7 +454,7 @@ status_t VolumeTraits::deserialize(_xmlDoc *doc, const _xmlNode *root, Collectio for (const xmlNode *child = referenceName.empty() ? root->xmlChildrenNode : ref->xmlChildrenNode; child != NULL; child = child->next) { if (!xmlStrcmp(child->name, (const xmlChar *)volumePointTag)) { xmlCharUnique pointXml(xmlNodeListGetString(doc, child->xmlChildrenNode, 1), xmlFree); auto pointXml = make_xmlUnique(xmlNodeListGetString(doc, child->xmlChildrenNode, 1)); if (pointXml == NULL) { return BAD_VALUE; } Loading Loading @@ -471,14 +484,14 @@ status_t VolumeGroupTraits::deserialize(_xmlDoc *doc, const _xmlNode *root, Coll for (const xmlNode *child = root->xmlChildrenNode; child != NULL; child = child->next) { if (not xmlStrcmp(child->name, (const xmlChar *)Attributes::name)) { xmlCharUnique nameXml(xmlNodeListGetString(doc, child->xmlChildrenNode, 1), xmlFree); auto nameXml = make_xmlUnique(xmlNodeListGetString(doc, child->xmlChildrenNode, 1)); if (nameXml == nullptr) { return BAD_VALUE; } name = reinterpret_cast<const char*>(nameXml.get()); } if (not xmlStrcmp(child->name, (const xmlChar *)Attributes::indexMin)) { xmlCharUnique indexMinXml(xmlNodeListGetString(doc, child->xmlChildrenNode, 1), xmlFree); auto indexMinXml = make_xmlUnique(xmlNodeListGetString(doc, child->xmlChildrenNode, 1)); if (indexMinXml == nullptr) { return BAD_VALUE; } Loading @@ -488,7 +501,7 @@ status_t VolumeGroupTraits::deserialize(_xmlDoc *doc, const _xmlNode *root, Coll } } if (not xmlStrcmp(child->name, (const xmlChar *)Attributes::indexMax)) { xmlCharUnique indexMaxXml(xmlNodeListGetString(doc, child->xmlChildrenNode, 1), xmlFree); auto indexMaxXml = make_xmlUnique(xmlNodeListGetString(doc, child->xmlChildrenNode, 1)); if (indexMaxXml == nullptr) { return BAD_VALUE; } Loading Loading @@ -548,7 +561,7 @@ status_t deserializeLegacyVolume(_xmlDoc *doc, const _xmlNode *cur, for (const xmlNode *child = referenceName.empty() ? cur->xmlChildrenNode : ref->xmlChildrenNode; child != NULL; child = child->next) { if (!xmlStrcmp(child->name, (const xmlChar *)VolumeTraits::volumePointTag)) { xmlCharUnique pointXml(xmlNodeListGetString(doc, child->xmlChildrenNode, 1), xmlFree); auto pointXml = make_xmlUnique(xmlNodeListGetString(doc, child->xmlChildrenNode, 1)); if (pointXml == NULL) { return BAD_VALUE; } Loading Loading @@ -640,8 +653,7 @@ private: ParsingResult parse(const char* path) { XmlErrorHandler errorHandler; xmlDocPtr doc; doc = xmlParseFile(path); auto doc = make_xmlUnique(xmlParseFile(path)); if (doc == NULL) { // It is OK not to find an engine config file at the default location // as the caller will default to hardcoded default config Loading @@ -650,13 +662,12 @@ ParsingResult parse(const char* path) { } return {nullptr, 0}; } xmlNodePtr cur = xmlDocGetRootElement(doc); xmlNodePtr cur = xmlDocGetRootElement(doc.get()); if (cur == NULL) { ALOGE("%s: Could not parse: empty document %s", __FUNCTION__, path); xmlFreeDoc(doc); return {nullptr, 0}; } if (xmlXIncludeProcess(doc) < 0) { if (xmlXIncludeProcess(doc.get()) < 0) { ALOGE("%s: libxml failed to resolve XIncludes on document %s", __FUNCTION__, path); return {nullptr, 0}; } Loading @@ -669,37 +680,35 @@ ParsingResult parse(const char* path) { auto config = std::make_unique<Config>(); config->version = std::stof(version); deserializeCollection<ProductStrategyTraits>( doc, cur, config->productStrategies, nbSkippedElements); doc.get(), cur, config->productStrategies, nbSkippedElements); deserializeCollection<CriterionTraits>( doc, cur, config->criteria, nbSkippedElements); doc.get(), cur, config->criteria, nbSkippedElements); deserializeCollection<CriterionTypeTraits>( doc, cur, config->criterionTypes, nbSkippedElements); doc.get(), cur, config->criterionTypes, nbSkippedElements); deserializeCollection<VolumeGroupTraits>( doc, cur, config->volumeGroups, nbSkippedElements); doc.get(), cur, config->volumeGroups, nbSkippedElements); return {std::move(config), nbSkippedElements}; } android::status_t parseLegacyVolumeFile(const char* path, VolumeGroups &volumeGroups) { XmlErrorHandler errorHandler; xmlDocPtr doc; doc = xmlParseFile(path); auto doc = make_xmlUnique(xmlParseFile(path)); if (doc == NULL) { ALOGE("%s: Could not parse document %s", __FUNCTION__, path); return BAD_VALUE; } xmlNodePtr cur = xmlDocGetRootElement(doc); xmlNodePtr cur = xmlDocGetRootElement(doc.get()); if (cur == NULL) { ALOGE("%s: Could not parse: empty document %s", __FUNCTION__, path); xmlFreeDoc(doc); return BAD_VALUE; } if (xmlXIncludeProcess(doc) < 0) { if (xmlXIncludeProcess(doc.get()) < 0) { ALOGE("%s: libxml failed to resolve XIncludes on document %s", __FUNCTION__, path); return BAD_VALUE; } size_t nbSkippedElements = 0; return deserializeLegacyVolumeCollection(doc, cur, volumeGroups, nbSkippedElements); return deserializeLegacyVolumeCollection(doc.get(), cur, volumeGroups, nbSkippedElements); } android::status_t parseLegacyVolumes(VolumeGroups &volumeGroups) { Loading services/camera/libcameraservice/CameraService.cpp +3 −15 Original line number Diff line number Diff line Loading @@ -4051,25 +4051,13 @@ void CameraService::updateStatus(StatusInternal status, const String8& cameraId, ALOGE("%s: Invalid camera id %s, skipping", __FUNCTION__, cameraId.string()); return; } bool supportsHAL3 = false; // supportsCameraApi also holds mInterfaceMutex, we can't call it in the // HIDL onStatusChanged wrapper call (we'll hold mStatusListenerLock and // mInterfaceMutex together, which can lead to deadlocks) binder::Status sRet = supportsCameraApi(String16(cameraId), hardware::ICameraService::API_VERSION_2, &supportsHAL3); if (!sRet.isOk()) { ALOGW("%s: Failed to determine if device supports HAL3 %s, supportsCameraApi call failed", __FUNCTION__, cameraId.string()); return; } // Collect the logical cameras without holding mStatusLock in updateStatus // as that can lead to a deadlock(b/162192331). auto logicalCameraIds = getLogicalCameras(cameraId); // Update the status for this camera state, then send the onStatusChangedCallbacks to each // of the listeners with both the mStatusLock and mStatusListenerLock held state->updateStatus(status, cameraId, rejectSourceStates, [this, &deviceKind, &supportsHAL3, state->updateStatus(status, cameraId, rejectSourceStates, [this, &deviceKind, &logicalCameraIds] (const String8& cameraId, StatusInternal status) { Loading Loading @@ -4097,8 +4085,8 @@ void CameraService::updateStatus(StatusInternal status, const String8& cameraId, bool isVendorListener = listener->isVendorListener(); if (shouldSkipStatusUpdates(deviceKind, isVendorListener, listener->getListenerPid(), listener->getListenerUid()) || (isVendorListener && !supportsHAL3)) { ALOGV("Skipping discovery callback for system-only camera/HAL1 device %s", isVendorListener) { ALOGV("Skipping discovery callback for system-only camera device %s", cameraId.c_str()); continue; } Loading services/camera/libcameraservice/device3/Camera3Device.cpp +18 −8 Original line number Diff line number Diff line Loading @@ -353,9 +353,15 @@ status_t Camera3Device::initializeCommonLocked() { camera_metadata_entry_t availableTestPatternModes = mDeviceInfo.find( ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES); for (size_t i = 0; i < availableTestPatternModes.count; i++) { if (availableTestPatternModes.data.i32[i] == ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR) { if (availableTestPatternModes.data.i32[i] == ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR) { mSupportCameraMute = true; mSupportTestPatternSolidColor = true; break; } else if (availableTestPatternModes.data.i32[i] == ANDROID_SENSOR_TEST_PATTERN_MODE_BLACK) { mSupportCameraMute = true; mSupportTestPatternSolidColor = false; } } Loading Loading @@ -4163,7 +4169,7 @@ Camera3Device::RequestThread::RequestThread(wp<Camera3Device> parent, mCurrentAfTriggerId(0), mCurrentPreCaptureTriggerId(0), mRotateAndCropOverride(ANDROID_SCALER_ROTATE_AND_CROP_NONE), mCameraMute(false), mCameraMute(ANDROID_SENSOR_TEST_PATTERN_MODE_OFF), mCameraMuteChanged(false), mRepeatingLastFrameNumber( hardware::camera2::ICameraDeviceUser::NO_IN_FLIGHT_REPEATING_FRAMES), Loading Loading @@ -5265,11 +5271,11 @@ status_t Camera3Device::RequestThread::setRotateAndCropAutoBehavior( return OK; } status_t Camera3Device::RequestThread::setCameraMute(bool enabled) { status_t Camera3Device::RequestThread::setCameraMute(int32_t muteMode) { ATRACE_CALL(); Mutex::Autolock l(mTriggerMutex); if (enabled != mCameraMute) { mCameraMute = enabled; if (muteMode != mCameraMute) { mCameraMute = muteMode; mCameraMuteChanged = true; } return OK; Loading Loading @@ -5844,8 +5850,8 @@ bool Camera3Device::RequestThread::overrideTestPattern( request->mOriginalTestPatternData[3] }; if (mCameraMute) { testPatternMode = ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR; if (mCameraMute != ANDROID_SENSOR_TEST_PATTERN_MODE_OFF) { testPatternMode = mCameraMute; testPatternData[0] = 0; testPatternData[1] = 0; testPatternData[2] = 0; Loading Loading @@ -6535,7 +6541,11 @@ status_t Camera3Device::setCameraMute(bool enabled) { if (mRequestThread == nullptr || !mSupportCameraMute) { return INVALID_OPERATION; } return mRequestThread->setCameraMute(enabled); int32_t muteMode = !enabled ? ANDROID_SENSOR_TEST_PATTERN_MODE_OFF : mSupportTestPatternSolidColor ? ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR : ANDROID_SENSOR_TEST_PATTERN_MODE_BLACK; return mRequestThread->setCameraMute(muteMode); } status_t Camera3Device::injectCamera(const String8& injectedCamId, Loading services/camera/libcameraservice/device3/Camera3Device.h +4 −2 Original line number Diff line number Diff line Loading @@ -918,7 +918,7 @@ class Camera3Device : status_t setRotateAndCropAutoBehavior( camera_metadata_enum_android_scaler_rotate_and_crop_t rotateAndCropValue); status_t setCameraMute(bool enabled); status_t setCameraMute(int32_t muteMode); status_t setHalInterface(sp<HalInterface> newHalInterface); Loading Loading @@ -1069,7 +1069,7 @@ class Camera3Device : uint32_t mCurrentAfTriggerId; uint32_t mCurrentPreCaptureTriggerId; camera_metadata_enum_android_scaler_rotate_and_crop_t mRotateAndCropOverride; bool mCameraMute; int32_t mCameraMute; // 0 = no mute, otherwise the TEST_PATTERN_MODE to use bool mCameraMuteChanged; int64_t mRepeatingLastFrameNumber; Loading Loading @@ -1342,6 +1342,8 @@ class Camera3Device : // Whether the HAL supports camera muting via test pattern bool mSupportCameraMute = false; // Whether the HAL supports SOLID_COLOR or BLACK if mSupportCameraMute is true bool mSupportTestPatternSolidColor = false; // Injection camera related methods. class Camera3DeviceInjectionMethods : public virtual RefBase { Loading Loading
camera/ndk/include/camera/NdkCameraMetadataTags.h +2 −2 Original line number Diff line number Diff line Loading @@ -9224,10 +9224,10 @@ typedef enum acamera_metadata_enum_acamera_sensor_test_pattern_mode { * respective color channel provided in * ACAMERA_SENSOR_TEST_PATTERN_DATA.</p> * <p>For example:</p> * <pre><code>android.control.testPatternData = [0, 0xFFFFFFFF, 0xFFFFFFFF, 0] * <pre><code>ACAMERA_SENSOR_TEST_PATTERN_DATA = [0, 0xFFFFFFFF, 0xFFFFFFFF, 0] * </code></pre> * <p>All green pixels are 100% green. All red/blue pixels are black.</p> * <pre><code>android.control.testPatternData = [0xFFFFFFFF, 0, 0xFFFFFFFF, 0] * <pre><code>ACAMERA_SENSOR_TEST_PATTERN_DATA = [0xFFFFFFFF, 0, 0xFFFFFFFF, 0] * </code></pre> * <p>All red pixels are 100% red. Only the odd green pixels * are 100% green. All blue pixels are 100% black.</p> Loading
services/audiopolicy/engine/config/src/EngineConfig.cpp +31 −22 Original line number Diff line number Diff line Loading @@ -139,11 +139,24 @@ struct VolumeGroupTraits : public BaseSerializerTraits<VolumeGroup, VolumeGroups Collection &collection); }; using xmlCharUnique = std::unique_ptr<xmlChar, decltype(xmlFree)>; template <class T> constexpr void (*xmlDeleter)(T* t); template <> constexpr auto xmlDeleter<xmlDoc> = xmlFreeDoc; template <> constexpr auto xmlDeleter<xmlChar> = [](xmlChar *s) { xmlFree(s); }; /** @return a unique_ptr with the correct deleter for the libxml2 object. */ template <class T> constexpr auto make_xmlUnique(T *t) { // Wrap deleter in lambda to enable empty base optimization auto deleter = [](T *t) { xmlDeleter<T>(t); }; return std::unique_ptr<T, decltype(deleter)>{t, deleter}; } std::string getXmlAttribute(const xmlNode *cur, const char *attribute) { xmlCharUnique charPtr(xmlGetProp(cur, reinterpret_cast<const xmlChar *>(attribute)), xmlFree); auto charPtr = make_xmlUnique(xmlGetProp(cur, reinterpret_cast<const xmlChar *>(attribute))); if (charPtr == NULL) { return ""; } Loading Loading @@ -441,7 +454,7 @@ status_t VolumeTraits::deserialize(_xmlDoc *doc, const _xmlNode *root, Collectio for (const xmlNode *child = referenceName.empty() ? root->xmlChildrenNode : ref->xmlChildrenNode; child != NULL; child = child->next) { if (!xmlStrcmp(child->name, (const xmlChar *)volumePointTag)) { xmlCharUnique pointXml(xmlNodeListGetString(doc, child->xmlChildrenNode, 1), xmlFree); auto pointXml = make_xmlUnique(xmlNodeListGetString(doc, child->xmlChildrenNode, 1)); if (pointXml == NULL) { return BAD_VALUE; } Loading Loading @@ -471,14 +484,14 @@ status_t VolumeGroupTraits::deserialize(_xmlDoc *doc, const _xmlNode *root, Coll for (const xmlNode *child = root->xmlChildrenNode; child != NULL; child = child->next) { if (not xmlStrcmp(child->name, (const xmlChar *)Attributes::name)) { xmlCharUnique nameXml(xmlNodeListGetString(doc, child->xmlChildrenNode, 1), xmlFree); auto nameXml = make_xmlUnique(xmlNodeListGetString(doc, child->xmlChildrenNode, 1)); if (nameXml == nullptr) { return BAD_VALUE; } name = reinterpret_cast<const char*>(nameXml.get()); } if (not xmlStrcmp(child->name, (const xmlChar *)Attributes::indexMin)) { xmlCharUnique indexMinXml(xmlNodeListGetString(doc, child->xmlChildrenNode, 1), xmlFree); auto indexMinXml = make_xmlUnique(xmlNodeListGetString(doc, child->xmlChildrenNode, 1)); if (indexMinXml == nullptr) { return BAD_VALUE; } Loading @@ -488,7 +501,7 @@ status_t VolumeGroupTraits::deserialize(_xmlDoc *doc, const _xmlNode *root, Coll } } if (not xmlStrcmp(child->name, (const xmlChar *)Attributes::indexMax)) { xmlCharUnique indexMaxXml(xmlNodeListGetString(doc, child->xmlChildrenNode, 1), xmlFree); auto indexMaxXml = make_xmlUnique(xmlNodeListGetString(doc, child->xmlChildrenNode, 1)); if (indexMaxXml == nullptr) { return BAD_VALUE; } Loading Loading @@ -548,7 +561,7 @@ status_t deserializeLegacyVolume(_xmlDoc *doc, const _xmlNode *cur, for (const xmlNode *child = referenceName.empty() ? cur->xmlChildrenNode : ref->xmlChildrenNode; child != NULL; child = child->next) { if (!xmlStrcmp(child->name, (const xmlChar *)VolumeTraits::volumePointTag)) { xmlCharUnique pointXml(xmlNodeListGetString(doc, child->xmlChildrenNode, 1), xmlFree); auto pointXml = make_xmlUnique(xmlNodeListGetString(doc, child->xmlChildrenNode, 1)); if (pointXml == NULL) { return BAD_VALUE; } Loading Loading @@ -640,8 +653,7 @@ private: ParsingResult parse(const char* path) { XmlErrorHandler errorHandler; xmlDocPtr doc; doc = xmlParseFile(path); auto doc = make_xmlUnique(xmlParseFile(path)); if (doc == NULL) { // It is OK not to find an engine config file at the default location // as the caller will default to hardcoded default config Loading @@ -650,13 +662,12 @@ ParsingResult parse(const char* path) { } return {nullptr, 0}; } xmlNodePtr cur = xmlDocGetRootElement(doc); xmlNodePtr cur = xmlDocGetRootElement(doc.get()); if (cur == NULL) { ALOGE("%s: Could not parse: empty document %s", __FUNCTION__, path); xmlFreeDoc(doc); return {nullptr, 0}; } if (xmlXIncludeProcess(doc) < 0) { if (xmlXIncludeProcess(doc.get()) < 0) { ALOGE("%s: libxml failed to resolve XIncludes on document %s", __FUNCTION__, path); return {nullptr, 0}; } Loading @@ -669,37 +680,35 @@ ParsingResult parse(const char* path) { auto config = std::make_unique<Config>(); config->version = std::stof(version); deserializeCollection<ProductStrategyTraits>( doc, cur, config->productStrategies, nbSkippedElements); doc.get(), cur, config->productStrategies, nbSkippedElements); deserializeCollection<CriterionTraits>( doc, cur, config->criteria, nbSkippedElements); doc.get(), cur, config->criteria, nbSkippedElements); deserializeCollection<CriterionTypeTraits>( doc, cur, config->criterionTypes, nbSkippedElements); doc.get(), cur, config->criterionTypes, nbSkippedElements); deserializeCollection<VolumeGroupTraits>( doc, cur, config->volumeGroups, nbSkippedElements); doc.get(), cur, config->volumeGroups, nbSkippedElements); return {std::move(config), nbSkippedElements}; } android::status_t parseLegacyVolumeFile(const char* path, VolumeGroups &volumeGroups) { XmlErrorHandler errorHandler; xmlDocPtr doc; doc = xmlParseFile(path); auto doc = make_xmlUnique(xmlParseFile(path)); if (doc == NULL) { ALOGE("%s: Could not parse document %s", __FUNCTION__, path); return BAD_VALUE; } xmlNodePtr cur = xmlDocGetRootElement(doc); xmlNodePtr cur = xmlDocGetRootElement(doc.get()); if (cur == NULL) { ALOGE("%s: Could not parse: empty document %s", __FUNCTION__, path); xmlFreeDoc(doc); return BAD_VALUE; } if (xmlXIncludeProcess(doc) < 0) { if (xmlXIncludeProcess(doc.get()) < 0) { ALOGE("%s: libxml failed to resolve XIncludes on document %s", __FUNCTION__, path); return BAD_VALUE; } size_t nbSkippedElements = 0; return deserializeLegacyVolumeCollection(doc, cur, volumeGroups, nbSkippedElements); return deserializeLegacyVolumeCollection(doc.get(), cur, volumeGroups, nbSkippedElements); } android::status_t parseLegacyVolumes(VolumeGroups &volumeGroups) { Loading
services/camera/libcameraservice/CameraService.cpp +3 −15 Original line number Diff line number Diff line Loading @@ -4051,25 +4051,13 @@ void CameraService::updateStatus(StatusInternal status, const String8& cameraId, ALOGE("%s: Invalid camera id %s, skipping", __FUNCTION__, cameraId.string()); return; } bool supportsHAL3 = false; // supportsCameraApi also holds mInterfaceMutex, we can't call it in the // HIDL onStatusChanged wrapper call (we'll hold mStatusListenerLock and // mInterfaceMutex together, which can lead to deadlocks) binder::Status sRet = supportsCameraApi(String16(cameraId), hardware::ICameraService::API_VERSION_2, &supportsHAL3); if (!sRet.isOk()) { ALOGW("%s: Failed to determine if device supports HAL3 %s, supportsCameraApi call failed", __FUNCTION__, cameraId.string()); return; } // Collect the logical cameras without holding mStatusLock in updateStatus // as that can lead to a deadlock(b/162192331). auto logicalCameraIds = getLogicalCameras(cameraId); // Update the status for this camera state, then send the onStatusChangedCallbacks to each // of the listeners with both the mStatusLock and mStatusListenerLock held state->updateStatus(status, cameraId, rejectSourceStates, [this, &deviceKind, &supportsHAL3, state->updateStatus(status, cameraId, rejectSourceStates, [this, &deviceKind, &logicalCameraIds] (const String8& cameraId, StatusInternal status) { Loading Loading @@ -4097,8 +4085,8 @@ void CameraService::updateStatus(StatusInternal status, const String8& cameraId, bool isVendorListener = listener->isVendorListener(); if (shouldSkipStatusUpdates(deviceKind, isVendorListener, listener->getListenerPid(), listener->getListenerUid()) || (isVendorListener && !supportsHAL3)) { ALOGV("Skipping discovery callback for system-only camera/HAL1 device %s", isVendorListener) { ALOGV("Skipping discovery callback for system-only camera device %s", cameraId.c_str()); continue; } Loading
services/camera/libcameraservice/device3/Camera3Device.cpp +18 −8 Original line number Diff line number Diff line Loading @@ -353,9 +353,15 @@ status_t Camera3Device::initializeCommonLocked() { camera_metadata_entry_t availableTestPatternModes = mDeviceInfo.find( ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES); for (size_t i = 0; i < availableTestPatternModes.count; i++) { if (availableTestPatternModes.data.i32[i] == ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR) { if (availableTestPatternModes.data.i32[i] == ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR) { mSupportCameraMute = true; mSupportTestPatternSolidColor = true; break; } else if (availableTestPatternModes.data.i32[i] == ANDROID_SENSOR_TEST_PATTERN_MODE_BLACK) { mSupportCameraMute = true; mSupportTestPatternSolidColor = false; } } Loading Loading @@ -4163,7 +4169,7 @@ Camera3Device::RequestThread::RequestThread(wp<Camera3Device> parent, mCurrentAfTriggerId(0), mCurrentPreCaptureTriggerId(0), mRotateAndCropOverride(ANDROID_SCALER_ROTATE_AND_CROP_NONE), mCameraMute(false), mCameraMute(ANDROID_SENSOR_TEST_PATTERN_MODE_OFF), mCameraMuteChanged(false), mRepeatingLastFrameNumber( hardware::camera2::ICameraDeviceUser::NO_IN_FLIGHT_REPEATING_FRAMES), Loading Loading @@ -5265,11 +5271,11 @@ status_t Camera3Device::RequestThread::setRotateAndCropAutoBehavior( return OK; } status_t Camera3Device::RequestThread::setCameraMute(bool enabled) { status_t Camera3Device::RequestThread::setCameraMute(int32_t muteMode) { ATRACE_CALL(); Mutex::Autolock l(mTriggerMutex); if (enabled != mCameraMute) { mCameraMute = enabled; if (muteMode != mCameraMute) { mCameraMute = muteMode; mCameraMuteChanged = true; } return OK; Loading Loading @@ -5844,8 +5850,8 @@ bool Camera3Device::RequestThread::overrideTestPattern( request->mOriginalTestPatternData[3] }; if (mCameraMute) { testPatternMode = ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR; if (mCameraMute != ANDROID_SENSOR_TEST_PATTERN_MODE_OFF) { testPatternMode = mCameraMute; testPatternData[0] = 0; testPatternData[1] = 0; testPatternData[2] = 0; Loading Loading @@ -6535,7 +6541,11 @@ status_t Camera3Device::setCameraMute(bool enabled) { if (mRequestThread == nullptr || !mSupportCameraMute) { return INVALID_OPERATION; } return mRequestThread->setCameraMute(enabled); int32_t muteMode = !enabled ? ANDROID_SENSOR_TEST_PATTERN_MODE_OFF : mSupportTestPatternSolidColor ? ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR : ANDROID_SENSOR_TEST_PATTERN_MODE_BLACK; return mRequestThread->setCameraMute(muteMode); } status_t Camera3Device::injectCamera(const String8& injectedCamId, Loading
services/camera/libcameraservice/device3/Camera3Device.h +4 −2 Original line number Diff line number Diff line Loading @@ -918,7 +918,7 @@ class Camera3Device : status_t setRotateAndCropAutoBehavior( camera_metadata_enum_android_scaler_rotate_and_crop_t rotateAndCropValue); status_t setCameraMute(bool enabled); status_t setCameraMute(int32_t muteMode); status_t setHalInterface(sp<HalInterface> newHalInterface); Loading Loading @@ -1069,7 +1069,7 @@ class Camera3Device : uint32_t mCurrentAfTriggerId; uint32_t mCurrentPreCaptureTriggerId; camera_metadata_enum_android_scaler_rotate_and_crop_t mRotateAndCropOverride; bool mCameraMute; int32_t mCameraMute; // 0 = no mute, otherwise the TEST_PATTERN_MODE to use bool mCameraMuteChanged; int64_t mRepeatingLastFrameNumber; Loading Loading @@ -1342,6 +1342,8 @@ class Camera3Device : // Whether the HAL supports camera muting via test pattern bool mSupportCameraMute = false; // Whether the HAL supports SOLID_COLOR or BLACK if mSupportCameraMute is true bool mSupportTestPatternSolidColor = false; // Injection camera related methods. class Camera3DeviceInjectionMethods : public virtual RefBase { Loading