/* * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include "accesstoken_kit.h" #include "camera_input.h" #include "camera_log.h" #include "camera_photo_proxy.h" #include "capture_input.h" #include "capture_output.h" #include "capture_scene_const.h" #include "capture_session_fuzzer.h" #include "input/camera_manager.h" #include "ipc_skeleton.h" #include "iservice_registry.h" #include "input/camera_manager_for_sys.h" #include "message_parcel.h" #include "nativetoken_kit.h" #include "os_account_manager.h" #include "preview_output.h" #include "refbase.h" #include "system_ability_definition.h" #include "test_token.h" #include "token_setproc.h" namespace OHOS { namespace CameraStandard { namespace CaptureSessionFuzzer { const int32_t LIMITSIZE = 309; const int32_t NUM_TWO = 2; const int32_t NUM_20 = 20; const int32_t NUM_40 = 40; sptr surface; sptr camera; Profile profile; CaptureOutput* curOutput; bool g_isSupported; bool g_isCameraDevicePermission = false; SceneMode g_sceneMode; std::vector previewProfile_ = {}; sptr manager_; sptr GetCameraInput(FuzzedDataProvider& fdp) { MEDIA_INFO_LOG("CaptureSessionFuzzer: ENTER"); auto manager = CameraManager::GetInstance(); auto cameras = manager->GetSupportedCameras(); CHECK_RETURN_RET_ELOG(cameras.size() < NUM_TWO, nullptr, "CaptureSessionFuzzer: GetSupportedCameras Error"); camera = cameras[fdp.ConsumeIntegral() % cameras.size()]; CHECK_RETURN_RET_ELOG(!camera, nullptr, "CaptureSessionFuzzer: Camera is null Error"); return manager->CreateCameraInput(camera); } sptr CreatePreviewOutput(Profile previewProfile) { sptr surface = Surface::CreateSurfaceAsConsumer(); if (surface == nullptr) { return nullptr; } return manager_->CreatePreviewOutput(previewProfile, surface); } void Test(uint8_t* data, size_t size) { CHECK_RETURN(size < LIMITSIZE); CHECK_RETURN_ELOG(!TestToken().GetAllCameraPermission(), "GetPermission error"); manager_ = CameraManager::GetInstance(); sptr session = CameraManagerForSys::GetInstance()->CreateCaptureSessionForSys(SceneMode::CAPTURE); std::vector> cameras = manager_->GetCameraDeviceListFromServer(); CHECK_RETURN_ELOG(cameras.empty(), "GetCameraDeviceListFromServer Error"); sptr input = manager_->CreateCameraInput(cameras[0]); CHECK_RETURN_ELOG(!input, "CreateCameraInput Error"); input->Open(); auto outputCapability = manager_->GetSupportedOutputCapability(cameras[0], 0); CHECK_RETURN_ELOG(!outputCapability, "GetSupportedOutputCapability Error"); previewProfile_ = outputCapability->GetPreviewProfiles(); CHECK_RETURN_ELOG(previewProfile_.empty(), "GetPreviewProfiles Error"); outputCapability->GetVideoProfiles(); sptr preview = CreatePreviewOutput(previewProfile_[0]); session->BeginConfig(); session->AddInput(input); session->AddOutput(preview); session->CommitConfig(); sptr deviceObj = nullptr; manager_->CreateCameraDevice(cameras[0]->GetID(), &deviceObj); sptr camInput = (sptr&)input; camInput->SwitchCameraDevice(deviceObj, cameras[0]); input->GetCameraDeviceInfo(); session->SetInputDevice(input); session->GetInputDevice()->GetCameraDeviceInfo(); preview->outputType_ = CAPTURE_OUTPUT_TYPE_DEPTH_DATA; session->CanAddOutput(preview); FuzzedDataProvider fdp(data, size); TestCallback(session, fdp); TestExposure(session, fdp); TestFocus(session, fdp); TestZoom(session, fdp); TestStabilization(session, fdp); TestProcess(session, fdp); TestAperture(session, fdp); TestBeauty(session, fdp); TestOther(session, fdp); TestOther3(session, fdp); TestFlash(session, fdp); TestAdd(session, fdp); TestSession(session, fdp); TestOther2(session, fdp); session->Release(); session->Stop(); } sptr GetCaptureOutput(FuzzedDataProvider& fdp) { MEDIA_INFO_LOG("CaptureSessionFuzzer: ENTER"); auto manager = CameraManager::GetInstance(); CHECK_RETURN_RET_ELOG(!manager, nullptr, "CaptureSessionFuzzer: CameraManager::GetInstance Error"); CHECK_RETURN_RET_ELOG(!camera, nullptr, "CaptureSessionFuzzer: Camera is null Error"); auto capability = manager->GetSupportedOutputCapability(camera, g_sceneMode); CHECK_RETURN_RET_ELOG(!capability, nullptr, "CaptureSessionFuzzer: GetSupportedOutputCapability Error"); auto profiles = capability->GetPhotoProfiles(); CHECK_RETURN_RET_ELOG(profiles.empty(), nullptr, "CaptureSessionFuzzer: GetPhotoProfiles empty"); profile = profiles[fdp.ConsumeIntegral() % profiles.size()]; sptr photoSurface = IConsumerSurface::Create(); CHECK_RETURN_RET_ELOG(!photoSurface, nullptr, "CaptureSessionFuzzer: create photoSurface Error"); surface = photoSurface->GetProducer(); CHECK_RETURN_RET_ELOG(!surface, nullptr, "CaptureSessionFuzzer: surface GetProducer Error"); return manager->CreatePhotoOutput(profile, surface); } void TestExposure(sptr session, FuzzedDataProvider& fdp) { MEDIA_INFO_LOG("CaptureSessionFuzzer: ENTER"); session->GetSupportedExposureModes(); vector exposureModes; session->GetSupportedExposureModes(exposureModes); ExposureMode exposureMode = static_cast( fdp.ConsumeIntegral() % (ExposureMode::EXPOSURE_MODE_CONTINUOUS_AUTO + NUM_TWO)); session->IsExposureModeSupported(exposureMode); session->IsExposureModeSupported(exposureMode, g_isSupported); session->GetExposureMode(); session->GetExposureMode(exposureMode); session->GetMeteringPoint(); Point exposurePoint; session->GetMeteringPoint(exposurePoint); session->GetExposureBiasRange(); vector exposureBiasRange; session->GetExposureBiasRange(exposureBiasRange); session->GetExposureValue(); float exposure; session->GetExposureValue(exposure); session->LockForControl(); session->SetExposureMode(exposureMode); session->SetMeteringPoint(exposurePoint); float exposureBias = fdp.ConsumeFloatingPoint(); session->SetExposureBias(exposureBias); vector sensorExposureTimeRange; session->GetSensorExposureTimeRange(sensorExposureTimeRange); session->SetSensorExposureTime(fdp.ConsumeIntegral()); uint32_t sensorExposureTime; session->GetSensorExposureTime(sensorExposureTime); session->UnlockForControl(); } void TestFocus(sptr session, FuzzedDataProvider& fdp) { MEDIA_INFO_LOG("CaptureSessionFuzzer: ENTER"); session->GetSupportedFocusModes(); vector focusModes; session->GetSupportedFocusModes(focusModes); FocusMode focusMode = static_cast( fdp.ConsumeIntegral() % (FocusMode::FOCUS_MODE_LOCKED + NUM_TWO)); session->IsFocusModeSupported(focusMode); session->IsFocusModeSupported(focusMode, g_isSupported); session->GetFocusMode(); session->GetFocusMode(focusMode); session->GetFocusPoint(); Point focusPoint; session->GetFocusPoint(focusPoint); session->GetFocalLength(); float focalLength; session->GetFocalLength(focalLength); float distance; session->GetFocusDistance(distance); session->GetMinimumFocusDistance(); session->LockForControl(); session->SetFocusMode(focusMode); session->SetFocusPoint(focusPoint); session->UnlockForControl(); } void TestZoom(sptr session, FuzzedDataProvider& fdp) { MEDIA_INFO_LOG("CaptureSessionFuzzer: ENTER"); session->GetZoomRatioRange(); vector zoomRatioRange; session->GetZoomRatioRange(zoomRatioRange); session->GetZoomRatio(); float zoomRatio; session->GetZoomRatio(zoomRatio); vector zoomPointInfoList; session->GetZoomPointInfos(zoomPointInfoList); session->LockForControl(); session->SetZoomRatio(zoomRatio); session->PrepareZoom(); session->UnPrepareZoom(); float targetZoomRatio = fdp.ConsumeFloatingPoint(); uint32_t smoothZoomType = fdp.ConsumeIntegral(); session->SetSmoothZoom(targetZoomRatio, smoothZoomType); session->UnlockForControl(); } void TestCallback(sptr session, FuzzedDataProvider& fdp) { MEDIA_INFO_LOG("CaptureSessionFuzzer: ENTER"); session->SetCallback(make_shared()); session->SetExposureCallback(make_shared()); session->SetFocusCallback(make_shared()); session->SetSmoothZoomCallback(make_shared()); session->SetMacroStatusCallback(make_shared()); session->SetMoonCaptureBoostStatusCallback(make_shared()); auto fdsCallback = make_shared(fdp.ConsumeBool()); session->SetFeatureDetectionStatusCallback(fdsCallback); session->SetEffectSuggestionCallback(make_shared()); session->SetARCallback(make_shared()); session->SetAbilityCallback(make_shared()); session->GetApplicationCallback(); session->GetExposureCallback(); session->GetFocusCallback(); session->GetMacroStatusCallback(); session->GetMoonCaptureBoostStatusCallback(); session->GetFeatureDetectionStatusCallback(); session->GetSmoothZoomCallback(); session->GetARCallback(); } void TestStabilization(sptr session, FuzzedDataProvider& fdp) { MEDIA_INFO_LOG("CaptureSessionFuzzer: ENTER"); session->GetSupportedStabilizationMode(); vector modes; session->GetSupportedStabilizationMode(modes); VideoStabilizationMode stabilizationMode = static_cast( fdp.ConsumeIntegral() % (VideoStabilizationMode::AUTO + NUM_TWO)); session->IsVideoStabilizationModeSupported(stabilizationMode); session->IsVideoStabilizationModeSupported(stabilizationMode, g_isSupported); VideoStabilizationMode mode; session->GetActiveVideoStabilizationMode(); session->GetActiveVideoStabilizationMode(mode); session->SetVideoStabilizationMode(stabilizationMode); } void TestFlash(sptr session, FuzzedDataProvider& fdp) { MEDIA_INFO_LOG("CaptureSessionFuzzer: ENTER"); session->GetSupportedFlashModes(); vector flashModes; session->GetSupportedFlashModes(flashModes); session->HasFlash(); bool hasFlash; session->HasFlash(hasFlash); FlashMode flashMode = static_cast( fdp.ConsumeIntegral() % (FlashMode::FLASH_MODE_ALWAYS_OPEN + NUM_TWO)); session->IsFlashModeSupported(flashMode); session->IsFlashModeSupported(flashMode, g_isSupported); session->GetFlashMode(); session->GetFlashMode(flashMode); session->SetFlashMode(flashMode); } void TestProcess(sptr session, FuzzedDataProvider& fdp) { MEDIA_INFO_LOG("CaptureSessionFuzzer: ENTER"); static const size_t ITEM_CAP = 10; static const size_t DATA_CAP = 100; shared_ptr result = make_shared(ITEM_CAP, DATA_CAP); int32_t idata = fdp.ConsumeIntegral(); result->addEntry(OHOS_CONTROL_EXPOSURE_MODE, &idata, 1); result->addEntry(OHOS_CONTROL_FOCUS_MODE, &idata, 1); camera_rational_t cr = {fdp.ConsumeIntegral(), fdp.ConsumeIntegral()}; result->addEntry(OHOS_STATUS_SENSOR_EXPOSURE_TIME, &cr, 1); result->addEntry(CAMERA_POSITION_FRONT, &idata, 1); result->addEntry(OHOS_CAMERA_CUSTOM_SNAPSHOT_DURATION, &idata, 1); result->addEntry(OHOS_CAMERA_MACRO_STATUS, &idata, 1); result->addEntry(OHOS_STATUS_MOON_CAPTURE_DETECTION, &idata, 1); result->addEntry(OHOS_CAMERA_EFFECT_SUGGESTION_TYPE, &idata, 1); session->ProcessAutoExposureUpdates(result); session->ProcessAutoFocusUpdates(result); session->ProcessAREngineUpdates(fdp.ConsumeIntegral(), result); session->ProcessSnapshotDurationUpdates(fdp.ConsumeIntegral(), result); session->ProcessMacroStatusChange(result); session->ProcessMoonCaptureBoostStatusChange(result); session->ProcessEffectSuggestionTypeUpdates(result); } void TestAperture(sptr session, FuzzedDataProvider& fdp) { MEDIA_INFO_LOG("CaptureSessionFuzzer: ENTER"); uint32_t moduleType; session->GetModuleType(moduleType); session->IsEffectSuggestionSupported(); session->GetSupportedEffectSuggestionInfo(); session->GetSupportedEffectSuggestionType(); session->LockForControl(); session->SetARMode(fdp.ConsumeBool()); session->EnableEffectSuggestion(fdp.ConsumeBool()); vector effectSuggestionStatusList; size_t max = EffectSuggestionType::EFFECT_SUGGESTION_SUNRISE_SUNSET + NUM_TWO; for (size_t i = 0; i < fdp.ConsumeIntegral() % max; i++) { EffectSuggestionStatus status = { static_cast(fdp.ConsumeIntegral() % max), fdp.ConsumeBool(), }; effectSuggestionStatusList.push_back(status); } session->SetEffectSuggestionStatus(effectSuggestionStatusList); EffectSuggestionType effectSuggestionType = static_cast(fdp.ConsumeIntegral() % max); session->UpdateEffectSuggestion(effectSuggestionType, fdp.ConsumeBool()); session->UnlockForControl(); } void TestBeauty(sptr session, FuzzedDataProvider& fdp) { MEDIA_INFO_LOG("CaptureSessionFuzzer: ENTER"); session->GetSupportedFilters(); session->GetSupportedBeautyTypes(); BeautyType type = static_cast( fdp.ConsumeIntegral() % (BeautyType::SKIN_TONE + NUM_TWO)); session->GetSupportedBeautyRange(type); session->GetBeauty(type); session->GetSupportedColorSpaces(); ColorSpace colorSpace; session->GetActiveColorSpace(colorSpace); session->GetSupportedColorEffects(); session->GetColorEffect(); session->GetFilter(); FilterType filter = static_cast( fdp.ConsumeIntegral() % (FilterType::PINK + NUM_TWO)); session->LockForControl(); session->SetFilter(filter); session->SetColorSpace(colorSpace); ColorEffect colorEffect = static_cast( fdp.ConsumeIntegral() % (ColorEffect::COLOR_EFFECT_BLACK_WHITE + NUM_TWO)); session->SetColorEffect(colorEffect); BeautyType beautyType = static_cast( fdp.ConsumeIntegral() % (BeautyType::SKIN_TONE + NUM_TWO)); session->SetBeautyValue(beautyType, fdp.ConsumeIntegral()); session->SetBeauty(type, fdp.ConsumeIntegral()); session->UnlockForControl(); } void TestOther(sptr session, FuzzedDataProvider& fdp) { MEDIA_INFO_LOG("CaptureSessionFuzzer: ENTER"); session->IsMacroSupported(); session->IsMovingPhotoSupported(); session->IsMoonCaptureBoostSupported(); SceneFeature feature = static_cast( fdp.ConsumeIntegral() % (SceneFeature::FEATURE_ENUM_MAX + NUM_TWO)); session->IsFeatureSupported(feature); vector sensitivityRange; session->GetSensorSensitivityRange(sensitivityRange); session->GetFeaturesMode(); session->GetSubFeatureMods(); session->IsSetEnableMacro(); session->GetMetaOutput(); session->GetMetadata(); session->IsMovingPhotoEnabled(); session->IsImageDeferred(); session->CanSetFrameRateRange(fdp.ConsumeIntegral(), fdp.ConsumeIntegral(), curOutput); session->CanSetFrameRateRangeForOutput(fdp.ConsumeIntegral(), fdp.ConsumeIntegral(), curOutput); session->ExecuteAbilityChangeCallback(); session->EnableFeature(feature, fdp.ConsumeBool()); vector frameRateRange{fdp.ConsumeIntegral(), fdp.ConsumeIntegral()}; session->SetFrameRateRange(frameRateRange); DeferredDeliveryImageType deferredType = static_cast( fdp.ConsumeIntegral() % (DeferredDeliveryImageType::DELIVERY_VIDEO + NUM_TWO)); session->EnableDeferredType(deferredType, fdp.ConsumeBool()); session->SetUserId(); session->EnableAutoHighQualityPhoto(fdp.ConsumeBool()); session->EnableRawDelivery(fdp.ConsumeBool()); auto curMinFps = fdp.ConsumeIntegral(); auto curMaxFps = fdp.ConsumeIntegral(); auto minFps = fdp.ConsumeIntegral(); auto maxFps = fdp.ConsumeIntegral(); session->CheckFrameRateRangeWithCurrentFps(curMinFps, curMaxFps, minFps, maxFps); session->CheckFrameRateRangeWithCurrentFps(NUM_20, NUM_20, NUM_40, NUM_40); session->CheckFrameRateRangeWithCurrentFps(NUM_40, NUM_40, NUM_20, NUM_20); ProfileSizeRatio sizeRatio = RATIO_1_1; session->GetMaxSizePhotoProfile(sizeRatio); session->GetPreconfigPreviewProfile(); session->GetPreconfigPhotoProfile(); session->GetPreconfigVideoProfile(); session->IsVideoDeferred(); } void TestOther2(sptr session, FuzzedDataProvider& fdp) { MEDIA_INFO_LOG("CaptureSessionFuzzer: ENTER"); camera_face_detect_mode_t t = static_cast( fdp.ConsumeIntegral() % (camera_face_detect_mode_t::OHOS_CAMERA_FACE_DETECT_MODE_SIMPLE + NUM_TWO)); set metadataObjectTypes; metadataObjectTypes.insert(t); session->SetCaptureMetadataObjectTypes(metadataObjectTypes); uint32_t ability = fdp.ConsumeIntegral(); session->VerifyAbility(ability); session->SetFocusDistance(fdp.ConsumeFloatingPoint()); session->EnableMacro(fdp.ConsumeBool()); session->EnableMovingPhoto(fdp.ConsumeBool()); session->EnableMovingPhotoMirror(fdp.ConsumeBool(), fdp.ConsumeBool()); session->EnableMoonCaptureBoost(fdp.ConsumeBool()); session->SetSensorSensitivity(fdp.ConsumeIntegral()); int32_t wbValue = fdp.ConsumeIntegral(); session->GetManualWhiteBalance(wbValue); std::vector> supportedPhysicalApertures = {}; session->GetSupportedPhysicalApertures(supportedPhysicalApertures); std::vector apertures; session->GetSupportedVirtualApertures(apertures); float aperture = fdp.ConsumeFloatingPoint(); session->GetVirtualAperture(aperture); session->SetVirtualAperture(aperture); session->GetPhysicalAperture(aperture); session->SetPhysicalAperture(aperture); session->UnlockForControl(); } void TestSession(sptr session, FuzzedDataProvider& fdp) { MEDIA_INFO_LOG("CaptureSessionFuzzer: ENTER"); sptr input = GetCameraInput(fdp); sptr output = GetCaptureOutput(fdp); CHECK_RETURN_ELOG(!input || !output || !session, "CaptureSessionFuzzer: input/output/session is null"); session->SetMode(g_sceneMode); session->GetMode(); PreconfigType preconfigType = static_cast( fdp.ConsumeIntegral() % (PreconfigType::PRECONFIG_HIGH_QUALITY + NUM_TWO)); ProfileSizeRatio preconfigRatio = static_cast( fdp.ConsumeIntegral() % (ProfileSizeRatio::RATIO_16_9 + NUM_TWO)); session->CanPreconfig(preconfigType, preconfigRatio); session->Preconfig(preconfigType, preconfigRatio); session->BeginConfig(); session->CanAddInput(input); session->AddInput(input); session->CanAddOutput(output); session->AddOutput(output); session->RemoveInput(input); session->RemoveOutput(output); session->AddInput(input); session->AddOutput(output); session->AddSecureOutput(output); input->Open(); session->CommitConfig(); session->CheckSpecSearch(); session->Start(); curOutput = output.GetRefPtr(); CaptureOutputType outputType = static_cast( fdp.ConsumeIntegral() % (CaptureOutputType::CAPTURE_OUTPUT_TYPE_MAX + NUM_TWO)); session->ValidateOutputProfile(profile, outputType); session->GeneratePreconfigProfiles(preconfigType, preconfigRatio); session->EnableAutoDeferredVideoEnhancement(fdp.ConsumeBool()); session->ConfigurePhotoOutput(output); } void TestAdd(sptr session, FuzzedDataProvider& fdp) { std::vector supportedPortraitThemeTypes = { PortraitThemeType::NATURAL, PortraitThemeType::DELICATE, PortraitThemeType::STYLISH }; session->SetPortraitThemeType(PortraitThemeType::NATURAL); session->GetSupportedPortraitThemeTypes(supportedPortraitThemeTypes); session->IsPortraitThemeSupported(); std::vector supportedRotation = {0, 90, 180, 270}; session->GetSupportedVideoRotations(supportedRotation); std::vector depthFusionThreshold = {0.0}; session->GetDepthFusionThreshold(depthFusionThreshold); session->EnableDepthFusion(fdp.ConsumeBool()); session->IsDepthFusionEnabled(); session->IsVideoRotationSupported(); session->SetVideoRotation(fdp.ConsumeIntegral()); session->SetIsAutoSwitchDeviceStatus(fdp.ConsumeBool()); FoldCallback *fold = new FoldCallback(session); fold->OnFoldStatusChanged(FoldStatus::UNKNOWN_FOLD); session->ExecuteAllFunctionsInMap(); session->CreateAndSetFoldServiceCallback(); shared_ptr autoDeviceSwitchCallback = nullptr; session->SwitchDevice(); session->FindFrontCamera(); session->SetAutoDeviceSwitchCallback(autoDeviceSwitchCallback); session->GetAutoDeviceSwitchCallback(); session->StartVideoOutput(); session->StopVideoOutput(); session->SetUsage(UsageType::BOKEH, fdp.ConsumeBool()); session->IsAutoDeviceSwitchSupported(); session->EnableAutoDeviceSwitch(fdp.ConsumeBool()); session->CreateCameraAbilityContainer(); } void TestOther3(sptr session, FuzzedDataProvider& fdp) { MEDIA_INFO_LOG("CaptureSessionFuzzer: ENTER"); QualityPrioritization qualityPrioritization = static_cast( fdp.ConsumeIntegral() % (QualityPrioritization::HIGH_QUALITY + NUM_TWO)); session->LockForControl(); session->SetQualityPrioritization(qualityPrioritization); session->EnableAutoAigcPhoto(fdp.ConsumeBool()); session->ProcessProfilesAbilityId(g_sceneMode); Point point; session->CoordinateTransform(point); session->VerifyFocusCorrectness(point); vector types; session->GetSupportedFocusRangeTypes(types); FocusRangeType focusRangeType = static_cast( fdp.ConsumeIntegral() % (FocusRangeType::FOCUS_RANGE_TYPE_AUTO + NUM_TWO)); bool isSupported = fdp.ConsumeBool(); session->IsFocusRangeTypeSupported(focusRangeType, isSupported); session->GetFocusRange(focusRangeType); session->SetFocusRange(focusRangeType); vector types1; session->GetSupportedFocusDrivenTypes(types1); FocusDrivenType focusDrivenType = static_cast( fdp.ConsumeIntegral() % (FocusDrivenType::FOCUS_DRIVEN_TYPE_AUTO + NUM_TWO)); session->IsFocusDrivenTypeSupported(focusDrivenType, isSupported); session->GetFocusDriven(focusDrivenType); session->SetFocusDriven(focusDrivenType); vector types2; session->GetSupportedColorReservationTypes(types2); ColorReservationType colorReservationType = static_cast( fdp.ConsumeIntegral() % (ColorReservationType::COLOR_RESERVATION_TYPE_NONE + NUM_TWO)); session->IsColorReservationTypeSupported(colorReservationType, isSupported); session->GetColorReservation(colorReservationType); session->SetColorReservation(colorReservationType); WhiteBalanceMode mode = AWB_MODE_LOCKED; session->SetWhiteBalanceMode(mode); std::vector supportedWhiteBalanceModes = {}; session->GetSupportedWhiteBalanceModes(supportedWhiteBalanceModes); session->IsWhiteBalanceModeSupported(mode, isSupported); session->GetWhiteBalanceMode(mode); std::vector whiteBalanceRange = {}; session->GetManualWhiteBalanceRange(whiteBalanceRange); session->IsManualWhiteBalanceSupported(isSupported); session->SetManualWhiteBalance(fdp.ConsumeIntegral()); session->SetWhiteBalanceMode(WhiteBalanceMode::AWB_MODE_AUTO); session->UnlockForControl(); } } // namespace StreamRepeatStubFuzzer } // namespace CameraStandard } // namespace OHOS /* Fuzzer entry point */ extern "C" int LLVMFuzzerTestOneInput(uint8_t* data, size_t size) { /* Run your code on data */ OHOS::CameraStandard::CaptureSessionFuzzer::Test(data, size); return 0; }