diff --git a/services/service/src/ipc/standard/ipc_server_stub.cpp b/services/service/src/ipc/standard/ipc_server_stub.cpp index c85383af7292f05e11704bbdbc510063dd097d6b..a971dd983848abdd1948a9a7f4b2eb46528979a0 100644 --- a/services/service/src/ipc/standard/ipc_server_stub.cpp +++ b/services/service/src/ipc/standard/ipc_server_stub.cpp @@ -16,6 +16,7 @@ #include "ipc_server_stub.h" #include +#include #include "ipc_cmd_register.h" #include "ipc_skeleton.h" @@ -44,6 +45,15 @@ namespace OHOS { namespace DistributedHardware { +namespace { +const std::unordered_set CLIENT_CODE { SERVER_DEVICE_STATE_NOTIFY, SERVER_DEVICE_FOUND, BIND_TARGET_RESULT, +SERVER_DEVICE_DISCOVERY, SERVER_PUBLISH_FINISH, SERVER_AUTH_RESULT, SERVER_DEVICE_FA_NOTIFY, SERVER_CREDENTIAL_RESULT, +SERVER_CREATE_PIN_HOLDER, SERVER_DESTROY_PIN_HOLDER, SERVER_CREATE_PIN_HOLDER_RESULT, SERVER_DESTROY_PIN_HOLDER_RESULT, +SERVER_ON_PIN_HOLDER_EVENT, UNBIND_TARGET_RESULT, REMOTE_DEVICE_TRUST_CHANGE, SERVER_DEVICE_SCREEN_STATE_NOTIFY, +SERVICE_CREDENTIAL_AUTH_STATUS_NOTIFY, SINK_BIND_TARGET_RESULT, GET_DEVICE_PROFILE_INFO_LIST_RESULT, +GET_DEVICE_ICON_INFO_RESULT, SET_LOCAL_DEVICE_NAME_RESULT, SET_REMOTE_DEVICE_NAME_RESULT }; +} + DM_IMPLEMENT_SINGLE_INSTANCE(IpcServerStub); const bool REGISTER_RESULT = SystemAbility::MakeAndRegisterAbility(&IpcServerStub::GetInstance()); @@ -242,6 +252,9 @@ void IpcServerStub::OnStop() int32_t IpcServerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { + if (CLIENT_CODE.find(code) != CLIENT_CODE.end()) { + return IPCObjectStub::OnRemoteRequest(code, data, reply, option); + } auto remoteDescriptor = data.ReadInterfaceToken(); if (GetDescriptor() != remoteDescriptor) { LOGI("ReadInterfaceToken fail!"); diff --git a/test/unittest/UTTest_ipc_server_stub.cpp b/test/unittest/UTTest_ipc_server_stub.cpp index 67f91bd307d257e4801efb489f0035e909361e68..adc33ab53c1bb534285886645528d21208a98aec 100644 --- a/test/unittest/UTTest_ipc_server_stub.cpp +++ b/test/unittest/UTTest_ipc_server_stub.cpp @@ -159,8 +159,8 @@ HWTEST_F(IpcServerStubTest, OnRemoteRequest_002, testing::ext::TestSize.Level0) int ret = 0; // 2. Call IpcServerStub OnRemoteRequest with param ret = IpcServerStub::GetInstance().OnRemoteRequest(code, data, reply, option); - // 3. check ret not ERR_DM_IPC_READ_FAILED - ASSERT_EQ(ret, ERR_DM_IPC_READ_FAILED); + // 3. check ret not DM_OK + ASSERT_NE(ret, DM_OK); } /**