mirror of
https://gitee.com/openharmony/security_device_security_level
synced 2024-11-23 06:41:06 +00:00
!309 feat: add remote judgment
Merge pull request !309 from zhuofan/master
This commit is contained in:
commit
00dac715fb
@ -48,6 +48,12 @@ int32_t DeviceSecurityLevelProxy::RequestDeviceSecurityLevel(const DeviceIdentif
|
||||
MessageParcel reply;
|
||||
|
||||
auto length = identify.length;
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
HILOG_ERROR(LOG_CORE, "Remote is nullptr");
|
||||
return ERR_INVALID_PARA;
|
||||
}
|
||||
|
||||
if (length == 0 || length > DEVICE_ID_MAX_LEN) {
|
||||
HILOG_ERROR(LOG_CORE, "RequestDeviceSecurityLevel invalid para len.");
|
||||
return ERR_INVALID_LEN_PARA;
|
||||
@ -72,7 +78,7 @@ int32_t DeviceSecurityLevelProxy::RequestDeviceSecurityLevel(const DeviceIdentif
|
||||
data.WriteUint32(cookie);
|
||||
|
||||
MessageOption ipcOption = {MessageOption::TF_SYNC};
|
||||
auto result = Remote()->SendRequest(CMD_GET_DEVICE_SECURITY_LEVEL, data, reply, ipcOption);
|
||||
auto result = remote->SendRequest(CMD_GET_DEVICE_SECURITY_LEVEL, data, reply, ipcOption);
|
||||
if (result != ERR_NONE) {
|
||||
HILOG_ERROR(LOG_CORE, "RequestDeviceSecurityLevelSendRequest send failed, ret is %{public}d", result);
|
||||
return result;
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "message_parcel.h"
|
||||
|
||||
#include "device_security_defines.h"
|
||||
#include "utils_log.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Security {
|
||||
@ -34,6 +35,11 @@ int32_t DslmCallbackProxy::ResponseDeviceSecurityLevel(uint32_t cookie, const Re
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
SECURITY_LOG_ERROR("Remote is nullptr");
|
||||
return ERR_INVALID_PARA;
|
||||
}
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERR_INVALID_PARA;
|
||||
}
|
||||
@ -48,7 +54,7 @@ int32_t DslmCallbackProxy::ResponseDeviceSecurityLevel(uint32_t cookie, const Re
|
||||
}
|
||||
|
||||
MessageOption ipcOption = {MessageOption::TF_ASYNC};
|
||||
return Remote()->SendRequest(CMD_SET_DEVICE_SECURITY_LEVEL, data, reply, ipcOption);
|
||||
return remote->SendRequest(CMD_SET_DEVICE_SECURITY_LEVEL, data, reply, ipcOption);
|
||||
}
|
||||
} // namespace DeviceSecurityLevel
|
||||
} // namespace Security
|
||||
|
Loading…
Reference in New Issue
Block a user