From 377744cf49e69da6f3aac63f6da98c48c8778aba Mon Sep 17 00:00:00 2001 From: xuedong Date: Tue, 24 Dec 2024 10:05:52 +0800 Subject: [PATCH] fix: sync --- .../include/brightness_manager.h | 2 +- .../include/brightness_manager_ext.h | 2 +- brightness_manager/src/brightness_manager.cpp | 4 +- .../src/brightness_manager_ext.cpp | 7 +- brightness_manager/src/brightness_service.cpp | 2 +- .../src/brightness_manager_ext_test.cpp | 2 +- .../src/mock_brightness_manager_interface.cpp | 2 +- state_manager/service/BUILD.gn | 2 + .../native/include/display_common_event_mgr.h | 50 ++++++++ .../include/display_power_mgr_service.h | 2 + .../native/include/display_system_ability.h | 7 +- .../native/src/display_common_event_mgr.cpp | 114 ++++++++++++++++++ .../native/src/display_power_mgr_service.cpp | 24 ++-- .../native/src/display_system_ability.cpp | 41 +++++-- .../fuzztest/adjustbrightness_fuzzer/BUILD.gn | 6 + .../autoadjustbrightness_fuzzer/BUILD.gn | 6 + .../fuzztest/boostbrightness_fuzzer/BUILD.gn | 6 + .../discountbrightness_fuzzer/BUILD.gn | 6 + .../fuzztest/displaystate_fuzzer/BUILD.gn | 6 + .../fuzztest/getbrightness_fuzzer/BUILD.gn | 6 + .../fuzztest/getdisplayid_fuzzer/BUILD.gn | 6 + .../overridebrightness_fuzzer/BUILD.gn | 6 + .../overridedisplayoffdelay_fuzzer/BUILD.gn | 6 + .../fuzztest/registercallback_fuzzer/BUILD.gn | 6 + .../fuzztest/setbrightness_fuzzer/BUILD.gn | 6 + .../fuzztest/setcoordinated_fuzzer/BUILD.gn | 6 + .../BUILD.gn | 6 + .../fuzztest/setmaxbrightness_fuzzer/BUILD.gn | 6 + 28 files changed, 313 insertions(+), 32 deletions(-) create mode 100644 state_manager/service/native/include/display_common_event_mgr.h create mode 100644 state_manager/service/native/src/display_common_event_mgr.cpp diff --git a/brightness_manager/include/brightness_manager.h b/brightness_manager/include/brightness_manager.h index f3316bd..13031be 100644 --- a/brightness_manager/include/brightness_manager.h +++ b/brightness_manager/include/brightness_manager.h @@ -32,7 +32,7 @@ public: void Init(uint32_t defaultMax, uint32_t defaultMin); void DeInit(); - void SetDisplayState(uint32_t id, DisplayState state); + void SetDisplayState(uint32_t id, DisplayState state, uint32_t reason); DisplayState GetState(); bool AutoAdjustBrightness(bool enable); bool SetBrightness(uint32_t value, uint32_t gradualDuration = 0, bool continuous = false); diff --git a/brightness_manager/include/brightness_manager_ext.h b/brightness_manager/include/brightness_manager_ext.h index 96ffb0b..2dd71b7 100644 --- a/brightness_manager/include/brightness_manager_ext.h +++ b/brightness_manager/include/brightness_manager_ext.h @@ -32,7 +32,7 @@ public: void Init(uint32_t defaultMax, uint32_t defaultMin); void DeInit(); - void SetDisplayState(uint32_t id, DisplayState state); + void SetDisplayState(uint32_t id, DisplayState state, uint32_t reason); DisplayState GetState(); bool AutoAdjustBrightness(bool enable); bool SetBrightness(uint32_t value, uint32_t gradualDuration = 0, bool continuous = false); diff --git a/brightness_manager/src/brightness_manager.cpp b/brightness_manager/src/brightness_manager.cpp index e14ad2c..320f097 100644 --- a/brightness_manager/src/brightness_manager.cpp +++ b/brightness_manager/src/brightness_manager.cpp @@ -41,10 +41,10 @@ void BrightnessManager::DeInit() #endif } -void BrightnessManager::SetDisplayState(uint32_t id, DisplayState state) +void BrightnessManager::SetDisplayState(uint32_t id, DisplayState state, uint32_t reason) { #ifdef OHOS_BUILD_ENABLE_BRIGHTNESS_WRAPPER - mBrightnessManagerExt.SetDisplayState(id, state); + mBrightnessManagerExt.SetDisplayState(id, state, reason); #else BrightnessService::Get().SetDisplayState(id, state); #endif diff --git a/brightness_manager/src/brightness_manager_ext.cpp b/brightness_manager/src/brightness_manager_ext.cpp index 2f7df3c..f6b8f31 100644 --- a/brightness_manager/src/brightness_manager_ext.cpp +++ b/brightness_manager/src/brightness_manager_ext.cpp @@ -229,13 +229,14 @@ void BrightnessManagerExt::CloseBrightnessExtLibrary() mSetMaxBrightnessNitFunc = nullptr; } -void BrightnessManagerExt::SetDisplayState(uint32_t id, DisplayState state) +void BrightnessManagerExt::SetDisplayState(uint32_t id, DisplayState state, uint32_t reason) { if (!mBrightnessManagerExtEnable) { return; } - auto setDisplayStateFunc = reinterpret_cast(mSetDisplayStateFunc); - setDisplayStateFunc(id, state); + auto setDisplayStateFunc = reinterpret_cast + (mSetDisplayStateFunc); + setDisplayStateFunc(id, state, reason); } DisplayState BrightnessManagerExt::GetState() diff --git a/brightness_manager/src/brightness_service.cpp b/brightness_manager/src/brightness_service.cpp index a504759..eaab127 100644 --- a/brightness_manager/src/brightness_service.cpp +++ b/brightness_manager/src/brightness_service.cpp @@ -873,7 +873,7 @@ void BrightnessService::SetSleepBrightness() MIN_DEFAULT_BRGIHTNESS_LEVEL); uint32_t sleepDarkenTime = BrightnessParamHelper::GetSleepDarkenTime(); mIsSleepStatus = true; - DISPLAY_HILOGI(FEAT_BRIGHTNESS, "SetSleepBrightness enterSleepBrightness=%{pulblic}d, sleepDarkenTime=%{public}d", + DISPLAY_HILOGI(FEAT_BRIGHTNESS, "SetSleepBrightness enterSleepBrightness=%{public}d, sleepDarkenTime=%{public}d", enterSleepBrightness, sleepDarkenTime); OverrideBrightness(enterSleepBrightness, sleepDarkenTime); } diff --git a/brightness_manager/test/unittest/src/brightness_manager_ext_test.cpp b/brightness_manager/test/unittest/src/brightness_manager_ext_test.cpp index 5395be3..1475d48 100644 --- a/brightness_manager/test/unittest/src/brightness_manager_ext_test.cpp +++ b/brightness_manager/test/unittest/src/brightness_manager_ext_test.cpp @@ -106,7 +106,7 @@ HWTEST_F(BrightnessManagerExtTest, MockInit001, TestSize.Level0) MockInitBrightnessManagerExt(g_BrightnessManagerExt); MockClearValues(); - g_BrightnessManagerExt.SetDisplayState(0, DisplayState::DISPLAY_OFF); + g_BrightnessManagerExt.SetDisplayState(0, DisplayState::DISPLAY_OFF, 0); MockSetValue(1.0); usleep(DEFAULT_WAITING_TIME); diff --git a/brightness_manager/test/unittest/src/mock_brightness_manager_interface.cpp b/brightness_manager/test/unittest/src/mock_brightness_manager_interface.cpp index 8a5f07b..f8f81b3 100644 --- a/brightness_manager/test/unittest/src/mock_brightness_manager_interface.cpp +++ b/brightness_manager/test/unittest/src/mock_brightness_manager_interface.cpp @@ -54,7 +54,7 @@ void DeInit() { } -void SetDisplayState(uint32_t id, DisplayState state) +void SetDisplayState(uint32_t id, DisplayState state, uint32_t reason) { } diff --git a/state_manager/service/BUILD.gn b/state_manager/service/BUILD.gn index e7fd8b0..acf15cf 100644 --- a/state_manager/service/BUILD.gn +++ b/state_manager/service/BUILD.gn @@ -34,6 +34,7 @@ ohos_shared_library("displaymgrservice") { sources = [ "native/src/display_auto_brightness.cpp", + "native/src/display_common_event_mgr.cpp", "native/src/display_param_helper.cpp", "native/src/display_power_mgr_service.cpp", "native/src/display_setting_helper.cpp", @@ -75,6 +76,7 @@ ohos_shared_library("displaymgrservice") { "power_manager:power_sysparam", "power_manager:powermgr_client", "safwk:system_ability_fwk", + "samgr:samgr_proxy", "window_manager:libdm_lite", ] diff --git a/state_manager/service/native/include/display_common_event_mgr.h b/state_manager/service/native/include/display_common_event_mgr.h new file mode 100644 index 0000000..0a218ec --- /dev/null +++ b/state_manager/service/native/include/display_common_event_mgr.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2024 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. + */ + +#ifndef DISPLAY_COMMON_EVENT_MGR_H +#define DISPLAY_COMMON_EVENT_MGR_H + +#include "common_event_manager.h" +#include "common_event_subscriber.h" +#include "common_event_support.h" +#include "datashare_helper.h" +#include "display_common.h" + +namespace OHOS { +namespace DisplayPowerMgr { +class DisplayCommonEventManager : public OHOS::EventFwk::CommonEventSubscriber { +public: + explicit DisplayCommonEventManager(const OHOS::EventFwk::CommonEventSubscribeInfo &subscribeInfo); + virtual ~DisplayCommonEventManager() = default; + DisplayCommonEventManager(const DisplayCommonEventManager&) = delete; + DisplayCommonEventManager& operator=(const DisplayCommonEventManager&) = delete; + DisplayCommonEventManager(DisplayCommonEventManager&&) = delete; + DisplayCommonEventManager& operator=(DisplayCommonEventManager&&) = delete; + + void OnReceiveEvent(const OHOS::EventFwk::CommonEventData &data) override; + bool CheckIfSettingsDataReady(); + bool SetKvDataReady(); + void HandleBootBrightness(); + +private: + sptr GetDpmsRemoteObj(); + bool CreateDataShareHelper(sptr remoteObj); + bool isDataShareReady_ {false}; + bool isKvDataReady_ {false}; + std::mutex lock_ {}; +}; +} // namespace DisplayPowerMgr +} // namespace OHOS +#endif \ No newline at end of file diff --git a/state_manager/service/native/include/display_power_mgr_service.h b/state_manager/service/native/include/display_power_mgr_service.h index f3ee1b8..bd3c210 100644 --- a/state_manager/service/native/include/display_power_mgr_service.h +++ b/state_manager/service/native/include/display_power_mgr_service.h @@ -77,6 +77,7 @@ public: void Reset(); void ClearOffset(); void SetScreenOnBrightness(); + void HandleBootBrightness(); static uint32_t GetSafeBrightness(uint32_t value); static double GetSafeDiscount(double discount, uint32_t brightness); @@ -157,6 +158,7 @@ private: uint32_t displayReason_ {0}; std::shared_ptr queue_; bool isInTestMode_ {false}; + std::once_flag initFlag_; }; } // namespace DisplayPowerMgr } // namespace OHOS diff --git a/state_manager/service/native/include/display_system_ability.h b/state_manager/service/native/include/display_system_ability.h index a5a829b..8607eca 100644 --- a/state_manager/service/native/include/display_system_ability.h +++ b/state_manager/service/native/include/display_system_ability.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 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 @@ -21,6 +21,7 @@ #include #include #include "refbase.h" +#include "display_common_event_mgr.h" #include "display_power_mgr_service.h" namespace OHOS { @@ -38,8 +39,8 @@ public: private: sptr service_; - bool isDpmsLoaded{false}; - bool isDataLoaded{false}; + std::shared_ptr commonEventManager_ {nullptr}; + bool isReady{false}; }; } } diff --git a/state_manager/service/native/src/display_common_event_mgr.cpp b/state_manager/service/native/src/display_common_event_mgr.cpp new file mode 100644 index 0000000..a2f1005 --- /dev/null +++ b/state_manager/service/native/src/display_common_event_mgr.cpp @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2024 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 "display_common_event_mgr.h" + +#include + +#include "display_system_ability.h" +#include "display_power_mgr_service.h" +#include "iservice_registry.h" +#include "system_ability_definition.h" + + +namespace OHOS { +namespace DisplayPowerMgr { +namespace { +constexpr const char *SETTING_URI_PROXY = + "datashare:///com.ohos.settingsdata/entry/settingsdata/SETTINGSDATA?Proxy=true"; +constexpr const char *SETTINGS_DATA_EXT_URI = "datashare_ext"; +} +using CommonEventSubscriber = OHOS::EventFwk::CommonEventSubscriber; +using CommonEventSubscribeInfo = OHOS::EventFwk::CommonEventSubscribeInfo; +using CommonEventData = OHOS::EventFwk::CommonEventData; + +DisplayCommonEventManager::DisplayCommonEventManager(const CommonEventSubscribeInfo &subscribeInfo) + : CommonEventSubscriber(subscribeInfo) +{ +} + +void DisplayCommonEventManager::OnReceiveEvent(const CommonEventData &data) +{ + std::string action = data.GetWant().GetAction(); + if (action == "usual.event.DATA_SHARE_READY") { + DISPLAY_HILOGI(COMP_SVC, "on receive data_share ready."); + if (GetDpmsRemoteObj() && SetKvDataReady()) { + HandleBootBrightness(); + } + } +} + +bool DisplayCommonEventManager::CheckIfSettingsDataReady() +{ + if (isDataShareReady_) { + return true; + } + auto remoteObj = GetDpmsRemoteObj(); + if (remoteObj == nullptr) { + DISPLAY_HILOGE(COMP_SVC, "remote obj is null"); + return false; + } + return CreateDataShareHelper(remoteObj); +} + +sptr DisplayCommonEventManager::GetDpmsRemoteObj() +{ + auto sam = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (sam == nullptr) { + DISPLAY_HILOGE(COMP_SVC, "sa manager is null"); + return nullptr; + } + return sam->CheckSystemAbility(DISPLAY_MANAGER_SERVICE_ID); +} + +bool DisplayCommonEventManager::CreateDataShareHelper(sptr remoteObj) +{ + std::pair> ret = + DataShare::DataShareHelper::Create(remoteObj, SETTING_URI_PROXY, SETTINGS_DATA_EXT_URI); + DISPLAY_HILOGI(COMP_SVC, "create data_share helper, ret=%{public}d", ret.first); + if (ret.first == DataShare::E_OK) { + DISPLAY_HILOGI(COMP_SVC, "create data_share helper success"); + auto helper = ret.second; + if (helper != nullptr) { + bool releaseRet = helper->Release(); + DISPLAY_HILOGI(COMP_SVC, "release data_share helper, releaseRet=%{public}d", releaseRet); + } + isDataShareReady_ = true; + return true; + } else { + DISPLAY_HILOGE(COMP_SVC, "create data_share helper failed"); + isDataShareReady_ = false; + return false; + } +} + +bool DisplayCommonEventManager::SetKvDataReady() +{ + std::lock_guard lock(lock_); + if (isKvDataReady_) { + return false; + } + isKvDataReady_ = true; + return true; +} + +void DisplayCommonEventManager::HandleBootBrightness() +{ + DISPLAY_HILOGI(COMP_SVC, "set boot brightness"); + auto service = DelayedSpSingleton::GetInstance(); + service->HandleBootBrightness(); +} +} // namespace DisplayPowerMgr +} // namespace OHOS diff --git a/state_manager/service/native/src/display_power_mgr_service.cpp b/state_manager/service/native/src/display_power_mgr_service.cpp index d7e1979..d9f0e6f 100644 --- a/state_manager/service/native/src/display_power_mgr_service.cpp +++ b/state_manager/service/native/src/display_power_mgr_service.cpp @@ -85,15 +85,9 @@ void DisplayPowerMgrService::Init() #ifdef ENABLE_SENSOR_PART InitSensors(); #endif - FFRTTask task = [this]() { - DISPLAY_HILOGI(COMP_SVC, "Boot completed delayed"); - SetBootCompletedBrightness(); - SetBootCompletedAutoBrightness(); - RegisterSettingObservers(); - }; - g_screenOffDelayTaskHandle = FFRTUtils::SubmitDelayTask(task, BOOTED_COMPLETE_DELAY_TIME, queue_); RegisterBootCompletedCallback(); } + void DisplayPowerMgrService::RegisterBootCompletedCallback() { g_bootCompletedCallback = []() { @@ -120,6 +114,16 @@ void DisplayPowerMgrService::Reset() DISPLAY_HILOGI(FEAT_BRIGHTNESS, "reset end"); } +void DisplayPowerMgrService::HandleBootBrightness() +{ + BrightnessManager::Get().Init(BRIGHTNESS_MAX, BRIGHTNESS_MIN); + std::call_once(initFlag_, [] { + SetBootCompletedBrightness(); + SetBootCompletedAutoBrightness(); + }); + RegisterSettingObservers(); +} + void DisplayPowerMgrService::SetBootCompletedBrightness() { uint32_t mainDisplayId = DelayedSpSingleton::GetInstance()->GetMainDisplayId(); @@ -127,7 +131,7 @@ void DisplayPowerMgrService::SetBootCompletedBrightness() uint32_t currentDisplayId = BrightnessManager::Get().GetCurrentDisplayId(mainDisplayId); DisplayState state = DelayedSpSingleton::GetInstance()->GetDisplayState(mainDisplayId); BrightnessManager::Get().SetDisplayId(currentDisplayId); - BrightnessManager::Get().SetDisplayState(currentDisplayId, state); + BrightnessManager::Get().SetDisplayState(currentDisplayId, state, 0); DelayedSpSingleton::GetInstance()->SetBrightness(brightness, mainDisplayId); DISPLAY_HILOGI(FEAT_BRIGHTNESS, "SetBootCompletedBrightness currentDisplayId=%{public}d", currentDisplayId); } @@ -237,7 +241,7 @@ bool DisplayPowerMgrService::SetDisplayState(uint32_t id, DisplayState state, ui } } - BrightnessManager::Get().SetDisplayState(id, state); + BrightnessManager::Get().SetDisplayState(id, state, reason); if (state == DisplayState::DISPLAY_OFF) { if (!isDisplayDelayOff_) { @@ -245,7 +249,7 @@ bool DisplayPowerMgrService::SetDisplayState(uint32_t id, DisplayState state, ui bool ret = iterator->second->UpdateState(state, reason); if (!ret) { DISPLAY_HILOGI(COMP_SVC, "[UL_POWER]undo brightness SetDisplayState"); - BrightnessManager::Get().SetDisplayState(id, iterator->second->GetState()); + BrightnessManager::Get().SetDisplayState(id, iterator->second->GetState(), reason); } return ret; } diff --git a/state_manager/service/native/src/display_system_ability.cpp b/state_manager/service/native/src/display_system_ability.cpp index 1cbd492..b0046e9 100644 --- a/state_manager/service/native/src/display_system_ability.cpp +++ b/state_manager/service/native/src/display_system_ability.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 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 @@ -30,6 +30,7 @@ void DisplaySystemAbility::OnStart() DISPLAY_HILOGI(COMP_SVC, "DisplayPowerService On Start."); AddSystemAbilityListener(DISPLAY_MANAGER_SERVICE_SA_ID); // we need to listen data service completed when create dpms service + AddSystemAbilityListener(COMMON_EVENT_SERVICE_ID); AddSystemAbilityListener(DISTRIBUTED_KV_DATA_SERVICE_ABILITY_ID); } @@ -37,19 +38,40 @@ void DisplaySystemAbility::OnAddSystemAbility(int32_t systemAbilityId, const std { if (systemAbilityId == DISPLAY_MANAGER_SERVICE_SA_ID) { DISPLAY_HILOGI(COMP_SVC, "DISPLAY_MANAGER_SERVICE_SA_ID loaded"); - isDpmsLoaded = true; - } - if (systemAbilityId == DISTRIBUTED_KV_DATA_SERVICE_ABILITY_ID) { - DISPLAY_HILOGI(COMP_SVC, "DISTRIBUTED_KV_DATA_SERVICE_ABILITY_ID loaded"); - isDataLoaded = true; - } - if (isDpmsLoaded && isDataLoaded) { // dpms service and data service both ready - DISPLAY_HILOGI(COMP_SVC, "Start DisplayPowerMgrService"); + if (isReady) { + DISPLAY_HILOGI(COMP_SVC, "Onstart is ready, nothing to do"); + return; + } auto service = DelayedSpSingleton::GetInstance(); service->Init(); if (!Publish(service)) { DISPLAY_HILOGE(COMP_SVC, "Failed to publish service"); } + if (commonEventManager_ != nullptr && commonEventManager_->CheckIfSettingsDataReady() + && commonEventManager_->SetKvDataReady()) { + commonEventManager_->HandleBootBrightness(); + } + isReady = true; + } + if (systemAbilityId == COMMON_EVENT_SERVICE_ID) { + DISPLAY_HILOGI(COMP_SVC, "COMMON_EVENT_SERVICE_ID loaded"); + OHOS::EventFwk::MatchingSkills matchingSkills; + matchingSkills.AddEvent("usual.event.DATA_SHARE_READY"); + OHOS::EventFwk::CommonEventSubscribeInfo subscribeInfo(matchingSkills); + if (commonEventManager_ == nullptr) { + commonEventManager_ = std::make_shared(subscribeInfo); + } + if (commonEventManager_ == nullptr || + !OHOS::EventFwk::CommonEventManager::SubscribeCommonEvent(commonEventManager_)) { + DISPLAY_HILOGI(COMP_SVC, "subscribe common event failed"); + } + } + if (systemAbilityId == DISTRIBUTED_KV_DATA_SERVICE_ABILITY_ID) { + DISPLAY_HILOGI(COMP_SVC, "DISTRIBUTED_KV_DATA_SERVICE_ABILITY_ID loaded"); + if (commonEventManager_ != nullptr && commonEventManager_->CheckIfSettingsDataReady() && + commonEventManager_->SetKvDataReady()) { + commonEventManager_->HandleBootBrightness(); + } } } @@ -59,6 +81,7 @@ void DisplaySystemAbility::OnStop() auto service = DelayedSpSingleton::GetInstance(); service->Deinit(); RemoveSystemAbilityListener(DISPLAY_MANAGER_SERVICE_SA_ID); + isReady = false; } } // OHOS } // DisplayPowerMgr diff --git a/state_manager/test/fuzztest/adjustbrightness_fuzzer/BUILD.gn b/state_manager/test/fuzztest/adjustbrightness_fuzzer/BUILD.gn index a3693c0..e885c3e 100644 --- a/state_manager/test/fuzztest/adjustbrightness_fuzzer/BUILD.gn +++ b/state_manager/test/fuzztest/adjustbrightness_fuzzer/BUILD.gn @@ -46,6 +46,7 @@ ohos_fuzztest("AdjustBrightnessFuzzTest") { ] sources = [ "${displaymgr_root_path}/service/native/src/display_auto_brightness.cpp", + "${displaymgr_root_path}/service/native/src/display_common_event_mgr.cpp", "${displaymgr_root_path}/service/native/src/display_param_helper.cpp", "${displaymgr_root_path}/service/native/src/display_power_mgr_service.cpp", "${displaymgr_root_path}/service/native/src/display_setting_helper.cpp", @@ -61,8 +62,12 @@ ohos_fuzztest("AdjustBrightnessFuzzTest") { external_deps = [ "power_manager:power_permission" ] external_deps += [ + "ability_base:base", + "ability_base:want", "ability_runtime:ability_manager", "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "data_share:datashare_common", "data_share:datashare_consumer", "display_manager:displaymgr", "eventhandler:libeventhandler", @@ -77,6 +82,7 @@ ohos_fuzztest("AdjustBrightnessFuzzTest") { "power_manager:power_sysparam", "power_manager:powermgr_client", "safwk:system_ability_fwk", + "samgr:samgr_proxy", "window_manager:libdm_lite", ] diff --git a/state_manager/test/fuzztest/autoadjustbrightness_fuzzer/BUILD.gn b/state_manager/test/fuzztest/autoadjustbrightness_fuzzer/BUILD.gn index b5d2d92..2214385 100644 --- a/state_manager/test/fuzztest/autoadjustbrightness_fuzzer/BUILD.gn +++ b/state_manager/test/fuzztest/autoadjustbrightness_fuzzer/BUILD.gn @@ -46,6 +46,7 @@ ohos_fuzztest("AutoAdjustBrightnessFuzzTest") { ] sources = [ "${displaymgr_root_path}/service/native/src/display_auto_brightness.cpp", + "${displaymgr_root_path}/service/native/src/display_common_event_mgr.cpp", "${displaymgr_root_path}/service/native/src/display_param_helper.cpp", "${displaymgr_root_path}/service/native/src/display_power_mgr_service.cpp", "${displaymgr_root_path}/service/native/src/display_setting_helper.cpp", @@ -61,8 +62,12 @@ ohos_fuzztest("AutoAdjustBrightnessFuzzTest") { external_deps = [ "power_manager:power_permission" ] external_deps += [ + "ability_base:base", + "ability_base:want", "ability_runtime:ability_manager", "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "data_share:datashare_common", "data_share:datashare_consumer", "display_manager:displaymgr", "eventhandler:libeventhandler", @@ -77,6 +82,7 @@ ohos_fuzztest("AutoAdjustBrightnessFuzzTest") { "power_manager:power_sysparam", "power_manager:powermgr_client", "safwk:system_ability_fwk", + "samgr:samgr_proxy", "window_manager:libdm_lite", ] diff --git a/state_manager/test/fuzztest/boostbrightness_fuzzer/BUILD.gn b/state_manager/test/fuzztest/boostbrightness_fuzzer/BUILD.gn index 22ac526..2ec6ed6 100644 --- a/state_manager/test/fuzztest/boostbrightness_fuzzer/BUILD.gn +++ b/state_manager/test/fuzztest/boostbrightness_fuzzer/BUILD.gn @@ -46,6 +46,7 @@ ohos_fuzztest("BoostBrightnessFuzzTest") { ] sources = [ "${displaymgr_root_path}/service/native/src/display_auto_brightness.cpp", + "${displaymgr_root_path}/service/native/src/display_common_event_mgr.cpp", "${displaymgr_root_path}/service/native/src/display_param_helper.cpp", "${displaymgr_root_path}/service/native/src/display_power_mgr_service.cpp", "${displaymgr_root_path}/service/native/src/display_setting_helper.cpp", @@ -61,8 +62,12 @@ ohos_fuzztest("BoostBrightnessFuzzTest") { external_deps = [ "power_manager:power_permission" ] external_deps += [ + "ability_base:base", + "ability_base:want", "ability_runtime:ability_manager", "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "data_share:datashare_common", "data_share:datashare_consumer", "display_manager:displaymgr", "eventhandler:libeventhandler", @@ -77,6 +82,7 @@ ohos_fuzztest("BoostBrightnessFuzzTest") { "power_manager:power_sysparam", "power_manager:powermgr_client", "safwk:system_ability_fwk", + "samgr:samgr_proxy", "window_manager:libdm_lite", ] diff --git a/state_manager/test/fuzztest/discountbrightness_fuzzer/BUILD.gn b/state_manager/test/fuzztest/discountbrightness_fuzzer/BUILD.gn index 8af3b7a..ecffaf3 100644 --- a/state_manager/test/fuzztest/discountbrightness_fuzzer/BUILD.gn +++ b/state_manager/test/fuzztest/discountbrightness_fuzzer/BUILD.gn @@ -46,6 +46,7 @@ ohos_fuzztest("DiscountBrightnessFuzzTest") { ] sources = [ "${displaymgr_root_path}/service/native/src/display_auto_brightness.cpp", + "${displaymgr_root_path}/service/native/src/display_common_event_mgr.cpp", "${displaymgr_root_path}/service/native/src/display_param_helper.cpp", "${displaymgr_root_path}/service/native/src/display_power_mgr_service.cpp", "${displaymgr_root_path}/service/native/src/display_setting_helper.cpp", @@ -61,8 +62,12 @@ ohos_fuzztest("DiscountBrightnessFuzzTest") { external_deps = [ "power_manager:power_permission" ] external_deps += [ + "ability_base:base", + "ability_base:want", "ability_runtime:ability_manager", "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "data_share:datashare_common", "data_share:datashare_consumer", "display_manager:displaymgr", "eventhandler:libeventhandler", @@ -77,6 +82,7 @@ ohos_fuzztest("DiscountBrightnessFuzzTest") { "power_manager:power_sysparam", "power_manager:powermgr_client", "safwk:system_ability_fwk", + "samgr:samgr_proxy", "window_manager:libdm_lite", ] diff --git a/state_manager/test/fuzztest/displaystate_fuzzer/BUILD.gn b/state_manager/test/fuzztest/displaystate_fuzzer/BUILD.gn index 9078538..4a1d11a 100644 --- a/state_manager/test/fuzztest/displaystate_fuzzer/BUILD.gn +++ b/state_manager/test/fuzztest/displaystate_fuzzer/BUILD.gn @@ -45,6 +45,7 @@ ohos_fuzztest("DisplayStateFuzzTest") { ] sources = [ "${displaymgr_root_path}/service/native/src/display_auto_brightness.cpp", + "${displaymgr_root_path}/service/native/src/display_common_event_mgr.cpp", "${displaymgr_root_path}/service/native/src/display_param_helper.cpp", "${displaymgr_root_path}/service/native/src/display_power_mgr_service.cpp", "${displaymgr_root_path}/service/native/src/display_setting_helper.cpp", @@ -60,8 +61,12 @@ ohos_fuzztest("DisplayStateFuzzTest") { external_deps = [ "power_manager:power_permission" ] external_deps += [ + "ability_base:base", + "ability_base:want", "ability_runtime:ability_manager", "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "data_share:datashare_common", "data_share:datashare_consumer", "display_manager:displaymgr", "eventhandler:libeventhandler", @@ -76,6 +81,7 @@ ohos_fuzztest("DisplayStateFuzzTest") { "power_manager:power_sysparam", "power_manager:powermgr_client", "safwk:system_ability_fwk", + "samgr:samgr_proxy", "window_manager:libdm_lite", ] diff --git a/state_manager/test/fuzztest/getbrightness_fuzzer/BUILD.gn b/state_manager/test/fuzztest/getbrightness_fuzzer/BUILD.gn index be8f744..d6fd71e 100644 --- a/state_manager/test/fuzztest/getbrightness_fuzzer/BUILD.gn +++ b/state_manager/test/fuzztest/getbrightness_fuzzer/BUILD.gn @@ -46,6 +46,7 @@ ohos_fuzztest("GetBrightnessFuzzTest") { ] sources = [ "${displaymgr_root_path}/service/native/src/display_auto_brightness.cpp", + "${displaymgr_root_path}/service/native/src/display_common_event_mgr.cpp", "${displaymgr_root_path}/service/native/src/display_param_helper.cpp", "${displaymgr_root_path}/service/native/src/display_power_mgr_service.cpp", "${displaymgr_root_path}/service/native/src/display_setting_helper.cpp", @@ -61,8 +62,12 @@ ohos_fuzztest("GetBrightnessFuzzTest") { external_deps = [ "power_manager:power_permission" ] external_deps += [ + "ability_base:base", + "ability_base:want", "ability_runtime:ability_manager", "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "data_share:datashare_common", "data_share:datashare_consumer", "display_manager:displaymgr", "eventhandler:libeventhandler", @@ -77,6 +82,7 @@ ohos_fuzztest("GetBrightnessFuzzTest") { "power_manager:power_sysparam", "power_manager:powermgr_client", "safwk:system_ability_fwk", + "samgr:samgr_proxy", "window_manager:libdm_lite", ] diff --git a/state_manager/test/fuzztest/getdisplayid_fuzzer/BUILD.gn b/state_manager/test/fuzztest/getdisplayid_fuzzer/BUILD.gn index 082a95e..e9021d1 100644 --- a/state_manager/test/fuzztest/getdisplayid_fuzzer/BUILD.gn +++ b/state_manager/test/fuzztest/getdisplayid_fuzzer/BUILD.gn @@ -45,6 +45,7 @@ ohos_fuzztest("GetDisplayIdFuzzTest") { ] sources = [ "${displaymgr_root_path}/service/native/src/display_auto_brightness.cpp", + "${displaymgr_root_path}/service/native/src/display_common_event_mgr.cpp", "${displaymgr_root_path}/service/native/src/display_param_helper.cpp", "${displaymgr_root_path}/service/native/src/display_power_mgr_service.cpp", "${displaymgr_root_path}/service/native/src/display_setting_helper.cpp", @@ -60,8 +61,12 @@ ohos_fuzztest("GetDisplayIdFuzzTest") { external_deps = [ "power_manager:power_permission" ] external_deps += [ + "ability_base:base", + "ability_base:want", "ability_runtime:ability_manager", "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "data_share:datashare_common", "data_share:datashare_consumer", "display_manager:displaymgr", "eventhandler:libeventhandler", @@ -76,6 +81,7 @@ ohos_fuzztest("GetDisplayIdFuzzTest") { "power_manager:power_sysparam", "power_manager:powermgr_client", "safwk:system_ability_fwk", + "samgr:samgr_proxy", "window_manager:libdm_lite", ] diff --git a/state_manager/test/fuzztest/overridebrightness_fuzzer/BUILD.gn b/state_manager/test/fuzztest/overridebrightness_fuzzer/BUILD.gn index adf209c..c1c0131 100644 --- a/state_manager/test/fuzztest/overridebrightness_fuzzer/BUILD.gn +++ b/state_manager/test/fuzztest/overridebrightness_fuzzer/BUILD.gn @@ -46,6 +46,7 @@ ohos_fuzztest("OverrideBrightnessFuzzTest") { ] sources = [ "${displaymgr_root_path}/service/native/src/display_auto_brightness.cpp", + "${displaymgr_root_path}/service/native/src/display_common_event_mgr.cpp", "${displaymgr_root_path}/service/native/src/display_param_helper.cpp", "${displaymgr_root_path}/service/native/src/display_power_mgr_service.cpp", "${displaymgr_root_path}/service/native/src/display_setting_helper.cpp", @@ -61,8 +62,12 @@ ohos_fuzztest("OverrideBrightnessFuzzTest") { external_deps = [ "power_manager:power_permission" ] external_deps += [ + "ability_base:base", + "ability_base:want", "ability_runtime:ability_manager", "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "data_share:datashare_common", "data_share:datashare_consumer", "display_manager:displaymgr", "eventhandler:libeventhandler", @@ -77,6 +82,7 @@ ohos_fuzztest("OverrideBrightnessFuzzTest") { "power_manager:power_sysparam", "power_manager:powermgr_client", "safwk:system_ability_fwk", + "samgr:samgr_proxy", "window_manager:libdm_lite", ] diff --git a/state_manager/test/fuzztest/overridedisplayoffdelay_fuzzer/BUILD.gn b/state_manager/test/fuzztest/overridedisplayoffdelay_fuzzer/BUILD.gn index 3070476..a9b5791 100644 --- a/state_manager/test/fuzztest/overridedisplayoffdelay_fuzzer/BUILD.gn +++ b/state_manager/test/fuzztest/overridedisplayoffdelay_fuzzer/BUILD.gn @@ -46,6 +46,7 @@ ohos_fuzztest("OverrideDisplayOffDelayFuzzTest") { ] sources = [ "${displaymgr_root_path}/service/native/src/display_auto_brightness.cpp", + "${displaymgr_root_path}/service/native/src/display_common_event_mgr.cpp", "${displaymgr_root_path}/service/native/src/display_param_helper.cpp", "${displaymgr_root_path}/service/native/src/display_power_mgr_service.cpp", "${displaymgr_root_path}/service/native/src/display_setting_helper.cpp", @@ -61,8 +62,12 @@ ohos_fuzztest("OverrideDisplayOffDelayFuzzTest") { external_deps = [ "power_manager:power_permission" ] external_deps += [ + "ability_base:base", + "ability_base:want", "ability_runtime:ability_manager", "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "data_share:datashare_common", "data_share:datashare_consumer", "display_manager:displaymgr", "eventhandler:libeventhandler", @@ -77,6 +82,7 @@ ohos_fuzztest("OverrideDisplayOffDelayFuzzTest") { "power_manager:power_sysparam", "power_manager:powermgr_client", "safwk:system_ability_fwk", + "samgr:samgr_proxy", "window_manager:libdm_lite", ] diff --git a/state_manager/test/fuzztest/registercallback_fuzzer/BUILD.gn b/state_manager/test/fuzztest/registercallback_fuzzer/BUILD.gn index 430c463..7927bae 100644 --- a/state_manager/test/fuzztest/registercallback_fuzzer/BUILD.gn +++ b/state_manager/test/fuzztest/registercallback_fuzzer/BUILD.gn @@ -46,6 +46,7 @@ ohos_fuzztest("RegisterCallbackFuzzTest") { ] sources = [ "${displaymgr_root_path}/service/native/src/display_auto_brightness.cpp", + "${displaymgr_root_path}/service/native/src/display_common_event_mgr.cpp", "${displaymgr_root_path}/service/native/src/display_param_helper.cpp", "${displaymgr_root_path}/service/native/src/display_power_mgr_service.cpp", "${displaymgr_root_path}/service/native/src/display_setting_helper.cpp", @@ -61,8 +62,12 @@ ohos_fuzztest("RegisterCallbackFuzzTest") { external_deps = [ "power_manager:power_permission" ] external_deps += [ + "ability_base:base", + "ability_base:want", "ability_runtime:ability_manager", "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "data_share:datashare_common", "data_share:datashare_consumer", "display_manager:displaymgr", "eventhandler:libeventhandler", @@ -77,6 +82,7 @@ ohos_fuzztest("RegisterCallbackFuzzTest") { "power_manager:power_sysparam", "power_manager:powermgr_client", "safwk:system_ability_fwk", + "samgr:samgr_proxy", "window_manager:libdm_lite", ] diff --git a/state_manager/test/fuzztest/setbrightness_fuzzer/BUILD.gn b/state_manager/test/fuzztest/setbrightness_fuzzer/BUILD.gn index a395342..9475ea8 100644 --- a/state_manager/test/fuzztest/setbrightness_fuzzer/BUILD.gn +++ b/state_manager/test/fuzztest/setbrightness_fuzzer/BUILD.gn @@ -46,6 +46,7 @@ ohos_fuzztest("SetBrightnessFuzzTest") { ] sources = [ "${displaymgr_root_path}/service/native/src/display_auto_brightness.cpp", + "${displaymgr_root_path}/service/native/src/display_common_event_mgr.cpp", "${displaymgr_root_path}/service/native/src/display_param_helper.cpp", "${displaymgr_root_path}/service/native/src/display_power_mgr_service.cpp", "${displaymgr_root_path}/service/native/src/display_setting_helper.cpp", @@ -61,8 +62,12 @@ ohos_fuzztest("SetBrightnessFuzzTest") { external_deps = [ "power_manager:power_permission" ] external_deps += [ + "ability_base:base", + "ability_base:want", "ability_runtime:ability_manager", "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "data_share:datashare_common", "data_share:datashare_consumer", "display_manager:displaymgr", "eventhandler:libeventhandler", @@ -77,6 +82,7 @@ ohos_fuzztest("SetBrightnessFuzzTest") { "power_manager:power_sysparam", "power_manager:powermgr_client", "safwk:system_ability_fwk", + "samgr:samgr_proxy", "window_manager:libdm_lite", ] diff --git a/state_manager/test/fuzztest/setcoordinated_fuzzer/BUILD.gn b/state_manager/test/fuzztest/setcoordinated_fuzzer/BUILD.gn index bf88856..f8b4a87 100644 --- a/state_manager/test/fuzztest/setcoordinated_fuzzer/BUILD.gn +++ b/state_manager/test/fuzztest/setcoordinated_fuzzer/BUILD.gn @@ -46,6 +46,7 @@ ohos_fuzztest("SetCoordinatedFuzzTest") { ] sources = [ "${displaymgr_root_path}/service/native/src/display_auto_brightness.cpp", + "${displaymgr_root_path}/service/native/src/display_common_event_mgr.cpp", "${displaymgr_root_path}/service/native/src/display_param_helper.cpp", "${displaymgr_root_path}/service/native/src/display_power_mgr_service.cpp", "${displaymgr_root_path}/service/native/src/display_setting_helper.cpp", @@ -61,8 +62,12 @@ ohos_fuzztest("SetCoordinatedFuzzTest") { external_deps = [ "power_manager:power_permission" ] external_deps += [ + "ability_base:base", + "ability_base:want", "ability_runtime:ability_manager", "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "data_share:datashare_common", "data_share:datashare_consumer", "display_manager:displaymgr", "eventhandler:libeventhandler", @@ -77,6 +82,7 @@ ohos_fuzztest("SetCoordinatedFuzzTest") { "power_manager:power_sysparam", "power_manager:powermgr_client", "safwk:system_ability_fwk", + "samgr:samgr_proxy", "window_manager:libdm_lite", ] diff --git a/state_manager/test/fuzztest/setlightbrightnessthreshold_fuzzer/BUILD.gn b/state_manager/test/fuzztest/setlightbrightnessthreshold_fuzzer/BUILD.gn index b909b90..26ea7bd 100644 --- a/state_manager/test/fuzztest/setlightbrightnessthreshold_fuzzer/BUILD.gn +++ b/state_manager/test/fuzztest/setlightbrightnessthreshold_fuzzer/BUILD.gn @@ -46,6 +46,7 @@ ohos_fuzztest("SetLightBrightnessThresholdFuzzTest") { ] sources = [ "${displaymgr_root_path}/service/native/src/display_auto_brightness.cpp", + "${displaymgr_root_path}/service/native/src/display_common_event_mgr.cpp", "${displaymgr_root_path}/service/native/src/display_param_helper.cpp", "${displaymgr_root_path}/service/native/src/display_power_mgr_service.cpp", "${displaymgr_root_path}/service/native/src/display_setting_helper.cpp", @@ -61,8 +62,12 @@ ohos_fuzztest("SetLightBrightnessThresholdFuzzTest") { external_deps = [ "power_manager:power_permission" ] external_deps += [ + "ability_base:base", + "ability_base:want", "ability_runtime:ability_manager", "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "data_share:datashare_common", "data_share:datashare_consumer", "display_manager:displaymgr", "eventhandler:libeventhandler", @@ -77,6 +82,7 @@ ohos_fuzztest("SetLightBrightnessThresholdFuzzTest") { "power_manager:power_sysparam", "power_manager:powermgr_client", "safwk:system_ability_fwk", + "samgr:samgr_proxy", "window_manager:libdm_lite", ] diff --git a/state_manager/test/fuzztest/setmaxbrightness_fuzzer/BUILD.gn b/state_manager/test/fuzztest/setmaxbrightness_fuzzer/BUILD.gn index 3f95590..b0826b9 100644 --- a/state_manager/test/fuzztest/setmaxbrightness_fuzzer/BUILD.gn +++ b/state_manager/test/fuzztest/setmaxbrightness_fuzzer/BUILD.gn @@ -46,6 +46,7 @@ ohos_fuzztest("SetMaxBrightnessFuzzTest") { ] sources = [ "${displaymgr_root_path}/service/native/src/display_auto_brightness.cpp", + "${displaymgr_root_path}/service/native/src/display_common_event_mgr.cpp", "${displaymgr_root_path}/service/native/src/display_param_helper.cpp", "${displaymgr_root_path}/service/native/src/display_power_mgr_service.cpp", "${displaymgr_root_path}/service/native/src/display_setting_helper.cpp", @@ -61,8 +62,12 @@ ohos_fuzztest("SetMaxBrightnessFuzzTest") { external_deps = [ "power_manager:power_permission" ] external_deps += [ + "ability_base:base", + "ability_base:want", "ability_runtime:ability_manager", "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "data_share:datashare_common", "data_share:datashare_consumer", "display_manager:displaymgr", "eventhandler:libeventhandler", @@ -77,6 +82,7 @@ ohos_fuzztest("SetMaxBrightnessFuzzTest") { "power_manager:power_sysparam", "power_manager:powermgr_client", "safwk:system_ability_fwk", + "samgr:samgr_proxy", "window_manager:libdm_lite", ] -- Gitee