From 4b63788995da8f7dce79c887537496f4b4c66fea Mon Sep 17 00:00:00 2001 From: 18795846185 Date: Thu, 5 Jun 2025 14:55:24 +0800 Subject: [PATCH] support idl Signed-off-by: 18795846185 --- .../napi/app_startup/startup_manager/BUILD.gn | 7 +- frameworks/js/napi/application/BUILD.gn | 7 +- frameworks/native/ability/native/BUILD.gn | 7 +- interfaces/inner_api/ability_manager/BUILD.gn | 8 +- interfaces/inner_api/app_manager/BUILD.gn | 113 +++++++++++++++++- .../IKiaInterceptor.idl} | 39 +----- .../include/appmgr/app_mgr_interface.h | 10 +- .../include/appmgr/kia_interceptor_proxy.h | 66 ---------- .../include/appmgr/kia_interceptor_stub.h | 68 ----------- .../src/appmgr/kia_interceptor_proxy.cpp | 67 ----------- .../src/appmgr/kia_interceptor_stub.cpp | 59 --------- interfaces/inner_api/wantagent/BUILD.gn | 8 +- .../appmgr/include/app_mgr_service_inner.h | 2 +- services/uripermmgr/BUILD.gn | 4 +- .../include/mock_kia_interceptor.h | 6 +- .../include/mock_kia_interceptor.h | 6 +- .../BUILD.gn | 3 + .../mock/include/mock_iapp_mgr.h | 2 +- .../app_mgr_service_inner_eighth_test.cpp | 4 +- .../app_mgr_service_inner_mock_test/BUILD.gn | 13 +- .../include/mock_app_mgr_service_inner.h | 4 +- .../include/mock_kia_interceptor_impl.h | 4 +- .../src/mock_kia_interceptor_impl.cpp | 4 +- .../app_mgr_service_inner_second_test.cpp | 7 +- test/unittest/dfr_test/watchdog_test/BUILD.gn | 3 +- .../BUILD.gn | 9 +- tools/aa/BUILD.gn | 5 +- 27 files changed, 191 insertions(+), 344 deletions(-) rename interfaces/inner_api/app_manager/{include/appmgr/kia_interceptor_interface.h => idl/IKiaInterceptor.idl} (39%) delete mode 100644 interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_proxy.h delete mode 100644 interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_stub.h delete mode 100644 interfaces/inner_api/app_manager/src/appmgr/kia_interceptor_proxy.cpp delete mode 100644 interfaces/inner_api/app_manager/src/appmgr/kia_interceptor_stub.cpp diff --git a/frameworks/js/napi/app_startup/startup_manager/BUILD.gn b/frameworks/js/napi/app_startup/startup_manager/BUILD.gn index 07a18a2e8fe..188d701565a 100644 --- a/frameworks/js/napi/app_startup/startup_manager/BUILD.gn +++ b/frameworks/js/napi/app_startup/startup_manager/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-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 @@ -31,7 +31,10 @@ ohos_shared_library("startupmanager_napi") { "startup_manager_module.cpp", ] - configs = [ "${ability_runtime_services_path}/common:common_config" ] + configs = [ + "${ability_runtime_innerkits_path}/app_manager:appmgr_idl_config", + "${ability_runtime_services_path}/common:common_config", + ] include_dirs = [ "${ability_runtime_path}/interfaces/inner_api/error_utils/include", diff --git a/frameworks/js/napi/application/BUILD.gn b/frameworks/js/napi/application/BUILD.gn index 6e38f0181c5..921894c8713 100644 --- a/frameworks/js/napi/application/BUILD.gn +++ b/frameworks/js/napi/application/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-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 @@ -37,7 +37,10 @@ ohos_shared_library("application_napi") { "js_application.cpp", ] - configs = [ "${ability_runtime_services_path}/common:common_config" ] + configs = [ + "${ability_runtime_services_path}/common:common_config", + "${ability_runtime_innerkits_path}/app_manager:appmgr_idl_config", + ] deps = [ "${ability_runtime_innerkits_path}/error_utils:ability_runtime_error_util", diff --git a/frameworks/native/ability/native/BUILD.gn b/frameworks/native/ability/native/BUILD.gn index 831a39ff221..45ba8f6ec3b 100644 --- a/frameworks/native/ability/native/BUILD.gn +++ b/frameworks/native/ability/native/BUILD.gn @@ -93,9 +93,7 @@ config("app_service_extension_public_config") { "${ability_runtime_services_path}/common/include", ] if (ability_runtime_graphics) { - defines = [ - "SUPPORT_GRAPHICS", - ] + defines = [ "SUPPORT_GRAPHICS" ] } } @@ -332,6 +330,7 @@ ohos_shared_library("abilitykit_native") { public_configs = [ ":ability_public_config", "${ability_runtime_native_path}/ability:ability_context_public_config", + "${ability_runtime_innerkits_path}/app_manager:appmgr_idl_config", "${ability_runtime_innerkits_path}/wantagent:wantagent_innerkits_public_config", ] @@ -698,8 +697,8 @@ ohos_shared_library("insight_intent_executor") { sources = [ "${ability_runtime_native_path}/ability/native/insight_intent_executor/insight_intent_executor.cpp", "${ability_runtime_native_path}/ability/native/insight_intent_executor/insight_intent_executor_mgr.cpp", - "${ability_runtime_native_path}/ability/native/insight_intent_executor/js_insight_intent_executor.cpp", "${ability_runtime_native_path}/ability/native/insight_intent_executor/js_insight_intent_entry.cpp", + "${ability_runtime_native_path}/ability/native/insight_intent_executor/js_insight_intent_executor.cpp", "${ability_runtime_native_path}/ability/native/insight_intent_executor/js_insight_intent_func.cpp", "${ability_runtime_native_path}/ability/native/insight_intent_executor/js_insight_intent_page.cpp", "${ability_runtime_native_path}/ability/native/insight_intent_executor/js_insight_intent_utils.cpp", diff --git a/interfaces/inner_api/ability_manager/BUILD.gn b/interfaces/inner_api/ability_manager/BUILD.gn index 8bb1055efa0..45a94824f08 100644 --- a/interfaces/inner_api/ability_manager/BUILD.gn +++ b/interfaces/inner_api/ability_manager/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. +# Copyright (c) 2023-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 @@ -130,6 +130,7 @@ ohos_shared_library("ability_manager") { public_configs = [ ":ability_manager_public_config", "${ability_runtime_services_path}/abilitymgr:abilityms_config", + "${ability_runtime_innerkits_path}/app_manager:appmgr_idl_config", ] public_deps = [ ":ability_connect_callback_stub" ] @@ -409,7 +410,10 @@ 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_runtime_innerkits_path}/app_manager:appmgr_idl_config", + ] external_deps = [ "c_utils:utils", diff --git a/interfaces/inner_api/app_manager/BUILD.gn b/interfaces/inner_api/app_manager/BUILD.gn index 70b9b94ddf8..85695255ee3 100644 --- a/interfaces/inner_api/app_manager/BUILD.gn +++ b/interfaces/inner_api/app_manager/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2023 Huawei Device Co., Ltd. +# Copyright (c) 2021-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 @@ -11,9 +11,14 @@ # 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") +config("appmgr_idl_config") { + include_dirs = [ "${target_gen_dir}" ] +} + config("appmgr_sdk_config") { include_dirs = [ "include/appmgr", @@ -40,7 +45,103 @@ config("appmgr_core_config") { } } +idl_gen_interface("app_mgr_interface") { + sources = [ "idl/IKiaInterceptor.idl" ] + sources_callback = [] + + log_domainid = "0xD001311" + log_tag = "AppMgr" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_source_set("app_mgr_idl_proxy") { + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + configs = [ + ":appmgr_core_config", + ":appmgr_sdk_config", + ] + + public_configs = [ + ":appmgr_idl_config", + "${ability_runtime_path}/utils/server/startup:startup_util_config", + ] + + output_values = get_target_outputs(":app_mgr_interface") + sources = filter_include(output_values, [ "*_proxy.cpp" ]) + + deps = [ + ":app_mgr_interface", + "${ability_runtime_path}/utils/server/startup:startup_util", + ] + external_deps = [ + "ability_base:configuration", + "bundle_framework:appexecfwk_base", + "c_utils:utils", + "hilog:libhilog", + "hitrace:hitrace_meter", + "ipc:ipc_core", + "samgr:samgr_proxy", + ] + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_source_set("app_mgr_idl_stub") { + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + configs = [ + ":appmgr_core_config", + ":appmgr_sdk_config", + ] + + public_configs = [ + ":appmgr_idl_config", + "${ability_runtime_path}/utils/server/startup:startup_util_config", + ] + + output_values = get_target_outputs(":app_mgr_interface") + sources = filter_include(output_values, [ "*_stub.cpp" ]) + + deps = [ ":app_mgr_interface" ] + external_deps = [ + "ability_base:configuration", + "ability_base:session_info", + "ability_base:want", + "bundle_framework:appexecfwk_base", + "c_utils:utils", + "faultloggerd:libbacktrace_local", + "faultloggerd:libdfx_dumpcatcher", + "faultloggerd:libfaultloggerd", + "ffrt:libffrt", + "hilog:libhilog", + "hisysevent:libhisysevent", + "hitrace:hitrace_meter", + "image_framework:image_native", + "init:libbegetutil", + "ipc:ipc_core", + "json:nlohmann_json_static", + "relational_store:native_rdb", + "samgr:samgr_proxy", + ] + + subsystem_name = "ability" + part_name = "ability_runtime" +} + ohos_shared_library("app_manager") { + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } branch_protector_ret = "pac_ret" include_dirs = [ @@ -49,6 +150,7 @@ ohos_shared_library("app_manager") { "${ability_runtime_services_path}/appdfr/include", "${ability_runtime_services_path}/appmgr/include", "${ability_runtime_services_path}/common/include", + "${target_gen_dir}", ] sources = [ @@ -96,14 +198,13 @@ ohos_shared_library("app_manager") { "src/appmgr/configuration_observer_stub.cpp", "src/appmgr/configuration_policy.cpp", "src/appmgr/fault_data.cpp", - "src/appmgr/kia_interceptor_proxy.cpp", - "src/appmgr/kia_interceptor_stub.cpp", "src/appmgr/killed_process_info.cpp", "src/appmgr/memory_level_info.cpp", "src/appmgr/native_child_notify_proxy.cpp", "src/appmgr/native_child_notify_stub.cpp", "src/appmgr/page_state_data.cpp", "src/appmgr/priority_object.cpp", + "src/appmgr/process_bind_data.cpp", "src/appmgr/process_data.cpp", "src/appmgr/process_info.cpp", "src/appmgr/process_memory_state.cpp", @@ -121,12 +222,13 @@ ohos_shared_library("app_manager") { "src/appmgr/start_specified_ability_response_proxy.cpp", "src/appmgr/start_specified_ability_response_stub.cpp", "src/appmgr/system_memory_attr.cpp", - "src/appmgr/process_bind_data.cpp", ] public_configs = [ ":appmgr_core_config", ":appmgr_sdk_config", + ":appmgr_idl_config", + "${ability_runtime_path}/utils/server/startup:startup_util_config", ] defines = [ "AMS_LOG_TAG = \"AppexecfwkCore\"" ] @@ -136,6 +238,8 @@ ohos_shared_library("app_manager") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ + ":app_mgr_idl_proxy", + ":app_mgr_idl_stub", "${ability_runtime_path}/utils/global/freeze:freeze_util", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/common:app_util", @@ -162,6 +266,7 @@ ohos_shared_library("app_manager") { "ability_base:want", "bundle_framework:appexecfwk_base", "image_framework:image_native", + "relational_store:native_dataability", "relational_store:native_rdb", ] if (ability_runtime_child_process) { diff --git a/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_interface.h b/interfaces/inner_api/app_manager/idl/IKiaInterceptor.idl similarity index 39% rename from interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_interface.h rename to interfaces/inner_api/app_manager/idl/IKiaInterceptor.idl index 52dc49e2bbd..80564f2c441 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_interface.h +++ b/interfaces/inner_api/app_manager/idl/IKiaInterceptor.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * 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 @@ -13,37 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_ABILITY_RUNTIME_KIA_INTERCEPTOR_INTERFACE_H -#define OHOS_ABILITY_RUNTIME_KIA_INTERCEPTOR_INTERFACE_H +sequenceable want..OHOS.AAFwk.Want; -#include - -#include "want.h" - -namespace OHOS { -namespace AppExecFwk { -/** - * @class IKiaInterceptor - * IPC interface for KIA. - */ -class IKiaInterceptor : public OHOS::IRemoteBroker { -public: - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.IKiaInterceptor"); - - /** - * OnIntercept, processing method from KIA. - * - * @param want The param of openning the app. - * @return Error code of calling the function. - */ - virtual int OnIntercept(AAFwk::Want &want) = 0; - - enum { - // ipc code for calling OnIntercept - KIA_INTERCEPTOR_ON_INTERCEPT = 0, - }; -}; -} // namespace AppExecFwk -} // namespace OHOS - -#endif // OHOS_ABILITY_RUNTIME_KIA_INTERCEPTOR_INTERFACE_H +interface OHOS.AppExecFwk.IKiaInterceptor { + void OnIntercept([inout] Want want); +} \ No newline at end of file diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h index 4a7b8a736fa..621994d8556 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h +++ b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Copyright (c) 2021-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 @@ -20,6 +20,7 @@ #include "ability_info.h" #include "ams_mgr_interface.h" #include "app_foreground_state_observer_interface.h" +#include "app_jsheap_mem_info.h" #include "app_malloc_info.h" #include "app_mgr_ipc_interface_code.h" #include "app_record_id.h" @@ -32,26 +33,25 @@ #include "child_process_request.h" #endif // SUPPORT_CHILD_PROCESS #include "fault_data.h" -#include "kia_interceptor_interface.h" #include "iapp_state_callback.h" #include "iapplication_state_observer.h" #include "iconfiguration_observer.h" +#include "ikia_interceptor.h" #include "iquick_fix_callback.h" #include "iremote_broker.h" #include "iremote_object.h" #include "irender_state_observer.h" #include "killed_process_info.h" #include "memory_level_info.h" +#include "native_child_notify_interface.h" #include "page_state_data.h" #include "process_memory_state.h" #include "render_process_info.h" +#include "running_multi_info.h" #include "running_process_info.h" #include "system_memory_attr.h" #include "want.h" -#include "app_jsheap_mem_info.h" #include "app_cjheap_mem_info.h" -#include "running_multi_info.h" -#include "native_child_notify_interface.h" namespace OHOS { namespace AppExecFwk { diff --git a/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_proxy.h b/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_proxy.h deleted file mode 100644 index 328ac436beb..00000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_proxy.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 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. - */ - -#ifndef OHOS_ABILITY_RUNTIME_KIA_INTERCEPTOR_PROXY_H -#define OHOS_ABILITY_RUNTIME_KIA_INTERCEPTOR_PROXY_H - -#include "kia_interceptor_interface.h" - -#include - -namespace OHOS { -namespace AppExecFwk { -/** - * @class KiaInterceptorProxy - * IPC proxy of IKiaInterceptor. - */ -class KiaInterceptorProxy : public IRemoteProxy { -public: - /** - * KiaInterceptorProxy, constructor. - * - * @param impl The implementation of IKiaInterceptor. - */ - explicit KiaInterceptorProxy(const sptr &impl) : IRemoteProxy(impl) - {} - - /** - * KiaInterceptorProxy, destructor. - * - */ - virtual ~KiaInterceptorProxy() - {} - - /** - * OnIntercept, processing method from KIA. - * - * @param want The param of openning the app. - */ - virtual int OnIntercept(AAFwk::Want &want) override; - -private: - /** - * WriteInterfaceToken. - * - * @param data The message parcel data. - * @return Flag whether write is successful. - */ - bool WriteInterfaceToken(MessageParcel &data); - - static inline BrokerDelegator delegator_; -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_KIA_INTERCEPTOR_PROXY_H diff --git a/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_stub.h b/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_stub.h deleted file mode 100644 index 784a3d80ebd..00000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/kia_interceptor_stub.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 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. - */ - -#ifndef OHOS_ABILITY_RUNTIME_KIA_INTERCEPTOR_STUB_H -#define OHOS_ABILITY_RUNTIME_KIA_INTERCEPTOR_STUB_H - -#include "kia_interceptor_interface.h" - -#include -#include - -namespace OHOS { -namespace AppExecFwk { -/** - * @class KiaInterceptorStub - * IPC stub of IKiaInterceptor. - */ -class KiaInterceptorStub : public IRemoteStub { -public: - /** - * KiaInterceptorStub, constructor. - * - */ - KiaInterceptorStub(); - - /** - * KiaInterceptorStub, destructor. - * - */ - virtual ~KiaInterceptorStub(); - - /** - * OnRemoteRequest, IPC method. - * - * @param code The IPC code. - * @param data The message parcel data. - * @param reply The message parcel reply. - * @param option The message parcel option. - * @return Error code of calling the function. - */ - virtual int OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - -private: - /** - * OnInterceptInner, inner processing method from KIA. - * - * @param data The message parcel data. - * @param reply The message parcel reply. - * @return Error code of calling the function. - */ - int OnInterceptInner(MessageParcel &data, MessageParcel &reply); -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_KIA_INTERCEPTOR_STUB_H diff --git a/interfaces/inner_api/app_manager/src/appmgr/kia_interceptor_proxy.cpp b/interfaces/inner_api/app_manager/src/appmgr/kia_interceptor_proxy.cpp deleted file mode 100644 index 15f2e759cd4..00000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/kia_interceptor_proxy.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 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 "kia_interceptor_proxy.h" - -#include "hilog_tag_wrapper.h" -#include "ipc_capacity_wrap.h" - -namespace OHOS { -namespace AppExecFwk { -bool KiaInterceptorProxy::WriteInterfaceToken(MessageParcel &data) -{ - if (!data.WriteInterfaceToken(KiaInterceptorProxy::GetDescriptor())) { - TAG_LOGE(AAFwkTag::APPMGR, "write interface token failed"); - return false; - } - return true; -} - -int KiaInterceptorProxy::OnIntercept(AAFwk::Want &want) -{ - MessageParcel data; - MessageParcel reply; - AAFwk::ExtendMaxIpcCapacityForInnerWant(data); - MessageOption option(MessageOption::TF_SYNC); - if (!WriteInterfaceToken(data)) { - return ERR_INVALID_VALUE; - } - data.WriteParcelable(&want); - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "Remote() is NULL"); - return ERR_INVALID_VALUE; - } - int32_t ret = remote->SendRequest(static_cast(IKiaInterceptor::KIA_INTERCEPTOR_ON_INTERCEPT), - data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGE(AAFwkTag::APPMGR, "SendRequest is failed, error code: %{public}d.", ret); - return ret; - } - int resultCode = reply.ReadInt32(); - if (resultCode != ERR_OK) { - TAG_LOGE(AAFwkTag::APPMGR, "OnIntercept failed, resultCode=%{public}d.", resultCode); - return resultCode; - } - sptr resultWant = reply.ReadParcelable(); - if (resultWant == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "resultWant is nullptr."); - return ERR_INVALID_VALUE; - } - want = *resultWant; - return resultCode; -} -} // namespace AppExecFwk -} // namespace OHOS diff --git a/interfaces/inner_api/app_manager/src/appmgr/kia_interceptor_stub.cpp b/interfaces/inner_api/app_manager/src/appmgr/kia_interceptor_stub.cpp deleted file mode 100644 index 96eb5f75048..00000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/kia_interceptor_stub.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 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 "kia_interceptor_stub.h" - -#include "hilog_tag_wrapper.h" - -namespace OHOS { -namespace AppExecFwk { -KiaInterceptorStub::KiaInterceptorStub() {} - -KiaInterceptorStub::~KiaInterceptorStub() {} - -int KiaInterceptorStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) -{ - TAG_LOGD(AAFwkTag::APPMGR, "cmd=%d,flags=%d", code, option.GetFlags()); - std::u16string descriptor = KiaInterceptorStub::GetDescriptor(); - std::u16string remoteDescriptor = data.ReadInterfaceToken(); - if (descriptor != remoteDescriptor) { - TAG_LOGI(AAFwkTag::APPMGR, "local descriptor is not equal to remote"); - return ERR_INVALID_STATE; - } - - if (code == KIA_INTERCEPTOR_ON_INTERCEPT) { - return OnInterceptInner(data, reply); - } - TAG_LOGW(AAFwkTag::APPMGR, "KiaInterceptorStub::OnRemoteRequest, default case, need check."); - return IPCObjectStub::OnRemoteRequest(code, data, reply, option); -} - -int KiaInterceptorStub::OnInterceptInner(MessageParcel &data, MessageParcel &reply) -{ - sptr want = data.ReadParcelable(); - int resultCode = OnIntercept(*want); - if (!reply.WriteInt32(resultCode)) { - TAG_LOGE(AAFwkTag::APPMGR, "write resultCode failed."); - return ERR_INVALID_VALUE; - } - if (!reply.WriteParcelable(want)) { - TAG_LOGE(AAFwkTag::APPMGR, "write want failed."); - return ERR_INVALID_VALUE; - } - - return NO_ERROR; -} -} // namespace AppExecFwk -} // namespace OHOS diff --git a/interfaces/inner_api/wantagent/BUILD.gn b/interfaces/inner_api/wantagent/BUILD.gn index b1e9d373d3d..c5c29fa37f1 100644 --- a/interfaces/inner_api/wantagent/BUILD.gn +++ b/interfaces/inner_api/wantagent/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-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 @@ -64,7 +64,11 @@ 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}/app_manager:appmgr_idl_config", + "${ability_runtime_path}/utils/server/startup:startup_util_config", + ] deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_start_options", diff --git a/services/appmgr/include/app_mgr_service_inner.h b/services/appmgr/include/app_mgr_service_inner.h index 2df4e8c84ed..f749e5d1f98 100644 --- a/services/appmgr/include/app_mgr_service_inner.h +++ b/services/appmgr/include/app_mgr_service_inner.h @@ -64,7 +64,7 @@ #include "iremote_object.h" #include "irender_state_observer.h" #include "istart_specified_ability_response.h" -#include "kia_interceptor_interface.h" +#include "ikia_interceptor.h" #include "kill_process_config.h" #include "killed_process_info.h" #include "process_memory_state.h" diff --git a/services/uripermmgr/BUILD.gn b/services/uripermmgr/BUILD.gn index 50b810f4fa1..ed048b6292e 100644 --- a/services/uripermmgr/BUILD.gn +++ b/services/uripermmgr/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2024 Huawei Device Co., Ltd. +# Copyright (c) 2022-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 @@ -50,6 +50,8 @@ ohos_shared_library("libupms") { "${ability_runtime_innerkits_path}/app_manager:appmgr_sdk_config", "${ability_runtime_services_path}/common:common_config", "${ability_runtime_services_path}/abilitymgr:abilityms_config", + "${ability_runtime_innerkits_path}/app_manager:appmgr_idl_config", + "${ability_runtime_path}/utils/server/startup:startup_util_config", ] public_configs = [ ":upms_config" ] diff --git a/test/mock/mock_appmgr_service/include/mock_kia_interceptor.h b/test/mock/mock_appmgr_service/include/mock_kia_interceptor.h index 99dd0a835c0..294e9dfc6fa 100644 --- a/test/mock/mock_appmgr_service/include/mock_kia_interceptor.h +++ b/test/mock/mock_appmgr_service/include/mock_kia_interceptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-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 @@ -28,9 +28,9 @@ public: MockKiaInterceptor() {} virtual ~MockKiaInterceptor() = default; - int OnIntercept(AAFwk::Want &want) override + ErrCode OnIntercept(AAFwk::Want &want) override { - return 0; + return ERR_OK; } }; } // namespace AppExecFwk diff --git a/test/mock/services_appmgr_test/include/mock_kia_interceptor.h b/test/mock/services_appmgr_test/include/mock_kia_interceptor.h index 99dd0a835c0..294e9dfc6fa 100644 --- a/test/mock/services_appmgr_test/include/mock_kia_interceptor.h +++ b/test/mock/services_appmgr_test/include/mock_kia_interceptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-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 @@ -28,9 +28,9 @@ public: MockKiaInterceptor() {} virtual ~MockKiaInterceptor() = default; - int OnIntercept(AAFwk::Want &want) override + ErrCode OnIntercept(AAFwk::Want &want) override { - return 0; + return ERR_OK; } }; } // namespace AppExecFwk diff --git a/test/unittest/app_exit_reason_helper_fourth_test/BUILD.gn b/test/unittest/app_exit_reason_helper_fourth_test/BUILD.gn index 0893709a1e6..2870b7659d4 100644 --- a/test/unittest/app_exit_reason_helper_fourth_test/BUILD.gn +++ b/test/unittest/app_exit_reason_helper_fourth_test/BUILD.gn @@ -67,6 +67,9 @@ ohos_unittest("app_exit_reason_helper_fourth_test") { "${ability_runtime_services_path}/common:task_handler_wrap", ] + configs = + [ "${ability_runtime_innerkits_path}/app_manager:appmgr_idl_config" ] + external_deps = [ "ability_base:session_info", "ability_base:want", diff --git a/test/unittest/app_exit_reason_helper_fourth_test/mock/include/mock_iapp_mgr.h b/test/unittest/app_exit_reason_helper_fourth_test/mock/include/mock_iapp_mgr.h index 027540709f7..98065698790 100644 --- a/test/unittest/app_exit_reason_helper_fourth_test/mock/include/mock_iapp_mgr.h +++ b/test/unittest/app_exit_reason_helper_fourth_test/mock/include/mock_iapp_mgr.h @@ -34,11 +34,11 @@ #include "iapp_state_callback.h" #include "iapplication_state_observer.h" #include "iconfiguration_observer.h" +#include "ikia_interceptor.h" #include "iquick_fix_callback.h" #include "iremote_broker.h" #include "iremote_object.h" #include "irender_state_observer.h" -#include "kia_interceptor_interface.h" #include "killed_process_info.h" #include "memory_level_info.h" #include "page_state_data.h" diff --git a/test/unittest/app_mgr_service_inner_eighth_test/app_mgr_service_inner_eighth_test.cpp b/test/unittest/app_mgr_service_inner_eighth_test/app_mgr_service_inner_eighth_test.cpp index a76ce33ce28..06998bf3a74 100644 --- a/test/unittest/app_mgr_service_inner_eighth_test/app_mgr_service_inner_eighth_test.cpp +++ b/test/unittest/app_mgr_service_inner_eighth_test/app_mgr_service_inner_eighth_test.cpp @@ -54,9 +54,9 @@ public: }; class MyKiaInterceptor : public IKiaInterceptor { public: - int OnIntercept(AAFwk::Want &want) override + ErrCode OnIntercept(AAFwk::Want &want) override { - return 0; + return ERR_OK; } sptr AsObject() override diff --git a/test/unittest/app_mgr_service_inner_mock_test/BUILD.gn b/test/unittest/app_mgr_service_inner_mock_test/BUILD.gn index 2ac11e3423a..be0ba94bd37 100644 --- a/test/unittest/app_mgr_service_inner_mock_test/BUILD.gn +++ b/test/unittest/app_mgr_service_inner_mock_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. +# Copyright (c) 2024-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 @@ -33,8 +33,6 @@ ohos_unittest("app_mgr_service_inner_mock_test") { ] sources = [ - "${ability_runtime_innerkits_path}/app_manager/src/appmgr/kia_interceptor_proxy.cpp", - "${ability_runtime_innerkits_path}/app_manager/src/appmgr/kia_interceptor_stub.cpp", "app_mgr_service_inner_mock_test.cpp", "src/app_utils.cpp", "src/mock_app_mgr_service_inner.cpp", @@ -43,7 +41,14 @@ ohos_unittest("app_mgr_service_inner_mock_test") { "src/window_manager.cpp", ] - deps = [] + deps = [ + "${ability_runtime_innerkits_path}/app_manager:app_manager", + "${ability_runtime_innerkits_path}/app_manager:app_mgr_idl_proxy", + "${ability_runtime_innerkits_path}/app_manager:app_mgr_idl_stub", + ] + + configs = + [ "${ability_runtime_innerkits_path}/app_manager:appmgr_idl_config" ] external_deps = [ "ability_base:want", diff --git a/test/unittest/app_mgr_service_inner_mock_test/include/mock_app_mgr_service_inner.h b/test/unittest/app_mgr_service_inner_mock_test/include/mock_app_mgr_service_inner.h index 4643203e841..9346c35a917 100644 --- a/test/unittest/app_mgr_service_inner_mock_test/include/mock_app_mgr_service_inner.h +++ b/test/unittest/app_mgr_service_inner_mock_test/include/mock_app_mgr_service_inner.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-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 @@ -18,7 +18,7 @@ #include "app_running_manager.h" #include "app_running_record.h" -#include "kia_interceptor_interface.h" +#include "ikia_interceptor.h" namespace OHOS { namespace AppExecFwk { diff --git a/test/unittest/app_mgr_service_inner_mock_test/include/mock_kia_interceptor_impl.h b/test/unittest/app_mgr_service_inner_mock_test/include/mock_kia_interceptor_impl.h index 7cc6e045531..d6a23ffc789 100644 --- a/test/unittest/app_mgr_service_inner_mock_test/include/mock_kia_interceptor_impl.h +++ b/test/unittest/app_mgr_service_inner_mock_test/include/mock_kia_interceptor_impl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-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 @@ -31,7 +31,7 @@ public: static int onInterceptRetCode; static std::string kiaWatermarkBusinessName; static bool isWatermarkEnabled; - virtual int OnIntercept(AAFwk::Want &want) override; + virtual ErrCode OnIntercept(AAFwk::Want &want) override; }; } // namespace AppExecFwk } // namespace OHOS diff --git a/test/unittest/app_mgr_service_inner_mock_test/src/mock_kia_interceptor_impl.cpp b/test/unittest/app_mgr_service_inner_mock_test/src/mock_kia_interceptor_impl.cpp index 0ccd59da340..1a7bf5872b2 100644 --- a/test/unittest/app_mgr_service_inner_mock_test/src/mock_kia_interceptor_impl.cpp +++ b/test/unittest/app_mgr_service_inner_mock_test/src/mock_kia_interceptor_impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-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 @@ -23,7 +23,7 @@ int MockKiaInterceptorImpl::onInterceptRetCode = 0; std::string MockKiaInterceptorImpl::kiaWatermarkBusinessName; bool MockKiaInterceptorImpl::isWatermarkEnabled = false; -int MockKiaInterceptorImpl::OnIntercept(AAFwk::Want &want) +ErrCode MockKiaInterceptorImpl::OnIntercept(AAFwk::Want &want) { if (onInterceptRetCode != 0) { return onInterceptRetCode; diff --git a/test/unittest/app_mgr_service_inner_second_test/app_mgr_service_inner_second_test.cpp b/test/unittest/app_mgr_service_inner_second_test/app_mgr_service_inner_second_test.cpp index 8fd19e76c54..01b522b86a2 100644 --- a/test/unittest/app_mgr_service_inner_second_test/app_mgr_service_inner_second_test.cpp +++ b/test/unittest/app_mgr_service_inner_second_test/app_mgr_service_inner_second_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-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 @@ -132,7 +132,10 @@ class IKiaInterceptorTest : public IKiaInterceptor { public: IKiaInterceptorTest() = default; virtual ~IKiaInterceptorTest() = default; - int OnIntercept(AAFwk::Want &want) override { return 0; } + ErrCode OnIntercept(AAFwk::Want &want) override + { + return ERR_OK; + } }; /** diff --git a/test/unittest/dfr_test/watchdog_test/BUILD.gn b/test/unittest/dfr_test/watchdog_test/BUILD.gn index 50b69e464d4..cc34e59436e 100644 --- a/test/unittest/dfr_test/watchdog_test/BUILD.gn +++ b/test/unittest/dfr_test/watchdog_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023-2024 Huawei Device Co., Ltd. +# Copyright (c) 2023-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 @@ -56,6 +56,7 @@ ohos_unittest("watchdog_test") { configs = [ ":module_context_config", ":ability_start_setting_config", + "${ability_runtime_innerkits_path}/app_manager:appmgr_idl_config", ] sources = [ diff --git a/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn b/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn index 0baadfbaeda..3d7f9003f86 100644 --- a/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn +++ b/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn @@ -957,13 +957,13 @@ ohos_unittest("dump_runtime_helper_test") { "ability_runtime:runtime", "c_utils:utils", "faultloggerd:libfaultloggerd", + "ffrt:libffrt", "googletest:gtest_main", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_core", "jsoncpp:jsoncpp", "napi:ace_napi", - "ffrt:libffrt", "storage_service:storage_manager_acl", ] } @@ -1008,7 +1008,10 @@ ohos_unittest("idle_time_test") { "idle_time_test.cpp", ] - configs = [ ":module_context_config" ] + configs = [ + ":module_context_config", + "${ability_runtime_innerkits_path}/app_manager:appmgr_idl_config", + ] deps = [ "${ability_runtime_native_path}/appkit:appkit_native" ] @@ -1053,13 +1056,13 @@ ohos_unittest("dump_runtime_helper_second_test") { "c_utils:utils", "ets_runtime:libark_jsruntime", "faultloggerd:libfaultloggerd", + "ffrt:libffrt", "googletest:gtest_main", "hilog:libhilog", "init:libbegetutil", "ipc:ipc_core", "jsoncpp:jsoncpp", "napi:ace_napi", - "ffrt:libffrt", "storage_service:storage_manager_acl", ] } diff --git a/tools/aa/BUILD.gn b/tools/aa/BUILD.gn index d6ec4e440c2..f7df9fba602 100644 --- a/tools/aa/BUILD.gn +++ b/tools/aa/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2024 Huawei Device Co., Ltd. +# Copyright (c) 2021-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 @@ -30,8 +30,8 @@ config("ability_command_exception_config") { ohos_static_library("tools_aa_source_set") { sources = [ "src/ability_command.cpp", - "src/ability_tool_command.cpp", "src/ability_start_with_observer.cpp", + "src/ability_tool_command.cpp", "src/shell_command.cpp", "src/shell_command_config_loader.cpp", "src/shell_command_executor.cpp", @@ -47,6 +47,7 @@ ohos_static_library("tools_aa_source_set") { ":ability_command_exception_config", "${ability_runtime_services_path}/abilitymgr:abilityms_config", "${ability_runtime_services_path}/common:common_config", + "${ability_runtime_innerkits_path}/app_manager:appmgr_idl_config", ] cflags = [] -- Gitee