diff --git a/frameworks/js/napi/mission_manager/BUILD.gn b/frameworks/js/napi/mission_manager/BUILD.gn index 4809eefeea56a62d730e2b767124c23a7691cb9d..acc10cafeee2e5d7f87cbcfe1de0ca6bd5fff8b5 100644 --- a/frameworks/js/napi/mission_manager/BUILD.gn +++ b/frameworks/js/napi/mission_manager/BUILD.gn @@ -73,7 +73,10 @@ ohos_shared_library("missionmanager_napi") { ohos_shared_library("distributedmissionmanager") { include_dirs = [] - configs = [ "${ability_runtime_services_path}/common:common_config" ] + configs = [ + "${ability_runtime_services_path}/common:common_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + ] cflags = [ "-fPIC", diff --git a/frameworks/js/napi/mission_manager/distributed_mission_manager.cpp b/frameworks/js/napi/mission_manager/distributed_mission_manager.cpp index 8b6683b6131b57f9099687fe2c091a8ea79853cc..dc4b5be5b6050677b2ac989040f2e93dc65a3788 100644 --- a/frameworks/js/napi/mission_manager/distributed_mission_manager.cpp +++ b/frameworks/js/napi/mission_manager/distributed_mission_manager.cpp @@ -1159,7 +1159,7 @@ void NAPIRemoteMissionListener::NotifyMissionsChanged(const std::string &deviceI TAG_LOGI(AAFwkTag::MISSION, "end"); } -void NAPIRemoteOnListener::OnCallback(const uint32_t continueState, const std::string &srcDeviceId, +ErrCode NAPIRemoteOnListener::OnCallback(const uint32_t continueState, const std::string &srcDeviceId, const std::string &bundleName, const std::string &continueType, const std::string &srcBundleName) { TAG_LOGI(AAFwkTag::MISSION, "called"); @@ -1168,7 +1168,7 @@ void NAPIRemoteOnListener::OnCallback(const uint32_t continueState, const std::s napi_get_uv_event_loop(env_, &loop); if (loop == nullptr) { TAG_LOGE(AAFwkTag::MISSION, "null loop"); - return; + return PARAMETER_CHECK_FAILED; } uv_work_t *work = new uv_work_t; @@ -1177,7 +1177,7 @@ void NAPIRemoteOnListener::OnCallback(const uint32_t continueState, const std::s if (onCB == nullptr) { TAG_LOGE(AAFwkTag::MISSION, "null onCB"); delete work; - return; + return PARAMETER_CHECK_FAILED; } for (auto ele = callbacks_.begin(); ele != callbacks_.end(); ++ele) { onCB->cbBase.cbInfo.vecCallbacks.push_back(*ele); @@ -1198,6 +1198,7 @@ void NAPIRemoteOnListener::OnCallback(const uint32_t continueState, const std::s delete work; } TAG_LOGI(AAFwkTag::MISSION, "OnCallback end"); + return ERR_OK; } void UvWorkNotifySnapshot(uv_work_t *work, int status) diff --git a/frameworks/js/napi/mission_manager/distributed_mission_manager.h b/frameworks/js/napi/mission_manager/distributed_mission_manager.h index 0db0335a895a80891cb070f9330d8369578fcea0..c82084ec6c17ab415ff684c0a698d6ec76a67d2b 100644 --- a/frameworks/js/napi/mission_manager/distributed_mission_manager.h +++ b/frameworks/js/napi/mission_manager/distributed_mission_manager.h @@ -101,7 +101,7 @@ class NAPIRemoteOnListener : public AAFwk::RemoteOnListenerStub { public: virtual ~NAPIRemoteOnListener() {}; - void OnCallback(const uint32_t continueState, const std::string &srcDeviceId, + ErrCode OnCallback(const uint32_t continueState, const std::string &srcDeviceId, const std::string &bundleName, const std::string &continueType = "", const std::string &srcBundleName = "") override; void SetEnv(const napi_env &env); diff --git a/frameworks/native/ability/native/BUILD.gn b/frameworks/native/ability/native/BUILD.gn index daafb4b1ac5cb59d5fa2a3c593dd079ad4d302ac..805b9856967948ed1a569f9aa10ef36caa2031cd 100644 --- a/frameworks/native/ability/native/BUILD.gn +++ b/frameworks/native/ability/native/BUILD.gn @@ -302,6 +302,7 @@ ohos_shared_library("abilitykit_native") { public_configs = [ ":ability_public_config", "${ability_runtime_native_path}/ability:ability_context_public_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", "${ability_runtime_innerkits_path}/wantagent:wantagent_innerkits_public_config", ] diff --git a/interfaces/inner_api/ability_manager/BUILD.gn b/interfaces/inner_api/ability_manager/BUILD.gn index 0c0c0c6e71d4461e463cde9b0e2eadeb85344e7c..36feed68a73cbfa013bc7666c057baae00f7fa41 100644 --- a/interfaces/inner_api/ability_manager/BUILD.gn +++ b/interfaces/inner_api/ability_manager/BUILD.gn @@ -11,8 +11,28 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//build/config/components/idl_tool/idl.gni") import("//build/ohos.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") +idl_gen_interface("ability_manager_interface") { + sources = [ + "idl/IRemoteOnListener.idl", + ] + sources_common = [ + + ] + log_domainid = "0xD001336" + log_tag = "AbilityMgr" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +config("ability_manager_idl_config") { + include_dirs = [ + "${ability_runtime_innerkits_path}/dataobs_manager/include", + "${target_gen_dir}", + ] +} config("ability_manager_public_config") { visibility = [ ":*" ] @@ -39,6 +59,7 @@ config("ability_manager_public_config") { "${ability_runtime_path}/interfaces/kits/native/appkit/dfr", "${ability_runtime_path}/interfaces/kits/native/appkit", "${ability_runtime_innerkits_path}/dataobs_manager/include", + "${target_gen_dir}", ] defines = [] @@ -61,10 +82,163 @@ config("ability_manager_public_config") { } } +ohos_source_set("ability_manager_proxy") { + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + debug = false + } + + output_values = get_target_outputs(":ability_manager_interface") + source_values = [ + "*remote_on_listener_proxy.cpp", + ] + sources = filter_include(output_values, source_values) + + public_configs = [ + ":ability_manager_idl_config", + "${ability_runtime_services_path}/abilitymgr:abilityms_config", + ] + + public_deps = [ ":ability_connect_callback_stub" ] + + deps = [ + ":ability_manager_interface", + ":ability_start_options", + ":ability_start_setting", + ":mission_info", + ":process_options", + ":start_window_option", + "${ability_runtime_innerkits_path}/app_manager:app_manager", + "${ability_runtime_path}/utils/global/freeze:freeze_util", + "${ability_runtime_services_path}/abilitymgr:wantagent_manager", + ] + + external_deps = [ + "bundle_framework:libappexecfwk_common", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "eventhandler:libeventhandler", + "hilog:libhilog", + "hisysevent:libhisysevent", + "hitrace:hitrace_meter", + "ipc:ipc_core", + "ipc:ipc_napi", + "jsoncpp:jsoncpp", + "relational_store:native_dataability", + "samgr:samgr_proxy", + ] + + if (host_cpu != "arm64") { + external_deps += [ "relational_store:native_rdb" ] + } + + public_external_deps = [ + "ability_base:base", + "ability_base:configuration", + "ability_base:session_info", + "ability_base:want", + "ability_base:zuri", + "background_task_mgr:bgtaskmgr_innerkits", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "init:libbegetutil", + "jsoncpp:jsoncpp", + ] + + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_source_set("ability_manager_stub") { + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + debug = false + } + + output_values = get_target_outputs(":ability_manager_interface") + source_values = [ + "*remote_on_listener_stub.cpp", + ] + sources = filter_include(output_values, source_values) + + public_configs = [ + ":ability_manager_idl_config", + "${ability_runtime_services_path}/abilitymgr:abilityms_config", + ] + + public_deps = [ ":ability_connect_callback_stub" ] + + deps = [ + ":ability_manager_interface", + ":ability_start_options", + ":ability_start_setting", + ":mission_info", + ":process_options", + ":start_window_option", + "${ability_runtime_innerkits_path}/app_manager:app_manager", + "${ability_runtime_path}/utils/global/freeze:freeze_util", + "${ability_runtime_services_path}/abilitymgr:wantagent_manager", + ] + + external_deps = [ + "bundle_framework:libappexecfwk_common", + "c_utils:utils", + "common_event_service:cesfwk_innerkits", + "eventhandler:libeventhandler", + "hilog:libhilog", + "hisysevent:libhisysevent", + "hitrace:hitrace_meter", + "ipc:ipc_core", + "ipc:ipc_napi", + "jsoncpp:jsoncpp", + "relational_store:native_dataability", + "samgr:samgr_proxy", + ] + + if (host_cpu != "arm64") { + external_deps += [ "relational_store:native_rdb" ] + } + + public_external_deps = [ + "ability_base:base", + "ability_base:configuration", + "ability_base:session_info", + "ability_base:want", + "ability_base:zuri", + "background_task_mgr:bgtaskmgr_innerkits", + "bundle_framework:appexecfwk_base", + "bundle_framework:appexecfwk_core", + "init:libbegetutil", + "jsoncpp:jsoncpp", + "relational_store:native_dataability", + ] + + subsystem_name = "ability" + part_name = "ability_runtime" +} + ohos_shared_library("ability_manager") { + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + debug = false + } use_exceptions = true branch_protector_ret = "pac_ret" - sources = [ "${ability_runtime_native_path}/ability/native/data_ability_operation.cpp", "${ability_runtime_native_path}/ability/native/data_ability_operation_builder.cpp", @@ -98,8 +272,6 @@ ohos_shared_library("ability_manager") { "${ability_runtime_services_path}/abilitymgr/src/prepare_terminate_callback_proxy.cpp", "${ability_runtime_services_path}/abilitymgr/src/prepare_terminate_callback_stub.cpp", "${ability_runtime_services_path}/abilitymgr/src/remote_mission_listener_stub.cpp", - "${ability_runtime_services_path}/abilitymgr/src/remote_on_listener_proxy.cpp", - "${ability_runtime_services_path}/abilitymgr/src/remote_on_listener_stub.cpp", "${ability_runtime_services_path}/abilitymgr/src/system_ability_token_callback_stub.cpp", "${ability_runtime_services_path}/abilitymgr/src/ui_extension/ui_extension_ability_connect_info.cpp", "${ability_runtime_services_path}/abilitymgr/src/ui_extension/ui_extension_host_info.cpp", @@ -125,12 +297,15 @@ ohos_shared_library("ability_manager") { public_configs = [ ":ability_manager_public_config", + ":ability_manager_idl_config", "${ability_runtime_services_path}/abilitymgr:abilityms_config", ] public_deps = [ ":ability_connect_callback_stub" ] deps = [ + ":ability_manager_proxy", + ":ability_manager_stub", ":ability_start_options", ":ability_start_setting", ":mission_info", @@ -300,7 +475,10 @@ ohos_shared_library("ability_start_setting") { "${ability_runtime_services_path}/abilitymgr/src/ability_start_setting.cpp", ] - public_configs = [ ":ability_manager_public_config" ] + public_configs = [ + ":ability_manager_public_config", + "${ability_runtime_path}/utils/server/startup:startup_util_config", + ] external_deps = [ "c_utils:utils" ] public_external_deps = [ @@ -405,7 +583,11 @@ ohos_shared_library("ability_connect_callback_stub") { sources = [ "${ability_runtime_services_path}/abilitymgr/src/ability_connect_callback_stub.cpp" ] - public_configs = [ ":ability_manager_public_config" ] + public_configs = [ + ":ability_manager_public_config", + ":ability_manager_idl_config", + "${ability_runtime_path}/utils/server/startup:startup_util_config", + ] external_deps = [ "c_utils:utils", diff --git a/interfaces/inner_api/ability_manager/include/remote_on_listener_stub.h b/interfaces/inner_api/ability_manager/idl/IRemoteOnListener.idl similarity index 38% rename from interfaces/inner_api/ability_manager/include/remote_on_listener_stub.h rename to interfaces/inner_api/ability_manager/idl/IRemoteOnListener.idl index 99dd3dc974c25800ddebea893752839149b59265..ddabdaf257d8d67fd57a6051ee9d6be94edd918c 100644 --- a/interfaces/inner_api/ability_manager/include/remote_on_listener_stub.h +++ b/interfaces/inner_api/ability_manager/idl/IRemoteOnListener.idl @@ -1,44 +1,19 @@ -/* - * Copyright (c) 2022 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_ABILITY_RUNTIME_REMOTE_ON_LISTENER_STUB_H -#define OHOS_ABILITY_RUNTIME_REMOTE_ON_LISTENER_STUB_H - -#include -#include - -#include "remote_on_listener_interface.h" -#include "nocopyable.h" - -namespace OHOS { -namespace AAFwk { -/** - * interface for remote mission listener proxy. - */ -class RemoteOnListenerStub : public IRemoteStub { -public: - RemoteOnListenerStub(); - virtual ~RemoteOnListenerStub(); - - virtual int OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; -private: - DISALLOW_COPY_AND_MOVE(RemoteOnListenerStub); - - int32_t OnCallbackInner(MessageParcel &data, MessageParcel &reply); -}; -} // namespace AAFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_REMOTE_ON_LISTENER_STUB_H +/* + * Copyright (c) 2025 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. + */ + +interface OHOS.AAFwk.IRemoteOnListener { + void OnCallback([in] unsigned int ContinueState, [in] String srcDeviceId, + [in] String bundleName, [in] String continueType, [in] String srcBundleName); +} \ No newline at end of file diff --git a/interfaces/inner_api/ability_manager/include/ability_manager_interface.h b/interfaces/inner_api/ability_manager/include/ability_manager_interface.h index e6a593210c57648a1f13c51f65a434ddf224191e..7734aede018de86475d11666ba788f9dc2415bfa 100644 --- a/interfaces/inner_api/ability_manager/include/ability_manager_interface.h +++ b/interfaces/inner_api/ability_manager/include/ability_manager_interface.h @@ -45,7 +45,7 @@ #include "mission_info.h" #include "query_erms_observer_interface.h" #include "remote_mission_listener_interface.h" -#include "remote_on_listener_interface.h" +#include "iremote_on_listener.h" #include "running_process_info.h" #include "sender_info.h" #include "start_options.h" diff --git a/interfaces/inner_api/ability_manager/include/remote_on_listener_interface.h b/interfaces/inner_api/ability_manager/include/remote_on_listener_interface.h deleted file mode 100644 index 56ae87f815298ecf6d7a0439b49a4f7a808aba25..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/ability_manager/include/remote_on_listener_interface.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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_ABILITY_RUNTIME_REMOTE_ON_LISTENER_INTERFACE_H -#define OHOS_ABILITY_RUNTIME_REMOTE_ON_LISTENER_INTERFACE_H - -#include "iremote_broker.h" - -namespace OHOS { -namespace AAFwk { -/** - * @class IRemoteOnListener - * IRemoteOnListener is used to notify caller that remote device mission is changed. - */ -class IRemoteOnListener : public OHOS::IRemoteBroker { -public: - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.aafwk.RemoteOnListener"); - - /** - * @brief When the remote device mission changed, AbilityMs notify the listener. - * - * @param deviceId, remote device Id. - */ - virtual void OnCallback(const uint32_t ContinueState, const std::string &srcDeviceId, - const std::string &bundleName, const std::string &continueType, const std::string &srcBundleName) = 0; - - enum { - // ipc id for OnCallback - ON_CALLBACK = 0, - }; -}; -} // namespace AAFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_REMOTE_MISSION_LISTENER_INTERFACE_H diff --git a/interfaces/inner_api/ability_manager/include/remote_on_listener_proxy.h b/interfaces/inner_api/ability_manager/include/remote_on_listener_proxy.h deleted file mode 100644 index 2bd9bbfda79feb0cb88ccba322fb188b01b72b8e..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/ability_manager/include/remote_on_listener_proxy.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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_ABILITY_RUNTIME_REMOTE_ON_LISTENER_PROXY_H -#define OHOS_ABILITY_RUNTIME_REMOTE_ON_LISTENER_PROXY_H - -#include "iremote_proxy.h" -#include "remote_on_listener_interface.h" - -namespace OHOS { -namespace AAFwk { -/** - * interface for remote mission listener proxy. - */ -class RemoteOnListenerProxy : public IRemoteProxy { -public: - explicit RemoteOnListenerProxy(const sptr &impl) : IRemoteProxy(impl) - {} - - /** - * @brief When the remote device mission changed, AbilityMs notify the listener. - * - * @param deviceId, remote device Id. - */ - virtual void OnCallback(const uint32_t continueState, const std::string &srcDeviceId, - const std::string &bundleName, const std::string &continueType, const std::string &srcBundleName) override; -private: - static inline BrokerDelegator delegator_; -}; -} // namespace AAFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_REMOTE_ON_LISTENER_PROXY_H diff --git a/interfaces/inner_api/app_manager/BUILD.gn b/interfaces/inner_api/app_manager/BUILD.gn index 99c5ec887c546bf0f622b0218d8e4253a822c75d..519daf4f1abf8b2b6752fadc80ddc9606431b138 100644 --- a/interfaces/inner_api/app_manager/BUILD.gn +++ b/interfaces/inner_api/app_manager/BUILD.gn @@ -126,6 +126,7 @@ ohos_shared_library("app_manager") { public_configs = [ ":appmgr_core_config", ":appmgr_sdk_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", ] defines = [ "AMS_LOG_TAG = \"AppexecfwkCore\"" ] diff --git a/interfaces/inner_api/extension_manager/BUILD.gn b/interfaces/inner_api/extension_manager/BUILD.gn index 2a0d85fb821d0fcbf9b261e096a6474f40bd6026..a9e78090dc0dc3f2454aa076fac9ba89b190111f 100755 --- a/interfaces/inner_api/extension_manager/BUILD.gn +++ b/interfaces/inner_api/extension_manager/BUILD.gn @@ -44,7 +44,10 @@ ohos_shared_library("extension_manager") { ] configs = [ ":extension_manager_config" ] - public_configs = [ ":extension_manager_public_config" ] + public_configs = [ + ":extension_manager_public_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + ] public_deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_connect_callback_stub" ] diff --git a/interfaces/inner_api/wantagent/BUILD.gn b/interfaces/inner_api/wantagent/BUILD.gn index a9f3008821ce8144f55e241721e9ab01b90077d1..b501ae1fe0a67e41407234c01f4f31a879192518 100644 --- a/interfaces/inner_api/wantagent/BUILD.gn +++ b/interfaces/inner_api/wantagent/BUILD.gn @@ -64,7 +64,10 @@ ohos_shared_library("wantagent_innerkits") { "src/want_agent_info.cpp", ] - public_configs = [ ":wantagent_innerkits_public_config" ] + public_configs = [ + ":wantagent_innerkits_public_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + ] deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_start_options", diff --git a/services/abilitymgr/BUILD.gn b/services/abilitymgr/BUILD.gn index af8b5ab776e4cd7ae6d4871348f1cf10fc7f9e1a..f2d01449f5926746ed8c9696af2b90839e11fced 100644 --- a/services/abilitymgr/BUILD.gn +++ b/services/abilitymgr/BUILD.gn @@ -119,6 +119,7 @@ ohos_shared_library("abilityms") { configs = [ ":abilityms_config", ":abilityms_exception_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", ] include_dirs = [ "${ability_runtime_services_path}/appdfr/include", @@ -307,6 +308,8 @@ ohos_shared_library("wantagent_manager") { "${ability_runtime_innerkits_path}/error_utils:ability_runtime_error_util", ] + configs = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config" ] + external_deps = [ "ability_base:want", "c_utils:utils", @@ -416,6 +419,8 @@ ohos_shared_library("mission_list") { "src/task_data_persistence_mgr.cpp", ] + configs = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config" ] + deps = [ ":abilityms", "${ability_runtime_innerkits_path}/ability_manager:ability_manager", diff --git a/services/abilitymgr/src/remote_on_listener_proxy.cpp b/services/abilitymgr/src/remote_on_listener_proxy.cpp deleted file mode 100644 index 5ac2ec8ff4af84b6be9d091624c0ce241d493971..0000000000000000000000000000000000000000 --- a/services/abilitymgr/src/remote_on_listener_proxy.cpp +++ /dev/null @@ -1,65 +0,0 @@ - -/* - * Copyright (c) 2023-2024 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. - */ - -#include "remote_on_listener_proxy.h" - -#include "hilog_tag_wrapper.h" - -namespace OHOS { -namespace AAFwk { -void RemoteOnListenerProxy::OnCallback(const uint32_t continueState, const std::string &srcDeviceId, - const std::string &bundleName, const std::string &continueType, const std::string &srcBundleName) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(RemoteOnListenerProxy::GetDescriptor())) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "NotifyMissionsChanged Write interface token failed."); - return; - } - if (!data.WriteUint32(continueState)) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "NotifyOnsChanged Write ContinueState failed"); - return; - } - if (!data.WriteString(srcDeviceId)) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "NotifyOnsChanged Write srcDeviceId failed"); - return; - } - if (!data.WriteString(bundleName)) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "NotifyOnsChanged Write bundleName failed"); - return; - } - if (!data.WriteString(continueType)) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "NotifyOnsChanged Write continueType failed"); - return; - } - if (!data.WriteString(srcBundleName)) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "NotifyOnsChanged Write srcBundleName failed"); - return; - } - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "null remote object"); - return; - } - int result = remote->SendRequest(IRemoteOnListener::ON_CALLBACK, data, reply, option); - if (result != NO_ERROR) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "fail, error: %{public}d", result); - return; - } -} -} // namespace AAFwk -} // namespace OHOS diff --git a/services/abilitymgr/src/remote_on_listener_stub.cpp b/services/abilitymgr/src/remote_on_listener_stub.cpp deleted file mode 100644 index cbf949d8a911c14f3b9070b9625b5428c0d6f57b..0000000000000000000000000000000000000000 --- a/services/abilitymgr/src/remote_on_listener_stub.cpp +++ /dev/null @@ -1,60 +0,0 @@ - -/* - * Copyright (c) 2023-2024 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. - */ - -#include "remote_on_listener_stub.h" - -#include "hilog_tag_wrapper.h" - -namespace OHOS { -namespace AAFwk { -RemoteOnListenerStub::RemoteOnListenerStub() -{} - -RemoteOnListenerStub::~RemoteOnListenerStub() -{} - -int RemoteOnListenerStub::OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) -{ - std::u16string descriptor = RemoteOnListenerStub::GetDescriptor(); - std::u16string remoteDescriptor = data.ReadInterfaceToken(); - if (descriptor != remoteDescriptor) { - TAG_LOGI(AAFwkTag::ABILITYMGR, "RemoteOnListenerStub Local descriptor invalid"); - return ERR_INVALID_STATE; - } - - switch (code) { - case IRemoteOnListener::ON_CALLBACK: { - return OnCallbackInner(data, reply); - } - default: { - return IPCObjectStub::OnRemoteRequest(code, data, reply, option); - } - } -} - -int32_t RemoteOnListenerStub::OnCallbackInner(MessageParcel &data, MessageParcel &reply) -{ - uint32_t continueState = data.ReadUint32(); - std::string srcDeviceId = data.ReadString(); - std::string bundleName = data.ReadString(); - std::string continueType = data.ReadString(); - std::string srcBundleName = data.ReadString(); - OnCallback(continueState, srcDeviceId, bundleName, continueType, srcBundleName); - return NO_ERROR; -} -} // namespace AAFwk -} // namespace OHOS diff --git a/services/appmgr/BUILD.gn b/services/appmgr/BUILD.gn index ade83eb7a01b176365192a96036d9f218c33b6cb..b5d9da775e38efdf907fe810e0260b34b1931ad4 100644 --- a/services/appmgr/BUILD.gn +++ b/services/appmgr/BUILD.gn @@ -99,7 +99,10 @@ ohos_shared_library("libappms") { defines += [ "ABILITY_PLATFORM_CHECK_PERMISSION" ] } - configs = [ ":appmgr_config" ] + configs = [ + ":appmgr_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] diff --git a/test/fuzztest/abilityautostartupclient_fuzzer/BUILD.gn b/test/fuzztest/abilityautostartupclient_fuzzer/BUILD.gn index a0e5c6650f52e1b5daf2b528a08c74e7c5188e1a..38190e58034c7ab029147270b781b4e82ebe8cb0 100644 --- a/test/fuzztest/abilityautostartupclient_fuzzer/BUILD.gn +++ b/test/fuzztest/abilityautostartupclient_fuzzer/BUILD.gn @@ -42,7 +42,10 @@ ohos_fuzztest("AbilityAutoStartupClientFuzzTest") { "abilityautostartupclient_fuzzer.cpp", ] - configs = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager_public_config" ] + configs = [ + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_public_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] diff --git a/test/unittest/ability_manager_service_twelfth_test/mock/include/remote_on_listener_stub_mock.h b/test/unittest/ability_manager_service_twelfth_test/mock/include/remote_on_listener_stub_mock.h index d4cd6fb0e87fa9eeb4bbdf9b7dc979bb6b12cf00..31ae4d474f6642f1bc5befa9a5a57572a22cd05d 100644 --- a/test/unittest/ability_manager_service_twelfth_test/mock/include/remote_on_listener_stub_mock.h +++ b/test/unittest/ability_manager_service_twelfth_test/mock/include/remote_on_listener_stub_mock.h @@ -18,7 +18,7 @@ #include #include #include -#include "remote_on_listener_interface.h" +#include "iremote_on_listener.h" namespace OHOS { namespace AAFwk { diff --git a/test/unittest/dfr_test/watchdog_test/BUILD.gn b/test/unittest/dfr_test/watchdog_test/BUILD.gn index 34307b9758d67f34b6fc64b567987bf2fc61c0fc..6f3523bf2f413fac93b2a2208d00ff24fce6e7dc 100644 --- a/test/unittest/dfr_test/watchdog_test/BUILD.gn +++ b/test/unittest/dfr_test/watchdog_test/BUILD.gn @@ -56,6 +56,7 @@ ohos_unittest("watchdog_test") { configs = [ ":module_context_config", ":ability_start_setting_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", ] sources = [ diff --git a/test/unittest/remote_mission_listener_proxy_test/remote_on_listener_stub_mock.h b/test/unittest/remote_mission_listener_proxy_test/remote_on_listener_stub_mock.h index 765a2080d8290b928dae67338d4ae2d079119873..314aed5075e2d9256c551a05a320fff3f187219b 100644 --- a/test/unittest/remote_mission_listener_proxy_test/remote_on_listener_stub_mock.h +++ b/test/unittest/remote_mission_listener_proxy_test/remote_on_listener_stub_mock.h @@ -18,7 +18,7 @@ #include #include #include -#include "remote_on_listener_interface.h" +#include "iremote_on_listener.h" namespace OHOS { namespace AAFwk { @@ -45,7 +45,7 @@ public: int code_ = 0; - virtual void OnCallback(const uint32_t ContinueState, const std::string &srcDeviceId, + virtual ErrCode OnCallback(const uint32_t ContinueState, const std::string &srcDeviceId, const std::string &bundleName, const std::string &continueType, const std::string &srcBundleName) {}; }; } // namespace AAFwk diff --git a/test/unittest/ui_extension_context_test/BUILD.gn b/test/unittest/ui_extension_context_test/BUILD.gn index 29c903dc6cd04b61200be528ea670e2cc5ea6bcc..b79abe1726a0c1b0fb2ee4cf6a6f66d1c78e3738 100644 --- a/test/unittest/ui_extension_context_test/BUILD.gn +++ b/test/unittest/ui_extension_context_test/BUILD.gn @@ -40,6 +40,7 @@ ohos_unittest("ui_extension_context_test") { "${ability_runtime_native_path}/ability/native:ui_extension", "${ability_runtime_native_path}/appkit:app_context", "${ability_runtime_native_path}/appkit:appkit_native", + "${ability_runtime_native_path}/ability:ability_context_native", ] external_deps = [ diff --git a/tools/aa/BUILD.gn b/tools/aa/BUILD.gn index 45ca82c63105416d77ab5fdd25320b54ce075741..ea7ab9146265798b11e3f3ecd7437317bd12e711 100644 --- a/tools/aa/BUILD.gn +++ b/tools/aa/BUILD.gn @@ -95,6 +95,10 @@ ohos_executable("aa") { cflags += [ "-DBINDER_IPC_32BIT" ] } + configs = [ + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + ] + deps = [ ":tools_aa_source_set" ] external_deps = [ diff --git a/tools/test/moduletest/ability_delegator/BUILD.gn b/tools/test/moduletest/ability_delegator/BUILD.gn index 872901063e0d85c830c5d924d25413d21668694e..f3dea50e53531a38d81e3d0de154bf7ce3009390 100644 --- a/tools/test/moduletest/ability_delegator/BUILD.gn +++ b/tools/test/moduletest/ability_delegator/BUILD.gn @@ -77,7 +77,10 @@ ohos_moduletest("shell_command_result_module_test") { sources = [ "shell_command_result_module_test.cpp" ] - configs = [ ":tools_ability_delegator_config" ] + configs = [ + ":tools_ability_delegator_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + ] deps = [ "${ability_runtime_path}/tools/aa:tools_aa_source_set" ] diff --git a/tools/test/systemtest/aa/BUILD.gn b/tools/test/systemtest/aa/BUILD.gn index 5fb4b5be113d64d06de46b1b63c5bc7e194a7a54..13741645f13c2da92867f770d297eff347a3297e 100644 --- a/tools/test/systemtest/aa/BUILD.gn +++ b/tools/test/systemtest/aa/BUILD.gn @@ -28,7 +28,10 @@ ohos_systemtest("aa_command_start_system_test") { "tool_system_test.cpp", ] - configs = [ ":tools_aa_test_config" ] + configs = [ + ":tools_aa_test_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + ] cflags = [] if (target_cpu == "arm") { @@ -61,7 +64,10 @@ ohos_systemtest("aa_command_stop_service_system_test") { "tool_system_test.cpp", ] - configs = [ ":tools_aa_test_config" ] + configs = [ + ":tools_aa_test_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + ] cflags = [] if (target_cpu == "arm") { @@ -93,7 +99,10 @@ ohos_systemtest("aa_command_dump_system_test") { "tool_system_test.cpp", ] - configs = [ ":tools_aa_test_config" ] + configs = [ + ":tools_aa_test_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + ] cflags = [] if (target_cpu == "arm") { diff --git a/tools/test/unittest/aa/BUILD.gn b/tools/test/unittest/aa/BUILD.gn index 99ef92ecb1c1fc3789c6f9bc62e0a7f679d1613d..0e3232dbc803e1395f53cfb8c44e018939e4c265 100644 --- a/tools/test/unittest/aa/BUILD.gn +++ b/tools/test/unittest/aa/BUILD.gn @@ -253,7 +253,10 @@ ohos_unittest("aa_command_test_test") { sources = [ "aa_command_test_test.cpp" ] sources += tools_aa_mock_sources - configs = [ ":tools_aa_config_mock" ] + configs = [ + ":tools_aa_config_mock", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + ] cflags = [] if (target_cpu == "arm") { @@ -280,7 +283,10 @@ ohos_unittest("aa_command_attach_test") { sources = [ "aa_command_attach_test.cpp" ] - configs = [ ":tools_aa_config_mock" ] + configs = [ + ":tools_aa_config_mock", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + ] cflags = [] if (target_cpu == "arm") { @@ -308,6 +314,8 @@ if (accessibility_enable) { "accessibility_ability_utils_test.cpp", ] + configs = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config" ] + cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] diff --git a/tools/test/unittest/ability_delegator/BUILD.gn b/tools/test/unittest/ability_delegator/BUILD.gn index 431e8bd2458df134e79c9f3256b99d29d5dbf4b5..2c21a4a9a88c8ca748ce4ecbe691fe93de11ca4a 100644 --- a/tools/test/unittest/ability_delegator/BUILD.gn +++ b/tools/test/unittest/ability_delegator/BUILD.gn @@ -29,7 +29,10 @@ config("tools_ability_delegator_config") { ohos_unittest("ability_command_test") { module_out_path = module_output_path - configs = [ ":tools_ability_delegator_config" ] + configs = [ + ":tools_ability_delegator_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + ] sources = [ "ability_command_test.cpp" ] sources += ability_delegator_mock_sources @@ -52,7 +55,10 @@ ohos_unittest("ability_command_test") { ohos_unittest("ability_command_second_test") { module_out_path = module_output_path - configs = [ ":tools_ability_delegator_config" ] + configs = [ + ":tools_ability_delegator_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + ] sources = [ "ability_command_second_test.cpp" ] sources += ability_delegator_mock_sources @@ -80,7 +86,10 @@ ohos_unittest("ability_command_second_test") { ohos_unittest("test_observer_test") { module_out_path = module_output_path - configs = [ ":tools_ability_delegator_config" ] + configs = [ + ":tools_ability_delegator_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + ] sources = [ "test_observer_test.cpp" ] sources += ability_delegator_mock_sources @@ -138,7 +147,10 @@ ohos_unittest("shell_command_result_test") { sources = [ "shell_command_result_test.cpp" ] - configs = [ ":tools_ability_delegator_config" ] + configs = [ + ":tools_ability_delegator_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + ] deps = [ "${ability_runtime_path}/tools/aa:tools_aa_source_set" ] @@ -183,7 +195,10 @@ if (accessibility_enable) { include_dirs = [] - configs = [ ":tools_ability_delegator_config" ] + configs = [ + ":tools_ability_delegator_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + ] sources = [ "${ability_runtime_path}/tools/aa/src/accessibility_ability_command.cpp", diff --git a/tools/test/unittest/ability_tool/BUILD.gn b/tools/test/unittest/ability_tool/BUILD.gn index 836b7e558d0a95502d0e3acc0a83ed9164ba18f6..deef37f3152c79741cc8a3942d08cee44dbfdee6 100644 --- a/tools/test/unittest/ability_tool/BUILD.gn +++ b/tools/test/unittest/ability_tool/BUILD.gn @@ -29,7 +29,10 @@ ohos_unittest("ability_tool_test") { sources = [ "ability_tool_test.cpp" ] sources += test_ability_tool_mock_sources - configs = [ ":test_ability_tool_config" ] + configs = [ + ":test_ability_tool_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + ] cflags = [] if (target_cpu == "arm") {