From 5185d4db6bb6a87ed26d115e9d26b96074c0e586 Mon Sep 17 00:00:00 2001 From: yanghang Date: Thu, 14 Aug 2025 14:44:02 +0800 Subject: [PATCH] fix: Second screen adaptation modification Signed-off-by: yanghang --- services/native/include/power_state_machine.h | 7 +++++++ services/native/src/wakeup/wakeup_controller.cpp | 3 ++- test/systemtest/src/power_mgr_system_test.cpp | 2 +- test/unittest/include/interface_test/running_lock_test.h | 2 +- .../running_lock/running_lock_scenario_test.h | 2 +- .../src/scenario_test/proximity_controller/BUILD.gn | 7 +++++++ 6 files changed, 19 insertions(+), 4 deletions(-) diff --git a/services/native/include/power_state_machine.h b/services/native/include/power_state_machine.h index 6ebafef1..ad4ea8f4 100644 --- a/services/native/include/power_state_machine.h +++ b/services/native/include/power_state_machine.h @@ -31,6 +31,7 @@ #include "running_lock_info.h" #include "power_mgr_notify.h" #include "window_manager_lite.h" +#include "parameters.h" namespace OHOS { namespace PowerMgr { @@ -172,6 +173,11 @@ public: { externalScreenNumber_ = exScreenNumber; } + bool IsOnlySecondDisplayModeSupported() const + { + int32_t displayMode = system::GetIntParameter("const.product.support_display_mode", 0); + return (displayMode & DISPLAY_MODE_ONLY_SECOND_SCREEN) > 0; + } #endif // only use for test @@ -429,6 +435,7 @@ private: #ifdef POWER_MANAGER_ENABLE_EXTERNAL_SCREEN_MANAGEMENT std::atomic externalScreenNumber_ {0}; std::mutex internalScreenStateMutex_; + static constexpr int32_t DISPLAY_MODE_ONLY_SECOND_SCREEN = 8; #endif std::atomic isDuringCall_ {false}; bool SetDreamingState(StateChangeReason reason); diff --git a/services/native/src/wakeup/wakeup_controller.cpp b/services/native/src/wakeup/wakeup_controller.cpp index c3b499f3..a6dc33a7 100644 --- a/services/native/src/wakeup/wakeup_controller.cpp +++ b/services/native/src/wakeup/wakeup_controller.cpp @@ -862,7 +862,8 @@ bool WakeupController::NeedToSkipCurrentWakeup(const sptr& pms, skipWakeup = !stateMachine_->IsSwitchOpen(); #endif #ifdef POWER_MANAGER_ENABLE_EXTERNAL_SCREEN_MANAGEMENT - skipWakeup = skipWakeup && (stateMachine_->GetExternalScreenNumber() <= 0); + skipWakeup = skipWakeup && + (stateMachine_->GetExternalScreenNumber() <= 0 || !stateMachine_->IsOnlySecondDisplayModeSupported()); #endif if (skipWakeup) { POWER_HILOGI(FEATURE_WAKEUP, "[UL_POWER] Switch is closed, skip current wakeup reason: %{public}u", reason); diff --git a/test/systemtest/src/power_mgr_system_test.cpp b/test/systemtest/src/power_mgr_system_test.cpp index 8cccc773..136c3dbd 100644 --- a/test/systemtest/src/power_mgr_system_test.cpp +++ b/test/systemtest/src/power_mgr_system_test.cpp @@ -48,7 +48,7 @@ const int32_t SLEEPTIME_ID = PowerModePolicy::ServiceType::SLEEPTIME; void PowerMgrSystemTest::SetUpTestCase(void) { - system("mount -o rw,remount /vendor"); + std::system("mount -o rw,remount /vendor"); } static void UpdateGlobalSleepTime(std::list& info) diff --git a/test/unittest/include/interface_test/running_lock_test.h b/test/unittest/include/interface_test/running_lock_test.h index 3ec61e26..044d910f 100644 --- a/test/unittest/include/interface_test/running_lock_test.h +++ b/test/unittest/include/interface_test/running_lock_test.h @@ -60,7 +60,7 @@ public: inline void DumpRunningLockInfo() { - system("hidumper -s 3301 -a -runninglock"); + std::system("hidumper -s 3301 -a -runninglock"); } static std::shared_ptr runningLockMgr_; diff --git a/test/unittest/include/scenario_test/running_lock/running_lock_scenario_test.h b/test/unittest/include/scenario_test/running_lock/running_lock_scenario_test.h index 73975222..8f150aa7 100644 --- a/test/unittest/include/scenario_test/running_lock/running_lock_scenario_test.h +++ b/test/unittest/include/scenario_test/running_lock/running_lock_scenario_test.h @@ -51,7 +51,7 @@ public: inline void DumpRunningLockInfo() { - system("hidumper -s 3301 -a -runninglock"); + std::system("hidumper -s 3301 -a -runninglock"); } static std::shared_ptr runningLockMgr_; diff --git a/test/unittest/src/scenario_test/proximity_controller/BUILD.gn b/test/unittest/src/scenario_test/proximity_controller/BUILD.gn index ddb8bf6c..f27dca27 100644 --- a/test/unittest/src/scenario_test/proximity_controller/BUILD.gn +++ b/test/unittest/src/scenario_test/proximity_controller/BUILD.gn @@ -103,6 +103,13 @@ ohos_unittest("test_proximity_running_lock_abnormal") { if (has_display_manager_part) { deps_ex += [ "display_manager:displaymgr" ] } + + if (power_manager_feature_charging_type_setting && + defined(global_parts_info) && + defined(global_parts_info.powermgr_battery_manager)) { + defines += [ "POWER_MANAGER_ENABLE_CHARGING_TYPE_SETTING" ] + deps_ex += [ "battery_manager:batterysrv_client" ] + } external_deps = deps_ex } -- Gitee