diff --git a/frameworks/native/ability/native/BUILD.gn b/frameworks/native/ability/native/BUILD.gn index 3f3cf0514d059135f6ffe853fb8cdd623bd9acf7..ed6b37ab25e816160e52527a9416199ce6990599 100644 --- a/frameworks/native/ability/native/BUILD.gn +++ b/frameworks/native/ability/native/BUILD.gn @@ -332,6 +332,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", ] @@ -343,6 +344,8 @@ ohos_shared_library("abilitykit_native") { ":ui_service_extension_connection", "${ability_runtime_innerkits_path}/ability_manager:ability_connect_callback_stub", "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_proxy", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_stub", "${ability_runtime_innerkits_path}/ability_manager:ability_start_options", "${ability_runtime_innerkits_path}/ability_manager:ability_start_setting", "${ability_runtime_innerkits_path}/ability_manager:mission_info", diff --git a/interfaces/inner_api/ability_manager/BUILD.gn b/interfaces/inner_api/ability_manager/BUILD.gn index 8bb1055efa0185b2c06da59016a9a25776c4c803..380678c3837378b720cb13395c639582c2cea210 100644 --- a/interfaces/inner_api/ability_manager/BUILD.gn +++ b/interfaces/inner_api/ability_manager/BUILD.gn @@ -11,8 +11,29 @@ # 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 = [ + "IHiddenStartObserver.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}", + #"include/", + ] +} config("ability_manager_public_config") { visibility = [ ":*" ] @@ -40,6 +61,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 = [] @@ -62,10 +84,174 @@ config("ability_manager_public_config") { } } +ohos_source_set("ability_manager_proxy") { + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + + output_values = get_target_outputs(":ability_manager_interface") + source_values = [ + "*hidden_start_observer_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", + "relational_store:native_dataability", + "relational_store:native_rdb", + ] + + if (ability_runtime_graphics) { + deps += [] + external_deps += [ + "ability_base:session_info", + "image_framework:image_native", + "window_manager:libwsutils", + "window_manager:session_manager_lite", + ] + public_external_deps += [ "graphic_2d:color_manager" ] + } + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_source_set("ability_manager_stub") { + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + + output_values = get_target_outputs(":ability_manager_interface") + source_values = [ + "*hidden_start_observer_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", + "relational_store:native_rdb", + ] + + if (ability_runtime_graphics) { + deps += [] + external_deps += [ + "ability_base:session_info", + "image_framework:image_native", + "window_manager:libwsutils", + "window_manager:session_manager_lite", + ] + public_external_deps += [ "graphic_2d:color_manager" ] + } + subsystem_name = "ability" + part_name = "ability_runtime" +} + ohos_shared_library("ability_manager") { + sanitize = { + cfi = true + cfi_cross_dso = 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", @@ -129,12 +315,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", @@ -423,6 +612,8 @@ ohos_shared_library("ability_connect_callback_stub") { "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "jsoncpp:jsoncpp", + "relational_store:native_dataability", + "relational_store:native_rdb", ] if (ability_runtime_graphics) { external_deps += [ "graphic_2d:color_manager" ] diff --git a/interfaces/inner_api/ability_manager/include/ihidden_start_observer.h b/interfaces/inner_api/ability_manager/IHiddenStartObserver.idl similarity index 44% rename from interfaces/inner_api/ability_manager/include/ihidden_start_observer.h rename to interfaces/inner_api/ability_manager/IHiddenStartObserver.idl index 663f58c30246b0b1e4c1e74799ba38ce74a43e6f..8afe667d8c6ef018279840684c4ab0e63975ec67 100644 --- a/interfaces/inner_api/ability_manager/include/ihidden_start_observer.h +++ b/interfaces/inner_api/ability_manager/IHiddenStartObserver.idl @@ -1,43 +1,18 @@ -/* - * 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. - */ - -#ifndef OHOS_ABILITY_RUNTIME_IHIDDEN_START_OBSERVER_H -#define OHOS_ABILITY_RUNTIME_IHIDDEN_START_OBSERVER_H - -#include -#include "iremote_object.h" -#include "iremote_broker.h" - -namespace OHOS { -namespace AAFwk { -class IHiddenStartObserver : public OHOS::IRemoteBroker { -public: - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.aafwk.IHiddenStartObserver"); - - /** - * IsHiddenStart, return if the given app is started hidden. - * - * @param pid Pid of the given app's process. - * @return if the given app is started hidden - */ - virtual bool IsHiddenStart(int32_t pid) = 0; - - enum class Message { - TRANSACT_ON_IS_HIDDEN_START = 0, - }; -}; -} // namespace AAFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_IHIDDEN_START_OBSERVER_H \ No newline at end of file +/* + * 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.IHiddenStartObserver { + boolean IsHiddenStart([in] int pid); +} \ No newline at end of file diff --git a/interfaces/inner_api/ability_manager/include/hidden_start_observer_proxy.h b/interfaces/inner_api/ability_manager/include/hidden_start_observer_proxy.h deleted file mode 100644 index 40b0b2a07436e49b6e6b9bee4940650e7b4d78a1..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/ability_manager/include/hidden_start_observer_proxy.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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. - */ - -#ifndef OHOS_ABILITY_RUNTIME_HIDDEN_START_OBSERVER_PROXY_H -#define OHOS_ABILITY_RUNTIME_HIDDEN_START_OBSERVER_PROXY_H - -#include "iremote_proxy.h" -#include "ihidden_start_observer.h" - -namespace OHOS { -namespace AAFwk { -class HiddenStartObserverProxy : public IRemoteProxy { -public: - explicit HiddenStartObserverProxy(const sptr &impl); - virtual ~HiddenStartObserverProxy() = default; - - /** - * IsHiddenStart, return if the given app is started hidden. - * - * @param pid Pid of the given app's process. - * @return if the given app is started hidden - */ - virtual bool IsHiddenStart(int32_t pid) override; - -private: - /** - * WriteInterfaceToken. - * - * @param data The message parcel data. - * @return Flag whether write is successful. - */ - bool WriteInterfaceToken(MessageParcel &data); - static inline BrokerDelegator delegator_; - int32_t SendTransactCmd(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); -}; -} // namespace AAFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_HIDDEN_START_OBSERVER_PROXY_H \ No newline at end of file diff --git a/interfaces/inner_api/ability_manager/include/hidden_start_observer_stub.h b/interfaces/inner_api/ability_manager/include/hidden_start_observer_stub.h deleted file mode 100644 index cf7a8678659a9a5eacae6950f264a2ad35656a25..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/ability_manager/include/hidden_start_observer_stub.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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. - */ - -#ifndef OHOS_ABILITY_RUNTIME_HIDDEN_START_OBSERVER_STUB_H -#define OHOS_ABILITY_RUNTIME_HIDDEN_START_OBSERVER_STUB_H - -#include -#include - -#include "iremote_stub.h" -#include "nocopyable.h" -#include "string_ex.h" -#include "app_mgr_constants.h" -#include "ihidden_start_observer.h" - -namespace OHOS { -namespace AAFwk { -class HiddenStartObserverStub : public IRemoteStub { -public: - HiddenStartObserverStub() = default; - virtual ~HiddenStartObserverStub() = default; - - virtual int OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - -private: - int32_t HandleIsHiddenStart(MessageParcel &data, MessageParcel &reply); - - DISALLOW_COPY_AND_MOVE(HiddenStartObserverStub); -}; -} // namespace AAFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_HIDDEN_START_OBSERVER_STUB_H \ No newline at end of file diff --git a/interfaces/inner_api/ability_manager/src/hidden_start_observer_proxy.cpp b/interfaces/inner_api/ability_manager/src/hidden_start_observer_proxy.cpp deleted file mode 100644 index 7f76a178ba94743d9d81baa9f732cd6c674ec1aa..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/ability_manager/src/hidden_start_observer_proxy.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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. - */ - -#include "hidden_start_observer_proxy.h" - -#include "hilog_tag_wrapper.h" -#include "ipc_types.h" - - -namespace OHOS { -namespace AAFwk { -HiddenStartObserverProxy::HiddenStartObserverProxy( - const sptr &impl) : IRemoteProxy(impl) -{} - -bool HiddenStartObserverProxy::WriteInterfaceToken(MessageParcel &data) -{ - if (!data.WriteInterfaceToken(HiddenStartObserverProxy::GetDescriptor())) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "write interface token failed"); - return false; - } - return true; -} - -bool HiddenStartObserverProxy::IsHiddenStart(int32_t pid) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option(MessageOption::TF_SYNC); - if (!WriteInterfaceToken(data)) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "WriteInterfaceToken failed"); - return false; - } - data.WriteInt32(pid); - int32_t ret = SendTransactCmd( - static_cast(IHiddenStartObserver::Message::TRANSACT_ON_IS_HIDDEN_START), - data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGW(AAFwkTag::ABILITYMGR, "SendRequest is failed, error code: %{public}d.", ret); - return false; - } - return reply.ReadBool(); -} - -int32_t HiddenStartObserverProxy::SendTransactCmd(uint32_t code, MessageParcel &data, - MessageParcel &reply, MessageOption &option) -{ - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "Remote is nullptr."); - return ERR_NULL_OBJECT; - } - - return remote->SendRequest(code, data, reply, option); -} -} // namespace AAFwk -} // namespace OHOS \ No newline at end of file diff --git a/interfaces/inner_api/ability_manager/src/hidden_start_observer_stub.cpp b/interfaces/inner_api/ability_manager/src/hidden_start_observer_stub.cpp deleted file mode 100644 index 0b47d6ff5a4e33735181af4f6d0fd075bc92efd3..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/ability_manager/src/hidden_start_observer_stub.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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. - */ - -#include "hidden_start_observer_stub.h" -#include "appexecfwk_errors.h" -#include "hilog_tag_wrapper.h" -#include "ipc_types.h" -#include "iremote_object.h" - -namespace OHOS { -namespace AAFwk { -int HiddenStartObserverStub::OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) -{ - std::u16string descriptor = HiddenStartObserverStub::GetDescriptor(); - std::u16string remoteDescriptor = data.ReadInterfaceToken(); - if (descriptor != remoteDescriptor) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "local descriptor is not equal to remote."); - return ERR_INVALID_STATE; - } - - if (static_cast(code) == Message::TRANSACT_ON_IS_HIDDEN_START) { - return HandleIsHiddenStart(data, reply); - } - TAG_LOGW(AAFwkTag::ABILITYMGR, "HiddenStartObserverStub::OnRemoteRequest, default case, need check"); - return IPCObjectStub::OnRemoteRequest(code, data, reply, option); -} - -int32_t HiddenStartObserverStub::HandleIsHiddenStart(MessageParcel &data, MessageParcel &reply) -{ - int32_t pid = data.ReadInt32(); - bool result = IsHiddenStart(pid); - reply.WriteBool(result); - return NO_ERROR; -} -} // namespace AAFwk -} // namespace OHOS \ No newline at end of file diff --git a/interfaces/inner_api/app_manager/BUILD.gn b/interfaces/inner_api/app_manager/BUILD.gn index 39ea4c18d2406607ef95399cddcc6f7b36e5eaa3..46f8696fea61cc15ea12e32be0cf2475702a97c5 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\"" ] @@ -161,6 +162,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/extension_manager/BUILD.gn b/interfaces/inner_api/extension_manager/BUILD.gn index 2a0d85fb821d0fcbf9b261e096a6474f40bd6026..bb2caa0f8ff43ee3cc2d7a4dd8c95eb063de3321 100755 --- a/interfaces/inner_api/extension_manager/BUILD.gn +++ b/interfaces/inner_api/extension_manager/BUILD.gn @@ -44,7 +44,14 @@ 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", + ] + + deps = [ + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_interface", + ] public_deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_connect_callback_stub" ] @@ -55,6 +62,8 @@ ohos_shared_library("extension_manager") { "hilog:libhilog", "hitrace:hitrace_meter", "ipc:ipc_single", + "relational_store:native_dataability", + "relational_store:native_rdb", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] diff --git a/interfaces/inner_api/wantagent/BUILD.gn b/interfaces/inner_api/wantagent/BUILD.gn index a9f3008821ce8144f55e241721e9ab01b90077d1..0f39f91c107f2a8b7ffcd6b865ee0194bb2e44f4 100644 --- a/interfaces/inner_api/wantagent/BUILD.gn +++ b/interfaces/inner_api/wantagent/BUILD.gn @@ -64,9 +64,13 @@ 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_manager_interface", "${ability_runtime_innerkits_path}/ability_manager:ability_start_options", "${ability_runtime_innerkits_path}/error_utils:ability_runtime_error_util", "${ability_runtime_services_path}/abilitymgr:wantagent_manager", @@ -92,6 +96,8 @@ ohos_shared_library("wantagent_innerkits") { "icu:shared_icuuc", "image_framework:image_native", "resource_management:global_resmgr", + "relational_store:native_dataability", + "relational_store:native_rdb", ] if (is_double_framework) { diff --git a/services/abilitymgr/BUILD.gn b/services/abilitymgr/BUILD.gn index 237513c55a1ef8f845bad13e4c29453c579192f3..8c1d490c17e6d0f93f748d92f3a5ff108861540c 100644 --- a/services/abilitymgr/BUILD.gn +++ b/services/abilitymgr/BUILD.gn @@ -121,6 +121,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", @@ -131,8 +132,12 @@ ohos_shared_library("abilityms") { ":wantagent_manager", "${ability_runtime_innerkits_path}/ability_manager:ability_connect_callback_stub", "${ability_runtime_innerkits_path}/ability_manager:ability_manager", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_proxy", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_stub", "${ability_runtime_innerkits_path}/ability_manager:ability_start_options", "${ability_runtime_innerkits_path}/ability_manager:ability_start_setting", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_proxy", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_stub", "${ability_runtime_innerkits_path}/ability_manager:mission_info", "${ability_runtime_innerkits_path}/ability_manager:process_options", "${ability_runtime_innerkits_path}/ability_manager:start_window_option", @@ -313,6 +318,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", @@ -422,6 +429,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/hidden_start_observer_manager.cpp b/services/abilitymgr/src/hidden_start_observer_manager.cpp index 134d481d65a33485b04aa06a8c8ee77dced46817..155f17c67b2b5d4b335c53ff5509ce649a40a122 100644 --- a/services/abilitymgr/src/hidden_start_observer_manager.cpp +++ b/services/abilitymgr/src/hidden_start_observer_manager.cpp @@ -98,11 +98,13 @@ bool HiddenStartObserverManager::IsHiddenStart(int32_t pid) HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); auto observersCopy = GetObserversCopy(); TAG_LOGE(AAFwkTag::ABILITYMGR, "Need query %{public}zu observers.", observersCopy.size()); + bool funcResult = false; for (auto it = observersCopy.begin(); it != observersCopy.end(); ++it) { if (*it == nullptr) { continue; } - if ((*it)->IsHiddenStart(pid)) { + (*it)->IsHiddenStart(pid, funcResult); + if (funcResult) { return true; } } diff --git a/services/appmgr/BUILD.gn b/services/appmgr/BUILD.gn index 81f2ddcdac9ad40f2bd2ad30be8a98b388c027d4..7386138f6373fe72920617163cc9372d94e47d4c 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/moduletest/ability_manager_client_test/mock_ihiddenstartobserver.h b/test/moduletest/ability_manager_client_test/mock_ihiddenstartobserver.h index 7e83a7fb17b60d9cbef0f4621064ee27917007f5..01b57ba88a8b859ffc22019887f30ae3fea5b543 100644 --- a/test/moduletest/ability_manager_client_test/mock_ihiddenstartobserver.h +++ b/test/moduletest/ability_manager_client_test/mock_ihiddenstartobserver.h @@ -21,9 +21,9 @@ namespace OHOS { namespace AAFwk { class MockIHiddenStartObserver : public IHiddenStartObserver { public: - bool IsHiddenStart(int32_t pid) override + ErrCode IsHiddenStart(int32_t pid, bool& funcResult) override { - return true; + return ERR_OK; } sptr AsObject() override { diff --git a/test/unittest/ability_manager_proxy_sixth_test/ability_manager_proxy_sixth_test.cpp b/test/unittest/ability_manager_proxy_sixth_test/ability_manager_proxy_sixth_test.cpp index a1e9cc56cc4dd8c6d3acdae9a8a5c1ed164abd08..4205e961d8b274fdf537274165bdccd32739fb4c 100644 --- a/test/unittest/ability_manager_proxy_sixth_test/ability_manager_proxy_sixth_test.cpp +++ b/test/unittest/ability_manager_proxy_sixth_test/ability_manager_proxy_sixth_test.cpp @@ -49,9 +49,9 @@ public: class MockIHiddenStartObserver : public IHiddenStartObserver { public: - bool IsHiddenStart(int32_t pid) + OHOS::ErrCode IsHiddenStart(int32_t pid, bool& funcResult) { - return false; + return ERR_OK; } sptr AsObject() { diff --git a/test/unittest/hidden_start_observer_manager_test/BUILD.gn b/test/unittest/hidden_start_observer_manager_test/BUILD.gn index 9403ccd18e1c2b3af42106e5f3901d8f00f82c4e..0fbcaa021ed55b314f24ced67237c2e8ec3fd08f 100644 --- a/test/unittest/hidden_start_observer_manager_test/BUILD.gn +++ b/test/unittest/hidden_start_observer_manager_test/BUILD.gn @@ -25,14 +25,20 @@ ohos_unittest("hidden_start_observer_manager_test") { } module_out_path = module_output_path - include_dirs = [ "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core/include" ] + include_dirs = [ + "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/appexecfwk_core/include", + "${target_gen_dir}", + ] sources = [ "hidden_start_observer_manager_test.cpp", "${ability_runtime_services_path}/abilitymgr/src/hidden_start_observer_manager.cpp", ] - configs = [ "${ability_runtime_services_path}/abilitymgr:abilityms_config" ] + configs = [ + "${ability_runtime_services_path}/abilitymgr:abilityms_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_idl_config", + ] deps = [ "${ability_runtime_innerkits_path}/app_manager:app_manager", diff --git a/test/unittest/hidden_start_observer_manager_test/hidden_start_observer_manager_test.cpp b/test/unittest/hidden_start_observer_manager_test/hidden_start_observer_manager_test.cpp index c09db615b7ac28bc308b068c9b2ad9b1f04f67fc..2bd94cf213e68f22389d9307988aedcb36f2f308 100644 --- a/test/unittest/hidden_start_observer_manager_test/hidden_start_observer_manager_test.cpp +++ b/test/unittest/hidden_start_observer_manager_test/hidden_start_observer_manager_test.cpp @@ -72,9 +72,9 @@ public: IHiddenStartObserverMock() = default; virtual ~IHiddenStartObserverMock() = default; - bool IsHiddenStart(int32_t pid) override + ErrCode IsHiddenStart(int32_t pid, bool& funcResult) override { - return mockReturnValue; + return funcResult = mockReturnValue; } sptr AsObject() override diff --git a/tools/aa/BUILD.gn b/tools/aa/BUILD.gn index d6ec4e440c24ab088a7c976c62ade9d8402e6b8c..55472741a99d69f77177692ffbbe8cb0560d23b6 100644 --- a/tools/aa/BUILD.gn +++ b/tools/aa/BUILD.gn @@ -96,6 +96,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 = [