diff --git a/services/dslm/dslm_core_defines.h b/services/dslm/dslm_core_defines.h index 48b20ab77b8a7bc55c7d2c2e97faf499e51bdac9..5f5a5aeb675e6358c78bf6e35882b08b7384d745 100644 --- a/services/dslm/dslm_core_defines.h +++ b/services/dslm/dslm_core_defines.h @@ -57,6 +57,7 @@ typedef struct DslmDeviceInfo { ListHead notifyList; uint32_t historyListSize; ListHead historyList; + uint32_t osType; } DslmDeviceInfo; static inline uint32_t GetCurrentVersion(void) diff --git a/services/dslm/dslm_device_list.c b/services/dslm/dslm_device_list.c index ecdb5f33c3431b356698496d79d6f3f9833edded..9ad06b53a94d8e41956f3710c860e089934502f1 100644 --- a/services/dslm/dslm_device_list.c +++ b/services/dslm/dslm_device_list.c @@ -31,6 +31,7 @@ #include "utils_state_machine.h" #define MAX_DEVICE_CNT 128 +#define DEFAULT_TYPE 10 static inline Mutex *GetDeviceListMutex(void) { @@ -150,3 +151,21 @@ void ForEachDeviceDump(const ProcessDumpFunction dumper, int32_t dumpHandle) } UnlockMutex(GetDeviceListMutex()); } + +bool JudgeListDeviceType() +{ + bool result = true; + ListNode *node = NULL; + + LockMutex(GetDeviceListMutex()); + FOREACH_LIST_NODE (node, GetDeviceList()) { + DslmDeviceInfo *info = LIST_ENTRY(node, DslmDeviceInfo, linkNode); + if (info->osType != DEFAULT_TYPE) { + result = false; + break; + } + } + UnlockMutex(GetDeviceListMutex()); + + return result; +} \ No newline at end of file diff --git a/services/dslm/dslm_device_list.h b/services/dslm/dslm_device_list.h index 7f140281775c4a82fdc9c135cb6e46944b22f17d..ee4abec65099f5ee5d8a0f857262fb1033e2ec7b 100644 --- a/services/dslm/dslm_device_list.h +++ b/services/dslm/dslm_device_list.h @@ -41,6 +41,8 @@ bool IsSameDevice(const DeviceIdentify *first, const DeviceIdentify *second); void ForEachDeviceDump(const ProcessDumpFunction dumper, int32_t dumpHandle); +bool JudgeListDeviceType(); + #ifdef __cplusplus } #endif diff --git a/services/dslm/dslm_fsm_process.c b/services/dslm/dslm_fsm_process.c index fd5b8df84cb42abd5ec0b2800ef8108dd8776d50..ee3e68808f3b70631dfd42f4af6d04e325726127 100644 --- a/services/dslm/dslm_fsm_process.c +++ b/services/dslm/dslm_fsm_process.c @@ -199,6 +199,7 @@ static bool ProcessDeviceOnline(const StateMachine *machine, uint32_t event, con } uint32_t level = deviceAttributes & 0xFF; uint32_t osType = (deviceAttributes & 0xFF00) >> TYPE_PLACE; + info->osType = osType; if (level == 0 && osType == DEFAULT_TYPE) { level = 1; SECURITY_LOG_INFO("level set 1"); diff --git a/services/sa/standard/dslm_ipc_process.cpp b/services/sa/standard/dslm_ipc_process.cpp index 3c827f7a0c9cc5d218cbd8555236714f03f9dc19..a12e2df77b97b19d00a3bbc27e386aadda1b1d1b 100644 --- a/services/sa/standard/dslm_ipc_process.cpp +++ b/services/sa/standard/dslm_ipc_process.cpp @@ -117,7 +117,7 @@ static void TimerProcessUnloadSystemAbility(const void *context) { (void)context; - if (GetDeviceListSize() > 1) { + if (!JudgeListDeviceType()) { return; } @@ -137,7 +137,7 @@ static void TimerProcessUnloadSystemAbility(const void *context) static void SetSystemAbilityUnloadSchedule(TimerHandle &handle) { - if (GetDeviceListSize() > 1) { + if (!JudgeListDeviceType()) { return; }