diff --git a/brightness_manager/include/brightness_manager.h b/brightness_manager/include/brightness_manager.h index f3316bd6ff4608406756a153f03c4e4f339b8b38..13031be7b65a90923fbf28a9e94636ce3a979b00 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 96ffb0b54f67ad8b85a774647397d36ece58765d..2dd71b7a8c5eb1df2c3727f134b162e36fdd6fcb 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 e14ad2ce349886aa37d36ac360ee7a3b3d2414ee..320f097a98dd4c809948f296a55c207aefaba9a1 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 2f7df3c34140ed1871c17122a92628c1f6a97169..f6b8f31f25e13f95fa65c45090d5d78240a3b275 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 a50475924fd9af841b5357dd3db3ac201bb87960..eaab127823dc503c3b68a75f5e68a54ad73a04f3 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 5395be34d291a60fee3f8a80abd1d9490ee98ad7..1475d48c884a5fc68046e863726fc17a8776d84b 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 8a5f07b8fac49d6867101c4f41ae87727db976e7..f8f81b3faff711c0b1173ca4bea7242acce341f5 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 e7fd8b02de6aed5c53703f6d9f077251720cf601..acf15cf1b15104530353c3f1fe49a91fa2d43e1e 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 0000000000000000000000000000000000000000..0a218ec708ac7ed373eaaba03a3dd7d131310496 --- /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 f3ee1b8ab770ad1a6babfd5e41414db1bbbf389c..bd3c2100ccd1a0766a861795f194d6bacf9080a5 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 a5a829bd8123b300f255bf3902ca801d48240100..8607eca71f154790bb15f4073cc0ed7c33eb6cf8 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 0000000000000000000000000000000000000000..a2f10052bf026eed85c9633986828da1a8a7fed5 --- /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 d7e19795a1a7a165e9b78d83b118e931da6a2c64..d9f0e6f48e84c9c7373054518a015a8305d684f4 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 1cbd492eeec6b839b32e0896d82b581992b12c42..b0046e9493af5fa15cc194bedad0d513ec580f62 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 a3693c0bb0896e9d997fc0b306d7819c296ef8d1..e885c3e3c890130aaad33aeb7ac89b17667fc159 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 b5d2d92bd1a1ea1c5a1f23d3b16d3c9f46cd85e6..221438590fa078cbc4c83063b7734470077d47f1 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 22ac526080d8d9188dd95050697f01fca6c310dd..2ec6ed6b71896ce74dab98182316bce6c2067cbe 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 8af3b7abf518d756cdf2bf4057c614dd0e93d2c2..ecffaf3f2ad16c3120cb112840f824726f366b10 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 907853835d8dac77660d36e441ce127623c4d68a..4a1d11ad144c8bce7239b0de261792027a9fbe4e 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 be8f7442a1002651e6dfa2fbad311805b4aaeafd..d6fd71eda57e42205f784a3528633051e65f7408 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 082a95ec1f2b81a2f3bec8cd12db75afe7cd9b5d..e9021d1f3a4742321a7e75ffaed1755bdf9daae2 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 adf209c049dcc5c42ef40eb9bc0b1ead4e9aaab4..c1c0131fa381a4596fd0fb388ab19b0f001c2dc6 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 3070476fda7bc07b9fca6204f6831ee55a77a734..a9b5791e5ddce218423922e51453c4cc33cc6ffc 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 430c46382aa461fe8288d55e453dcea46d89497e..7927bae664ba046ea05f25ff98090c0e82debcf7 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 a395342b1c4f0195e8cfc642361e2f88b016a449..9475ea82efff7ee648f8be917577eb0a56006ff3 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 bf88856fb7121ebfc9e9f924014ccd51da0fcb30..f8b4a874972f5ee18d947805eac5655566a7e15c 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 b909b90a2b6611fbce0f1680cb2d73174892f175..26ea7bdbf0be71c07bb57882a9ddbacff09dcc7d 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 3f955901dddb517febc9c4d7bef1eddd861b78a8..b0826b9f2bb1f71201eb8d81496231b420251b3b 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", ]