!308 feat: cancel connect laptop

Merge pull request !308 from zhuofan/master
This commit is contained in:
openharmony_ci 2024-09-20 09:33:05 +00:00 committed by Gitee
commit 260110bad8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -31,6 +31,9 @@
#define PKG_NAME_LEN 128
#define TYPE_PLACE 8
#define DEFAULT_TYPE 10
#define LAPTOP_TYPE 12
#define SMART_DISPLAY_TYPE 2562
static void GetDeviceSecurityLevelByNetworkId(const OHOS::DistributedHardware::DmDeviceInfo &info, int32_t &level);
@ -258,8 +261,12 @@ static void GetDeviceSecurityLevelByNetworkId(const OHOS::DistributedHardware::D
if (handle == nullptr) {
return;
}
const uint32_t osType = static_cast<uint32_t>(DslmGetJsonFieldInt(handle, "OS_TYPE"));
uint32_t osType = static_cast<uint32_t>(DslmGetJsonFieldInt(handle, "OS_TYPE"));
SECURITY_LOG_INFO("device type is %{public}d", osType);
if (info.deviceTypeId == LAPTOP_TYPE || info.deviceTypeId == SMART_DISPLAY_TYPE) {
osType = DEFAULT_TYPE;
SECURITY_LOG_INFO("deviceTypeId is %{public}d", info.deviceTypeId);
}
level = static_cast<int32_t>(static_cast<uint32_t>(level) | (osType << TYPE_PLACE));
DslmDestroyJson(handle);
return;