From a825ef414ea16269058697243f1793d5b8ca83dd Mon Sep 17 00:00:00 2001 From: maan4 Date: Fri, 18 Apr 2025 10:53:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9dims=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E5=BC=95=E5=85=A5=E5=86=85=E5=AD=98=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: maan4 --- bundle.json | 2 +- services/BUILD.gn | 4 ++-- services/src/sensor_service.cpp | 9 +++++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bundle.json b/bundle.json index e3faa5d4..a8802331 100755 --- a/bundle.json +++ b/bundle.json @@ -34,7 +34,7 @@ "samgr", "eventhandler", "hicollie", - "window_manager" + "init" ], "third_party": [] }, diff --git a/services/BUILD.gn b/services/BUILD.gn index 44f81a11..a2b7bc27 100644 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -73,10 +73,10 @@ ohos_shared_library("libsensor_service") { "access_token:libtokenid_sdk", "c_utils:utils", "hilog:libhilog", + "init:libbegetutil", "ipc:ipc_single", "safwk:system_ability_fwk", "samgr:samgr_proxy", - "window_manager:libdm", ] if (sensor_memmgr_enable) { @@ -191,10 +191,10 @@ ohos_static_library("libsensor_service_static") { "access_token:libtokenid_sdk", "c_utils:utils", "hilog:libhilog", + "init:libbegetutil", "ipc:ipc_single", "safwk:system_ability_fwk", "samgr:samgr_proxy", - "window_manager:libdm", ] if (sensor_memmgr_enable) { diff --git a/services/src/sensor_service.cpp b/services/src/sensor_service.cpp index 6364091a..997e8158 100644 --- a/services/src/sensor_service.cpp +++ b/services/src/sensor_service.cpp @@ -19,7 +19,6 @@ #include #include -#include "display_manager.h" #ifdef HIVIEWDFX_HISYSEVENT_ENABLE #include "hisysevent.h" #endif // HIVIEWDFX_HISYSEVENT_ENABLE @@ -29,6 +28,7 @@ #include "motion_plugin.h" #include "ipc_skeleton.h" #include "permission_util.h" +#include "parameters.h" #include "print_sensor_data.h" #include "sensor_dump.h" @@ -63,6 +63,11 @@ void SensorService::OnDump() SEN_HILOGI("OnDump"); } +std::string GetDmsDeviceStatus() +{ + return OHOS::system::GetParameter("persist.dms.set.device.status", "0"); +} + void SensorService::OnAddSystemAbility(int32_t systemAbilityId, const std::string &deviceId) { SEN_HILOGI("OnAddSystemAbility systemAbilityId:%{public}d", systemAbilityId); @@ -85,7 +90,7 @@ void SensorService::OnAddSystemAbility(int32_t systemAbilityId, const std::strin } #endif // MSDP_MOTION_ENABLE if (systemAbilityId == DISPLAY_MANAGER_SERVICE_SA_ID) { - uint32_t status = Rosen::DisplayManager::GetInstance().GetDeviceStatus(); + uint32_t status = static_cast(std::stoi(GetDmsDeviceStatus())); clientInfo_.SetDeviceStatus(status); SEN_HILOGI("GetDeviceStatus, deviceStatus:%{public}d", status); } -- Gitee