diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 00000000..6e26215d --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + #ang change to common/include/dtbabilitymgr_ipc_interface_code.h needs to be reviewed by @leonchan5 + common/include/dtbabilitymgr_ipc_interface_code.h @leonchan5 + + #ang change to common/include/distributed_ipc_interface_code.h needs to be reviewed by @leonchan5 + common/include/distributed_ipc_interface_code.h @leonchan5 \ No newline at end of file diff --git a/interfaces/innerkits/continuation_manager/include/idevice_selection_notifier.h b/interfaces/innerkits/continuation_manager/include/idevice_selection_notifier.h index 16c4bb1f..ba3876d8 100644 --- a/interfaces/innerkits/continuation_manager/include/idevice_selection_notifier.h +++ b/interfaces/innerkits/continuation_manager/include/idevice_selection_notifier.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -19,6 +19,7 @@ #include #include "continuation_result.h" +#include "dtbabilitymgr_ipc_interface_code.h" #include "iremote_broker.h" namespace OHOS { @@ -37,11 +38,6 @@ public: virtual void OnDeviceConnect(const std::vector& continuationResults) = 0; virtual void OnDeviceDisconnect(const std::vector& continuationResults) = 0; - - enum RequestCode { - EVENT_DEVICE_CONNECT = 1, - EVENT_DEVICE_DISCONNECT = 2, - }; }; } // namespace DistributedSchedule } // namespace OHOS diff --git a/services/dtbabilitymgr/include/continuation_manager/app_device_callback_interface.h b/services/dtbabilitymgr/include/continuation_manager/app_device_callback_interface.h index 1b89a362..2b442307 100644 --- a/services/dtbabilitymgr/include/continuation_manager/app_device_callback_interface.h +++ b/services/dtbabilitymgr/include/continuation_manager/app_device_callback_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -19,6 +19,7 @@ #include #include "continuation_result.h" +#include "dtbabilitymgr_ipc_interface_code.h" #include "iremote_broker.h" namespace OHOS { @@ -33,12 +34,6 @@ public: virtual int32_t OnDeviceConnect(int32_t token, const std::vector& continuationResults) = 0; virtual int32_t OnDeviceDisconnect(int32_t token, const std::vector& continuationResults) = 0; virtual int32_t OnDeviceCancel() = 0; - - enum RequestCode { - EVENT_DEVICE_CONNECT = 1, - EVENT_DEVICE_DISCONNECT = 2, - EVENT_DEVICE_CANCEL = 3, - }; }; } // namespace DistributedSchedule } // namespace OHOS diff --git a/services/dtbabilitymgr/include/distributed_ability_manager_interface.h b/services/dtbabilitymgr/include/distributed_ability_manager_interface.h index 59fa6e94..8dff7a4b 100644 --- a/services/dtbabilitymgr/include/distributed_ability_manager_interface.h +++ b/services/dtbabilitymgr/include/distributed_ability_manager_interface.h @@ -18,6 +18,7 @@ #include "continuation_extra_params.h" #include "continuation_result.h" +#include "dtbabilitymgr_ipc_interface_code.h" #include "device_connect_status.h" #include "iremote_broker.h" @@ -41,16 +42,6 @@ public: const DeviceConnectStatus& deviceConnectStatus) = 0; virtual int32_t StartDeviceManager( int32_t token, const std::shared_ptr& continuationExtraParams = nullptr) = 0; - - enum { - // request code for continuation manager - REGISTER = 500, - UNREGISTER = 501, - REGISTER_DEVICE_SELECTION_CALLBACK = 502, - UNREGISTER_DEVICE_SELECTION_CALLBACK = 503, - UPDATE_CONNECT_STATUS = 504, - START_DEVICE_MANAGER = 505, - }; }; } // namespace DistributedSchedule } // namespace OHOS diff --git a/services/dtbabilitymgr/include/dtbabilitymgr_ipc_interface_code.h b/services/dtbabilitymgr/include/dtbabilitymgr_ipc_interface_code.h new file mode 100644 index 00000000..e9d87f85 --- /dev/null +++ b/services/dtbabilitymgr/include/dtbabilitymgr_ipc_interface_code.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_DISTRIBUTED_DTBABILITYMGR_IPC_INTERFACE_CODE_H +#define OHOS_DISTRIBUTED_DTBABILITYMGR_IPC_INTERFACE_CODE_H + +namespace OHOS { +namespace DistributedSchedule { +enum class IDAbilityManagerInterfaceCode : uint32_t { + // request code for continuation manager + REGISTER = 500, + UNREGISTER = 501, + REGISTER_DEVICE_SELECTION_CALLBACK = 502, + UNREGISTER_DEVICE_SELECTION_CALLBACK = 503, + UPDATE_CONNECT_STATUS = 504, + START_DEVICE_MANAGER = 505, +}; + +enum class IDRequestCallbackInterfaceCode : uint32_t { + EVENT_DEVICE_CONNECT = 1, + EVENT_DEVICE_DISCONNECT = 2, + EVENT_DEVICE_CANCEL = 3, +}; + +enum class IDRequestInterfaceCode { + EVENT_DEVICE_CONNECT = 1, + EVENT_DEVICE_DISCONNECT = 2, +}; +} // namespace DistributedSchedule +} // namespace OHOS +#endif // OHOS_DISTRIBUTED_DTBABILITYMGR_IPC_INTERFACE_CODE_H diff --git a/services/dtbabilitymgr/src/continuation_manager/app_device_callback_stub.cpp b/services/dtbabilitymgr/src/continuation_manager/app_device_callback_stub.cpp index 8391f8bb..dd417e7b 100644 --- a/services/dtbabilitymgr/src/continuation_manager/app_device_callback_stub.cpp +++ b/services/dtbabilitymgr/src/continuation_manager/app_device_callback_stub.cpp @@ -41,7 +41,7 @@ int32_t AppDeviceCallbackStub::OnRemoteRequest(uint32_t code, MessageParcel& dat } int32_t token = -1; switch (code) { - case AppDeviceCallbackInterface::EVENT_DEVICE_CONNECT: { + case static_cast(IDRequestCallbackInterfaceCode::EVENT_DEVICE_CONNECT): { PARCEL_READ_HELPER(data, Int32, token); std::vector continuationResults; if (!ContinuationResult::ReadContinuationResultsFromParcel(data, continuationResults)) { @@ -50,7 +50,7 @@ int32_t AppDeviceCallbackStub::OnRemoteRequest(uint32_t code, MessageParcel& dat int32_t result = OnDeviceConnect(token, continuationResults); return result; } - case AppDeviceCallbackInterface::EVENT_DEVICE_DISCONNECT: { + case static_cast(IDRequestCallbackInterfaceCode::EVENT_DEVICE_DISCONNECT): { PARCEL_READ_HELPER(data, Int32, token); std::vector continuationResults; if (!ContinuationResult::ReadContinuationResultsFromParcel(data, continuationResults)) { @@ -59,7 +59,7 @@ int32_t AppDeviceCallbackStub::OnRemoteRequest(uint32_t code, MessageParcel& dat int32_t result = OnDeviceDisconnect(token, continuationResults); return result; } - case AppDeviceCallbackInterface::EVENT_DEVICE_CANCEL: { + case static_cast(IDRequestCallbackInterfaceCode::EVENT_DEVICE_CANCEL): { int32_t result = OnDeviceCancel(); return result; } diff --git a/services/dtbabilitymgr/src/continuation_manager/device_selection_notifier_proxy.cpp b/services/dtbabilitymgr/src/continuation_manager/device_selection_notifier_proxy.cpp index 18f0b6d5..f53b18cd 100644 --- a/services/dtbabilitymgr/src/continuation_manager/device_selection_notifier_proxy.cpp +++ b/services/dtbabilitymgr/src/continuation_manager/device_selection_notifier_proxy.cpp @@ -43,7 +43,8 @@ void DeviceSelectionNotifierProxy::OnDeviceConnect(const std::vectorSendRequest(IDeviceSelectionNotifier::EVENT_DEVICE_CONNECT, data, reply, option); + int32_t errCode = Remote()->SendRequest(static_cast + (IDRequestInterfaceCode::EVENT_DEVICE_CONNECT), data, reply, option); HILOGD("result = %{public}d", errCode); } @@ -59,7 +60,8 @@ void DeviceSelectionNotifierProxy::OnDeviceDisconnect(const std::vectorSendRequest(IDeviceSelectionNotifier::EVENT_DEVICE_DISCONNECT, data, reply, option); + int32_t errCode = Remote()->SendRequest(static_cast + (IDRequestInterfaceCode::EVENT_DEVICE_DISCONNECT), data, reply, option); HILOGD("result = %{public}d", errCode); } } // namespace DistributedSchedule diff --git a/services/dtbabilitymgr/src/continuation_manager/device_selection_notifier_stub.cpp b/services/dtbabilitymgr/src/continuation_manager/device_selection_notifier_stub.cpp index 55e2fa3e..669e8a9e 100644 --- a/services/dtbabilitymgr/src/continuation_manager/device_selection_notifier_stub.cpp +++ b/services/dtbabilitymgr/src/continuation_manager/device_selection_notifier_stub.cpp @@ -42,7 +42,7 @@ int32_t DeviceSelectionNotifierStub::OnRemoteRequest(uint32_t code, MessageParce return ERR_INVALID_VALUE; } switch (code) { - case IDeviceSelectionNotifier::EVENT_DEVICE_CONNECT: { + case static_cast(IDRequestInterfaceCode::EVENT_DEVICE_CONNECT): { std::vector continuationResults; if (!ContinuationResult::ReadContinuationResultsFromParcel(data, continuationResults)) { return ERR_FLATTEN_OBJECT; @@ -50,7 +50,7 @@ int32_t DeviceSelectionNotifierStub::OnRemoteRequest(uint32_t code, MessageParce int32_t result = OnDeviceConnectInner(continuationResults); return result; } - case IDeviceSelectionNotifier::EVENT_DEVICE_DISCONNECT: { + case static_cast(IDRequestInterfaceCode::EVENT_DEVICE_DISCONNECT): { std::vector continuationResults; if (!ContinuationResult::ReadContinuationResultsFromParcel(data, continuationResults)) { return ERR_FLATTEN_OBJECT; diff --git a/services/dtbabilitymgr/src/distributed_ability_manager_proxy.cpp b/services/dtbabilitymgr/src/distributed_ability_manager_proxy.cpp index 94b4115b..7944914d 100644 --- a/services/dtbabilitymgr/src/distributed_ability_manager_proxy.cpp +++ b/services/dtbabilitymgr/src/distributed_ability_manager_proxy.cpp @@ -47,7 +47,8 @@ int32_t DistributedAbilityManagerProxy::Register( } MessageParcel reply; MessageOption option; - int32_t error = remote->SendRequest(REGISTER, data, reply, option); + int32_t error = remote->SendRequest(static_cast(IDAbilityManagerInterfaceCode::REGISTER), + data, reply, option); if (error != ERR_NONE) { HILOGE("SendRequest error = %{public}d", error); return error; @@ -75,7 +76,7 @@ int32_t DistributedAbilityManagerProxy::Unregister(int32_t token) } PARCEL_WRITE_HELPER(data, Int32, token); MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, UNREGISTER, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDAbilityManagerInterfaceCode::UNREGISTER), data, reply); } int32_t DistributedAbilityManagerProxy::RegisterDeviceSelectionCallback( @@ -104,7 +105,8 @@ int32_t DistributedAbilityManagerProxy::RegisterDeviceSelectionCallback( PARCEL_WRITE_HELPER(data, String, cbType); PARCEL_WRITE_HELPER(data, RemoteObject, notifier); MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, REGISTER_DEVICE_SELECTION_CALLBACK, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast + (IDAbilityManagerInterfaceCode::REGISTER_DEVICE_SELECTION_CALLBACK), data, reply); } int32_t DistributedAbilityManagerProxy::UnregisterDeviceSelectionCallback(int32_t token, const std::string& cbType) @@ -126,7 +128,8 @@ int32_t DistributedAbilityManagerProxy::UnregisterDeviceSelectionCallback(int32_ PARCEL_WRITE_HELPER(data, Int32, token); PARCEL_WRITE_HELPER(data, String, cbType); MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, UNREGISTER_DEVICE_SELECTION_CALLBACK, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast + (IDAbilityManagerInterfaceCode::UNREGISTER_DEVICE_SELECTION_CALLBACK), data, reply); } int32_t DistributedAbilityManagerProxy::UpdateConnectStatus(int32_t token, const std::string& deviceId, @@ -146,7 +149,8 @@ int32_t DistributedAbilityManagerProxy::UpdateConnectStatus(int32_t token, const PARCEL_WRITE_HELPER(data, String, deviceId); PARCEL_WRITE_HELPER(data, Int32, static_cast(deviceConnectStatus)); MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, UPDATE_CONNECT_STATUS, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDAbilityManagerInterfaceCode::UPDATE_CONNECT_STATUS), + data, reply); } int32_t DistributedAbilityManagerProxy::StartDeviceManager( @@ -170,7 +174,8 @@ int32_t DistributedAbilityManagerProxy::StartDeviceManager( PARCEL_WRITE_HELPER(data, Parcelable, continuationExtraParams.get()); } MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, START_DEVICE_MANAGER, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDAbilityManagerInterfaceCode::START_DEVICE_MANAGER), + data, reply); } } // namespace DistributedSchedule } // namespace OHOS \ No newline at end of file diff --git a/services/dtbabilitymgr/src/distributed_ability_manager_stub.cpp b/services/dtbabilitymgr/src/distributed_ability_manager_stub.cpp index 72e4202d..a8c290de 100644 --- a/services/dtbabilitymgr/src/distributed_ability_manager_stub.cpp +++ b/services/dtbabilitymgr/src/distributed_ability_manager_stub.cpp @@ -38,14 +38,18 @@ const std::string PERMISSION_DISTRIBUTED_DATASYNC = "ohos.permission.DISTRIBUTED DistributedAbilityManagerStub::DistributedAbilityManagerStub() { - funcsMap_[REGISTER] = &DistributedAbilityManagerStub::RegisterInner; - funcsMap_[UNREGISTER] = &DistributedAbilityManagerStub::UnregisterInner; - funcsMap_[REGISTER_DEVICE_SELECTION_CALLBACK] = + funcsMap_[static_cast(IDAbilityManagerInterfaceCode::REGISTER)] = + &DistributedAbilityManagerStub::RegisterInner; + funcsMap_[static_cast(IDAbilityManagerInterfaceCode::UNREGISTER)] = + &DistributedAbilityManagerStub::UnregisterInner; + funcsMap_[static_cast(IDAbilityManagerInterfaceCode::REGISTER_DEVICE_SELECTION_CALLBACK)] = &DistributedAbilityManagerStub::RegisterDeviceSelectionCallbackInner; - funcsMap_[UNREGISTER_DEVICE_SELECTION_CALLBACK] = + funcsMap_[static_cast(IDAbilityManagerInterfaceCode::UNREGISTER_DEVICE_SELECTION_CALLBACK)] = &DistributedAbilityManagerStub::UnregisterDeviceSelectionCallbackInner; - funcsMap_[UPDATE_CONNECT_STATUS] = &DistributedAbilityManagerStub::UpdateConnectStatusInner; - funcsMap_[START_DEVICE_MANAGER] = &DistributedAbilityManagerStub::StartDeviceManagerInner; + funcsMap_[static_cast(IDAbilityManagerInterfaceCode::UPDATE_CONNECT_STATUS)] = + &DistributedAbilityManagerStub::UpdateConnectStatusInner; + funcsMap_[static_cast(IDAbilityManagerInterfaceCode::START_DEVICE_MANAGER)] = + &DistributedAbilityManagerStub::StartDeviceManagerInner; } DistributedAbilityManagerStub::~DistributedAbilityManagerStub() diff --git a/services/dtbabilitymgr/test/unittest/continuation_manager/continuation_manager_test.cpp b/services/dtbabilitymgr/test/unittest/continuation_manager/continuation_manager_test.cpp index ad50e481..5ea6498e 100644 --- a/services/dtbabilitymgr/test/unittest/continuation_manager/continuation_manager_test.cpp +++ b/services/dtbabilitymgr/test/unittest/continuation_manager/continuation_manager_test.cpp @@ -1629,8 +1629,8 @@ HWTEST_F(ContinuationManagerTest, OnRemoteRequest_001, TestSize.Level3) MessageParcel reply; MessageOption option; DeviceSelectionNotifierTest deviceSelectionNotifierTest; - int32_t result = deviceSelectionNotifierTest.OnRemoteRequest(IDeviceSelectionNotifier::EVENT_DEVICE_CONNECT, - data, reply, option); + int32_t result = deviceSelectionNotifierTest.OnRemoteRequest(static_cast + (IDRequestInterfaceCode::EVENT_DEVICE_CONNECT), data, reply, option); EXPECT_EQ(ERR_INVALID_VALUE, result); } @@ -1683,8 +1683,8 @@ HWTEST_F(ContinuationManagerTest, OnRemoteRequest_003, TestSize.Level3) MessageParcel reply; MessageOption option; DeviceSelectionNotifierTest deviceSelectionNotifierTest; - int32_t result2 = deviceSelectionNotifierTest.OnRemoteRequest(IDeviceSelectionNotifier::EVENT_DEVICE_CONNECT, - data, reply, option); + int32_t result2 = deviceSelectionNotifierTest.OnRemoteRequest(static_cast + (IDRequestInterfaceCode::EVENT_DEVICE_CONNECT), data, reply, option); EXPECT_EQ(true, result1); EXPECT_EQ(ERR_OK, result2); @@ -1705,8 +1705,8 @@ HWTEST_F(ContinuationManagerTest, OnRemoteRequest_004, TestSize.Level3) MessageParcel reply; MessageOption option; DeviceSelectionNotifierTest deviceSelectionNotifierTest; - int32_t result = deviceSelectionNotifierTest.OnRemoteRequest(IDeviceSelectionNotifier::EVENT_DEVICE_DISCONNECT, - data, reply, option); + int32_t result = deviceSelectionNotifierTest.OnRemoteRequest(static_cast + (IDRequestInterfaceCode::EVENT_DEVICE_DISCONNECT), data, reply, option); EXPECT_EQ(ERR_INVALID_VALUE, result); /** * @tc.steps: step2. test OnRemoteDied when dmsNotifier_ == nullptr. @@ -1747,8 +1747,8 @@ HWTEST_F(ContinuationManagerTest, OnRemoteRequest_005, TestSize.Level3) MessageParcel reply; MessageOption option; DeviceSelectionNotifierTest deviceSelectionNotifierTest; - int32_t result = deviceSelectionNotifierTest.OnRemoteRequest(IDeviceSelectionNotifier::EVENT_DEVICE_DISCONNECT, - data, reply, option); + int32_t result = deviceSelectionNotifierTest.OnRemoteRequest(static_cast + (IDRequestInterfaceCode::EVENT_DEVICE_DISCONNECT), data, reply, option); EXPECT_EQ(ERR_OK, result); } @@ -1768,8 +1768,8 @@ HWTEST_F(ContinuationManagerTest, OnRemoteRequest_006, TestSize.Level3) MessageParcel reply; MessageOption option; DeviceSelectionNotifierTest deviceSelectionNotifierTest; - int32_t result = deviceSelectionNotifierTest.OnRemoteRequest(IDeviceSelectionNotifier::EVENT_DEVICE_CONNECT, - data, reply, option); + int32_t result = deviceSelectionNotifierTest.OnRemoteRequest(static_cast + (IDRequestInterfaceCode::EVENT_DEVICE_CONNECT), data, reply, option); EXPECT_EQ(ERR_FLATTEN_OBJECT, result); } @@ -1788,8 +1788,8 @@ HWTEST_F(ContinuationManagerTest, OnRemoteRequest_007, TestSize.Level3) MessageParcel reply; MessageOption option; DeviceSelectionNotifierTest deviceSelectionNotifierTest; - int32_t result = deviceSelectionNotifierTest.OnRemoteRequest(IDeviceSelectionNotifier::EVENT_DEVICE_DISCONNECT, - data, reply, option); + int32_t result = deviceSelectionNotifierTest.OnRemoteRequest(static_cast + (IDRequestInterfaceCode::EVENT_DEVICE_DISCONNECT), data, reply, option); EXPECT_EQ(ERR_FLATTEN_OBJECT, result); } @@ -1845,7 +1845,8 @@ HWTEST_F(ContinuationManagerTest, OnRemoteRequest_008, TestSize.Level3) /** * @tc.name: OnRemoteRequest_009 - * @tc.desc: test OnRemoteRequest when code = AppDeviceCallbackInterface::EVENT_DEVICE_CONNECT. + * @tc.desc: test OnRemoteRequest when code = static_cast + * (IDRequestCallbackInterfaceCode::EVENT_DEVICE_CONNECT). * @tc.type: FUNC * @tc.require: I621C1 */ @@ -1858,7 +1859,7 @@ HWTEST_F(ContinuationManagerTest, OnRemoteRequest_009, TestSize.Level3) data.WriteInterfaceToken(AppDeviceCallbackInterface::GetDescriptor()); data.WriteInt32(TEST_TOKEN); int32_t ret = appDeviceCallbackStub.OnRemoteRequest( - AppDeviceCallbackInterface::EVENT_DEVICE_CONNECT, data, reply, option); + static_cast(IDRequestCallbackInterfaceCode::EVENT_DEVICE_CONNECT), data, reply, option); EXPECT_EQ(DISCONNECT_ABILITY_FAILED, ret); } @@ -1879,13 +1880,14 @@ HWTEST_F(ContinuationManagerTest, OnRemoteRequest_010, TestSize.Level3) data.WriteInt32(VALUE_OBJECT); data.WriteInt32(INVALID_LEN); int32_t ret = appDeviceCallbackStub.OnRemoteRequest( - AppDeviceCallbackInterface::EVENT_DEVICE_CONNECT, data, reply, option); + static_cast(IDRequestCallbackInterfaceCode::EVENT_DEVICE_CONNECT), data, reply, option); EXPECT_EQ(ERR_FLATTEN_OBJECT, ret); } /** * @tc.name: OnRemoteRequest_011 - * @tc.desc: test OnRemoteRequest when code = AppDeviceCallbackInterface::EVENT_DEVICE_DISCONNECT. + * @tc.desc: test OnRemoteRequest when code = static_cast + * (IDRequestCallbackInterfaceCode::EVENT_DEVICE_DISCONNECT). * @tc.type: FUNC * @tc.require: I621C1 */ @@ -1898,7 +1900,7 @@ HWTEST_F(ContinuationManagerTest, OnRemoteRequest_011, TestSize.Level3) data.WriteInterfaceToken(AppDeviceCallbackInterface::GetDescriptor()); data.WriteInt32(TEST_TOKEN); int32_t ret = appDeviceCallbackStub.OnRemoteRequest( - AppDeviceCallbackInterface::EVENT_DEVICE_DISCONNECT, data, reply, option); + static_cast(IDRequestCallbackInterfaceCode::EVENT_DEVICE_DISCONNECT), data, reply, option); EXPECT_EQ(DISCONNECT_ABILITY_FAILED, ret); } @@ -1919,13 +1921,14 @@ HWTEST_F(ContinuationManagerTest, OnRemoteRequest_012, TestSize.Level3) data.WriteInt32(VALUE_OBJECT); data.WriteInt32(INVALID_LEN); int32_t ret = appDeviceCallbackStub.OnRemoteRequest( - AppDeviceCallbackInterface::EVENT_DEVICE_DISCONNECT, data, reply, option); + static_cast(IDRequestCallbackInterfaceCode::EVENT_DEVICE_DISCONNECT), data, reply, option); EXPECT_EQ(ERR_FLATTEN_OBJECT, ret); } /** * @tc.name: OnRemoteRequest_013 - * @tc.desc: test OnRemoteRequest when code = AppDeviceCallbackInterface::EVENT_DEVICE_CANCEL. + * @tc.desc: test OnRemoteRequest when code = static_cast + * (IDRequestCallbackInterfaceCode::EVENT_DEVICE_CANCEL). * @tc.type: FUNC * @tc.require: I621C1 */ @@ -1937,7 +1940,7 @@ HWTEST_F(ContinuationManagerTest, OnRemoteRequest_013, TestSize.Level3) MessageOption option; data.WriteInterfaceToken(AppDeviceCallbackInterface::GetDescriptor()); int32_t ret = appDeviceCallbackStub.OnRemoteRequest( - AppDeviceCallbackInterface::EVENT_DEVICE_CANCEL, data, reply, option); + static_cast(IDRequestCallbackInterfaceCode::EVENT_DEVICE_CANCEL), data, reply, option); EXPECT_EQ(DISCONNECT_ABILITY_FAILED, ret); } diff --git a/services/dtbschedmgr/include/bundle/bundle_manager_callback_interface.h b/services/dtbschedmgr/include/bundle/bundle_manager_callback_interface.h index 1c1407bd..ea75402d 100644 --- a/services/dtbschedmgr/include/bundle/bundle_manager_callback_interface.h +++ b/services/dtbschedmgr/include/bundle/bundle_manager_callback_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,6 +16,7 @@ #ifndef OHOS_DISTRIBUTED_BUNDLE_MANANGER_CALLBACK_INTERFACE_H #define OHOS_DISTRIBUTED_BUNDLE_MANANGER_CALLBACK_INTERFACE_H +#include "distributedsched_ipc_interface_code.h" #include namespace OHOS { @@ -27,11 +28,6 @@ namespace DistributedSchedule { class IDmsBundleManagerCallback : public IRemoteBroker { public: DECLARE_INTERFACE_DESCRIPTOR(u"ohos.DistributedSchedule.IDmsBundleManagerCallback"); - -protected: - enum IDmsBundleManagerCallbackCmd { - ON_QUERY_INSTALLATION_DONE = 1, - }; }; } // namespace DistributedSchedule } // namespace OHOS diff --git a/services/dtbschedmgr/include/distributed_sched_interface.h b/services/dtbschedmgr/include/distributed_sched_interface.h index ced78ea1..4c49057e 100644 --- a/services/dtbschedmgr/include/distributed_sched_interface.h +++ b/services/dtbschedmgr/include/distributed_sched_interface.h @@ -20,6 +20,7 @@ #include "ability_info.h" #include "ability_manager_interface.h" #include "caller_info.h" +#include "distributedsched_ipc_interface_code.h" #ifdef SUPPORT_DISTRIBUTED_FORM_SHARE #include "form_share_info.h" #endif @@ -144,72 +145,6 @@ public: const OHOS::AAFwk::Want& want, int32_t callerUid, uint32_t accessToken, int32_t extensionType) = 0; virtual int32_t StopExtensionAbilityFromRemote(const OHOS::AAFwk::Want& want, const CallerInfo& callerInfo, const AccountInfo& accountInfo, int32_t extensionType) = 0; - - enum { - START_REMOTE_ABILITY = 1, - STOP_REMOTE_ABILITY = 3, - START_ABILITY_FROM_REMOTE = 4, - STOP_ABILITY_FROM_REMOTE = 5, - CONNECT_REMOTE_ABILITY = 6, - DISCONNECT_REMOTE_ABILITY = 7, - CONNECT_ABILITY_FROM_REMOTE = 8, - DISCONNECT_ABILITY_FROM_REMOTE = 9, - START_CONTINUATION = 11, - NOTIFY_COMPLETE_CONTINUATION = 12, - NOTIFY_CONTINUATION_RESULT_FROM_REMOTE = 13, - REGISTER_ABILITY_TOKEN = 14, - UNREGISTER_ABILITY_TOKEN = 15, - CONTINUE_ABILITY = 16, - NOTIFY_PROCESS_DIED_FROM_REMOTE = 17, - SEND_RESULT_FROM_REMOTE = 20, - GET_REMOTE_APPTHREAD = 35, - CONTINUE_MISSION = 36, - CONTINUE_MISSION_OF_BUNDLENAME = 37, - - // requeset code for free install - START_FREE_INSTALL_FROM_REMOTE = 51, - NOTIFY_COMPLETE_FREE_INSTALL_FROM_REMOTE = 52, - - // request code for mission - GET_MISSION_INFOS = 80, - REGISTER_MISSION_LISTENER = 84, - UNREGISTER_MISSION_LISTENER = 85, - START_SYNC_MISSIONS_FROM_REMOTE = 86, - STOP_SYNC_MISSIONS_FROM_REMOTE = 87, - CHECK_SUPPORTED_OSD = 88, - CHECK_SUPPORT_OSD_FROM_REMOTE = 89, - MISSION_CHANGED = 90, - NOTIFY_MISSIONS_CHANGED_FROM_REMOTE = 91, - START_SYNC_MISSIONS = 92, - TRY_OPENP2PSESSION_FROM_REMOTE = 93, - SWITCH_CHANGED = 94, - NOTIFY_SWITCH_CHANGED_FROM_REMOTE = 95, - GET_CACHED_SUPPORTED_OSD = 96, - ALL_CONNECT_TO_DMS = 97, - STOP_SYNC_MISSIONS = 98, - GET_REMOTE_MISSION_SNAPSHOT_INFO = 99, - - // request code for call ability - START_REMOTE_ABILITY_BY_CALL = 150, - RELEASE_REMOTE_ABILITY = 151, - START_ABILITY_BY_CALL_FROM_REMOTE = 152, - RELEASE_ABILITY_FROM_REMOTE = 153, - NOTIFY_STATE_CHANGED_FROM_REMOTE = 154, - - START_REMOTE_FREE_INSTALL = 200, - // request code for upload distributed component info - GET_DISTRIBUTED_COMPONENT_LIST = 161, - - // form share - START_REMOTE_SHARE_FORM = 220, - START_SHARE_FORM_FROM_REMOTE = 221, - - // stop externsion ability - STOP_REMOTE_EXTERNSION_ABILITY = 225, - STOP_EXTERNSION_ABILITY_FROM_REMOTE = 226, - REGISTER_ON_LISTENER = 260, - REGISTER_OFF_LISTENER = 261, - }; }; } // namespace DistributedSchedule } // namespace OHOS diff --git a/services/dtbschedmgr/include/distributedsched_ipc_interface_code.h b/services/dtbschedmgr/include/distributedsched_ipc_interface_code.h new file mode 100644 index 00000000..07da4801 --- /dev/null +++ b/services/dtbschedmgr/include/distributedsched_ipc_interface_code.h @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_DISTRIBUTED_DISTRIBUTEDSCHED_IPC_INTERFACE_CODE_H +#define OHOS_DISTRIBUTED_DISTRIBUTEDSCHED_IPC_INTERFACE_CODE_H + +namespace OHOS { +namespace DistributedSchedule { +/* SAID: 1401 */ +enum class IDSchedInterfaceCode : uint32_t { + START_REMOTE_ABILITY = 1, + STOP_REMOTE_ABILITY = 3, + START_ABILITY_FROM_REMOTE = 4, + STOP_ABILITY_FROM_REMOTE = 5, + CONNECT_REMOTE_ABILITY = 6, + DISCONNECT_REMOTE_ABILITY = 7, + CONNECT_ABILITY_FROM_REMOTE = 8, + DISCONNECT_ABILITY_FROM_REMOTE = 9, + START_CONTINUATION = 11, + NOTIFY_COMPLETE_CONTINUATION = 12, + NOTIFY_CONTINUATION_RESULT_FROM_REMOTE = 13, + REGISTER_ABILITY_TOKEN = 14, + UNREGISTER_ABILITY_TOKEN = 15, + CONTINUE_ABILITY = 16, + NOTIFY_PROCESS_DIED_FROM_REMOTE = 17, + SEND_RESULT_FROM_REMOTE = 20, + GET_REMOTE_APPTHREAD = 35, + CONTINUE_MISSION = 36, + CONTINUE_MISSION_OF_BUNDLENAME = 37, + + // requeset code for free install + START_FREE_INSTALL_FROM_REMOTE = 51, + NOTIFY_COMPLETE_FREE_INSTALL_FROM_REMOTE = 52, + + // request code for mission + GET_MISSION_INFOS = 80, + REGISTER_MISSION_LISTENER = 84, + UNREGISTER_MISSION_LISTENER = 85, + START_SYNC_MISSIONS_FROM_REMOTE = 86, + STOP_SYNC_MISSIONS_FROM_REMOTE = 87, + CHECK_SUPPORTED_OSD = 88, + CHECK_SUPPORT_OSD_FROM_REMOTE = 89, + MISSION_CHANGED = 90, + NOTIFY_MISSIONS_CHANGED_FROM_REMOTE = 91, + START_SYNC_MISSIONS = 92, + TRY_OPENP2PSESSION_FROM_REMOTE = 93, + SWITCH_CHANGED = 94, + NOTIFY_SWITCH_CHANGED_FROM_REMOTE = 95, + GET_CACHED_SUPPORTED_OSD = 96, + ALL_CONNECT_TO_DMS = 97, + STOP_SYNC_MISSIONS = 98, + GET_REMOTE_MISSION_SNAPSHOT_INFO = 99, + + // request code for call ability + START_REMOTE_ABILITY_BY_CALL = 150, + RELEASE_REMOTE_ABILITY = 151, + START_ABILITY_BY_CALL_FROM_REMOTE = 152, + RELEASE_ABILITY_FROM_REMOTE = 153, + NOTIFY_STATE_CHANGED_FROM_REMOTE = 154, + + // request code for upload distributed component info + GET_DISTRIBUTED_COMPONENT_LIST = 161, + + START_REMOTE_FREE_INSTALL = 200, + // form share + START_REMOTE_SHARE_FORM = 220, + START_SHARE_FORM_FROM_REMOTE = 221, + + // stop externsion ability + STOP_REMOTE_EXTERNSION_ABILITY = 225, + STOP_EXTERNSION_ABILITY_FROM_REMOTE = 226, + REGISTER_ON_LISTENER = 260, + REGISTER_OFF_LISTENER = 261, +}; + +enum class IDRreeInstallCallbackInterfaceCode : uint32_t { + ON_FREE_INSTALL_DONE = 0, + CMD_MAX, +}; + +enum class IDBundleManagerCallbackInterfaceCod { + ON_QUERY_INSTALLATION_DONE = 1, +}; +} // namespace DistributedSchedule +} // namespace OHOS +#endif // OHOS_DISTRIBUTED_DISTRIBUTEDSCHED_IPC_INTERFACE_CODE_H diff --git a/services/dtbschedmgr/include/dms_free_install_callback_interface.h b/services/dtbschedmgr/include/dms_free_install_callback_interface.h index c141b72f..0adb422b 100644 --- a/services/dtbschedmgr/include/dms_free_install_callback_interface.h +++ b/services/dtbschedmgr/include/dms_free_install_callback_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,6 +16,7 @@ #ifndef OHOS_DMS_FREE_INSTALL_CALLBACK_INTERFACE_H #define OHOS_DMS_FREE_INSTALL_CALLBACK_INTERFACE_H +#include "distributedsched_ipc_interface_code.h" #include #include "want.h" @@ -37,12 +38,6 @@ public: * @param resultCode, ERR_OK on success, others on failure. */ virtual void OnInstallFinished(const AAFwk::Want& want, int32_t requestCode, int32_t resultCode) = 0; - -protected: - enum IDmsFreeInstallCallbackCmd { - ON_FREE_INSTALL_DONE = 0, - CMD_MAX, - }; }; } // namespace DistributedSchedule } // namespace OHOS diff --git a/services/dtbschedmgr/include/dms_free_install_callback_proxy.h b/services/dtbschedmgr/include/dms_free_install_callback_proxy.h index 60936f0c..7e8347ae 100644 --- a/services/dtbschedmgr/include/dms_free_install_callback_proxy.h +++ b/services/dtbschedmgr/include/dms_free_install_callback_proxy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -43,7 +43,6 @@ public: virtual void OnInstallFinished(const OHOS::AAFwk::Want& want, int32_t requestCode, int32_t resultCode) override; private: - void SendRequestCommon(int32_t errcode, IDmsFreeInstallCallback::IDmsFreeInstallCallbackCmd cmd); static inline BrokerDelegator delegator_; }; } // namespace DistributedSchedule diff --git a/services/dtbschedmgr/src/bundle/bundle_manager_callback_stub.cpp b/services/dtbschedmgr/src/bundle/bundle_manager_callback_stub.cpp index ce6d1692..122befdb 100644 --- a/services/dtbschedmgr/src/bundle/bundle_manager_callback_stub.cpp +++ b/services/dtbschedmgr/src/bundle/bundle_manager_callback_stub.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -30,7 +30,7 @@ constexpr int64_t CONTINUATION_FREE_INSTALL_TIMEOUT = 50000; // 50s DmsBundleManagerCallbackStub::DmsBundleManagerCallbackStub() { - memberFuncMap_[IDmsBundleManagerCallbackCmd::ON_QUERY_INSTALLATION_DONE] = + memberFuncMap_[static_cast(IDBundleManagerCallbackInterfaceCod::ON_QUERY_INSTALLATION_DONE)] = &DmsBundleManagerCallbackStub::OnQueryInstallationFinishedInner; } diff --git a/services/dtbschedmgr/src/distributed_sched_permission.cpp b/services/dtbschedmgr/src/distributed_sched_permission.cpp index 9c59cc58..a2f5c699 100644 --- a/services/dtbschedmgr/src/distributed_sched_permission.cpp +++ b/services/dtbschedmgr/src/distributed_sched_permission.cpp @@ -53,21 +53,19 @@ const int DEFAULT_DEVICE_SECURITY_LEVEL = -1; IMPLEMENT_SINGLE_INSTANCE(DistributedSchedPermission); void from_json(const nlohmann::json& jsonObject, GroupInfo& groupInfo) { - if (jsonObject.find(FIELD_GROUP_NAME) != jsonObject.end() && jsonObject[FIELD_GROUP_NAME].is_string()) { + if (jsonObject.find(FIELD_GROUP_NAME) != jsonObject.end()) { jsonObject.at(FIELD_GROUP_NAME).get_to(groupInfo.groupName); } - if (jsonObject.find(FIELD_GROUP_ID) != jsonObject.end() && jsonObject[FIELD_GROUP_ID].is_string()) { + if (jsonObject.find(FIELD_GROUP_ID) != jsonObject.end()) { jsonObject.at(FIELD_GROUP_ID).get_to(groupInfo.groupId); } - if (jsonObject.find(FIELD_GROUP_OWNER) != jsonObject.end() && jsonObject[FIELD_GROUP_OWNER].is_string()) { + if (jsonObject.find(FIELD_GROUP_OWNER) != jsonObject.end()) { jsonObject.at(FIELD_GROUP_OWNER).get_to(groupInfo.groupOwner); } - if (jsonObject.find(FIELD_GROUP_TYPE) != jsonObject.end() && - jsonObject[FIELD_GROUP_TYPE].is_number_integer()) { + if (jsonObject.find(FIELD_GROUP_TYPE) != jsonObject.end()) { jsonObject.at(FIELD_GROUP_TYPE).get_to(groupInfo.groupType); } - if (jsonObject.find(FIELD_GROUP_VISIBILITY) != jsonObject.end() && - jsonObject[FIELD_GROUP_VISIBILITY].is_number_integer()) { + if (jsonObject.find(FIELD_GROUP_VISIBILITY) != jsonObject.end()) { jsonObject.at(FIELD_GROUP_VISIBILITY).get_to(groupInfo.groupVisibility); } } diff --git a/services/dtbschedmgr/src/distributed_sched_proxy.cpp b/services/dtbschedmgr/src/distributed_sched_proxy.cpp index dca28697..0e29a56c 100644 --- a/services/dtbschedmgr/src/distributed_sched_proxy.cpp +++ b/services/dtbschedmgr/src/distributed_sched_proxy.cpp @@ -58,7 +58,8 @@ int32_t DistributedSchedProxy::StartRemoteAbility(const OHOS::AAFwk::Want& want, PARCEL_WRITE_HELPER(data, Int32, requestCode); PARCEL_WRITE_HELPER(data, Uint32, accessToken); MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, START_REMOTE_ABILITY, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::START_REMOTE_ABILITY), + data, reply); } int32_t DistributedSchedProxy::StartAbilityFromRemote(const OHOS::AAFwk::Want& want, @@ -94,7 +95,8 @@ int32_t DistributedSchedProxy::StartAbilityFromRemote(const OHOS::AAFwk::Want& w PARCEL_WRITE_HELPER(data, String, extraInfo); MessageParcel reply; HITRACE_METER_NAME(TraceTag::DSCHED, TraceValue::REMOTE_PROCEDURE_CALL); - PARCEL_TRANSACT_SYNC_RET_INT(remote, START_ABILITY_FROM_REMOTE, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::START_ABILITY_FROM_REMOTE), + data, reply); } int32_t DistributedSchedProxy::SendResultFromRemote(OHOS::AAFwk::Want& want, int32_t requestCode, @@ -121,7 +123,8 @@ int32_t DistributedSchedProxy::SendResultFromRemote(OHOS::AAFwk::Want& want, int std::string extraInfo = callerInfo.extraInfoJson.dump(); PARCEL_WRITE_HELPER(data, String, extraInfo); MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, SEND_RESULT_FROM_REMOTE, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::SEND_RESULT_FROM_REMOTE), + data, reply); } int32_t DistributedSchedProxy::ContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId, @@ -146,7 +149,7 @@ int32_t DistributedSchedProxy::ContinueMission(const std::string& srcDeviceId, c PARCEL_WRITE_HELPER(data, RemoteObject, callback); PARCEL_WRITE_HELPER(data, Parcelable, &wantParams); MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, CONTINUE_MISSION, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::CONTINUE_MISSION), data, reply); } int32_t DistributedSchedProxy::ContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId, @@ -171,7 +174,8 @@ int32_t DistributedSchedProxy::ContinueMission(const std::string& srcDeviceId, c PARCEL_WRITE_HELPER(data, RemoteObject, callback); PARCEL_WRITE_HELPER(data, Parcelable, &wantParams); MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, CONTINUE_MISSION_OF_BUNDLENAME, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::CONTINUE_MISSION_OF_BUNDLENAME), + data, reply); } int32_t DistributedSchedProxy::StartContinuation(const OHOS::AAFwk::Want& want, int32_t missionId, int32_t callerUid, @@ -192,7 +196,7 @@ int32_t DistributedSchedProxy::StartContinuation(const OHOS::AAFwk::Want& want, PARCEL_WRITE_HELPER(data, Int32, status); PARCEL_WRITE_HELPER(data, Uint32, accessToken); MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, START_CONTINUATION, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::START_CONTINUATION), data, reply); } void DistributedSchedProxy::NotifyCompleteContinuation(const std::u16string& devId, int32_t sessionId, bool isSuccess) @@ -210,7 +214,8 @@ void DistributedSchedProxy::NotifyCompleteContinuation(const std::u16string& dev PARCEL_WRITE_HELPER_NORET(data, Int32, sessionId); PARCEL_WRITE_HELPER_NORET(data, Bool, isSuccess); MessageParcel reply; - PARCEL_TRANSACT_SYNC_NORET(remote, NOTIFY_COMPLETE_CONTINUATION, data, reply); + PARCEL_TRANSACT_SYNC_NORET(remote, static_cast(IDSchedInterfaceCode::NOTIFY_COMPLETE_CONTINUATION), + data, reply); } int32_t DistributedSchedProxy::NotifyContinuationResultFromRemote(int32_t sessionId, bool isSuccess) @@ -227,7 +232,8 @@ int32_t DistributedSchedProxy::NotifyContinuationResultFromRemote(int32_t sessio PARCEL_WRITE_HELPER(data, Int32, sessionId); PARCEL_WRITE_HELPER(data, Bool, isSuccess); MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, NOTIFY_CONTINUATION_RESULT_FROM_REMOTE, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast + (IDSchedInterfaceCode::NOTIFY_CONTINUATION_RESULT_FROM_REMOTE), data, reply); } int32_t DistributedSchedProxy::ConnectRemoteAbility(const OHOS::AAFwk::Want& want, const sptr& connect, @@ -253,7 +259,8 @@ int32_t DistributedSchedProxy::ConnectRemoteAbility(const OHOS::AAFwk::Want& wan PARCEL_WRITE_HELPER(data, Int32, callerPid); PARCEL_WRITE_HELPER(data, Uint32, accessToken); MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, CONNECT_REMOTE_ABILITY, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::CONNECT_REMOTE_ABILITY), + data, reply); } int32_t DistributedSchedProxy::DisconnectRemoteAbility(const sptr& connect, int32_t callerUid, @@ -277,7 +284,8 @@ int32_t DistributedSchedProxy::DisconnectRemoteAbility(const sptr PARCEL_WRITE_HELPER(data, Int32, callerUid); PARCEL_WRITE_HELPER(data, Uint32, accessToken); MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, DISCONNECT_REMOTE_ABILITY, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::DISCONNECT_REMOTE_ABILITY), + data, reply); } int32_t DistributedSchedProxy::ConnectAbilityFromRemote(const OHOS::AAFwk::Want& want, @@ -319,7 +327,8 @@ int32_t DistributedSchedProxy::ConnectAbilityFromRemote(const OHOS::AAFwk::Want& PARCEL_WRITE_HELPER(data, String, extraInfo); MessageParcel reply; HITRACE_METER_NAME(TraceTag::DSCHED, TraceValue::REMOTE_PROCEDURE_CALL); - PARCEL_TRANSACT_SYNC_RET_INT(remote, CONNECT_ABILITY_FROM_REMOTE, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::CONNECT_ABILITY_FROM_REMOTE), + data, reply); } int32_t DistributedSchedProxy::DisconnectAbilityFromRemote(const sptr& connect, @@ -344,7 +353,8 @@ int32_t DistributedSchedProxy::DisconnectAbilityFromRemote(const sptr(IDSchedInterfaceCode::DISCONNECT_ABILITY_FROM_REMOTE), + data, reply); } int32_t DistributedSchedProxy::NotifyProcessDiedFromRemote(const CallerInfo& callerInfo) @@ -363,7 +373,8 @@ int32_t DistributedSchedProxy::NotifyProcessDiedFromRemote(const CallerInfo& cal PARCEL_WRITE_HELPER(data, Int32, callerInfo.pid); PARCEL_WRITE_HELPER(data, String, callerInfo.sourceDeviceId); MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, NOTIFY_PROCESS_DIED_FROM_REMOTE, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::NOTIFY_PROCESS_DIED_FROM_REMOTE), + data, reply); } #ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER @@ -384,7 +395,7 @@ int32_t DistributedSchedProxy::StartSyncRemoteMissions(const std::string& devId, PARCEL_WRITE_HELPER(data, String16, Str8ToStr16(devId)); PARCEL_WRITE_HELPER(data, Bool, fixConflict); PARCEL_WRITE_HELPER(data, Int64, tag); - PARCEL_TRANSACT_SYNC_RET_INT(remote, START_SYNC_MISSIONS, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::START_SYNC_MISSIONS), data, reply); } int32_t DistributedSchedProxy::StartSyncMissionsFromRemote(const CallerInfo& callerInfo, @@ -405,7 +416,8 @@ int32_t DistributedSchedProxy::StartSyncMissionsFromRemote(const CallerInfo& cal if (!CallerInfoMarshalling(callerInfo, data)) { return ERR_FLATTEN_OBJECT; } - int32_t error = remote->SendRequest(START_SYNC_MISSIONS_FROM_REMOTE, data, reply, option); + int32_t error = remote->SendRequest(static_cast(IDSchedInterfaceCode::START_SYNC_MISSIONS_FROM_REMOTE), + data, reply, option); if (error != ERR_NONE) { HILOGW("fail, error: %{public}d", error); return error; @@ -429,7 +441,7 @@ int32_t DistributedSchedProxy::StopSyncRemoteMissions(const std::string& devId) return ERR_FLATTEN_OBJECT; } PARCEL_WRITE_HELPER(data, String16, Str8ToStr16(devId)); - PARCEL_TRANSACT_SYNC_RET_INT(remote, STOP_SYNC_MISSIONS, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::STOP_SYNC_MISSIONS), data, reply); } int32_t DistributedSchedProxy::StopSyncMissionsFromRemote(const CallerInfo& callerInfo) @@ -449,7 +461,8 @@ int32_t DistributedSchedProxy::StopSyncMissionsFromRemote(const CallerInfo& call if (!CallerInfoMarshalling(callerInfo, data)) { return ERR_FLATTEN_OBJECT; } - int32_t error = remote->SendRequest(STOP_SYNC_MISSIONS_FROM_REMOTE, data, reply, option); + int32_t error = remote->SendRequest(static_cast(IDSchedInterfaceCode::STOP_SYNC_MISSIONS_FROM_REMOTE), + data, reply, option); if (error != ERR_NONE) { HILOGW("sendRequest fail, error: %{public}d", error); return error; @@ -473,7 +486,8 @@ int32_t DistributedSchedProxy::RegisterMissionListener(const std::u16string& dev } PARCEL_WRITE_HELPER(data, String16, devId); PARCEL_WRITE_HELPER(data, RemoteObject, obj); - PARCEL_TRANSACT_SYNC_RET_INT(remote, REGISTER_MISSION_LISTENER, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::REGISTER_MISSION_LISTENER), + data, reply); } int32_t DistributedSchedProxy::RegisterOnListener(const std::string& type, @@ -492,7 +506,8 @@ int32_t DistributedSchedProxy::RegisterOnListener(const std::string& type, } PARCEL_WRITE_HELPER(data, String, type); PARCEL_WRITE_HELPER(data, RemoteObject, obj); - PARCEL_TRANSACT_SYNC_RET_INT(remote, REGISTER_ON_LISTENER, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::REGISTER_ON_LISTENER), + data, reply); } int32_t DistributedSchedProxy::RegisterOffListener(const std::string& type, @@ -511,7 +526,8 @@ int32_t DistributedSchedProxy::RegisterOffListener(const std::string& type, } PARCEL_WRITE_HELPER(data, String, type); PARCEL_WRITE_HELPER(data, RemoteObject, obj); - PARCEL_TRANSACT_SYNC_RET_INT(remote, REGISTER_OFF_LISTENER, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::REGISTER_OFF_LISTENER), + data, reply); } int32_t DistributedSchedProxy::UnRegisterMissionListener(const std::u16string& devId, @@ -530,7 +546,8 @@ int32_t DistributedSchedProxy::UnRegisterMissionListener(const std::u16string& d } PARCEL_WRITE_HELPER(data, String16, devId); PARCEL_WRITE_HELPER(data, RemoteObject, obj); - PARCEL_TRANSACT_SYNC_RET_INT(remote, UNREGISTER_MISSION_LISTENER, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::UNREGISTER_MISSION_LISTENER), + data, reply); } int32_t DistributedSchedProxy::GetMissionInfos(const std::string& deviceId, int32_t numMissions, @@ -551,7 +568,8 @@ int32_t DistributedSchedProxy::GetMissionInfos(const std::string& deviceId, int3 } PARCEL_WRITE_HELPER(data, String16, Str8ToStr16(deviceId)); PARCEL_WRITE_HELPER(data, Int32, numMissions); - int32_t ret = remote->SendRequest(GET_MISSION_INFOS, data, reply, option); + int32_t ret = remote->SendRequest(static_cast(IDSchedInterfaceCode::GET_MISSION_INFOS), data, reply, + option); if (ret != ERR_NONE) { HILOGW("sendRequest fail, error: %{public}d", ret); return ret; @@ -583,7 +601,8 @@ int32_t DistributedSchedProxy::NotifyMissionsChangedFromRemote(const std::vector PARCEL_WRITE_HELPER(data, Int32, callerInfo.dmsVersion); MessageParcel reply; MessageOption option { MessageOption::TF_SYNC, WAIT_TIME }; - int32_t error = remote->SendRequest(NOTIFY_MISSIONS_CHANGED_FROM_REMOTE, data, reply, option); + int32_t error = remote->SendRequest(static_cast + (IDSchedInterfaceCode::NOTIFY_MISSIONS_CHANGED_FROM_REMOTE), data, reply, option); if (error != ERR_NONE) { HILOGE("%{public}s transact failed, error: %{public}d", __func__, error); return error; @@ -617,7 +636,8 @@ int32_t DistributedSchedProxy::GetRemoteMissionSnapshotInfo(const std::string& n PARCEL_WRITE_HELPER(data, Int32, missionId); MessageParcel reply; MessageOption option; - int32_t error = remote->SendRequest(GET_REMOTE_MISSION_SNAPSHOT_INFO, data, reply, option); + int32_t error = remote->SendRequest(static_cast(IDSchedInterfaceCode::GET_REMOTE_MISSION_SNAPSHOT_INFO), + data, reply, option); if (error != ERR_NONE) { HILOGE("transact failed, error: %{public}d", error); return error; @@ -663,7 +683,8 @@ int32_t DistributedSchedProxy::StartRemoteAbilityByCall(const OHOS::AAFwk::Want& PARCEL_WRITE_HELPER(data, Int32, callerPid); PARCEL_WRITE_HELPER(data, Uint32, accessToken); MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, START_REMOTE_ABILITY_BY_CALL, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::START_REMOTE_ABILITY_BY_CALL), + data, reply); } int32_t DistributedSchedProxy::ReleaseRemoteAbility(const sptr& connect, @@ -689,7 +710,8 @@ int32_t DistributedSchedProxy::ReleaseRemoteAbility(const sptr& c return ERR_INVALID_VALUE; } MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, RELEASE_REMOTE_ABILITY, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::RELEASE_REMOTE_ABILITY), + data, reply); } int32_t DistributedSchedProxy::StartAbilityByCallFromRemote(const OHOS::AAFwk::Want& want, @@ -727,7 +749,8 @@ int32_t DistributedSchedProxy::StartAbilityByCallFromRemote(const OHOS::AAFwk::W PARCEL_WRITE_HELPER(data, Parcelable, &dstbWant); MessageParcel reply; HITRACE_METER_NAME(TraceTag::DSCHED, TraceValue::REMOTE_PROCEDURE_CALL); - PARCEL_TRANSACT_SYNC_RET_INT(remote, START_ABILITY_BY_CALL_FROM_REMOTE, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast + (IDSchedInterfaceCode::START_ABILITY_BY_CALL_FROM_REMOTE), data, reply); } int32_t DistributedSchedProxy::ReleaseAbilityFromRemote(const sptr& connect, @@ -757,7 +780,8 @@ int32_t DistributedSchedProxy::ReleaseAbilityFromRemote(const sptr(IDSchedInterfaceCode::RELEASE_ABILITY_FROM_REMOTE), + data, reply); } int32_t DistributedSchedProxy::StartRemoteFreeInstall(const OHOS::AAFwk::Want& want, @@ -787,7 +811,8 @@ int32_t DistributedSchedProxy::StartRemoteFreeInstall(const OHOS::AAFwk::Want& w PARCEL_WRITE_HELPER(data, Uint32, accessToken); PARCEL_WRITE_HELPER(data, RemoteObject, callback); MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, START_REMOTE_FREE_INSTALL, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::START_REMOTE_FREE_INSTALL), + data, reply); } int32_t DistributedSchedProxy::StartFreeInstallFromRemote(const FreeInstallInfo& info, int64_t taskId) @@ -826,7 +851,8 @@ int32_t DistributedSchedProxy::StartFreeInstallFromRemote(const FreeInstallInfo& PARCEL_WRITE_HELPER(data, String, extraInfo); MessageParcel reply; HITRACE_METER_NAME(TraceTag::DSCHED, TraceValue::REMOTE_PROCEDURE_CALL); - PARCEL_TRANSACT_SYNC_RET_INT(remote, START_FREE_INSTALL_FROM_REMOTE, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::START_FREE_INSTALL_FROM_REMOTE), + data, reply); } int32_t DistributedSchedProxy::NotifyCompleteFreeInstallFromRemote(int64_t taskId, int32_t resultCode) @@ -847,7 +873,8 @@ int32_t DistributedSchedProxy::NotifyCompleteFreeInstallFromRemote(int64_t taskI PARCEL_WRITE_HELPER(data, Int64, taskId); PARCEL_WRITE_HELPER(data, Int32, resultCode); MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, NOTIFY_COMPLETE_FREE_INSTALL_FROM_REMOTE, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast + (IDSchedInterfaceCode::NOTIFY_COMPLETE_FREE_INSTALL_FROM_REMOTE), data, reply); } #ifdef SUPPORT_DISTRIBUTED_FORM_SHARE @@ -876,7 +903,8 @@ int32_t DistributedSchedProxy::StartRemoteShareForm( PARCEL_WRITE_HELPER(data, String, remoteDeviceId); PARCEL_WRITE_HELPER(data, Parcelable, &formShareInfo); - PARCEL_TRANSACT_SYNC_RET_INT(remote, START_REMOTE_SHARE_FORM, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::START_REMOTE_SHARE_FORM), + data, reply); } int32_t DistributedSchedProxy::StartShareFormFromRemote( @@ -904,7 +932,8 @@ int32_t DistributedSchedProxy::StartShareFormFromRemote( PARCEL_WRITE_HELPER(data, String, remoteDeviceId); PARCEL_WRITE_HELPER(data, Parcelable, &formShareInfo); - PARCEL_TRANSACT_SYNC_RET_INT(remote, START_SHARE_FORM_FROM_REMOTE, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::START_SHARE_FORM_FROM_REMOTE), + data, reply); } #endif @@ -928,7 +957,8 @@ int32_t DistributedSchedProxy::NotifyStateChangedFromRemote(int32_t abilityState return ERR_INVALID_VALUE; } MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, NOTIFY_STATE_CHANGED_FROM_REMOTE, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::NOTIFY_STATE_CHANGED_FROM_REMOTE), + data, reply); } int32_t DistributedSchedProxy::GetDistributedComponentList(std::vector& distributedComponents) @@ -944,7 +974,8 @@ int32_t DistributedSchedProxy::GetDistributedComponentList(std::vectorSendRequest(GET_DISTRIBUTED_COMPONENT_LIST, data, reply, option); + int32_t error = remote->SendRequest(static_cast(IDSchedInterfaceCode::GET_DISTRIBUTED_COMPONENT_LIST), + data, reply, option); if (error != ERR_NONE) { HILOGE("GetDistributedComponentList SendRequest error = %{public}d", error); return error; @@ -976,7 +1007,8 @@ int32_t DistributedSchedProxy::StopRemoteExtensionAbility( PARCEL_WRITE_HELPER(data, Uint32, accessToken); PARCEL_WRITE_HELPER(data, Int32, extensionType); MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, STOP_REMOTE_EXTERNSION_ABILITY, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast(IDSchedInterfaceCode::STOP_REMOTE_EXTERNSION_ABILITY), + data, reply); } int32_t DistributedSchedProxy::StopExtensionAbilityFromRemote(const OHOS::AAFwk::Want& want, @@ -1005,7 +1037,8 @@ int32_t DistributedSchedProxy::StopExtensionAbilityFromRemote(const OHOS::AAFwk: std::string extraInfo = extraInfoJson.dump(); PARCEL_WRITE_HELPER(data, String, extraInfo); MessageParcel reply; - PARCEL_TRANSACT_SYNC_RET_INT(remote, STOP_EXTERNSION_ABILITY_FROM_REMOTE, data, reply); + PARCEL_TRANSACT_SYNC_RET_INT(remote, static_cast + (IDSchedInterfaceCode::STOP_EXTERNSION_ABILITY_FROM_REMOTE), data, reply); } } // namespace DistributedSchedule } // namespace OHOS diff --git a/services/dtbschedmgr/src/distributed_sched_service.cpp b/services/dtbschedmgr/src/distributed_sched_service.cpp index 83b47e8f..db62ae18 100644 --- a/services/dtbschedmgr/src/distributed_sched_service.cpp +++ b/services/dtbschedmgr/src/distributed_sched_service.cpp @@ -447,9 +447,11 @@ int32_t DistributedSchedService::ContinueMission(const std::string& srcDeviceId, return INVALID_PARAMETERS_ERR; } - if (srcDeviceId == localDevId) { + if (srcDeviceId == localDevId && + DtbschedmgrDeviceInfoStorage::GetInstance().GetDeviceInfoById(dstDeviceId) != nullptr) { return ContinueLocalMission(dstDeviceId, missionId, callback, wantParams); - } else if (dstDeviceId == localDevId) { + } else if (dstDeviceId == localDevId && + DtbschedmgrDeviceInfoStorage::GetInstance().GetDeviceInfoById(srcDeviceId) != nullptr) { return ContinueRemoteMission(srcDeviceId, dstDeviceId, missionId, callback, wantParams); } else { HILOGE("source or target device must be local!"); @@ -473,7 +475,8 @@ int32_t DistributedSchedService::ContinueMission(const std::string& srcDeviceId, return INVALID_PARAMETERS_ERR; } - if (srcDeviceId == localDevId) { + if (srcDeviceId == localDevId && + DtbschedmgrDeviceInfoStorage::GetInstance().GetDeviceInfoById(dstDeviceId) != nullptr) { int32_t missionId = 1; #ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER int32_t ret = DistributedSchedContinueManager::GetInstance().GetMissionId(bundleName, missionId); @@ -483,7 +486,8 @@ int32_t DistributedSchedService::ContinueMission(const std::string& srcDeviceId, } #endif return ContinueLocalMission(dstDeviceId, missionId, callback, wantParams); - } else if (dstDeviceId == localDevId) { + } else if (dstDeviceId == localDevId && + DtbschedmgrDeviceInfoStorage::GetInstance().GetDeviceInfoById(srcDeviceId) != nullptr) { return ContinueRemoteMission(srcDeviceId, dstDeviceId, bundleName, callback, wantParams); } else { HILOGE("source or target device must be local!"); diff --git a/services/dtbschedmgr/src/distributed_sched_stub.cpp b/services/dtbschedmgr/src/distributed_sched_stub.cpp index 13a4b017..dcdce754 100644 --- a/services/dtbschedmgr/src/distributed_sched_stub.cpp +++ b/services/dtbschedmgr/src/distributed_sched_stub.cpp @@ -71,65 +71,97 @@ DistributedSchedStub::~DistributedSchedStub() void DistributedSchedStub::InitLocalFuncsInner() { - localFuncsMap_[START_REMOTE_ABILITY] = &DistributedSchedStub::StartRemoteAbilityInner; - localFuncsMap_[CONTINUE_MISSION] = &DistributedSchedStub::ContinueMissionInner; - localFuncsMap_[CONTINUE_MISSION_OF_BUNDLENAME] = &DistributedSchedStub::ContinueMissionOfBundleNameInner; - localFuncsMap_[START_CONTINUATION] = &DistributedSchedStub::StartContinuationInner; - localFuncsMap_[NOTIFY_COMPLETE_CONTINUATION] = &DistributedSchedStub::NotifyCompleteContinuationInner; - localFuncsMap_[CONNECT_REMOTE_ABILITY] = &DistributedSchedStub::ConnectRemoteAbilityInner; - localFuncsMap_[DISCONNECT_REMOTE_ABILITY] = &DistributedSchedStub::DisconnectRemoteAbilityInner; + localFuncsMap_[static_cast(IDSchedInterfaceCode::START_REMOTE_ABILITY)] = + &DistributedSchedStub::StartRemoteAbilityInner; + localFuncsMap_[static_cast(IDSchedInterfaceCode::CONTINUE_MISSION)] = + &DistributedSchedStub::ContinueMissionInner; + localFuncsMap_[static_cast(IDSchedInterfaceCode::CONTINUE_MISSION_OF_BUNDLENAME)] = + &DistributedSchedStub::ContinueMissionOfBundleNameInner; + localFuncsMap_[static_cast(IDSchedInterfaceCode::START_CONTINUATION)] = + &DistributedSchedStub::StartContinuationInner; + localFuncsMap_[static_cast(IDSchedInterfaceCode::NOTIFY_COMPLETE_CONTINUATION)] = + &DistributedSchedStub::NotifyCompleteContinuationInner; + localFuncsMap_[static_cast(IDSchedInterfaceCode::CONNECT_REMOTE_ABILITY)] = + &DistributedSchedStub::ConnectRemoteAbilityInner; + localFuncsMap_[static_cast(IDSchedInterfaceCode::DISCONNECT_REMOTE_ABILITY)] = + &DistributedSchedStub::DisconnectRemoteAbilityInner; // request codes for mission manager #ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER - localFuncsMap_[GET_REMOTE_MISSION_SNAPSHOT_INFO] = &DistributedSchedStub::GetRemoteMissionSnapshotInfoInner; - localFuncsMap_[REGISTER_MISSION_LISTENER] = &DistributedSchedStub::RegisterMissionListenerInner; - localFuncsMap_[REGISTER_ON_LISTENER] = &DistributedSchedStub::RegisterOnListenerInner; - localFuncsMap_[REGISTER_OFF_LISTENER] = &DistributedSchedStub::RegisterOffListenerInner; - localFuncsMap_[UNREGISTER_MISSION_LISTENER] = &DistributedSchedStub::UnRegisterMissionListenerInner; - localFuncsMap_[GET_MISSION_INFOS] = &DistributedSchedStub::GetMissionInfosInner; - localFuncsMap_[START_SYNC_MISSIONS] = &DistributedSchedStub::StartSyncRemoteMissionsInner; - localFuncsMap_[STOP_SYNC_MISSIONS] = &DistributedSchedStub::StopSyncRemoteMissionsInner; + localFuncsMap_[static_cast(IDSchedInterfaceCode::GET_REMOTE_MISSION_SNAPSHOT_INFO)] = + &DistributedSchedStub::GetRemoteMissionSnapshotInfoInner; + localFuncsMap_[static_cast(IDSchedInterfaceCode::REGISTER_MISSION_LISTENER)] = + &DistributedSchedStub::RegisterMissionListenerInner; + localFuncsMap_[static_cast(IDSchedInterfaceCode::REGISTER_ON_LISTENER)] = + &DistributedSchedStub::RegisterOnListenerInner; + localFuncsMap_[static_cast(IDSchedInterfaceCode::REGISTER_OFF_LISTENER)] = + &DistributedSchedStub::RegisterOffListenerInner; + localFuncsMap_[static_cast(IDSchedInterfaceCode::UNREGISTER_MISSION_LISTENER)] = + &DistributedSchedStub::UnRegisterMissionListenerInner; + localFuncsMap_[static_cast(IDSchedInterfaceCode::GET_MISSION_INFOS)] = + &DistributedSchedStub::GetMissionInfosInner; + localFuncsMap_[static_cast(IDSchedInterfaceCode::START_SYNC_MISSIONS)] = + &DistributedSchedStub::StartSyncRemoteMissionsInner; + localFuncsMap_[static_cast(IDSchedInterfaceCode::STOP_SYNC_MISSIONS)] = + &DistributedSchedStub::StopSyncRemoteMissionsInner; #endif - localFuncsMap_[START_REMOTE_ABILITY_BY_CALL] = &DistributedSchedStub::StartRemoteAbilityByCallInner; - localFuncsMap_[RELEASE_REMOTE_ABILITY] = &DistributedSchedStub::ReleaseRemoteAbilityInner; + localFuncsMap_[static_cast(IDSchedInterfaceCode::START_REMOTE_ABILITY_BY_CALL)] = + &DistributedSchedStub::StartRemoteAbilityByCallInner; + localFuncsMap_[static_cast(IDSchedInterfaceCode::RELEASE_REMOTE_ABILITY)] = + &DistributedSchedStub::ReleaseRemoteAbilityInner; #ifdef SUPPORT_DISTRIBUTED_FORM_SHARE - localFuncsMap_[START_REMOTE_SHARE_FORM] = &DistributedSchedStub::StartRemoteShareFormInner; + localFuncsMap_[static_cast(IDSchedInterfaceCode::START_REMOTE_SHARE_FORM)] = + &DistributedSchedStub::StartRemoteShareFormInner; #endif - localFuncsMap_[GET_DISTRIBUTED_COMPONENT_LIST] = &DistributedSchedStub::GetDistributedComponentListInner; - localFuncsMap_[START_REMOTE_FREE_INSTALL] = &DistributedSchedStub::StartRemoteFreeInstallInner; - localFuncsMap_[STOP_REMOTE_EXTERNSION_ABILITY] = + localFuncsMap_[static_cast(IDSchedInterfaceCode::GET_DISTRIBUTED_COMPONENT_LIST)] = + &DistributedSchedStub::GetDistributedComponentListInner; + localFuncsMap_[static_cast(IDSchedInterfaceCode::START_REMOTE_FREE_INSTALL)] = + &DistributedSchedStub::StartRemoteFreeInstallInner; + localFuncsMap_[static_cast(IDSchedInterfaceCode::STOP_REMOTE_EXTERNSION_ABILITY)] = &DistributedSchedStub::StopRemoteExtensionAbilityInner; } void DistributedSchedStub::InitRemoteFuncsInner() { - remoteFuncsMap_[START_ABILITY_FROM_REMOTE] = &DistributedSchedStub::StartAbilityFromRemoteInner; - remoteFuncsMap_[SEND_RESULT_FROM_REMOTE] = &DistributedSchedStub::SendResultFromRemoteInner; - remoteFuncsMap_[NOTIFY_CONTINUATION_RESULT_FROM_REMOTE] = + remoteFuncsMap_[static_cast(IDSchedInterfaceCode::START_ABILITY_FROM_REMOTE)] = + &DistributedSchedStub::StartAbilityFromRemoteInner; + remoteFuncsMap_[static_cast(IDSchedInterfaceCode::SEND_RESULT_FROM_REMOTE)] = + &DistributedSchedStub::SendResultFromRemoteInner; + remoteFuncsMap_[static_cast(IDSchedInterfaceCode::NOTIFY_CONTINUATION_RESULT_FROM_REMOTE)] = &DistributedSchedStub::NotifyContinuationResultFromRemoteInner; - remoteFuncsMap_[CONNECT_ABILITY_FROM_REMOTE] = &DistributedSchedStub::ConnectAbilityFromRemoteInner; - remoteFuncsMap_[DISCONNECT_ABILITY_FROM_REMOTE] = &DistributedSchedStub::DisconnectAbilityFromRemoteInner; - remoteFuncsMap_[NOTIFY_PROCESS_DIED_FROM_REMOTE] = &DistributedSchedStub::NotifyProcessDiedFromRemoteInner; + remoteFuncsMap_[static_cast(IDSchedInterfaceCode::CONNECT_ABILITY_FROM_REMOTE)] = + &DistributedSchedStub::ConnectAbilityFromRemoteInner; + remoteFuncsMap_[static_cast(IDSchedInterfaceCode::DISCONNECT_ABILITY_FROM_REMOTE)] = + &DistributedSchedStub::DisconnectAbilityFromRemoteInner; + remoteFuncsMap_[static_cast(IDSchedInterfaceCode::NOTIFY_PROCESS_DIED_FROM_REMOTE)] = + &DistributedSchedStub::NotifyProcessDiedFromRemoteInner; #ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER // request codes for mission manager - remoteFuncsMap_[START_SYNC_MISSIONS_FROM_REMOTE] = + remoteFuncsMap_[static_cast(IDSchedInterfaceCode::START_SYNC_MISSIONS_FROM_REMOTE)] = &DistributedSchedStub::StartSyncMissionsFromRemoteInner; - remoteFuncsMap_[STOP_SYNC_MISSIONS_FROM_REMOTE] = + remoteFuncsMap_[static_cast(IDSchedInterfaceCode::STOP_SYNC_MISSIONS_FROM_REMOTE)] = &DistributedSchedStub::StopSyncMissionsFromRemoteInner; - remoteFuncsMap_[NOTIFY_MISSIONS_CHANGED_FROM_REMOTE] = &DistributedSchedStub::NotifyMissionsChangedFromRemoteInner; + remoteFuncsMap_[static_cast(IDSchedInterfaceCode::NOTIFY_MISSIONS_CHANGED_FROM_REMOTE)] = + &DistributedSchedStub::NotifyMissionsChangedFromRemoteInner; #endif - remoteFuncsMap_[CONTINUE_MISSION] = &DistributedSchedStub::ContinueMissionInner; - remoteFuncsMap_[CONTINUE_MISSION_OF_BUNDLENAME] = &DistributedSchedStub::ContinueMissionOfBundleNameInner; - remoteFuncsMap_[START_ABILITY_BY_CALL_FROM_REMOTE] = &DistributedSchedStub::StartAbilityByCallFromRemoteInner; - remoteFuncsMap_[RELEASE_ABILITY_FROM_REMOTE] = &DistributedSchedStub::ReleaseAbilityFromRemoteInner; - remoteFuncsMap_[NOTIFY_STATE_CHANGED_FROM_REMOTE] = + remoteFuncsMap_[static_cast(IDSchedInterfaceCode::CONTINUE_MISSION)] = + &DistributedSchedStub::ContinueMissionInner; + remoteFuncsMap_[static_cast(IDSchedInterfaceCode::CONTINUE_MISSION_OF_BUNDLENAME)] = + &DistributedSchedStub::ContinueMissionOfBundleNameInner; + remoteFuncsMap_[static_cast(IDSchedInterfaceCode::START_ABILITY_BY_CALL_FROM_REMOTE)] = + &DistributedSchedStub::StartAbilityByCallFromRemoteInner; + remoteFuncsMap_[static_cast(IDSchedInterfaceCode::RELEASE_ABILITY_FROM_REMOTE)] = + &DistributedSchedStub::ReleaseAbilityFromRemoteInner; + remoteFuncsMap_[static_cast(IDSchedInterfaceCode::NOTIFY_STATE_CHANGED_FROM_REMOTE)] = &DistributedSchedStub::NotifyStateChangedFromRemoteInner; #ifdef SUPPORT_DISTRIBUTED_FORM_SHARE - remoteFuncsMap_[START_SHARE_FORM_FROM_REMOTE] = &DistributedSchedStub::StartShareFormFromRemoteInner; + remoteFuncsMap_[static_cast(IDSchedInterfaceCode::START_SHARE_FORM_FROM_REMOTE)] = + &DistributedSchedStub::StartShareFormFromRemoteInner; #endif - remoteFuncsMap_[START_FREE_INSTALL_FROM_REMOTE] = &DistributedSchedStub::StartFreeInstallFromRemoteInner; - remoteFuncsMap_[NOTIFY_COMPLETE_FREE_INSTALL_FROM_REMOTE] = + remoteFuncsMap_[static_cast(IDSchedInterfaceCode::START_FREE_INSTALL_FROM_REMOTE)] = + &DistributedSchedStub::StartFreeInstallFromRemoteInner; + remoteFuncsMap_[static_cast(IDSchedInterfaceCode::NOTIFY_COMPLETE_FREE_INSTALL_FROM_REMOTE)] = &DistributedSchedStub::NotifyCompleteFreeInstallFromRemoteInner; - remoteFuncsMap_[STOP_EXTERNSION_ABILITY_FROM_REMOTE] = + remoteFuncsMap_[static_cast(IDSchedInterfaceCode::STOP_EXTERNSION_ABILITY_FROM_REMOTE)] = &DistributedSchedStub::StopExtensionAbilityFromRemoteInner; } diff --git a/services/dtbschedmgr/src/dms_free_install_callback_proxy.cpp b/services/dtbschedmgr/src/dms_free_install_callback_proxy.cpp index 4147ed73..4086f35c 100644 --- a/services/dtbschedmgr/src/dms_free_install_callback_proxy.cpp +++ b/services/dtbschedmgr/src/dms_free_install_callback_proxy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -57,7 +57,8 @@ void DmsFreeInstallCallbackProxy::OnInstallFinished( return; } - int32_t error = Remote()->SendRequest(IDmsFreeInstallCallbackCmd::ON_FREE_INSTALL_DONE, data, reply, option); + int32_t error = Remote()->SendRequest(static_cast + (IDRreeInstallCallbackInterfaceCode::ON_FREE_INSTALL_DONE), data, reply, option); if (error != NO_ERROR) { HILOGE("OnFinished fail, error: %{public}d", error); return; diff --git a/services/dtbschedmgr/src/dms_free_install_callback_stub.cpp b/services/dtbschedmgr/src/dms_free_install_callback_stub.cpp index 4095e47e..1dc7cf3b 100644 --- a/services/dtbschedmgr/src/dms_free_install_callback_stub.cpp +++ b/services/dtbschedmgr/src/dms_free_install_callback_stub.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -26,7 +26,7 @@ const std::string TAG = "DmsFreeInstallCallbackStub"; } DmsFreeInstallCallbackStub::DmsFreeInstallCallbackStub() { - memberFuncMap_[IDmsFreeInstallCallbackCmd::ON_FREE_INSTALL_DONE] = + memberFuncMap_[static_cast(IDRreeInstallCallbackInterfaceCode::ON_FREE_INSTALL_DONE)] = &DmsFreeInstallCallbackStub::OnInstallFinishedInner; } diff --git a/services/dtbschedmgr/test/unittest/distributed_sched_stub_test.cpp b/services/dtbschedmgr/test/unittest/distributed_sched_stub_test.cpp index f2836b3e..ff22bd37 100644 --- a/services/dtbschedmgr/test/unittest/distributed_sched_stub_test.cpp +++ b/services/dtbschedmgr/test/unittest/distributed_sched_stub_test.cpp @@ -120,7 +120,7 @@ void DistributedSchedStubTest::FreeInstallInfoMarshalling(const CallerInfo& call HWTEST_F(DistributedSchedStubTest, OnRemoteRequest_001, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest OnRemoteRequest_001 begin" << std::endl; - int32_t code = DistributedSchedStub::START_REMOTE_ABILITY; + int32_t code = static_cast(IDSchedInterfaceCode::START_REMOTE_ABILITY); MessageParcel data; MessageParcel reply; MessageOption option; @@ -139,7 +139,7 @@ HWTEST_F(DistributedSchedStubTest, OnRemoteRequest_001, TestSize.Level3) HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_001, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_001 begin" << std::endl; - int32_t code = DistributedSchedStub::START_REMOTE_ABILITY; + int32_t code = static_cast(IDSchedInterfaceCode::START_REMOTE_ABILITY); MessageParcel data; MessageParcel reply; MessageOption option; @@ -158,7 +158,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_001, TestSize.Level3) HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_002, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_002 begin" << std::endl; - int32_t code = DistributedSchedStub::START_REMOTE_ABILITY; + int32_t code = static_cast(IDSchedInterfaceCode::START_REMOTE_ABILITY); MessageParcel data; MessageParcel reply; MessageOption option; @@ -203,7 +203,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_002, TestSize.Level3) HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_003, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_003 begin" << std::endl; - int32_t code = DistributedSchedStub::START_REMOTE_ABILITY; + int32_t code = static_cast(IDSchedInterfaceCode::START_REMOTE_ABILITY); MessageParcel data; MessageParcel reply; MessageOption option; @@ -231,7 +231,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_003, TestSize.Level3) HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_004, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_004 begin" << std::endl; - int32_t code = DistributedSchedStub::START_REMOTE_ABILITY; + int32_t code = static_cast(IDSchedInterfaceCode::START_REMOTE_ABILITY); MessageParcel data; MessageParcel reply; MessageOption option; @@ -563,7 +563,7 @@ HWTEST_F(DistributedSchedStubTest, ContinueMissionInner_002, TestSize.Level3) HWTEST_F(DistributedSchedStubTest, StartContinuationInner_001, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest StartContinuationInner_001 begin" << std::endl; - int32_t code = DistributedSchedStub::START_CONTINUATION; + int32_t code = static_cast(IDSchedInterfaceCode::START_CONTINUATION); MessageParcel data; MessageParcel reply; MessageOption option; @@ -583,7 +583,7 @@ HWTEST_F(DistributedSchedStubTest, StartContinuationInner_001, TestSize.Level3) HWTEST_F(DistributedSchedStubTest, StartContinuationInner_002, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest StartContinuationInner_002 begin" << std::endl; - int32_t code = DistributedSchedStub::START_CONTINUATION; + int32_t code = static_cast(IDSchedInterfaceCode::START_CONTINUATION); MessageParcel data; MessageParcel reply; MessageOption option; @@ -616,7 +616,7 @@ HWTEST_F(DistributedSchedStubTest, StartContinuationInner_002, TestSize.Level3) HWTEST_F(DistributedSchedStubTest, StartContinuationInner_003, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest StartContinuationInner_003 begin" << std::endl; - int32_t code = DistributedSchedStub::START_CONTINUATION; + int32_t code = static_cast(IDSchedInterfaceCode::START_CONTINUATION); MessageParcel data; MessageParcel reply; MessageOption option; @@ -645,7 +645,7 @@ HWTEST_F(DistributedSchedStubTest, StartContinuationInner_003, TestSize.Level3) HWTEST_F(DistributedSchedStubTest, NotifyCompleteContinuationInner_001, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest NotifyCompleteContinuationInner_001 begin" << std::endl; - int32_t code = DistributedSchedStub::NOTIFY_COMPLETE_CONTINUATION; + int32_t code = static_cast(IDSchedInterfaceCode::NOTIFY_COMPLETE_CONTINUATION); MessageParcel data; MessageParcel reply; MessageOption option; @@ -665,7 +665,7 @@ HWTEST_F(DistributedSchedStubTest, NotifyCompleteContinuationInner_001, TestSize HWTEST_F(DistributedSchedStubTest, NotifyCompleteContinuationInner_002, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest NotifyCompleteContinuationInner_002 begin" << std::endl; - int32_t code = DistributedSchedStub::NOTIFY_COMPLETE_CONTINUATION; + int32_t code = static_cast(IDSchedInterfaceCode::NOTIFY_COMPLETE_CONTINUATION); MessageParcel data; MessageParcel reply; MessageOption option; @@ -714,7 +714,7 @@ HWTEST_F(DistributedSchedStubTest, NotifyContinuationResultFromRemoteInner_001, HWTEST_F(DistributedSchedStubTest, ConnectRemoteAbilityInner_001, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest ConnectRemoteAbilityInner_001 begin" << std::endl; - int32_t code = DistributedSchedStub::CONNECT_REMOTE_ABILITY; + int32_t code = static_cast(IDSchedInterfaceCode::CONNECT_REMOTE_ABILITY); MessageParcel data; MessageParcel reply; MessageOption option; @@ -734,7 +734,7 @@ HWTEST_F(DistributedSchedStubTest, ConnectRemoteAbilityInner_001, TestSize.Level HWTEST_F(DistributedSchedStubTest, ConnectRemoteAbilityInner_002, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest ConnectRemoteAbilityInner_002 begin" << std::endl; - int32_t code = DistributedSchedStub::CONNECT_REMOTE_ABILITY; + int32_t code = static_cast(IDSchedInterfaceCode::CONNECT_REMOTE_ABILITY); MessageParcel data; MessageParcel reply; MessageOption option; @@ -765,7 +765,7 @@ HWTEST_F(DistributedSchedStubTest, ConnectRemoteAbilityInner_002, TestSize.Level HWTEST_F(DistributedSchedStubTest, ConnectRemoteAbilityInner_003, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest ConnectRemoteAbilityInner_003 begin" << std::endl; - int32_t code = DistributedSchedStub::CONNECT_REMOTE_ABILITY; + int32_t code = static_cast(IDSchedInterfaceCode::CONNECT_REMOTE_ABILITY); MessageParcel data; MessageParcel reply; MessageOption option; @@ -792,7 +792,7 @@ HWTEST_F(DistributedSchedStubTest, ConnectRemoteAbilityInner_003, TestSize.Level HWTEST_F(DistributedSchedStubTest, DisconnectRemoteAbilityInner_001, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest DisconnectRemoteAbilityInner_001 begin" << std::endl; - int32_t code = DistributedSchedStub::DISCONNECT_REMOTE_ABILITY; + int32_t code = static_cast(IDSchedInterfaceCode::DISCONNECT_REMOTE_ABILITY); MessageParcel data; MessageParcel reply; MessageOption option; @@ -812,7 +812,7 @@ HWTEST_F(DistributedSchedStubTest, DisconnectRemoteAbilityInner_001, TestSize.Le HWTEST_F(DistributedSchedStubTest, DisconnectRemoteAbilityInner_002, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest DisconnectRemoteAbilityInner_002 begin" << std::endl; - int32_t code = DistributedSchedStub::DISCONNECT_REMOTE_ABILITY; + int32_t code = static_cast(IDSchedInterfaceCode::DISCONNECT_REMOTE_ABILITY); MessageParcel data; MessageParcel reply; MessageOption option; @@ -837,7 +837,7 @@ HWTEST_F(DistributedSchedStubTest, DisconnectRemoteAbilityInner_002, TestSize.Le HWTEST_F(DistributedSchedStubTest, DisconnectRemoteAbilityInner_003, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest DisconnectRemoteAbilityInner_003 begin" << std::endl; - int32_t code = DistributedSchedStub::DISCONNECT_REMOTE_ABILITY; + int32_t code = static_cast(IDSchedInterfaceCode::DISCONNECT_REMOTE_ABILITY); MessageParcel data; MessageParcel reply; MessageOption option; @@ -989,7 +989,7 @@ HWTEST_F(DistributedSchedStubTest, NotifyProcessDiedFromRemoteInner_001, TestSiz HWTEST_F(DistributedSchedStubTest, GetMissionInfosInner_001, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest GetMissionInfosInner_001 begin" << std::endl; - int32_t code = DistributedSchedStub::GET_MISSION_INFOS; + int32_t code = static_cast(IDSchedInterfaceCode::GET_MISSION_INFOS); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1009,7 +1009,7 @@ HWTEST_F(DistributedSchedStubTest, GetMissionInfosInner_001, TestSize.Level3) HWTEST_F(DistributedSchedStubTest, GetMissionInfosInner_002, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest GetMissionInfosInner_002 begin" << std::endl; - int32_t code = DistributedSchedStub::GET_MISSION_INFOS; + int32_t code = static_cast(IDSchedInterfaceCode::GET_MISSION_INFOS); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1032,7 +1032,7 @@ HWTEST_F(DistributedSchedStubTest, GetMissionInfosInner_002, TestSize.Level3) HWTEST_F(DistributedSchedStubTest, GetRemoteMissionSnapshotInfoInner_001, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest GetRemoteMissionSnapshotInfoInner_001 begin" << std::endl; - int32_t code = DistributedSchedStub::GET_REMOTE_MISSION_SNAPSHOT_INFO; + int32_t code = static_cast(IDSchedInterfaceCode::GET_REMOTE_MISSION_SNAPSHOT_INFO); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1052,7 +1052,7 @@ HWTEST_F(DistributedSchedStubTest, GetRemoteMissionSnapshotInfoInner_001, TestSi HWTEST_F(DistributedSchedStubTest, GetRemoteMissionSnapshotInfoInner_002, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest GetRemoteMissionSnapshotInfoInner_002 begin" << std::endl; - int32_t code = DistributedSchedStub::GET_REMOTE_MISSION_SNAPSHOT_INFO; + int32_t code = static_cast(IDSchedInterfaceCode::GET_REMOTE_MISSION_SNAPSHOT_INFO); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1086,7 +1086,7 @@ HWTEST_F(DistributedSchedStubTest, GetRemoteMissionSnapshotInfoInner_002, TestSi HWTEST_F(DistributedSchedStubTest, RegisterMissionListenerInner_001, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest RegisterMissionListenerInner_001 begin" << std::endl; - int32_t code = DistributedSchedStub::REGISTER_MISSION_LISTENER; + int32_t code = static_cast(IDSchedInterfaceCode::REGISTER_MISSION_LISTENER); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1106,7 +1106,7 @@ HWTEST_F(DistributedSchedStubTest, RegisterMissionListenerInner_001, TestSize.Le HWTEST_F(DistributedSchedStubTest, RegisterMissionListenerInner_002, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest RegisterMissionListenerInner_002 begin" << std::endl; - int32_t code = DistributedSchedStub::REGISTER_MISSION_LISTENER; + int32_t code = static_cast(IDSchedInterfaceCode::REGISTER_MISSION_LISTENER); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1138,7 +1138,7 @@ HWTEST_F(DistributedSchedStubTest, RegisterMissionListenerInner_002, TestSize.Le HWTEST_F(DistributedSchedStubTest, UnRegisterMissionListenerInner_001, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest UnRegisterMissionListenerInner_001 begin" << std::endl; - int32_t code = DistributedSchedStub::UNREGISTER_MISSION_LISTENER; + int32_t code = static_cast(IDSchedInterfaceCode::UNREGISTER_MISSION_LISTENER); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1158,7 +1158,7 @@ HWTEST_F(DistributedSchedStubTest, UnRegisterMissionListenerInner_001, TestSize. HWTEST_F(DistributedSchedStubTest, UnRegisterMissionListenerInner_002, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest UnRegisterMissionListenerInner_002 begin" << std::endl; - int32_t code = DistributedSchedStub::UNREGISTER_MISSION_LISTENER; + int32_t code = static_cast(IDSchedInterfaceCode::UNREGISTER_MISSION_LISTENER); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1226,7 +1226,7 @@ HWTEST_F(DistributedSchedStubTest, StartSyncMissionsFromRemoteInner_002, TestSiz HWTEST_F(DistributedSchedStubTest, StopSyncRemoteMissionsInner_001, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest StopSyncRemoteMissionsInner_001 begin" << std::endl; - int32_t code = DistributedSchedStub::STOP_SYNC_MISSIONS; + int32_t code = static_cast(IDSchedInterfaceCode::STOP_SYNC_MISSIONS); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1246,7 +1246,7 @@ HWTEST_F(DistributedSchedStubTest, StopSyncRemoteMissionsInner_001, TestSize.Lev HWTEST_F(DistributedSchedStubTest, StopSyncRemoteMissionsInner_002, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest StopSyncRemoteMissionsInner_002 begin" << std::endl; - int32_t code = DistributedSchedStub::STOP_SYNC_MISSIONS; + int32_t code = static_cast(IDSchedInterfaceCode::STOP_SYNC_MISSIONS); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1325,7 +1325,7 @@ HWTEST_F(DistributedSchedStubTest, NotifyMissionsChangedFromRemoteInner_001, Tes HWTEST_F(DistributedSchedStubTest, StartSyncRemoteMissionsInner_001, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest StartSyncRemoteMissionsInner_001 begin" << std::endl; - int32_t code = DistributedSchedStub::START_SYNC_MISSIONS; + int32_t code = static_cast(IDSchedInterfaceCode::START_SYNC_MISSIONS); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1345,7 +1345,7 @@ HWTEST_F(DistributedSchedStubTest, StartSyncRemoteMissionsInner_001, TestSize.Le HWTEST_F(DistributedSchedStubTest, StartSyncRemoteMissionsInner_002, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest StartSyncRemoteMissionsInner_002 begin" << std::endl; - int32_t code = DistributedSchedStub::START_SYNC_MISSIONS; + int32_t code = static_cast(IDSchedInterfaceCode::START_SYNC_MISSIONS); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1404,7 +1404,7 @@ HWTEST_F(DistributedSchedStubTest, CallerInfoUnmarshalling_001, TestSize.Level3) HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityByCallInner_001, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityByCallInner_001 begin" << std::endl; - int32_t code = DistributedSchedStub::START_REMOTE_ABILITY_BY_CALL; + int32_t code = static_cast(IDSchedInterfaceCode::START_REMOTE_ABILITY_BY_CALL); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1424,7 +1424,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityByCallInner_001, TestSize.L HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityByCallInner_002, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityByCallInner_002 begin" << std::endl; - int32_t code = DistributedSchedStub::START_REMOTE_ABILITY_BY_CALL; + int32_t code = static_cast(IDSchedInterfaceCode::START_REMOTE_ABILITY_BY_CALL); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1457,7 +1457,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityByCallInner_002, TestSize.L HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityByCallInner_003, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityByCallInner_003 begin" << std::endl; - int32_t code = DistributedSchedStub::START_REMOTE_ABILITY_BY_CALL; + int32_t code = static_cast(IDSchedInterfaceCode::START_REMOTE_ABILITY_BY_CALL); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1486,7 +1486,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityByCallInner_003, TestSize.L HWTEST_F(DistributedSchedStubTest, ReleaseRemoteAbilityInner_001, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest ReleaseRemoteAbilityInner_001 begin" << std::endl; - int32_t code = DistributedSchedStub::RELEASE_REMOTE_ABILITY; + int32_t code = static_cast(IDSchedInterfaceCode::RELEASE_REMOTE_ABILITY); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1506,7 +1506,7 @@ HWTEST_F(DistributedSchedStubTest, ReleaseRemoteAbilityInner_001, TestSize.Level HWTEST_F(DistributedSchedStubTest, ReleaseRemoteAbilityInner_002, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest ReleaseRemoteAbilityInner_002 begin" << std::endl; - int32_t code = DistributedSchedStub::RELEASE_REMOTE_ABILITY; + int32_t code = static_cast(IDSchedInterfaceCode::RELEASE_REMOTE_ABILITY); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1648,7 +1648,7 @@ HWTEST_F(DistributedSchedStubTest, ReleaseAbilityFromRemoteInner_001, TestSize.L HWTEST_F(DistributedSchedStubTest, StartRemoteShareFormInner_001, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest StartRemoteShareFormInner_001 begin" << std::endl; - int32_t code = DistributedSchedStub::START_REMOTE_SHARE_FORM; + int32_t code = static_cast(IDSchedInterfaceCode::START_REMOTE_SHARE_FORM); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1668,7 +1668,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteShareFormInner_001, TestSize.Level HWTEST_F(DistributedSchedStubTest, StartRemoteShareFormInner_002, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest StartRemoteShareFormInner_002 begin" << std::endl; - int32_t code = DistributedSchedStub::START_REMOTE_SHARE_FORM; + int32_t code = static_cast(IDSchedInterfaceCode::START_REMOTE_SHARE_FORM); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1721,7 +1721,7 @@ HWTEST_F(DistributedSchedStubTest, StartShareFormFromRemoteInner_001, TestSize.L HWTEST_F(DistributedSchedStubTest, StartRemoteFreeInstallInner_001, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest StartRemoteFreeInstallInner_001 begin" << std::endl; - int32_t code = DistributedSchedStub::START_REMOTE_FREE_INSTALL; + int32_t code = static_cast(IDSchedInterfaceCode::START_REMOTE_FREE_INSTALL); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1741,7 +1741,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteFreeInstallInner_001, TestSize.Lev HWTEST_F(DistributedSchedStubTest, StartRemoteFreeInstallInner_002, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest StartRemoteFreeInstallInner_002 begin" << std::endl; - int32_t code = DistributedSchedStub::START_REMOTE_FREE_INSTALL; + int32_t code = static_cast(IDSchedInterfaceCode::START_REMOTE_FREE_INSTALL); MessageParcel data; MessageParcel reply; MessageOption option; @@ -1782,7 +1782,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteFreeInstallInner_002, TestSize.Lev HWTEST_F(DistributedSchedStubTest, StartRemoteFreeInstallInner_003, TestSize.Level3) { DTEST_LOG << "DistributedSchedStubTest StartRemoteFreeInstallInner_003 begin" << std::endl; - int32_t code = DistributedSchedStub::START_REMOTE_FREE_INSTALL; + int32_t code = static_cast(IDSchedInterfaceCode::START_REMOTE_FREE_INSTALL); MessageParcel data; MessageParcel reply; MessageOption option; @@ -2112,7 +2112,7 @@ HWTEST_F(DistributedSchedStubTest, StopRemoteExtensionAbilityInner_002, TestSize CallerInfo callerInfo2; distributedSchedStub_->SaveExtraInfo(extraInfoJson2, callerInfo2); - int32_t code = DistributedSchedStub::STOP_REMOTE_EXTERNSION_ABILITY; + int32_t code = static_cast(IDSchedInterfaceCode::STOP_REMOTE_EXTERNSION_ABILITY); MessageParcel data; MessageParcel reply; MessageOption option;