diff --git a/frameworks/cj/ffi/want_agent/BUILD.gn b/frameworks/cj/ffi/want_agent/BUILD.gn index b6e9447be764c7805cd21f8fecf4fd32a2b3024d..12d69329e066071fd3bad9ecf68f9b4fdac5ef2f 100644 --- a/frameworks/cj/ffi/want_agent/BUILD.gn +++ b/frameworks/cj/ffi/want_agent/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 @@ -35,6 +35,10 @@ config("cj_want_agent_public_config") { "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime", "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context", ] + configs = [ + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits_config", + "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", + ] } ohos_shared_library("cj_want_agent_ffi") { diff --git a/frameworks/js/napi/app/js_app_manager/js_app_foreground_state_observer.cpp b/frameworks/js/napi/app/js_app_manager/js_app_foreground_state_observer.cpp index 05eaf832a71f698b506c1c3a38e41024c20025e2..c5bf91189bc1d99b13faf299e1e1e63ddd557e69 100644 --- a/frameworks/js/napi/app/js_app_manager/js_app_foreground_state_observer.cpp +++ b/frameworks/js/napi/app/js_app_manager/js_app_foreground_state_observer.cpp @@ -1,5 +1,5 @@ /* - * 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 @@ -25,12 +25,12 @@ constexpr size_t ARGC_ONE = 1; } JSAppForegroundStateObserver::JSAppForegroundStateObserver(napi_env env) : env_(env) {} -void JSAppForegroundStateObserver::OnAppStateChanged(const AppStateData &appStateData) +ErrCode JSAppForegroundStateObserver::OnAppStateChanged(const AppStateData &appStateData) { TAG_LOGD(AAFwkTag::APPMGR, "called"); if (!valid_) { TAG_LOGE(AAFwkTag::APPMGR, "invalid appMgr"); - return; + return ERR_INVALID_VALUE; } wptr self = this; std::unique_ptr complete = std::make_unique( @@ -45,6 +45,7 @@ void JSAppForegroundStateObserver::OnAppStateChanged(const AppStateData &appStat napi_ref callback = nullptr; NapiAsyncTask::Schedule("JSAppForegroundStateObserver::OnAppStateChanged", env_, std::make_unique(callback, nullptr, std::move(complete))); + return ERR_OK; } void JSAppForegroundStateObserver::HandleOnAppStateChanged(const AppStateData &appStateData) diff --git a/frameworks/js/napi/app/js_app_manager/js_app_foreground_state_observer.h b/frameworks/js/napi/app/js_app_manager/js_app_foreground_state_observer.h index 4e6ea0115732b6f9cb88cbed7c2e8e1a63bd7e18..4063f12b5c2362ec07bd0175de19f3dceaa31325 100644 --- a/frameworks/js/napi/app/js_app_manager/js_app_foreground_state_observer.h +++ b/frameworks/js/napi/app/js_app_manager/js_app_foreground_state_observer.h @@ -1,5 +1,5 @@ /* - * 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 @@ -31,7 +31,7 @@ class JSAppForegroundStateObserver : public AppForegroundStateObserverStub { public: explicit JSAppForegroundStateObserver(napi_env engine); virtual ~JSAppForegroundStateObserver() = default; - void OnAppStateChanged(const AppStateData &appStateData); + ErrCode OnAppStateChanged(const AppStateData &appStateData); void HandleOnAppStateChanged(const AppStateData &appStateData); void CallJsFunction(const napi_value value, const char *methodName, const napi_value *argv, const size_t argc); void AddJsObserverObject(const napi_value &jsObserverObject); diff --git a/frameworks/native/ability/native/BUILD.gn b/frameworks/native/ability/native/BUILD.gn index d74769b20b175e496d97098d1ad261ef911b9f3f..e056b24dd31615bb081230eff9908d9494bc7dc6 100644 --- a/frameworks/native/ability/native/BUILD.gn +++ b/frameworks/native/ability/native/BUILD.gn @@ -43,6 +43,7 @@ config("ability_config") { "${ability_runtime_napi_path}/featureAbility", ] + configs = [ "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] @@ -140,7 +141,7 @@ config("abilitykit_utils_public_config") { "${ability_runtime_path}/interfaces/kits/native/appkit/app", "${ability_runtime_innerkits_path}/app_manager/include/appmgr", ] - + configs = [ "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", ] if (ability_runtime_graphics) { defines = [ "SUPPORT_GRAPHICS" ] } @@ -333,6 +334,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_innerkits_config", "${ability_runtime_innerkits_path}/wantagent:wantagent_innerkits_public_config", ] @@ -550,7 +552,7 @@ config("extensionkit_public_config") { "${ability_runtime_innerkits_path}/app_manager/include/appmgr", "${ability_runtime_services_path}/common/include", ] - + configs = [ "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", ] if (ability_runtime_graphics) { defines = [ "SUPPORT_GRAPHICS" ] } @@ -758,7 +760,7 @@ config("uiability_config") { "${ability_runtime_services_path}/abilitymgr/include/utils", "${ability_runtime_services_path}/abilitymgr/include", ] - + configs = [ "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", ] if (ability_runtime_graphics) { defines = [ "SUPPORT_GRAPHICS", @@ -2218,7 +2220,7 @@ config("embedded_ui_extension_module_config") { "${ability_runtime_napi_path}/inner/napi_common", "${ability_runtime_napi_path}/featureAbility", ] - + configs = [ "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", ] cflags = [] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] diff --git a/interfaces/inner_api/ability_manager/BUILD.gn b/interfaces/inner_api/ability_manager/BUILD.gn index 55d58d3ea7abfb7c584459f4181dd618d19c0223..0480803a9b5a95878f67f73915b6d77f1a9bf564 100644 --- a/interfaces/inner_api/ability_manager/BUILD.gn +++ b/interfaces/inner_api/ability_manager/BUILD.gn @@ -11,6 +11,7 @@ # 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") @@ -40,8 +41,9 @@ 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}", ] - + configs = [ "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", ] defines = [] if (ability_command_for_test) { @@ -62,7 +64,94 @@ config("ability_manager_public_config") { } } +idl_gen_interface("ability_manager_innerkits") { + sources = [ + "idl/IUserCallback.idl", + ] + sources_callback = [ + ] + sources_common =[ + ] + log_domainid = "0xD001336" + log_tag = "AbilityMgr" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +config("ability_manager_innerkits_config") { + include_dirs = [ "${target_gen_dir}" ] +} + +ohos_source_set("ability_manager_innerkits_include") { + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + debug = false + } + + public_configs = [ + ":ability_manager_innerkits_config", + "${ability_runtime_services_path}/abilitymgr:abilityms_config", + ] + + deps = [ ":ability_manager_innerkits" ] + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + "ipc:ipc_core", + "samgr:samgr_proxy", + ] + + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_source_set("ability_manager_innerkits_source") { + 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_innerkits") + source_values = [ "*.cpp", ] + sources = filter_include(output_values, source_values) + + public_configs = [ + ":ability_manager_innerkits_config", + "${ability_runtime_services_path}/abilitymgr:abilityms_config", + ] + + deps = [ ":ability_manager_innerkits" ] + + external_deps = [ + "c_utils:utils", + "hilog:libhilog", + "hitrace:hitrace_meter", + "ipc:ipc_core", + ] + + 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" @@ -108,8 +197,6 @@ ohos_shared_library("ability_manager") { "${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", "${ability_runtime_services_path}/abilitymgr/src/ui_extension/ui_extension_session_info.cpp", - "${ability_runtime_services_path}/abilitymgr/src/user_callback_proxy.cpp", - "${ability_runtime_services_path}/abilitymgr/src/user_callback_stub.cpp", "${ability_runtime_services_path}/abilitymgr/src/window_config.cpp", "${ability_runtime_services_path}/abilitymgr/src/kiosk_status.cpp", "src/aa_tools/ability_start_with_wait_data.cpp", @@ -139,6 +226,8 @@ ohos_shared_library("ability_manager") { public_deps = [ ":ability_connect_callback_stub" ] deps = [ + ":ability_manager_innerkits_include", + ":ability_manager_innerkits_source", ":ability_start_options", ":ability_start_setting", ":mission_info", diff --git a/interfaces/inner_api/ability_manager/idl/IUserCallback.idl b/interfaces/inner_api/ability_manager/idl/IUserCallback.idl new file mode 100644 index 0000000000000000000000000000000000000000..4651d4c37b8207bc96cb4bdc17d7124ab6acfef8 --- /dev/null +++ b/interfaces/inner_api/ability_manager/idl/IUserCallback.idl @@ -0,0 +1,20 @@ +/* + * 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.IUserCallback { + [oneway] void OnStopUserDone([in] int userId, [in] int errcode); + [oneway] void OnStartUserDone([in] int userId, [in] int errcode); + [oneway] void OnLogoutUserDone([in] int userId, [in] int errcode); +} \ 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 c97397fd82c650ca98000eed81070d2df1be6270..203bb19dc64257b3e34c69b289381a81550c0b79 100644 --- a/interfaces/inner_api/ability_manager/include/ability_manager_interface.h +++ b/interfaces/inner_api/ability_manager/include/ability_manager_interface.h @@ -29,7 +29,6 @@ #include "ability_start_setting.h" #include "ability_state.h" #include "ability_state_data.h" -#include "app_debug_listener_interface.h" #include "auto_startup_info.h" #include "dms_continueInfo.h" #include "exit_reason.h" @@ -38,9 +37,11 @@ #include "iability_controller.h" #include "iability_manager_collaborator.h" #include "iacquire_share_data_callback_interface.h" +#include "iapp_debug_listener.h" #include "insight_intent/insight_intent_execute_param.h" #include "insight_intent/insight_intent_execute_result.h" #include "insight_intent/insight_intent_info_for_query.h" +#include "iuser_callback.h" #include "iprepare_terminate_callback_interface.h" #include "keep_alive_info.h" #include "mission_info.h" @@ -51,7 +52,6 @@ #include "sa_interceptor_interface.h" #include "sender_info.h" #include "start_options.h" -#include "user_callback.h" #include "system_memory_attr.h" #include "ui_extension/ui_extension_ability_connect_info.h" #include "ui_extension/ui_extension_host_info.h" diff --git a/interfaces/inner_api/ability_manager/include/user_callback.h b/interfaces/inner_api/ability_manager/include/user_callback.h deleted file mode 100644 index f2fd6373927b80afe9da51a98ab1c6c90c0708b9..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/ability_manager/include/user_callback.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2021-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_USER_CALLBACK_H -#define OHOS_ABILITY_RUNTIME_USER_CALLBACK_H - -#include "iremote_broker.h" - -namespace OHOS { -namespace AAFwk { -/** - * @class IUserCallback - * user callback. - */ -class IUserCallback : public OHOS::IRemoteBroker { -public: - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.aafwk.UserCallback"); - - virtual void OnStopUserDone(int userId, int errcode) = 0; - - /** - * @brief OnStartUserDone. - * - * @param userId userId. - * @param errcode errcode. - */ - virtual void OnStartUserDone(int userId, int errcode) = 0; - - /** - * @brief OnLogoutUserDone. - * - * @param userId userId. - * @param errcode errcode. - */ - virtual void OnLogoutUserDone(int userId, int errcode) {} - - enum UserCallbackCmd { - // ipc id for OnStopUserDone - ON_STOP_USER_DONE = 0, - - // ipc id for OnStartUserDone - ON_START_USER_DONE = 1, - - // ipc id for OnLogoutUserDone - ON_LOGOUT_USER_DONE = 2, - - // maximum of enum - CMD_MAX - }; -}; -} // namespace AAFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_USER_CALLBACK_H diff --git a/interfaces/inner_api/ability_manager/include/user_callback_proxy.h b/interfaces/inner_api/ability_manager/include/user_callback_proxy.h deleted file mode 100644 index e469b70b04d850e35dd14e65d69c4611761d4ca9..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/ability_manager/include/user_callback_proxy.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2021-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_STOP_USER_CALLBACK_PROXY_H -#define OHOS_ABILITY_RUNTIME_STOP_USER_CALLBACK_PROXY_H - -#include -#include "iremote_proxy.h" -#include "user_callback.h" - -namespace OHOS { -namespace AAFwk { -/** - * interface for UserCallbackProxy. - */ -class UserCallbackProxy : public IRemoteProxy { -public: - explicit UserCallbackProxy(const sptr &impl) : IRemoteProxy(impl) - {} - ~UserCallbackProxy() = default; - - /** - * @brief OnStopUserDone. - * - * @param userId userId. - * @param errcode errcode. - */ - virtual void OnStopUserDone(int userId, int errcode) override; - - /** - * @brief OnStartUserDone. - * - * @param userId userId. - * @param errcode errcode. - */ - virtual void OnStartUserDone(int userId, int errcode) override; - - /** - * @brief OnLogoutUserDone. - * - * @param userId userId. - * @param errcode errcode. - */ - virtual void OnLogoutUserDone(int userId, int errcode) override; -private: - void SendRequestCommon(int userId, int errcode, IUserCallback::UserCallbackCmd cmd); - -private: - static inline BrokerDelegator delegator_; -}; -} // namespace AAFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_STOP_USER_CALLBACK_PROXY_H diff --git a/interfaces/inner_api/app_manager/BUILD.gn b/interfaces/inner_api/app_manager/BUILD.gn index c9658b81753f9371a938e6f71a55f0b8f1ebf6d0..787a706e3850871792f3436a14ce3e7c7a12142e 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,6 +11,7 @@ # 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") @@ -40,9 +41,117 @@ config("appmgr_core_config") { } } +idl_gen_interface("appmgr_innerkits") { + sources = [ + "idl/IAbilityDebugResponse.idl", + "idl/IAppDebugListener.idl", + "idl/IAppForegroundStateObserver.idl", + "idl/IStartSpecifiedAbilityResponse.idl", + ] + log_domainid = "0xD001311" + log_tag = "AppMgr" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +config("appmgr_innerkits_config") { + include_dirs = [ "${target_gen_dir}" ] +} + +ohos_source_set("appmgr_innerkits_include") { + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + debug = false + } + + public_configs = [ + ":appmgr_innerkits_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits_config", + "${ability_runtime_path}/utils/server/startup:startup_util_config", + ] + + deps = [ + ":appmgr_innerkits", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits", + "${ability_runtime_path}/utils/server/startup:startup_util", + ] + external_deps = [ + "bundle_framework:appexecfwk_base", + "c_utils:utils", + "hilog:libhilog", + "hitrace:hitrace_meter", + "ipc:ipc_core", + "samgr:samgr_proxy", + "ability_base:configuration", + ] + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_source_set("appmgr_innerkits_source") { + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + debug = false + } + configs = [ + ":appmgr_core_config", + ":appmgr_sdk_config", + ] + + public_configs = [ + ":appmgr_innerkits_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits_config", + "${ability_runtime_path}/utils/server/startup:startup_util_config", + ] + + output_values = get_target_outputs(":appmgr_innerkits") + sources = filter_include(output_values, [ "*.cpp" ]) + + deps = [ + ":appmgr_innerkits", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits", + "${ability_runtime_path}/utils/server/startup:startup_util", + ] + external_deps = [ + "c_utils:utils", + "faultloggerd:libfaultloggerd", + "ffrt:libffrt", + "hilog:libhilog", + "hisysevent:libhisysevent", + "hitrace:hitrace_meter", + "ipc:ipc_core", + "samgr:samgr_proxy", + "ability_base:configuration", + "ability_base:session_info", + "ability_base:want", + "bundle_framework:appexecfwk_base", + ] + + subsystem_name = "ability" + part_name = "ability_runtime" +} + ohos_shared_library("app_manager") { + sanitize = { + integer_overflow = true + ubsan = true + boundary_sanitize = true + cfi = true + cfi_cross_dso = true + cfi_vcall_icall_only = true + debug = false + } branch_protector_ret = "pac_ret" - include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/dfr", "${ability_runtime_path}/utils/global/time/include", @@ -57,8 +166,6 @@ ohos_shared_library("app_manager") { "${ability_runtime_services_path}/appdfr/src/appfreeze_util.cpp", "src/appmgr/ability_controller_proxy.cpp", "src/appmgr/ability_controller_stub.cpp", - "src/appmgr/ability_debug_response_proxy.cpp", - "src/appmgr/ability_debug_response_stub.cpp", "src/appmgr/ability_foreground_state_observer_proxy.cpp", "src/appmgr/ability_foreground_state_observer_stub.cpp", "src/appmgr/ability_info_callback_proxy.cpp", @@ -67,10 +174,7 @@ ohos_shared_library("app_manager") { "src/appmgr/ams_mgr_proxy.cpp", "src/appmgr/ams_mgr_stub.cpp", "src/appmgr/app_debug_info.cpp", - "src/appmgr/app_debug_listener_proxy.cpp", - "src/appmgr/app_debug_listener_stub.cpp", - "src/appmgr/app_foreground_state_observer_proxy.cpp", - "src/appmgr/app_foreground_state_observer_stub.cpp", + "src/appmgr/app_foreground_state_observer_recipient.cpp", "src/appmgr/app_jsheap_mem_info.cpp", "src/appmgr/app_cjheap_mem_info.cpp", "src/appmgr/app_launch_data.cpp", @@ -120,15 +224,16 @@ ohos_shared_library("app_manager") { "src/appmgr/render_state_observer_stub.cpp", "src/appmgr/running_multi_info.cpp", "src/appmgr/running_process_info.cpp", - "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_innerkits_config", ":appmgr_sdk_config", + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits_config", + "${ability_runtime_path}/utils/server/startup:startup_util_config", ] defines = [ "AMS_LOG_TAG = \"AppexecfwkCore\"" ] @@ -138,6 +243,7 @@ ohos_shared_library("app_manager") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ + ":appmgr_innerkits_source", "${ability_runtime_path}/utils/global/freeze:freeze_util", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/common:app_util", diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_proxy.h b/interfaces/inner_api/app_manager/idl/IAbilityDebugResponse.idl similarity index 39% rename from interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_proxy.h rename to interfaces/inner_api/app_manager/idl/IAbilityDebugResponse.idl index b7d564bcc985841875510b9ecf5ff49363e1ce23..8f71029a117c3deccbc16bdf4a163f8caa2cfacd 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_proxy.h +++ b/interfaces/inner_api/app_manager/idl/IAbilityDebugResponse.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 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,25 +13,10 @@ * limitations under the License. */ -#ifndef OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_PROXY_H -#define OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_PROXY_H +sequenceable OHOS.IRemoteObject; -#include "app_foreground_state_observer_interface.h" -#include "iremote_proxy.h" - -namespace OHOS { -namespace AppExecFwk { -class AppForegroundStateObserverProxy : public IRemoteProxy { -public: - explicit AppForegroundStateObserverProxy(const sptr &impl); - virtual ~AppForegroundStateObserverProxy() = default; - - void OnAppStateChanged(const AppStateData &appStateData) override; - -private: - bool WriteInterfaceToken(MessageParcel &data); - static inline BrokerDelegator delegator_; -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_PROXY_H \ No newline at end of file +interface OHOS.AppExecFwk.IAbilityDebugResponse { + void OnAbilitysDebugStarted([in] List tokens); + void OnAbilitysDebugStoped([in] List tokens); + void OnAbilitysAssertDebugChange([in] List tokens, [in] boolean isAssertDebug); +} \ No newline at end of file diff --git a/interfaces/inner_api/ability_manager/include/user_callback_stub.h b/interfaces/inner_api/app_manager/idl/IAppDebugListener.idl similarity index 35% rename from interfaces/inner_api/ability_manager/include/user_callback_stub.h rename to interfaces/inner_api/app_manager/idl/IAppDebugListener.idl index bed99d5a402af2831e52066b2c0f0bbebce6da74..2020004d5fca8dd8af6da5d16cdd00b97ab6cf10 100644 --- a/interfaces/inner_api/ability_manager/include/user_callback_stub.h +++ b/interfaces/inner_api/app_manager/idl/IAppDebugListener.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 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,9 @@ * limitations under the License. */ -#ifndef OHOS_ABILITY_RUNTIME_USER_CALLBACK_STUB_H -#define OHOS_ABILITY_RUNTIME_USER_CALLBACK_STUB_H +sequenceable app_debug_info..AppDebugInfo; -#include -#include -#include - -#include "user_callback.h" -#include "nocopyable.h" - -namespace OHOS { -namespace AAFwk { -/** - * @class UserCallbackStub - * UserCallbackStub. - */ -class UserCallbackStub : public IRemoteStub { -public: - UserCallbackStub(); - virtual ~UserCallbackStub() = default; - - virtual int OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - -private: - DISALLOW_COPY_AND_MOVE(UserCallbackStub); - - int OnStopUserDoneInner(MessageParcel &data, MessageParcel &reply); - int OnStartUserDoneInner(MessageParcel &data, MessageParcel &reply); - int OnLogoutUserDoneInner(MessageParcel &data, MessageParcel &reply); -}; -} // namespace AAFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_USER_CALLBACK_STUB_H +interface OHOS.AppExecFwk.IAppDebugListener { + [oneway] void OnAppDebugStarted([in] List debugInfos); + [oneway] void OnAppDebugStoped([in] List debugInfos); +} \ No newline at end of file diff --git a/interfaces/inner_api/app_manager/idl/IAppForegroundStateObserver.idl b/interfaces/inner_api/app_manager/idl/IAppForegroundStateObserver.idl new file mode 100644 index 0000000000000000000000000000000000000000..2fd543880a4e1cb967547ba18e7dafaef10db487 --- /dev/null +++ b/interfaces/inner_api/app_manager/idl/IAppForegroundStateObserver.idl @@ -0,0 +1,20 @@ +/* + * 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. + */ + +sequenceable OHOS.AppExecFwk.AppStateData; + +interface OHOS.AppExecFwk.IAppForegroundStateObserver{ + [oneway]void OnAppStateChanged([in] AppStateData appStateData); +} \ No newline at end of file diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_debug_listener_stub.h b/interfaces/inner_api/app_manager/idl/IStartSpecifiedAbilityResponse.idl similarity index 39% rename from interfaces/inner_api/app_manager/include/appmgr/app_debug_listener_stub.h rename to interfaces/inner_api/app_manager/idl/IStartSpecifiedAbilityResponse.idl index 3aab199f486c133070a46827918d42d03c25293b..652fa7c75bab2e411e4c2851568780a7f421c1a2 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_debug_listener_stub.h +++ b/interfaces/inner_api/app_manager/idl/IStartSpecifiedAbilityResponse.idl @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 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,30 +13,14 @@ * limitations under the License. */ -#ifndef OHOS_ABILITY_RUNTIME_APP_DEBUG_LISTENER_STUB_H -#define OHOS_ABILITY_RUNTIME_APP_DEBUG_LISTENER_STUB_H +sequenceable want..OHOS.AAFwk.Want; -#include +interface OHOS.AAFwk.IUserCallback; -#include "iremote_stub.h" -#include "app_debug_listener_interface.h" - -namespace OHOS { -namespace AppExecFwk { -class AppDebugListenerStub : public IRemoteStub { -public: - AppDebugListenerStub(); - virtual ~AppDebugListenerStub(); - - virtual int OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - -private: - int32_t HandleOnAppDebugStarted(MessageParcel &data, MessageParcel &reply); - int32_t HandleOnAppDebugStoped(MessageParcel &data, MessageParcel &reply); - - DISALLOW_COPY_AND_MOVE(AppDebugListenerStub); -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_APP_DEBUG_LISTENER_STUB_H +interface OHOS.AppExecFwk.IStartSpecifiedAbilityResponse { + [oneway] void OnAcceptWantResponse([in] Want want, [in] String flag, [in] int requestId); + [oneway] void OnTimeoutResponse([in] int requestId); + [oneway] void OnNewProcessRequestResponse([in] String flag, [in] int requestId); + [oneway] void OnNewProcessRequestTimeoutResponse([in] int requestId); + [oneway] void OnStartSpecifiedFailed([in] int requestId); +} \ No newline at end of file diff --git a/interfaces/inner_api/app_manager/include/appmgr/ability_debug_response_interface.h b/interfaces/inner_api/app_manager/include/appmgr/ability_debug_response_interface.h deleted file mode 100644 index 87ec00b7b17419f546753f04aa51bd6063be409c..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/ability_debug_response_interface.h +++ /dev/null @@ -1,54 +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. - */ - -#ifndef OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_RESPONSE_INTERFACE_H -#define OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_RESPONSE_INTERFACE_H - -#include "iremote_broker.h" - -namespace OHOS { -namespace AppExecFwk { -class IAbilityDebugResponse : public IRemoteBroker { -public: - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.AbilityDebugResponse"); - - /** - * @brief Set ability attach debug flag to ability manager service. - * @param tokens The token of ability token. - */ - virtual void OnAbilitysDebugStarted(const std::vector> &tokens) = 0; - - /** - * @brief Cancel ability attach debug flag to ability manager service. - * @param tokens The token of ability token. - */ - virtual void OnAbilitysDebugStoped(const std::vector> &tokens) = 0; - - /** - * @brief Change ability assert debug flag. - * @param tokens The token of ability records. - * @param isAssertDebug Assert debug flag. - */ - virtual void OnAbilitysAssertDebugChange(const std::vector> &tokens, bool isAssertDebug) = 0; - - enum class Message { - ON_ABILITYS_DEBUG_STARTED = 0, - ON_ABILITYS_DEBUG_STOPED, - ON_ABILITYS_ASSERT_DEBUG, - }; -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_RESPONSE_INTERFACE_H diff --git a/interfaces/inner_api/app_manager/include/appmgr/ability_debug_response_proxy.h b/interfaces/inner_api/app_manager/include/appmgr/ability_debug_response_proxy.h deleted file mode 100644 index 1bdac574de5079f573caa45cb0f94fa48f45b400..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/ability_debug_response_proxy.h +++ /dev/null @@ -1,56 +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. - */ - -#ifndef OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_RESPONSE_PROXY_H -#define OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_RESPONSE_PROXY_H - -#include "ability_debug_response_interface.h" -#include "iremote_object.h" -#include "iremote_proxy.h" - -namespace OHOS { -namespace AppExecFwk { -class AbilityDebugResponseProxy : public IRemoteProxy { -public: - explicit AbilityDebugResponseProxy(const sptr &impl); - virtual ~AbilityDebugResponseProxy() = default; - - /** - * @brief Set ability attach debug flag through proxy project. - * @param tokens The token of ability token. - */ - void OnAbilitysDebugStarted(const std::vector> &tokens) override; - - /** - * @brief Cancel ability attach debug flag through proxy project. - * @param tokens The token of ability token. - */ - void OnAbilitysDebugStoped(const std::vector> &tokens) override; - - /** - * @brief Change ability assert debug flag. - * @param tokens The token of ability records. - * @param isAssertDebug Assert debug flag. - */ - void OnAbilitysAssertDebugChange(const std::vector> &tokens, bool isAssertDebug) override; - -private: - bool WriteInterfaceToken(MessageParcel &data); - void SendRequest(const IAbilityDebugResponse::Message &message, const std::vector> &tokens); - static inline BrokerDelegator delegator_; -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_RESPONSE_PROXY_H diff --git a/interfaces/inner_api/app_manager/include/appmgr/ability_debug_response_stub.h b/interfaces/inner_api/app_manager/include/appmgr/ability_debug_response_stub.h deleted file mode 100644 index 9753d7051b3d9a919fe390464038b42643e3528f..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/ability_debug_response_stub.h +++ /dev/null @@ -1,43 +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. - */ - -#ifndef OHOS_ABILITY_RUNTIME_ABILIYT_DEBUG_RESPONSE_STUB_H -#define OHOS_ABILITY_RUNTIME_ABILIYT_DEBUG_RESPONSE_STUB_H - -#include - -#include "ability_debug_response_interface.h" -#include "iremote_stub.h" - -namespace OHOS { -namespace AppExecFwk { -class AbilityDebugResponseStub : public IRemoteStub { -public: - AbilityDebugResponseStub(); - virtual ~AbilityDebugResponseStub(); - - virtual int OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - -private: - int32_t HandleOnAbilitysDebugStarted(MessageParcel &data, MessageParcel &reply); - int32_t HandleOnAbilitysDebugStoped(MessageParcel &data, MessageParcel &reply); - int32_t HandleOnAbilitysAssertDebugChange(MessageParcel &data, MessageParcel &reply); - - DISALLOW_COPY_AND_MOVE(AbilityDebugResponseStub); -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_ABILIYT_DEBUG_RESPONSE_STUB_H diff --git a/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_interface.h b/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_interface.h index d919a230212a1e201219df9f6acb316c16ab10f6..2df1661f0b0ced9e7af822ef1ab369f3523a2d80 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_interface.h +++ b/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_interface.h @@ -16,9 +16,9 @@ #ifndef OHOS_ABILITY_RUNTIME_AMS_MGR_INTERFACE_H #define OHOS_ABILITY_RUNTIME_AMS_MGR_INTERFACE_H -#include "ability_debug_response_interface.h" +#include "iability_debug_response.h" #include "ability_info.h" -#include "app_debug_listener_interface.h" +#include "iapp_debug_listener.h" #include "app_record_id.h" #include "application_info.h" #include "configuration.h" @@ -26,8 +26,8 @@ #include "iremote_broker.h" #include "iremote_object.h" #include "istart_specified_ability_response.h" +#include "iuser_callback.h" #include "running_process_info.h" -#include "user_callback.h" namespace OHOS { namespace AbilityRuntime { diff --git a/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_proxy.h b/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_proxy.h index fec486a478f85c862b9dfa97cb26618c0f1b60a3..411dd010e6b8d2db327d0438842bc6928a8fa3b9 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_proxy.h +++ b/interfaces/inner_api/app_manager/include/appmgr/ams_mgr_proxy.h @@ -17,7 +17,7 @@ #define OHOS_ABILITY_RUNTIME_AMS_MGR_PROXY_H #include "ams_mgr_interface.h" -#include "app_debug_listener_interface.h" +#include "iapp_debug_listener.h" #include "iremote_proxy.h" namespace OHOS { diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_debug_listener_interface.h b/interfaces/inner_api/app_manager/include/appmgr/app_debug_listener_interface.h deleted file mode 100644 index 113002837ee096eeff6d444017c0b2645f674f91..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/app_debug_listener_interface.h +++ /dev/null @@ -1,50 +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_APP_DEBUG_LISTENER_INTERFACE_H -#define OHOS_ABILITY_RUNTIME_APP_DEBUG_LISTENER_INTERFACE_H - -#include "app_debug_info.h" -#include "iremote_broker.h" - -namespace OHOS { -namespace AppExecFwk { -/** - * @brief Interface to monitor when debug mode. - */ -class IAppDebugListener : public IRemoteBroker { -public: - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.AppExecFwk.AppDebugListener"); - - /** - * @brief Notification of application information registered in listening and debugging mode. - * @param tokens The app info of app running record. - */ - virtual void OnAppDebugStarted(const std::vector &debugInfos) = 0; - - /** - * @brief Notification of application information registered in listening and remove debug mode. - * @param tokens The app info of app running record. - */ - virtual void OnAppDebugStoped(const std::vector &debugInfos) = 0; - - enum class Message { - ON_APP_DEBUG_STARTED = 0, - ON_APP_DEBUG_STOPED, - }; -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_APP_DEBUG_LISTENER_INTERFACE_H diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_debug_listener_proxy.h b/interfaces/inner_api/app_manager/include/appmgr/app_debug_listener_proxy.h deleted file mode 100644 index a309079a93810ad641b1c80af5bbf64a70c737b5..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/app_debug_listener_proxy.h +++ /dev/null @@ -1,49 +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_APP_DEBUG_LISTENER_PROXY_H -#define OHOS_ABILITY_RUNTIME_APP_DEBUG_LISTENER_PROXY_H - -#include "app_debug_info.h" -#include "app_debug_listener_interface.h" -#include "iremote_proxy.h" - -namespace OHOS { -namespace AppExecFwk { -class AppDebugListenerProxy : public IRemoteProxy { -public: - explicit AppDebugListenerProxy(const sptr &impl); - virtual ~AppDebugListenerProxy() = default; - - /** - * @brief Notification of application information registered in listening and debugging mode. - * @param tokens The app info of app running record. - */ - void OnAppDebugStarted(const std::vector &debugInfos) override; - - /** - * @brief Notification of application information registered in listening and remove debug mode. - * @param tokens The app info of app running record. - */ - void OnAppDebugStoped(const std::vector &debugInfos) override; - -private: - bool WriteInterfaceToken(MessageParcel &data); - void SendRequest(const IAppDebugListener::Message &message, const std::vector &debugInfos); - static inline BrokerDelegator delegator_; -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_APP_DEBUG_LISTENER_PROXY_H diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_stub.h b/interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_recipient.h similarity index 58% rename from interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_stub.h rename to interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_recipient.h index cbde5f949c8307c7fc31668fbbf764512734ff6f..24344aa85cda14b6dedeaed6361fd4174424837e 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_stub.h +++ b/interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_recipient.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 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,29 +13,13 @@ * limitations under the License. */ -#ifndef OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_STUB_H -#define OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_STUB_H +#ifndef OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_RECIPIENT_H +#define OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_RECIPIENT_H -#include - -#include "app_foreground_state_observer_interface.h" -#include "iremote_stub.h" -#include "nocopyable.h" -#include "string_ex.h" +#include "iapp_foreground_state_observer.h" namespace OHOS { namespace AppExecFwk { -class AppForegroundStateObserverStub : public IRemoteStub { -public: - AppForegroundStateObserverStub(); - virtual ~AppForegroundStateObserverStub(); - int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - -private: - int32_t HandleOnAppStateChanged(MessageParcel &data, MessageParcel &reply); - - DISALLOW_COPY_AND_MOVE(AppForegroundStateObserverStub); -}; /** * @class AppForegroundStateObserverRecipient @@ -53,4 +37,4 @@ private: }; } // namespace AppExecFwk } // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_STUB_H +#endif // OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_RECIPIENT_H \ No newline at end of file diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_client.h b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_client.h index 3a5e83250bc11b5db72b39366a1886ee86260dfc..5eec5d778fbe66cc35148843c447c3b0c464f58b 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_mgr_client.h +++ b/interfaces/inner_api/app_manager/include/appmgr/app_mgr_client.h @@ -16,9 +16,7 @@ #ifndef OHOS_ABILITY_RUNTIME_APP_MGR_CLIENT_H #define OHOS_ABILITY_RUNTIME_APP_MGR_CLIENT_H -#include "ability_debug_response_interface.h" #include "ability_info.h" -#include "app_debug_listener_interface.h" #include "app_malloc_info.h" #include "app_mem_info.h" #include "app_mgr_constants.h" @@ -27,6 +25,8 @@ #include "application_info.h" #include "bundle_info.h" #include "fault_data.h" +#include "iability_debug_response.h" +#include "iapp_debug_listener.h" #include "iapplication_state_observer.h" #include "iapp_state_callback.h" #include "iconfiguration_observer.h" 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 78c33ca8ff10759c433cbe893e184c8a80e51de8..bc16777c0cbb1214134a6a389ba999c83688cf95 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 @@ -19,7 +19,6 @@ #include "ability_foreground_state_observer_interface.h" #include "ability_info.h" #include "ams_mgr_interface.h" -#include "app_foreground_state_observer_interface.h" #include "app_malloc_info.h" #include "app_mgr_ipc_interface_code.h" #include "app_record_id.h" @@ -33,6 +32,7 @@ #endif // SUPPORT_CHILD_PROCESS #include "fault_data.h" #include "kia_interceptor_interface.h" +#include "iapp_foreground_state_observer.h" #include "iapp_state_callback.h" #include "iapplication_state_observer.h" #include "iconfiguration_observer.h" @@ -450,7 +450,7 @@ public: /** * UpdateConfigurationForBackgroundApp - * + * * @param appInfos Background application information. * @param policy Update policy. * @param userId configuration for the user diff --git a/interfaces/inner_api/app_manager/include/appmgr/istart_specified_ability_response.h b/interfaces/inner_api/app_manager/include/appmgr/istart_specified_ability_response.h deleted file mode 100644 index 0777f67ee1d2ce89d4bd6aca6db7e97b324bef6a..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/istart_specified_ability_response.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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_ISTART_SPECIFIED_ABILITY_RESPONSE_H -#define OHOS_ABILITY_RUNTIME_ISTART_SPECIFIED_ABILITY_RESPONSE_H - -#include "iremote_broker.h" -#include "iremote_object.h" -#include "want.h" - -namespace OHOS { -namespace AppExecFwk { -class IStartSpecifiedAbilityResponse : public IRemoteBroker { -public: - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.startSpecifiedAbilityResponse"); - - /** - * @brief called when the module's onAcceptWant done to notify ability mgr to continue - * @param want request param being accepted - * @param flag specified flag return by application - * @param requestId a number represents a request - */ - virtual void OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, int32_t requestId) = 0; - - /** - * @brief called when the module's onAcceptWant happens time out - * @param requestId a number represents a request - */ - virtual void OnTimeoutResponse(int32_t requestId) = 0; - - virtual void OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) = 0; - - virtual void OnNewProcessRequestTimeoutResponse(int32_t requestId) = 0; - - virtual void OnStartSpecifiedFailed(int32_t requestId) {}; - - enum Message { - ON_ACCEPT_WANT_RESPONSE = 0, - ON_TIMEOUT_RESPONSE, - ON_NEW_PROCESS_REQUEST_RESPONSE, - ON_NEW_PROCESS_REQUEST_TIMEOUT_RESPONSE, - ON_START_SPECIFIED_FAILED - }; -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_ISTART_SPECIFIED_ABILITY_RESPONSE_H diff --git a/interfaces/inner_api/app_manager/include/appmgr/start_specified_ability_response_proxy.h b/interfaces/inner_api/app_manager/include/appmgr/start_specified_ability_response_proxy.h deleted file mode 100644 index bf2037afc012bef53d69bc394ba8fc2e3ffa541d..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/start_specified_ability_response_proxy.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * 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_START_SPECIFIED_ABILITY_RESPONSE_PROXY_H -#define OHOS_ABILITY_RUNTIME_START_SPECIFIED_ABILITY_RESPONSE_PROXY_H - -#include "iremote_proxy.h" -#include "istart_specified_ability_response.h" -namespace OHOS { -namespace AppExecFwk { -class StartSpecifiedAbilityResponseProxy : public IRemoteProxy { -public: - explicit StartSpecifiedAbilityResponseProxy(const sptr &impl); - virtual ~StartSpecifiedAbilityResponseProxy() = default; - - /** - * @brief called when the module's onAcceptWant done to notify ability mgr to continue - * @param want request param being accepted - * @param flag specified flag return by application - * @param requestId a number represents a request - */ - virtual void OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, - int32_t requestId) override; - - /** - * @brief called when the module's onAcceptWant happens time out - * @param requestId a number represents a request - */ - virtual void OnTimeoutResponse(int32_t requestId) override; - - virtual void OnNewProcessRequestResponse(const std::string &flag, int32_t requestId = 0) override; - - virtual void OnNewProcessRequestTimeoutResponse(int32_t requestId) override; - - virtual void OnStartSpecifiedFailed(int32_t requestId) override; - -private: - bool WriteInterfaceToken(MessageParcel &data); - static inline BrokerDelegator delegator_; - int32_t SendTransactCmd(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_START_SPECIFIED_ABILITY_RESPONSE_PROXY_H diff --git a/interfaces/inner_api/app_manager/include/appmgr/start_specified_ability_response_stub.h b/interfaces/inner_api/app_manager/include/appmgr/start_specified_ability_response_stub.h deleted file mode 100644 index 041320de260806846208a8dc0f70d8a861c507a9..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/app_manager/include/appmgr/start_specified_ability_response_stub.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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_START_SPECIFIED_ABILITY_RESPONSE_STUB_H -#define OHOS_ABILITY_RUNTIME_START_SPECIFIED_ABILITY_RESPONSE_STUB_H - -#include "iremote_stub.h" -#include "nocopyable.h" -#include "string_ex.h" -#include "istart_specified_ability_response.h" - -namespace OHOS { -namespace AppExecFwk { -class StartSpecifiedAbilityResponseStub : public IRemoteStub { -public: - StartSpecifiedAbilityResponseStub() = default; - virtual ~StartSpecifiedAbilityResponseStub() = default; - - virtual int OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - -private: - int32_t HandleOnAcceptWantResponse(MessageParcel &data, MessageParcel &reply); - int32_t HandleOnTimeoutResponse(MessageParcel &data, MessageParcel &reply); - int32_t HandleOnNewProcessRequestResponse(MessageParcel &data, MessageParcel &reply); - int32_t HandleOnNewProcessRequestTimeoutResponse(MessageParcel &data, MessageParcel &reply); - int32_t HandleOnStartSpecifiedFailed(MessageParcel &data, MessageParcel &reply); - - DISALLOW_COPY_AND_MOVE(StartSpecifiedAbilityResponseStub); -}; -} // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_START_SPECIFIED_ABILITY_RESPONSE_STUB_H diff --git a/interfaces/inner_api/app_manager/src/appmgr/ability_debug_response_proxy.cpp b/interfaces/inner_api/app_manager/src/appmgr/ability_debug_response_proxy.cpp deleted file mode 100644 index 5736f1b596cc9b3cbfa92b607edb3e2fb3c07592..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/ability_debug_response_proxy.cpp +++ /dev/null @@ -1,131 +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 "ability_debug_response_proxy.h" - -#include "hilog_tag_wrapper.h" -#include "ipc_types.h" - -namespace OHOS { -namespace AppExecFwk { -namespace { -constexpr int32_t CYCLE_LIMIT_MIN = 0; -constexpr int32_t CYCLE_LIMIT_MAX = 1000; -} -AbilityDebugResponseProxy::AbilityDebugResponseProxy( - const sptr &impl) : IRemoteProxy(impl) -{} - -bool AbilityDebugResponseProxy::WriteInterfaceToken(MessageParcel &data) -{ - if (!data.WriteInterfaceToken(AbilityDebugResponseProxy::GetDescriptor())) { - TAG_LOGE(AAFwkTag::APPMGR, "Write token failed"); - return false; - } - return true; -} - -void AbilityDebugResponseProxy::OnAbilitysDebugStarted(const std::vector> &tokens) -{ - TAG_LOGD(AAFwkTag::APPMGR, "called"); - SendRequest(IAbilityDebugResponse::Message::ON_ABILITYS_DEBUG_STARTED, tokens); -} - -void AbilityDebugResponseProxy::OnAbilitysDebugStoped(const std::vector> &tokens) -{ - TAG_LOGD(AAFwkTag::APPMGR, "called"); - SendRequest(IAbilityDebugResponse::Message::ON_ABILITYS_DEBUG_STOPED, tokens); -} - -void AbilityDebugResponseProxy::OnAbilitysAssertDebugChange( - const std::vector> &tokens, bool isAssertDebug) -{ - TAG_LOGD(AAFwkTag::APPMGR, "called"); - MessageParcel data; - if (!WriteInterfaceToken(data)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write token failed"); - return; - } - - if (tokens.size() <= CYCLE_LIMIT_MIN || tokens.size() > CYCLE_LIMIT_MAX || - !data.WriteInt32(tokens.size())) { - TAG_LOGE(AAFwkTag::APPMGR, "Write data size failed"); - return; - } - - for (const auto &item : tokens) { - if (!data.WriteRemoteObject(item)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write token failed"); - return; - } - } - - if (!data.WriteBool(isAssertDebug)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write flag failed"); - return; - } - - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "null remote"); - return; - } - - MessageParcel reply; - MessageOption option; - auto ret = remote->SendRequest(static_cast(Message::ON_ABILITYS_ASSERT_DEBUG), data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGE(AAFwkTag::APPMGR, "SendRequest err: %{public}d", ret); - } -} - -void AbilityDebugResponseProxy::SendRequest( - const IAbilityDebugResponse::Message &message, const std::vector> &tokens) -{ - TAG_LOGD(AAFwkTag::APPMGR, "called"); - MessageParcel data; - if (!WriteInterfaceToken(data)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write token failed"); - return; - } - - if (tokens.size() <= CYCLE_LIMIT_MIN || tokens.size() > CYCLE_LIMIT_MAX || - !data.WriteInt32(tokens.size())) { - TAG_LOGE(AAFwkTag::APPMGR, "Write data size failed"); - return; - } - - for (auto iter = tokens.begin(); iter != tokens.end(); iter++) { - if (!data.WriteRemoteObject(iter->GetRefPtr())) { - TAG_LOGE(AAFwkTag::APPMGR, "Write token failed"); - return; - } - } - - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "null remote"); - return; - } - - MessageParcel reply; - MessageOption option(MessageOption::TF_SYNC); - auto ret = remote->SendRequest(static_cast(message), data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGE(AAFwkTag::APPMGR, "SendRequest err: %{public}d", ret); - } -} -} // namespace AppExecFwk -} // namespace OHOS diff --git a/interfaces/inner_api/app_manager/src/appmgr/ability_debug_response_stub.cpp b/interfaces/inner_api/app_manager/src/appmgr/ability_debug_response_stub.cpp deleted file mode 100644 index daf6a577ae851b01f3b24c02a06933c7521836d2..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/ability_debug_response_stub.cpp +++ /dev/null @@ -1,118 +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 "ability_debug_response_stub.h" - -#include "appexecfwk_errors.h" -#include "hilog_tag_wrapper.h" -#include "ipc_types.h" -#include "iremote_object.h" - -namespace OHOS { -namespace AppExecFwk { -namespace { -constexpr int32_t CYCLE_LIMIT_MIN = 0; -constexpr int32_t CYCLE_LIMIT_MAX = 1000; -} -AbilityDebugResponseStub::AbilityDebugResponseStub() {} - -AbilityDebugResponseStub::~AbilityDebugResponseStub() {} - -int32_t AbilityDebugResponseStub::HandleOnAbilitysDebugStarted(MessageParcel &data, MessageParcel &reply) -{ - auto tokenSize = data.ReadInt32(); - if (tokenSize <= CYCLE_LIMIT_MIN || tokenSize > CYCLE_LIMIT_MAX) { - TAG_LOGE(AAFwkTag::APPMGR, "Token size exceeds limit"); - return ERR_INVALID_DATA; - } - - std::vector> tokens; - for (int32_t index = 0; index < tokenSize; index++) { - auto token = data.ReadRemoteObject(); - if (token == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "null token"); - return ERR_INVALID_DATA; - } - tokens.push_back(token); - } - OnAbilitysDebugStarted(tokens); - return NO_ERROR; -} - -int32_t AbilityDebugResponseStub::HandleOnAbilitysDebugStoped(MessageParcel &data, MessageParcel &reply) -{ - auto tokenSize = data.ReadInt32(); - if (tokenSize <= CYCLE_LIMIT_MIN || tokenSize > CYCLE_LIMIT_MAX) { - TAG_LOGE(AAFwkTag::APPMGR, "Token size exceeds limit"); - return ERR_INVALID_DATA; - } - - std::vector> tokens; - for (int32_t index = 0; index < tokenSize; index++) { - auto token = data.ReadRemoteObject(); - if (token == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "null token"); - return ERR_INVALID_DATA; - } - tokens.push_back(token); - } - OnAbilitysDebugStoped(tokens); - return NO_ERROR; -} - -int32_t AbilityDebugResponseStub::HandleOnAbilitysAssertDebugChange(MessageParcel &data, MessageParcel &reply) -{ - auto tokenSize = data.ReadInt32(); - if (tokenSize <= CYCLE_LIMIT_MIN || tokenSize > CYCLE_LIMIT_MAX) { - TAG_LOGE(AAFwkTag::APPMGR, "Token size exceeds limit"); - return ERR_INVALID_DATA; - } - - std::vector> tokens; - for (int32_t index = 0; index < tokenSize; index++) { - auto token = data.ReadRemoteObject(); - if (token == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "null token"); - return ERR_INVALID_DATA; - } - tokens.push_back(token); - } - auto isAssertDebug = data.ReadBool(); - OnAbilitysAssertDebugChange(tokens, isAssertDebug); - return NO_ERROR; -} - -int AbilityDebugResponseStub::OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) -{ - TAG_LOGD(AAFwkTag::APPMGR, "code: %{public}u, flags: %{public}d", code, option.GetFlags()); - std::u16string descriptor = AbilityDebugResponseStub::GetDescriptor(); - std::u16string remoteDescriptor = data.ReadInterfaceToken(); - if (descriptor != remoteDescriptor) { - TAG_LOGE(AAFwkTag::APPMGR, "invalid descriptor"); - return ERR_INVALID_STATE; - } - - switch (code) { - case static_cast(IAbilityDebugResponse::Message::ON_ABILITYS_DEBUG_STARTED): - return HandleOnAbilitysDebugStarted(data, reply); - case static_cast(IAbilityDebugResponse::Message::ON_ABILITYS_DEBUG_STOPED): - return HandleOnAbilitysDebugStoped(data, reply); - } - - return IPCObjectStub::OnRemoteRequest(code, data, reply, option); -} -} // namespace AppExecFwk -} // namespace OHOS diff --git a/interfaces/inner_api/app_manager/src/appmgr/ams_mgr_stub.cpp b/interfaces/inner_api/app_manager/src/appmgr/ams_mgr_stub.cpp index 4fc28df4288dfd2ad409575516cb1f9f0ff11b56..3368465487741d6b6f719fbeea601e4e696dffed 100644 --- a/interfaces/inner_api/app_manager/src/appmgr/ams_mgr_stub.cpp +++ b/interfaces/inner_api/app_manager/src/appmgr/ams_mgr_stub.cpp @@ -16,12 +16,12 @@ #include "ams_mgr_stub.h" #include "ability_manager_errors.h" #include "ability_info.h" -#include "app_debug_listener_interface.h" #include "app_mgr_proxy.h" #include "app_scheduler_interface.h" #include "appexecfwk_errors.h" #include "hilog_tag_wrapper.h" #include "hitrace_meter.h" +#include "iapp_debug_listener.h" #include "iapp_state_callback.h" #include "ipc_skeleton.h" #include "ipc_types.h" diff --git a/interfaces/inner_api/app_manager/src/appmgr/app_debug_listener_proxy.cpp b/interfaces/inner_api/app_manager/src/appmgr/app_debug_listener_proxy.cpp deleted file mode 100644 index fc271be274a5c62723bbfb0fc75579120b1abfb4..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/app_debug_listener_proxy.cpp +++ /dev/null @@ -1,87 +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 "app_debug_listener_proxy.h" - -#include "hilog_tag_wrapper.h" -#include "ipc_types.h" - -namespace OHOS { -namespace AppExecFwk { -namespace { -constexpr int32_t CYCLE_LIMIT_MIN = 0; -constexpr int32_t CYCLE_LIMIT_MAX = 1000; -} -AppDebugListenerProxy::AppDebugListenerProxy( - const sptr &impl) : IRemoteProxy(impl) -{} - -bool AppDebugListenerProxy::WriteInterfaceToken(MessageParcel &data) -{ - if (!data.WriteInterfaceToken(AppDebugListenerProxy::GetDescriptor())) { - TAG_LOGE(AAFwkTag::APPMGR, "Write interface token failed."); - return false; - } - return true; -} - -void AppDebugListenerProxy::OnAppDebugStarted(const std::vector &debugInfos) -{ - TAG_LOGD(AAFwkTag::APPMGR, "called"); - SendRequest(IAppDebugListener::Message::ON_APP_DEBUG_STARTED, debugInfos); -} - -void AppDebugListenerProxy::OnAppDebugStoped(const std::vector &debugInfos) -{ - TAG_LOGD(AAFwkTag::APPMGR, "called"); - SendRequest(IAppDebugListener::Message::ON_APP_DEBUG_STOPED, debugInfos); -} - -void AppDebugListenerProxy::SendRequest( - const IAppDebugListener::Message &message, const std::vector &debugInfos) -{ - MessageParcel data; - if (!WriteInterfaceToken(data)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write interface token failed."); - return; - } - - if (debugInfos.size() <= CYCLE_LIMIT_MIN || debugInfos.size() > CYCLE_LIMIT_MAX || - !data.WriteInt32(debugInfos.size())) { - TAG_LOGE(AAFwkTag::APPMGR, "Write debug info size failed."); - return; - } - for (auto &debugInfo : debugInfos) { - if (!data.WriteParcelable(&debugInfo)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write debug info failed."); - return; - } - }; - - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "Remote is nullptr."); - return; - } - - MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - int32_t ret = remote->SendRequest(static_cast(message), data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGE(AAFwkTag::APPMGR, "SendRequest is failed, error code: %{public}d", ret); - } -} -} // namespace AppExecFwk -} // namespace OHOS diff --git a/interfaces/inner_api/app_manager/src/appmgr/app_debug_listener_stub.cpp b/interfaces/inner_api/app_manager/src/appmgr/app_debug_listener_stub.cpp deleted file mode 100644 index ae20e2535b890b8947c0d4fdc3785ef359f8503c..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/app_debug_listener_stub.cpp +++ /dev/null @@ -1,98 +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 "app_debug_listener_stub.h" - -#include "hilog_tag_wrapper.h" -#include "ipc_types.h" -#include "iremote_object.h" - -namespace OHOS { -namespace AppExecFwk { -namespace { -constexpr int32_t CYCLE_LIMIT_MIN = 0; -constexpr int32_t CYCLE_LIMIT_MAX = 1000; -} -AppDebugListenerStub::AppDebugListenerStub() {} - -AppDebugListenerStub::~AppDebugListenerStub() {} - -int AppDebugListenerStub::OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) -{ - TAG_LOGD(AAFwkTag::APPMGR, "code = %{public}u, flags= %{public}d", code, option.GetFlags()); - std::u16string descriptor = AppDebugListenerStub::GetDescriptor(); - std::u16string remoteDescriptor = data.ReadInterfaceToken(); - if (descriptor != remoteDescriptor) { - TAG_LOGE(AAFwkTag::APPMGR, "Local descriptor is not equal to remote."); - return ERR_INVALID_STATE; - } - - switch (code) { - case static_cast(IAppDebugListener::Message::ON_APP_DEBUG_STARTED): - return HandleOnAppDebugStarted(data, reply); - case static_cast(IAppDebugListener::Message::ON_APP_DEBUG_STOPED): - return HandleOnAppDebugStoped(data, reply); - } - - TAG_LOGD(AAFwkTag::APPMGR, "AppDebugListenerStub::OnRemoteRequest end"); - return IPCObjectStub::OnRemoteRequest(code, data, reply, option); -} - -int32_t AppDebugListenerStub::HandleOnAppDebugStarted(MessageParcel &data, MessageParcel &reply) -{ - auto infoSize = data.ReadInt32(); - if (infoSize <= CYCLE_LIMIT_MIN || infoSize > CYCLE_LIMIT_MAX) { - TAG_LOGE(AAFwkTag::APPMGR, "Token size exceeds limit."); - return ERR_INVALID_DATA; - } - - std::vector appDebugInfos; - for (int32_t index = 0; index < infoSize; index++) { - std::unique_ptr appDebugInfo(data.ReadParcelable()); - if (appDebugInfo == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "Read app debug infos failed."); - return ERR_INVALID_DATA; - } - appDebugInfos.emplace_back(*appDebugInfo); - } - - OnAppDebugStarted(appDebugInfos); - return NO_ERROR; -} - -int32_t AppDebugListenerStub::HandleOnAppDebugStoped(MessageParcel &data, MessageParcel &reply) -{ - auto infoSize = data.ReadInt32(); - if (infoSize <= CYCLE_LIMIT_MIN || infoSize > CYCLE_LIMIT_MAX) { - TAG_LOGE(AAFwkTag::APPMGR, "Token size exceeds limit."); - return ERR_INVALID_DATA; - } - - std::vector appDebugInfos; - for (int32_t index = 0; index < infoSize; index++) { - std::unique_ptr appDebugInfo(data.ReadParcelable()); - if (appDebugInfo == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "Read app debug infos failed."); - return ERR_INVALID_DATA; - } - appDebugInfos.emplace_back(*appDebugInfo); - } - - OnAppDebugStoped(appDebugInfos); - return NO_ERROR; -} -} // namespace AppExecFwk -} // namespace OHOS diff --git a/interfaces/inner_api/app_manager/src/appmgr/app_foreground_state_observer_proxy.cpp b/interfaces/inner_api/app_manager/src/appmgr/app_foreground_state_observer_proxy.cpp deleted file mode 100644 index 59d8eada735b3c5de307a06a882328c0bbdfa1e6..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/app_foreground_state_observer_proxy.cpp +++ /dev/null @@ -1,61 +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 "app_foreground_state_observer_proxy.h" - -#include "hilog_tag_wrapper.h" -#include "ipc_types.h" - -namespace OHOS { -namespace AppExecFwk { -AppForegroundStateObserverProxy::AppForegroundStateObserverProxy(const sptr &impl) - : IRemoteProxy(impl) -{} - -bool AppForegroundStateObserverProxy::WriteInterfaceToken(MessageParcel &data) -{ - if (!data.WriteInterfaceToken(AppForegroundStateObserverProxy::GetDescriptor())) { - TAG_LOGE(AAFwkTag::APPMGR, "Write interface token failed."); - return false; - } - return true; -} - -void AppForegroundStateObserverProxy::OnAppStateChanged(const AppStateData &appStateData) -{ - MessageParcel data; - if (!WriteInterfaceToken(data)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write Token failed."); - return; - } - if (!data.WriteParcelable(&appStateData)) { - TAG_LOGE(AAFwkTag::APPMGR, "Fail to write appStateData."); - return; - } - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "Remote is NULL."); - return; - } - MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - int32_t ret = remote->SendRequest( - static_cast(IAppForegroundStateObserver::Message::ON_APP_STATE_CHANGED), data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGE(AAFwkTag::APPMGR, "SendRequest is failed, error code: %{public}d.", ret); - } -} -} // namespace AppExecFwk -} // namespace OHOS diff --git a/interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_interface.h b/interfaces/inner_api/app_manager/src/appmgr/app_foreground_state_observer_recipient.cpp similarity index 49% rename from interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_interface.h rename to interfaces/inner_api/app_manager/src/appmgr/app_foreground_state_observer_recipient.cpp index f65b8edb92d93efdd66e5f6880314f423613ac93..35866522d3727281928963ec9c39483bc11b323a 100644 --- a/interfaces/inner_api/app_manager/include/appmgr/app_foreground_state_observer_interface.h +++ b/interfaces/inner_api/app_manager/src/appmgr/app_foreground_state_observer_recipient.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 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,25 +13,20 @@ * limitations under the License. */ -#ifndef OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_INTERFACE_H -#define OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_INTERFACE_H - -#include "app_state_data.h" -#include "iremote_broker.h" -#include "iremote_object.h" +#include "app_foreground_state_observer_recipient.h" +#include "hilog_tag_wrapper.h" namespace OHOS { namespace AppExecFwk { -class IAppForegroundStateObserver : public IRemoteBroker { -public: - DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.IAppForegroundStateObserver"); - - virtual void OnAppStateChanged(const AppStateData &appStateData) = 0; +AppForegroundStateObserverRecipient::AppForegroundStateObserverRecipient(RemoteDiedHandler handler) : handler_(handler) +{} - enum class Message { - ON_APP_STATE_CHANGED, - }; -}; +void AppForegroundStateObserverRecipient::OnRemoteDied(const wptr &__attribute__((unused)) remote) +{ + TAG_LOGE(AAFwkTag::APPMGR, "Remote died."); + if (handler_) { + handler_(remote); + } +} } // namespace AppExecFwk -} // namespace OHOS -#endif // OHOS_ABILITY_RUNTIME_APP_FOREGROUND_STATE_OBSERVER_INTERFACE_H +} // namespace OHOS \ No newline at end of file diff --git a/interfaces/inner_api/app_manager/src/appmgr/app_foreground_state_observer_stub.cpp b/interfaces/inner_api/app_manager/src/appmgr/app_foreground_state_observer_stub.cpp deleted file mode 100644 index b35443bb7900a4980be28a6b93bc9690d0c002f5..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/app_foreground_state_observer_stub.cpp +++ /dev/null @@ -1,70 +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 "app_foreground_state_observer_stub.h" - -#include "appexecfwk_errors.h" -#include "hilog_tag_wrapper.h" -#include "ipc_types.h" -#include "iremote_object.h" - -namespace OHOS { -namespace AppExecFwk { -AppForegroundStateObserverStub::AppForegroundStateObserverStub() {} - -AppForegroundStateObserverStub::~AppForegroundStateObserverStub() {} - -int32_t AppForegroundStateObserverStub::OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) -{ - TAG_LOGD(AAFwkTag::APPMGR, "called"); - std::u16string descriptor = AppForegroundStateObserverStub::GetDescriptor(); - std::u16string remoteDescriptor = data.ReadInterfaceToken(); - if (descriptor != remoteDescriptor) { - TAG_LOGE(AAFwkTag::APPMGR, "Local descriptor is not equal to remote."); - return ERR_INVALID_STATE; - } - - if (code == static_cast(IAppForegroundStateObserver::Message::ON_APP_STATE_CHANGED)) { - return HandleOnAppStateChanged(data, reply); - } - - return IPCObjectStub::OnRemoteRequest(code, data, reply, option); -} - -int32_t AppForegroundStateObserverStub::HandleOnAppStateChanged(MessageParcel &data, MessageParcel &reply) -{ - std::unique_ptr processData(data.ReadParcelable()); - if (processData == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "ProcessData is null."); - return ERR_APPEXECFWK_PARCEL_ERROR; - } - - OnAppStateChanged(*processData); - return NO_ERROR; -} - -AppForegroundStateObserverRecipient::AppForegroundStateObserverRecipient(RemoteDiedHandler handler) : handler_(handler) -{} - -void AppForegroundStateObserverRecipient::OnRemoteDied(const wptr &__attribute__((unused)) remote) -{ - TAG_LOGE(AAFwkTag::APPMGR, "Remote died."); - if (handler_) { - handler_(remote); - } -} -} // namespace AppExecFwk -} // namespace OHOS \ No newline at end of file diff --git a/interfaces/inner_api/app_manager/src/appmgr/start_specified_ability_response_proxy.cpp b/interfaces/inner_api/app_manager/src/appmgr/start_specified_ability_response_proxy.cpp deleted file mode 100644 index 024dfee1d07babb5c5b652b4b228d7d9c987b7e7..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/start_specified_ability_response_proxy.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2022-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 "start_specified_ability_response_proxy.h" -#include "ipc_types.h" -#include "hilog_tag_wrapper.h" - -namespace OHOS { -namespace AppExecFwk { -StartSpecifiedAbilityResponseProxy::StartSpecifiedAbilityResponseProxy(const sptr &impl) - : IRemoteProxy(impl) -{} - -bool StartSpecifiedAbilityResponseProxy::WriteInterfaceToken(MessageParcel &data) -{ - if (!data.WriteInterfaceToken(StartSpecifiedAbilityResponseProxy::GetDescriptor())) { - TAG_LOGE(AAFwkTag::APPMGR, "write interface token failed"); - return false; - } - return true; -} - -void StartSpecifiedAbilityResponseProxy::OnAcceptWantResponse( - const AAFwk::Want &want, const std::string &flag, int32_t requestId) -{ - TAG_LOGD(AAFwkTag::APPMGR, "On accept want by proxy."); - MessageParcel data; - MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - if (!WriteInterfaceToken(data)) { - return; - } - if (!data.WriteParcelable(&want) || !data.WriteString(flag) || - !data.WriteInt32(requestId)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write data failed."); - return; - } - - int32_t ret = SendTransactCmd( - static_cast(IStartSpecifiedAbilityResponse::Message::ON_ACCEPT_WANT_RESPONSE), data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGW(AAFwkTag::APPMGR, "SendRequest is failed, error code: %{public}d", ret); - } -} - -void StartSpecifiedAbilityResponseProxy::OnTimeoutResponse(int32_t requestId) -{ - TAG_LOGD(AAFwkTag::APPMGR, "On timeout response by proxy."); - MessageParcel data; - MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - if (!WriteInterfaceToken(data)) { - return; - } - if (!data.WriteInt32(requestId)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write data failed."); - return; - } - - int32_t ret = SendTransactCmd(static_cast( - IStartSpecifiedAbilityResponse::Message::ON_TIMEOUT_RESPONSE), data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGW(AAFwkTag::APPMGR, "SendRequest is failed, error code: %{public}d", ret); - } -} - -int32_t StartSpecifiedAbilityResponseProxy::SendTransactCmd(uint32_t code, MessageParcel &data, - MessageParcel &reply, MessageOption &option) -{ - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "Remote is nullptr."); - return ERR_NULL_OBJECT; - } - - return remote->SendRequest(code, data, reply, option); -} - -void StartSpecifiedAbilityResponseProxy::OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) -{ - TAG_LOGD(AAFwkTag::APPMGR, "On satrt specified process response by proxy."); - MessageParcel data; - MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - if (!WriteInterfaceToken(data)) { - return; - } - if (!data.WriteString(flag) || !data.WriteInt32(requestId)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write data failed."); - return; - } - - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "Remote is nullptr."); - return; - } - int32_t ret = remote->SendRequest( - static_cast(IStartSpecifiedAbilityResponse::Message::ON_NEW_PROCESS_REQUEST_RESPONSE), - data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGW(AAFwkTag::APPMGR, "SendRequest is failed, error code: %{public}d", ret); - } -} - -void StartSpecifiedAbilityResponseProxy::OnNewProcessRequestTimeoutResponse(int32_t requestId) -{ - TAG_LOGD(AAFwkTag::APPMGR, "On start specified process timeout response by proxy."); - MessageParcel data; - MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - if (!WriteInterfaceToken(data)) { - return; - } - if (data.WriteInt32(requestId)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write data failed."); - return; - } - - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "Remote is nullptr."); - return; - } - int32_t ret = remote->SendRequest(static_cast( - IStartSpecifiedAbilityResponse::Message::ON_NEW_PROCESS_REQUEST_TIMEOUT_RESPONSE), - data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGW(AAFwkTag::APPMGR, "SendRequest is failed, error code: %{public}d", ret); - } -} - -void StartSpecifiedAbilityResponseProxy::OnStartSpecifiedFailed(int32_t requestId) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - if (!WriteInterfaceToken(data)) { - return; - } - if (!data.WriteInt32(requestId)) { - TAG_LOGE(AAFwkTag::APPMGR, "Write data failed."); - return; - } - - int32_t ret = SendTransactCmd( - static_cast(IStartSpecifiedAbilityResponse::Message::ON_START_SPECIFIED_FAILED), data, reply, option); - if (ret != NO_ERROR) { - TAG_LOGW(AAFwkTag::APPMGR, "SendRequest is failed, error code: %{public}d", ret); - } -} -} // namespace AppExecFwk -} // namespace OHOS diff --git a/interfaces/inner_api/app_manager/src/appmgr/start_specified_ability_response_stub.cpp b/interfaces/inner_api/app_manager/src/appmgr/start_specified_ability_response_stub.cpp deleted file mode 100644 index 690da42b84a00652426d3e4dbc81d7c3663598d9..0000000000000000000000000000000000000000 --- a/interfaces/inner_api/app_manager/src/appmgr/start_specified_ability_response_stub.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2022-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 "start_specified_ability_response_stub.h" -#include "appexecfwk_errors.h" -#include "hilog_tag_wrapper.h" -#include "ipc_types.h" -#include "iremote_object.h" - -namespace OHOS { -namespace AppExecFwk { -int32_t StartSpecifiedAbilityResponseStub::HandleOnAcceptWantResponse(MessageParcel &data, MessageParcel &reply) -{ - AAFwk::Want *want = data.ReadParcelable(); - if (want == nullptr) { - TAG_LOGE(AAFwkTag::APPMGR, "want is nullptr"); - return ERR_INVALID_VALUE; - } - - auto flag = Str16ToStr8(data.ReadString16()); - OnAcceptWantResponse(*want, flag, data.ReadInt32()); - delete want; - return NO_ERROR; -} - -int32_t StartSpecifiedAbilityResponseStub::HandleOnTimeoutResponse(MessageParcel &data, MessageParcel &reply) -{ - OnTimeoutResponse(data.ReadInt32()); - return NO_ERROR; -} - -int32_t StartSpecifiedAbilityResponseStub::HandleOnNewProcessRequestResponse(MessageParcel &data, MessageParcel &reply) -{ - auto flag = Str16ToStr8(data.ReadString16()); - OnNewProcessRequestResponse(flag, data.ReadInt32()); - return NO_ERROR; -} - -int32_t StartSpecifiedAbilityResponseStub::HandleOnNewProcessRequestTimeoutResponse(MessageParcel &data, - MessageParcel &reply) -{ - OnNewProcessRequestTimeoutResponse(data.ReadInt32()); - return NO_ERROR; -} - -int32_t StartSpecifiedAbilityResponseStub::HandleOnStartSpecifiedFailed(MessageParcel &data, - MessageParcel &reply) -{ - OnStartSpecifiedFailed(data.ReadInt32()); - return NO_ERROR; -} - -int StartSpecifiedAbilityResponseStub::OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) -{ - TAG_LOGI(AAFwkTag::APPMGR, "StartSpecifiedAbilityResponseStub::OnReceived, code = %{public}u, flags= %{public}d.", - code, option.GetFlags()); - std::u16string descriptor = StartSpecifiedAbilityResponseStub::GetDescriptor(); - std::u16string remoteDescriptor = data.ReadInterfaceToken(); - if (descriptor != remoteDescriptor) { - TAG_LOGE(AAFwkTag::APPMGR, "local descriptor is not equal to remote"); - return ERR_INVALID_STATE; - } - - switch (code) { - case Message::ON_ACCEPT_WANT_RESPONSE: return HandleOnAcceptWantResponse(data, reply); - case Message::ON_TIMEOUT_RESPONSE: return HandleOnTimeoutResponse(data, reply); - case Message::ON_NEW_PROCESS_REQUEST_RESPONSE: return HandleOnNewProcessRequestResponse(data, reply); - case Message::ON_NEW_PROCESS_REQUEST_TIMEOUT_RESPONSE: - return HandleOnNewProcessRequestTimeoutResponse(data, reply); - case Message::ON_START_SPECIFIED_FAILED: return HandleOnStartSpecifiedFailed(data, reply); - default: return IPCObjectStub::OnRemoteRequest(code, data, reply, option); - } -} -} // namespace AppExecFwk -} // namespace OHOS diff --git a/interfaces/inner_api/wantagent/BUILD.gn b/interfaces/inner_api/wantagent/BUILD.gn index b1e9d373d3d8c656be1e22591d06408609ceea4b..e3c00c77ef8b08375edf62cc50caa92f3b365829 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 @@ -43,6 +43,10 @@ config("wantagent_innerkits_public_config") { "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime", "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context", ] + configs = [ + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits_config", + "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", + ] } ohos_shared_library("wantagent_innerkits") { diff --git a/services/abilitymgr/BUILD.gn b/services/abilitymgr/BUILD.gn index b0fd3beeac876bf5434115ebc2555215b245e4e8..94b1a2ade4e3e92174bac4605ee750ea1d6618fe 100644 --- a/services/abilitymgr/BUILD.gn +++ b/services/abilitymgr/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,7 @@ config("abilityms_config") { "${ability_runtime_path}/utils/global/time/include", "${ability_runtime_utils_path}/server/constant", ] - + configs = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits_config" ] defines = [] if (ability_command_for_test) { diff --git a/services/abilitymgr/abilitymgr.gni b/services/abilitymgr/abilitymgr.gni index 3f646c121f6c11eb390b711b87e6bcc8b1721f33..398c8a9c2163f66452754ec345149e8b114dffda 100644 --- a/services/abilitymgr/abilitymgr.gni +++ b/services/abilitymgr/abilitymgr.gni @@ -80,7 +80,6 @@ abilityms_files = [ "src/ui_extension_record/ui_extension_record_factory.cpp", "src/screen_lock/unlock_screen_manager.cpp", "src/start_options.cpp", - "src/user_callback_proxy.cpp", "src/call_container.cpp", "src/call_record.cpp", "src/inner_mission_info.cpp", diff --git a/services/abilitymgr/include/ability_debug_deal.h b/services/abilitymgr/include/ability_debug_deal.h index 13e446b090bedede16749721e33add5ae3b4ca30..64dc7d6063795c451c05ae63575426123765d2c6 100644 --- a/services/abilitymgr/include/ability_debug_deal.h +++ b/services/abilitymgr/include/ability_debug_deal.h @@ -1,5 +1,5 @@ /* - * 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 @@ -16,8 +16,8 @@ #ifndef OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_DEAL_H #define OHOS_ABILITY_RUNTIME_ABILITY_DEBUG_DEAL_H -#include "ability_debug_response_interface.h" #include "ability_debug_response_stub.h" +#include "iability_debug_response.h" namespace OHOS { namespace AAFwk { @@ -60,9 +60,9 @@ public: virtual ~AbilityDebugResponse() = default; private: - void OnAbilitysDebugStarted(const std::vector> &tokens) override; - void OnAbilitysDebugStoped(const std::vector> &tokens) override; - void OnAbilitysAssertDebugChange(const std::vector> &tokens, bool isAssertDebug) override; + ErrCode OnAbilitysDebugStarted(const std::vector> &tokens) override; + ErrCode OnAbilitysDebugStoped(const std::vector> &tokens) override; + ErrCode OnAbilitysAssertDebugChange(const std::vector> &tokens, bool isAssertDebug) override; std::weak_ptr abilityDebugDeal_; }; diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index ec5b8768550c6afc03f5ab9f231d6b7211a2ec0d..e945eff8b435e8a7882aeccfa6dc6614064ee5ed 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -37,7 +37,6 @@ #include "ability_keep_alive_service.h" #include "ability_start_with_wait_observer_utils.h" #include "ams_configuration_parameter.h" -#include "app_debug_listener_interface.h" #include "app_exit_reason_helper.h" #include "app_mgr_interface.h" #include "app_scheduler.h" @@ -52,6 +51,7 @@ #include "event_report.h" #include "free_install_manager.h" #include "iacquire_share_data_callback_interface.h" +#include "iapp_debug_listener.h" #include "interceptor/ability_interceptor_executer.h" #include "iremote_object.h" #include "mission_list_manager_interface.h" @@ -2170,7 +2170,7 @@ protected: int32_t GetCollaboratorType(const std::string &codePath) const; int32_t KillProcessForCollaborator(int32_t collaboratorType, const std::string &bundleName, int32_t userId); - + /** * Check if Caller is allowed to start AppServiceExtension(Stage). * @@ -2780,9 +2780,9 @@ private: ErrCode IntentOpenLinkInner(const std::shared_ptr ¶m, AbilityRuntime::ExtractInsightIntentGenericInfo &linkInfo, const int32_t userId); - + AbilityRuntime::ExtractInsightIntentGenericInfo GetInsightIntentGenericInfo(const InsightIntentExecuteParam ¶m); - + void CombinLinkInfo( const std::vector ¶mMappings, std::string &uri, AAFwk::Want &want); diff --git a/services/abilitymgr/include/app_scheduler.h b/services/abilitymgr/include/app_scheduler.h index b2de5a3951123671c45bf65a83bfed95c0db35da..e1eb97bf0ded9e95a27de140ec60a6ec0d309b66 100644 --- a/services/abilitymgr/include/app_scheduler.h +++ b/services/abilitymgr/include/app_scheduler.h @@ -19,20 +19,20 @@ #include #include -#include "ability_debug_response_interface.h" +#include "iability_debug_response.h" #include "ability_info.h" #include "ability_manager_client.h" -#include "app_debug_listener_interface.h" +#include "iapp_debug_listener.h" #include "application_info.h" #include "appmgr/app_mgr_client.h" #include "appmgr/app_state_callback_host.h" -#include "appmgr/start_specified_ability_response_stub.h" #include "bundle_info.h" #include "fault_data.h" #include "iremote_object.h" #include "refbase.h" #include "running_process_info.h" #include "singleton.h" +#include "start_specified_ability_response_stub.h" #include "system_memory_attr.h" #include "want.h" @@ -114,7 +114,7 @@ public: * @param abilityTokens abilities in died process. */ virtual void OnAppRemoteDied(const std::vector> &abilityTokens) {} - + virtual void OnStartProcessFailed(sptr token) {} virtual void OnCacheExitInfo(uint32_t accessTokenId, const AppExecFwk::RunningProcessInfo &exitInfo, @@ -127,14 +127,14 @@ public: StartSpecifiedAbilityResponse() = default; virtual ~StartSpecifiedAbilityResponse() = default; - virtual void OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, + virtual ErrCode OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, int32_t requestId) override; - virtual void OnTimeoutResponse(int32_t requestId) override; + virtual ErrCode OnTimeoutResponse(int32_t requestId) override; - virtual void OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) override; - virtual void OnNewProcessRequestTimeoutResponse(int32_t requestId) override; + virtual ErrCode OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) override; + virtual ErrCode OnNewProcessRequestTimeoutResponse(int32_t requestId) override; - virtual void OnStartSpecifiedFailed(int32_t requestId) override; + virtual ErrCode OnStartSpecifiedFailed(int32_t requestId) override; }; /** diff --git a/services/abilitymgr/src/ability_debug_deal.cpp b/services/abilitymgr/src/ability_debug_deal.cpp index 9493ef44d477c819b6405c76b41d33482b9b331e..7065cb9492eff78182b08ae3801fe7f0449e8be8 100644 --- a/services/abilitymgr/src/ability_debug_deal.cpp +++ b/services/abilitymgr/src/ability_debug_deal.cpp @@ -1,5 +1,5 @@ /* - * 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 @@ -74,50 +74,53 @@ void AbilityDebugDeal::OnAbilitysAssertDebugChange(const std::vector> &tokens) +ErrCode AbilityDebugResponse::OnAbilitysDebugStarted(const std::vector> &tokens) { if (tokens.empty()) { TAG_LOGW(AAFwkTag::ABILITYMGR, "tokens empty"); - return; + return ERR_INVALID_DATA; } auto deal = abilityDebugDeal_.lock(); if (deal == nullptr) { TAG_LOGE(AAFwkTag::ABILITYMGR, "deal null"); - return; + return ERR_INVALID_DATA; } deal->OnAbilitysDebugStarted(tokens); + return ERR_OK; } -void AbilityDebugResponse::OnAbilitysDebugStoped(const std::vector> &tokens) +ErrCode AbilityDebugResponse::OnAbilitysDebugStoped(const std::vector> &tokens) { if (tokens.empty()) { TAG_LOGW(AAFwkTag::ABILITYMGR, "tokens empty"); - return; + return ERR_INVALID_DATA; } auto deal = abilityDebugDeal_.lock(); if (deal == nullptr) { TAG_LOGE(AAFwkTag::ABILITYMGR, "deal null"); - return; + return ERR_INVALID_DATA; } deal->OnAbilitysDebugStoped(tokens); + return ERR_OK; } -void AbilityDebugResponse::OnAbilitysAssertDebugChange( +ErrCode AbilityDebugResponse::OnAbilitysAssertDebugChange( const std::vector> &tokens, bool isAssertDebug) { if (tokens.empty()) { TAG_LOGW(AAFwkTag::ABILITYMGR, "tokens empty"); - return; + return ERR_INVALID_DATA; } auto deal = abilityDebugDeal_.lock(); if (deal == nullptr) { TAG_LOGW(AAFwkTag::ABILITYMGR, "deal null"); - return; + return ERR_INVALID_DATA; } deal->OnAbilitysAssertDebugChange(tokens, isAssertDebug); + return ERR_OK; } } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/src/app_scheduler.cpp b/services/abilitymgr/src/app_scheduler.cpp index d6385c53b441b67a4d3d654c749e136024d108af..d26e6d7ffe6a89c043b20f133a6c7b59a58d70e2 100644 --- a/services/abilitymgr/src/app_scheduler.cpp +++ b/services/abilitymgr/src/app_scheduler.cpp @@ -386,10 +386,11 @@ void AppScheduler::StartSpecifiedAbility(const AAFwk::Want &want, const AppExecF IN_PROCESS_CALL_WITHOUT_RET(appMgrClient_->StartSpecifiedAbility(want, abilityInfo, requestId)); } -void StartSpecifiedAbilityResponse::OnAcceptWantResponse( +ErrCode StartSpecifiedAbilityResponse::OnAcceptWantResponse( const AAFwk::Want &want, const std::string &flag, int32_t requestId) { DelayedSingleton::GetInstance()->OnAcceptWantResponse(want, flag, requestId); + return ERR_OK; } void AppScheduler::PrepareTerminateApp(const pid_t pid, const std::string &moduleName) @@ -398,9 +399,10 @@ void AppScheduler::PrepareTerminateApp(const pid_t pid, const std::string &modul IN_PROCESS_CALL_WITHOUT_RET(appMgrClient_->PrepareTerminateApp(pid, moduleName)); } -void StartSpecifiedAbilityResponse::OnTimeoutResponse(int32_t requestId) +ErrCode StartSpecifiedAbilityResponse::OnTimeoutResponse(int32_t requestId) { DelayedSingleton::GetInstance()->OnStartSpecifiedAbilityTimeoutResponse(requestId); + return ERR_OK; } void AppScheduler::StartSpecifiedProcess( @@ -410,19 +412,22 @@ void AppScheduler::StartSpecifiedProcess( IN_PROCESS_CALL_WITHOUT_RET(appMgrClient_->StartSpecifiedProcess(want, abilityInfo, requestId)); } -void StartSpecifiedAbilityResponse::OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) +ErrCode StartSpecifiedAbilityResponse::OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) { DelayedSingleton::GetInstance()->OnStartSpecifiedProcessResponse(flag, requestId); + return ERR_OK; } -void StartSpecifiedAbilityResponse::OnNewProcessRequestTimeoutResponse(int32_t requestId) +ErrCode StartSpecifiedAbilityResponse::OnNewProcessRequestTimeoutResponse(int32_t requestId) { DelayedSingleton::GetInstance()->OnStartSpecifiedProcessTimeoutResponse(requestId); + return ERR_OK; } -void StartSpecifiedAbilityResponse::OnStartSpecifiedFailed(int32_t requestId) +ErrCode StartSpecifiedAbilityResponse::OnStartSpecifiedFailed(int32_t requestId) { DelayedSingleton::GetInstance()->OnStartSpecifiedFailed(requestId); + return ERR_OK; } int AppScheduler::GetProcessRunningInfos(std::vector &info) diff --git a/services/abilitymgr/src/user_callback_proxy.cpp b/services/abilitymgr/src/user_callback_proxy.cpp deleted file mode 100644 index a94521710d7886f3a2db28e4e9966335044b8fee..0000000000000000000000000000000000000000 --- a/services/abilitymgr/src/user_callback_proxy.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2021-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 "user_callback_proxy.h" - -#include "hilog_tag_wrapper.h" - -namespace OHOS { -namespace AAFwk { -void UserCallbackProxy::OnStopUserDone(int userId, int errcode) -{ - SendRequestCommon(userId, errcode, IUserCallback::UserCallbackCmd::ON_STOP_USER_DONE); -} - -void UserCallbackProxy::OnStartUserDone(int userId, int errcode) -{ - SendRequestCommon(userId, errcode, IUserCallback::UserCallbackCmd::ON_START_USER_DONE); -} - -void UserCallbackProxy::OnLogoutUserDone(int userId, int errcode) -{ - SendRequestCommon(userId, errcode, IUserCallback::UserCallbackCmd::ON_LOGOUT_USER_DONE); -} - -void UserCallbackProxy::SendRequestCommon(int userId, int errcode, IUserCallback::UserCallbackCmd cmd) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option(MessageOption::TF_ASYNC); - - TAG_LOGI(AAFwkTag::ABILITYMGR, - "UserCallbackProxy, sendrequest, cmd:%{public}d, userId:%{public}d, errcode:%{public}d", cmd, userId, errcode); - if (!data.WriteInterfaceToken(IUserCallback::GetDescriptor())) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "write interface token failed"); - return; - } - - if (!data.WriteInt32(userId)) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "write userId error"); - return; - } - - if (!data.WriteInt32(errcode)) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "write errcode error"); - return; - } - - sptr remote = Remote(); - if (remote == nullptr) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "null remote object"); - return; - } - - int error = remote->SendRequest(cmd, data, reply, option); - if (error != NO_ERROR) { - TAG_LOGE(AAFwkTag::ABILITYMGR, "SendRequest fail, error: %{public}d", error); - return; - } -} -} // namespace AAFwk -} // namespace OHOS diff --git a/services/abilitymgr/src/user_callback_stub.cpp b/services/abilitymgr/src/user_callback_stub.cpp deleted file mode 100644 index fe078586ffd957f68134f805f47a643769dd7f93..0000000000000000000000000000000000000000 --- a/services/abilitymgr/src/user_callback_stub.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2021-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 "user_callback_stub.h" - -#include "hilog_tag_wrapper.h" - -namespace OHOS { -namespace AAFwk { -UserCallbackStub::UserCallbackStub() {} - -int UserCallbackStub::OnStopUserDoneInner(MessageParcel &data, MessageParcel &reply) -{ - auto accountId = data.ReadInt32(); - auto errCode = data.ReadInt32(); - OnStopUserDone(accountId, errCode); - return NO_ERROR; -} - -int UserCallbackStub::OnStartUserDoneInner(MessageParcel &data, MessageParcel &reply) -{ - auto accountId = data.ReadInt32(); - auto errCode = data.ReadInt32(); - OnStartUserDone(accountId, errCode); - return NO_ERROR; -} - -int UserCallbackStub::OnLogoutUserDoneInner(MessageParcel &data, MessageParcel &reply) -{ - auto accountId = data.ReadInt32(); - auto errCode = data.ReadInt32(); - OnLogoutUserDone(accountId, errCode); - return NO_ERROR; -} - -int UserCallbackStub::OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) -{ - std::u16string descriptor = UserCallbackStub::GetDescriptor(); - std::u16string remoteDescriptor = data.ReadInterfaceToken(); - if (descriptor != remoteDescriptor) { - TAG_LOGI(AAFwkTag::ABILITYMGR, "local descriptor invalid"); - return ERR_INVALID_STATE; - } - - if (code < UserCallbackCmd::CMD_MAX && code >= 0) { - switch (code) { - case UserCallbackCmd::ON_STOP_USER_DONE: - return OnStopUserDoneInner(data, reply); - break; - case UserCallbackCmd::ON_START_USER_DONE: - return OnStartUserDoneInner(data, reply); - break; - case UserCallbackCmd::ON_LOGOUT_USER_DONE: - return OnLogoutUserDoneInner(data, reply); - break; - } - } - - return IPCObjectStub::OnRemoteRequest(code, data, reply, option); -} -} // namespace AAFwk -} // namespace OHOS diff --git a/services/appmgr/include/ams_mgr_scheduler.h b/services/appmgr/include/ams_mgr_scheduler.h index 69af744e93aa70926dfb03e69bfec5cd5d5aa538..28f6b3e78ff72f9b812a0ebfcce75e3da31b00cf 100644 --- a/services/appmgr/include/ams_mgr_scheduler.h +++ b/services/appmgr/include/ams_mgr_scheduler.h @@ -19,7 +19,6 @@ #include "ability_info.h" #include "ability_running_record.h" #include "ams_mgr_stub.h" -#include "app_debug_listener_interface.h" #include "app_mgr_constants.h" #include "app_mgr_service_inner.h" #include "app_record_id.h" @@ -27,6 +26,7 @@ #include "app_scheduler_proxy.h" #include "appexecfwk_errors.h" #include "application_info.h" +#include "iapp_debug_listener.h" #include "if_system_ability_manager.h" #include "nocopyable.h" #include "system_ability.h" diff --git a/services/appmgr/include/app_debug_manager.h b/services/appmgr/include/app_debug_manager.h index 8da182c9428beb521781100b6930ca21e0aba8b9..aae9db220dbcdaea243750c33db3b27fd2e844cb 100644 --- a/services/appmgr/include/app_debug_manager.h +++ b/services/appmgr/include/app_debug_manager.h @@ -1,5 +1,5 @@ /* - * 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 @@ -19,7 +19,7 @@ #include #include -#include "app_debug_listener_interface.h" +#include "iapp_debug_listener.h" namespace OHOS { namespace AppExecFwk { diff --git a/services/appmgr/include/app_mgr_service_inner.h b/services/appmgr/include/app_mgr_service_inner.h index 9bc66b07c2fc058a1746443ac4414a907518663c..599b7b3014d732388dfa8b65902040d504fa8241 100644 --- a/services/appmgr/include/app_mgr_service_inner.h +++ b/services/appmgr/include/app_mgr_service_inner.h @@ -24,14 +24,12 @@ #include #include -#include "ability_debug_response_interface.h" #include "ability_foreground_state_observer_interface.h" #include "ability_info.h" #include "advanced_security_mode_manager.h" #include "app_death_recipient.h" -#include "app_debug_listener_interface.h" +#include "iapp_debug_listener.h" #include "app_debug_manager.h" -#include "app_foreground_state_observer_interface.h" #include "app_malloc_info.h" #include "app_mgr_constants.h" #include "app_mgr_event.h" @@ -58,6 +56,8 @@ #include "fault_data.h" #include "fd_guard.h" #include "hisysevent.h" +#include "iapp_foreground_state_observer.h" +#include "iability_debug_response.h" #include "iapp_state_callback.h" #include "iapplication_state_observer.h" #include "iconfiguration_observer.h" @@ -81,7 +81,7 @@ #include "app_cjheap_mem_info.h" #include "running_multi_info.h" #include "multi_user_config_mgr.h" -#include "user_callback.h" +#include "iuser_callback.h" #include "native_child_notify_interface.h" namespace OHOS { diff --git a/services/appmgr/include/app_running_manager.h b/services/appmgr/include/app_running_manager.h index d92f1b5228b0dde430519a19ab1c77b73428ed99..061d13f2cd6334daba455ed0dae64e34dbc25188 100644 --- a/services/appmgr/include/app_running_manager.h +++ b/services/appmgr/include/app_running_manager.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 @@ -22,7 +22,7 @@ #include #include "ability_info.h" -#include "app_debug_listener_interface.h" +#include "iapp_debug_listener.h" #include "app_jsheap_mem_info.h" #include "app_cjheap_mem_info.h" #include "app_malloc_info.h" @@ -420,7 +420,7 @@ public: int32_t RemoveUIExtensionBindItemById(int32_t uiExtensionBindAbilityId); std::shared_ptr GetAppRunningRecordByChildRecordPid(const pid_t pid); - + int32_t AssignRunningProcessInfoByAppRecord( std::shared_ptr appRecord, AppExecFwk::RunningProcessInfo &info) const; diff --git a/services/appmgr/include/app_state_observer_manager.h b/services/appmgr/include/app_state_observer_manager.h index 89588f3376e98a9529bf5a18cfed54dee898395e..edc48346f626cd5916d4aa13148e1d0405ae579e 100644 --- a/services/appmgr/include/app_state_observer_manager.h +++ b/services/appmgr/include/app_state_observer_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 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 @@ -22,10 +22,10 @@ #include #include "ability_foreground_state_observer_interface.h" -#include "app_foreground_state_observer_interface.h" #include "app_running_record.h" #include "app_state_data.h" #include "cpp/mutex.h" +#include "iapp_foreground_state_observer.h" #include "iapp_state_callback.h" #include "iapplication_state_observer.h" #include "page_state_data.h" diff --git a/services/appmgr/src/app_state_observer_manager.cpp b/services/appmgr/src/app_state_observer_manager.cpp index c5443491634fc9e320023813fe91147448a2d11a..7685fe83f8d2e97cde7d49db8a9e368bbe6c493b 100644 --- a/services/appmgr/src/app_state_observer_manager.cpp +++ b/services/appmgr/src/app_state_observer_manager.cpp @@ -1,5 +1,5 @@ /* - * 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 @@ -16,6 +16,7 @@ #include "app_state_observer_manager.h" #include "ability_foreground_state_observer_stub.h" +#include "app_foreground_state_observer_recipient.h" #include "app_foreground_state_observer_stub.h" #include "application_state_observer_stub.h" #include "hilog_tag_wrapper.h" diff --git a/test/fuzztest/abilitydebugdeal_fuzzer/BUILD.gn b/test/fuzztest/abilitydebugdeal_fuzzer/BUILD.gn index f9c6a7be98b0b10f651f3016cf7977479bf9ecb7..8ddfb770b05721fd179ffa73388efc59c75f5598 100644 --- a/test/fuzztest/abilitydebugdeal_fuzzer/BUILD.gn +++ b/test/fuzztest/abilitydebugdeal_fuzzer/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023 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 @@ -37,7 +37,6 @@ ohos_fuzztest("AbilityDebugDealFuzzTest") { "-fno-omit-frame-pointer", ] sources = [ - "${ability_runtime_innerkits_path}/app_manager/src/appmgr/ability_debug_response_stub.cpp", "${ability_runtime_services_path}/abilitymgr/src/ability_debug_deal.cpp", "abilitydebugdeal_fuzzer.cpp", ] @@ -50,6 +49,7 @@ ohos_fuzztest("AbilityDebugDealFuzzTest") { deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", "${ability_runtime_innerkits_path}/ability_manager:ability_start_options", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", ] diff --git a/test/fuzztest/abilitydebugresponseproxy_fuzzer/BUILD.gn b/test/fuzztest/abilitydebugresponseproxy_fuzzer/BUILD.gn index 768834e2a31030ea533bc6a0c01692839bec5300..363a825f1b549469c7ade39958b0585c3fee8c5c 100755 --- a/test/fuzztest/abilitydebugresponseproxy_fuzzer/BUILD.gn +++ b/test/fuzztest/abilitydebugresponseproxy_fuzzer/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 @@ -36,7 +36,6 @@ ohos_fuzztest("AbilityDebugResponseProxyFuzzTest") { ] sources = [ - "${ability_runtime_innerkits_path}/app_manager/src/appmgr/ability_debug_response_proxy.cpp", "abilitydebugresponseproxy_fuzzer.cpp", ] @@ -48,6 +47,7 @@ ohos_fuzztest("AbilityDebugResponseProxyFuzzTest") { deps = [ "${ability_runtime_innerkits_path}/ability_manager:ability_manager", "${ability_runtime_innerkits_path}/ability_manager:ability_start_options", + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/deps_wrapper:ability_deps_wrapper", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_native_path}/ability/native:auto_startup_callback", diff --git a/test/fuzztest/abilitydebugresponseproxy_fuzzer/abilitydebugresponseproxy_fuzzer.cpp b/test/fuzztest/abilitydebugresponseproxy_fuzzer/abilitydebugresponseproxy_fuzzer.cpp index 7840d93e675deb7294dfad471df051e006418558..04bd6c2cf48871d6a2a4d99d391ee085221e3b90 100755 --- a/test/fuzztest/abilitydebugresponseproxy_fuzzer/abilitydebugresponseproxy_fuzzer.cpp +++ b/test/fuzztest/abilitydebugresponseproxy_fuzzer/abilitydebugresponseproxy_fuzzer.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 @@ -68,16 +68,10 @@ void AbilityDebugResponseProxyFuzztest1(bool boolParam, std::string &stringParam std::shared_ptr proxy = std::make_shared(nullptr); // branch constructor MessageParcel data; - proxy->WriteInterfaceToken(data); // branch std::vector> tokens; proxy->OnAbilitysDebugStarted(tokens); // branch proxy->OnAbilitysDebugStoped(tokens); // branch proxy->OnAbilitysAssertDebugChange(tokens, boolParam); // branch - sptr token = GetFuzzAbilityToken(); - tokens.emplace_back(token); - proxy->SendRequest(static_cast(int32Param), tokens); // branch tokens no empty. - tokens.clear(); - proxy->SendRequest(static_cast(int32Param), tokens); // branch tokens empty. } bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) diff --git a/test/fuzztest/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer.cpp b/test/fuzztest/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer.cpp index b09f529b4c3586f49641d25dbe92f48b6119de46..25969b4b201044158a59c96dfae628e25be3a7bd 100644 --- a/test/fuzztest/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer.cpp +++ b/test/fuzztest/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer/abilityinterfacesappmgrabilitydebugresponseproxy_fuzzer.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 @@ -20,7 +20,6 @@ #define private public #include "ability_debug_response_proxy.h" -#include "ability_debug_response_interface.h" #undef private #include "securec.h" @@ -73,17 +72,6 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) infosProxy->OnAbilitysDebugStoped(tokens); bool isAssertDebug = *data % ENABLE; infosProxy->OnAbilitysAssertDebugChange(tokens, isAssertDebug); - MessageParcel parcels; - parcels.WriteInterfaceToken(AMSMGR_INTERFACE_TOKEN); - parcels.WriteBuffer(data, size); - parcels.RewindRead(0); - infosProxy->WriteInterfaceToken(parcels); - IAbilityDebugResponse::Message message = IAbilityDebugResponse::Message::ON_ABILITYS_DEBUG_STARTED; - infosProxy->SendRequest(message, tokens); - message = IAbilityDebugResponse::Message::ON_ABILITYS_DEBUG_STOPED; - infosProxy->SendRequest(message, tokens); - message = IAbilityDebugResponse::Message::ON_ABILITYS_ASSERT_DEBUG; - infosProxy->SendRequest(message, tokens); return true; } } diff --git a/test/fuzztest/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer.cpp b/test/fuzztest/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer.cpp index bb28bb48cd9aa3f2e8154417ac0dd3238e539a4b..cf99b6d40aff686c8cd0490501336cdc9dd98fdc 100644 --- a/test/fuzztest/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer.cpp +++ b/test/fuzztest/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer/abilityinterfacesappmgrappdebuglistenerproxy_fuzzer.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 @@ -20,7 +20,6 @@ #define private public #include "app_debug_listener_proxy.h" -#include "app_debug_listener_interface.h" #undef private #include "securec.h" @@ -71,15 +70,6 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) std::vector debugInfos; infosProxy->OnAppDebugStarted(debugInfos); infosProxy->OnAppDebugStoped(debugInfos); - MessageParcel parcels; - parcels.WriteInterfaceToken(AMSMGR_INTERFACE_TOKEN); - parcels.WriteBuffer(data, size); - parcels.RewindRead(0); - infosProxy->WriteInterfaceToken(parcels); - IAppDebugListener::Message message = IAppDebugListener::Message::ON_APP_DEBUG_STARTED; - infosProxy->SendRequest(message, debugInfos); - message = IAppDebugListener::Message::ON_APP_DEBUG_STOPED; - infosProxy->SendRequest(message, debugInfos); return true; } } diff --git a/test/fuzztest/abilityinterfacesappmgrappdebuglistenerstub_fuzzer/abilityinterfacesappmgrappdebuglistenerstub_fuzzer.cpp b/test/fuzztest/abilityinterfacesappmgrappdebuglistenerstub_fuzzer/abilityinterfacesappmgrappdebuglistenerstub_fuzzer.cpp index 2b94e21e8d6fd6bd6bfcae798775df4bc7835bb0..79118353ee2c7b56a2bce6540b738d9449790949 100644 --- a/test/fuzztest/abilityinterfacesappmgrappdebuglistenerstub_fuzzer/abilityinterfacesappmgrappdebuglistenerstub_fuzzer.cpp +++ b/test/fuzztest/abilityinterfacesappmgrappdebuglistenerstub_fuzzer/abilityinterfacesappmgrappdebuglistenerstub_fuzzer.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 @@ -20,7 +20,6 @@ #define private public #include "app_debug_listener_stub.h" -#include "app_debug_listener_interface.h" #undef private #include "securec.h" @@ -55,8 +54,8 @@ public: virtual ~ AppDebugListenerStubFUZZ() {}; int OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override{ return 0; }; - void OnAppDebugStarted(const std::vector &debugInfos) override{}; - void OnAppDebugStoped(const std::vector &debugInfos) override{}; + ErrCode OnAppDebugStarted(const std::vector &debugInfos) override { return ERR_OK; }; + ErrCode OnAppDebugStoped(const std::vector &debugInfos) override { return ERR_OK; }; }; sptr GetFuzzAbilityToken() @@ -75,7 +74,7 @@ sptr GetFuzzAbilityToken() bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { - uint32_t codeOne = static_cast(IAppDebugListener::Message::ON_APP_DEBUG_STARTED); + uint32_t codeOne = static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STARTED); MessageParcel parcel; parcel.WriteInterfaceToken(AMSMGR_INTERFACE_TOKEN); parcel.WriteBuffer(data, size); @@ -84,7 +83,7 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) MessageOption option; std::shared_ptr abmsOne = std::make_shared(); abmsOne->OnRemoteRequest(codeOne, parcel, reply, option); - uint32_t codeTwo = static_cast(IAppDebugListener::Message::ON_APP_DEBUG_STOPED); + uint32_t codeTwo = static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STOPED); abmsOne->OnRemoteRequest(codeTwo, parcel, reply, option); return true; } diff --git a/test/fuzztest/abilityinterfacesappmgrappforegroundstateobserverstub_fuzzer/abilityinterfacesappmgrappforegroundstateobserverstub_fuzzer.cpp b/test/fuzztest/abilityinterfacesappmgrappforegroundstateobserverstub_fuzzer/abilityinterfacesappmgrappforegroundstateobserverstub_fuzzer.cpp index 049e3e8cc63e798662e0a96aa1bb821a86bfef0d..44214417b04dbfe9580f357af6d120c002b6f4a6 100644 --- a/test/fuzztest/abilityinterfacesappmgrappforegroundstateobserverstub_fuzzer/abilityinterfacesappmgrappforegroundstateobserverstub_fuzzer.cpp +++ b/test/fuzztest/abilityinterfacesappmgrappforegroundstateobserverstub_fuzzer/abilityinterfacesappmgrappforegroundstateobserverstub_fuzzer.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 @@ -19,8 +19,9 @@ #include #define private public +#include "app_foreground_state_observer_recipient.h" #include "app_foreground_state_observer_stub.h" -#include "app_foreground_state_observer_interface.h" +#include "iapp_foreground_state_observer.h" #undef private #include "securec.h" @@ -56,7 +57,10 @@ public: virtual ~ AppForegroundStateObserverStubFUZZ() {}; int OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override{ return 0; }; - void OnAppStateChanged(const AppStateData &appStateData) override{}; + ErrCode OnAppStateChanged(const AppStateData &appStateData) override + { + return ERR_OK; + }; }; sptr GetFuzzAbilityToken() @@ -75,7 +79,7 @@ sptr GetFuzzAbilityToken() bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) { - uint32_t code = static_cast(IAppForegroundStateObserver::Message::ON_APP_STATE_CHANGED); + uint32_t code = static_cast(IAppForegroundStateObserverIpcCode::COMMAND_ON_APP_STATE_CHANGED); MessageParcel parcel; parcel.WriteInterfaceToken(IA_APP_FOREGROUND_STATE_OBSERVER_TOKEN); parcel.WriteBuffer(data, size); diff --git a/test/fuzztest/usercallbackstub_fuzzer/usercallbackstub_fuzzer.cpp b/test/fuzztest/usercallbackstub_fuzzer/usercallbackstub_fuzzer.cpp index 11c5ff0e3f9f1ba60cb3c33d24cf90090cca5674..59a75929c1ef4d1fe53dd72ed363b2f627466395 100644 --- a/test/fuzztest/usercallbackstub_fuzzer/usercallbackstub_fuzzer.cpp +++ b/test/fuzztest/usercallbackstub_fuzzer/usercallbackstub_fuzzer.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 @@ -45,11 +45,9 @@ public: UserCallbackStubFuzzTest() = default; virtual ~UserCallbackStubFuzzTest() {} - void OnStopUserDone(int userId, int errcode) override - {} - void OnStartUserDone(int userId, int errcode) override {} - - void OnLogoutUserDone(int userId, int errcode) override {} + ErrCode OnStopUserDone(int userId, int errcode) override { return ERR_OK; } + ErrCode OnStartUserDone(int userId, int errcode) override { return ERR_OK; } + ErrCode OnLogoutUserDone(int userId, int errcode) override { return ERR_OK; } }; const std::u16string APPMGR_INTERFACE_TOKEN = u"ohos.aafwk.AppManager"; uint32_t GetU32Data(const char* ptr) @@ -70,8 +68,6 @@ bool DoSomethingInterestingWithMyAPI(const char *data, size_t size) MessageParcel reply; MessageOption option; backStub->OnRemoteRequest(code, dataParcel, reply, option); - backStub->OnStopUserDoneInner(dataParcel, reply); - backStub->OnStartUserDoneInner(dataParcel, reply); return true; } diff --git a/test/moduletest/app_mgr_client_test/BUILD.gn b/test/moduletest/app_mgr_client_test/BUILD.gn index 9a3c1e9e3ed30f6138aa90577216a64a8df50dff..409c2699258dacca81207a4e7d495782c9c73b22 100644 --- a/test/moduletest/app_mgr_client_test/BUILD.gn +++ b/test/moduletest/app_mgr_client_test/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 @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/mstabilitymgrservice" ohos_moduletest("app_mgr_client_test") { module_out_path = module_output_path - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_test_path}/mock/common/include", "${ability_runtime_test_path}/mock/mock_sa_call", diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index c6d53ceff4d1956bdd7252313171a8f4e0ae3c1d..0a8300cd1a9d7c7e9f224b632d35ceb981e48ab0 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -14,8 +14,7 @@ import("//build/ohos.gni") import("//build/test.gni") import("//foundation/ability/ability_runtime/ability_runtime.gni") -import( - "//foundation/ability/ability_runtime/services/abilitymgr/abilitymgr.gni") +import("//foundation/ability/ability_runtime/services/abilitymgr/abilitymgr.gni") config("appmgr_test_config") { configs = [ @@ -43,8 +42,6 @@ ohos_source_set("appmgr_test_source") { "${ability_runtime_innerkits_path}/app_manager/src/appmgr/app_record_id.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/app_scheduler_host.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/app_scheduler_proxy.cpp", - "${ability_runtime_innerkits_path}/app_manager/src/appmgr/app_state_callback_host.cpp", - "${ability_runtime_innerkits_path}/app_manager/src/appmgr/app_state_callback_proxy.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/fault_data.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/native_child_notify_proxy.cpp", "${ability_runtime_innerkits_path}/app_manager/src/appmgr/native_child_notify_stub.cpp", diff --git a/test/unittest/ability_debug_response_stub_test/ability_debug_response_stub_test.cpp b/test/unittest/ability_debug_response_stub_test/ability_debug_response_stub_test.cpp index 3167b3fa20fe2766f05ca22d936b6eda0e5ff3bf..ad8f8f90b749d10e4ea16bc49169a9e44b446409 100644 --- a/test/unittest/ability_debug_response_stub_test/ability_debug_response_stub_test.cpp +++ b/test/unittest/ability_debug_response_stub_test/ability_debug_response_stub_test.cpp @@ -1,5 +1,5 @@ /* - * 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 @@ -74,7 +74,7 @@ HWTEST_F(AbilityDebugResponseStubTest, HandleOnAbilitysDebugStarted_0100, TestSi data.WriteRemoteObject(token); auto result = stub->OnRemoteRequest( - static_cast(IAbilityDebugResponse::Message::ON_ABILITYS_DEBUG_STARTED), data, reply, option); + static_cast(IAbilityDebugResponseIpcCode::COMMAND_ON_ABILITYS_DEBUG_STARTED), data, reply, option); EXPECT_EQ(result, NO_ERROR); testing::Mock::AllowLeak(stub); GTEST_LOG_(INFO) << "AbilityDebugResponseProxyTest_HandleOnAbilitysDebugStarted_0100 end"; @@ -103,7 +103,7 @@ HWTEST_F(AbilityDebugResponseStubTest, HandleOnAbilitysDebugStoped_0100, TestSiz data.WriteRemoteObject(token); auto result = stub->OnRemoteRequest( - static_cast(IAbilityDebugResponse::Message::ON_ABILITYS_DEBUG_STOPED), data, reply, option); + static_cast(IAbilityDebugResponseIpcCode::COMMAND_ON_ABILITYS_DEBUG_STOPED), data, reply, option); EXPECT_EQ(result, NO_ERROR); testing::Mock::AllowLeak(stub); GTEST_LOG_(INFO) << "AbilityDebugResponseProxyTest_HandleOnAbilitysDebugStoped_0100 end"; diff --git a/test/unittest/ability_debug_response_stub_test/mock_ability_debug_response_stub.h b/test/unittest/ability_debug_response_stub_test/mock_ability_debug_response_stub.h index e4a257354df5e7ed0ecc1049011ab0f543bde68d..79f4777899911cd03d6a64d2e641bf41d59bcece 100644 --- a/test/unittest/ability_debug_response_stub_test/mock_ability_debug_response_stub.h +++ b/test/unittest/ability_debug_response_stub_test/mock_ability_debug_response_stub.h @@ -1,5 +1,5 @@ /* - * 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 @@ -27,9 +27,9 @@ class MockAbilityDebugResponseStub : public AbilityDebugResponseStub { public: MockAbilityDebugResponseStub() {} virtual ~ MockAbilityDebugResponseStub() {} - MOCK_METHOD1(OnAbilitysDebugStarted, void(const std::vector> &tokens)); - MOCK_METHOD1(OnAbilitysDebugStoped, void(const std::vector> &tokens)); - MOCK_METHOD2(OnAbilitysAssertDebugChange, void(const std::vector> &, bool)); + MOCK_METHOD1(OnAbilitysDebugStarted, ErrCode(const std::vector> &tokens)); + MOCK_METHOD1(OnAbilitysDebugStoped, ErrCode(const std::vector> &tokens)); + MOCK_METHOD2(OnAbilitysAssertDebugChange, ErrCode(const std::vector> &, bool)); }; } // namespace AppExecFwk } // namespace OHOS diff --git a/test/unittest/ability_manager_client_branch_second_test/BUILD.gn b/test/unittest/ability_manager_client_branch_second_test/BUILD.gn index ccd62f0691ec73b9d716c77f4a8720aa606e5068..100862c1c25611aac09a320994176597783f26ef 100644 --- a/test/unittest/ability_manager_client_branch_second_test/BUILD.gn +++ b/test/unittest/ability_manager_client_branch_second_test/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 @@ -16,7 +16,12 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_unittest("ability_manager_client_branch_second_test") { module_out_path = "ability_runtime/ability_runtime/ability_call_test" - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_test_path}/mock/ability_manager_collaborator", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock", diff --git a/test/unittest/ability_manager_client_branch_test/BUILD.gn b/test/unittest/ability_manager_client_branch_test/BUILD.gn index 44a1bc89fc60cad5d7c71fc5c16ed03da054f984..74881e2c3b91c4abeff29b0e948c02fdc413e2a0 100644 --- a/test/unittest/ability_manager_client_branch_test/BUILD.gn +++ b/test/unittest/ability_manager_client_branch_test/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 @@ -16,7 +16,12 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_unittest("ability_manager_client_branch_test") { module_out_path = "ability_runtime/ability_runtime/ability_call_test" - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_test_path}/mock/ability_manager_collaborator", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock", diff --git a/test/unittest/ability_manager_client_branch_third_test/BUILD.gn b/test/unittest/ability_manager_client_branch_third_test/BUILD.gn index 4d464465ef5874bdd52dee0de2279be4f08a208d..6fcb973b301cda7c1cebbe23e2c1735e4c96fcd7 100644 --- a/test/unittest/ability_manager_client_branch_third_test/BUILD.gn +++ b/test/unittest/ability_manager_client_branch_third_test/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 @@ -16,7 +16,12 @@ import("//foundation/ability/ability_runtime/ability_runtime.gni") ohos_unittest("ability_manager_client_branch_third_test") { module_out_path = "ability_runtime/ability_runtime/ability_call_test" - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "mock/include", "${ability_runtime_test_path}/mock/common/include", diff --git a/test/unittest/ability_manager_proxy_fourth_test/BUILD.gn b/test/unittest/ability_manager_proxy_fourth_test/BUILD.gn index 660c33c3f5105af111b3b3ff446ec6a508964798..3763375bdcbdca5bb69e68065f89af0e7c93ef2d 100644 --- a/test/unittest/ability_manager_proxy_fourth_test/BUILD.gn +++ b/test/unittest/ability_manager_proxy_fourth_test/BUILD.gn @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("ability_manager_proxy_fourth_test") { module_out_path = module_output_path - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock", "${ability_runtime_test_path}/unittest/ability_manager_proxy_fourth_test/", diff --git a/test/unittest/ability_manager_proxy_second_test/BUILD.gn b/test/unittest/ability_manager_proxy_second_test/BUILD.gn index f7442776ac31cd0a39cd31ed6bb9ddc1f2a1f739..d13e1cdb39fe6b2e7ece08c92c130313a9be76c9 100644 --- a/test/unittest/ability_manager_proxy_second_test/BUILD.gn +++ b/test/unittest/ability_manager_proxy_second_test/BUILD.gn @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("ability_manager_proxy_second_test") { module_out_path = module_output_path - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock", "${ability_runtime_test_path}/unittest/ability_manager_proxy_second_test/", diff --git a/test/unittest/ability_manager_proxy_test/BUILD.gn b/test/unittest/ability_manager_proxy_test/BUILD.gn index 697e6e567ea76186a90b90b29330e2821e85257b..232da0cd55a8e4d1b0c787eea1e996d90534cf12 100644 --- a/test/unittest/ability_manager_proxy_test/BUILD.gn +++ b/test/unittest/ability_manager_proxy_test/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 @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("ability_manager_proxy_test") { module_out_path = module_output_path - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock", "${ability_runtime_test_path}/unittest/ability_manager_proxy_test/", diff --git a/test/unittest/ability_manager_proxy_third_test/BUILD.gn b/test/unittest/ability_manager_proxy_third_test/BUILD.gn index 62f6e2dac84f3fc2e8494b3411eda1bb9711816b..09ae8600db6e7a467b03e9d3600cda8602184042 100644 --- a/test/unittest/ability_manager_proxy_third_test/BUILD.gn +++ b/test/unittest/ability_manager_proxy_third_test/BUILD.gn @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("ability_manager_proxy_third_test") { module_out_path = module_output_path - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock", "${ability_runtime_test_path}/unittest/ability_manager_proxy_third_test/", diff --git a/test/unittest/ability_manager_proxy_third_test/ability_manager_proxy_third_test.cpp b/test/unittest/ability_manager_proxy_third_test/ability_manager_proxy_third_test.cpp index 1a48b715b980fb73a1db49f66451261b340bb302..79ef873b77d7385f6e0ac38e54d98e6b9a1c5c13 100644 --- a/test/unittest/ability_manager_proxy_third_test/ability_manager_proxy_third_test.cpp +++ b/test/unittest/ability_manager_proxy_third_test/ability_manager_proxy_third_test.cpp @@ -75,10 +75,10 @@ public: MockIUserCallback() = default; virtual ~MockIUserCallback() = default; - void OnStopUserDone(int userId, int errcode) override {} - void OnStartUserDone(int userId, int errcode) override {} + ErrCode OnStopUserDone(int userId, int errcode) override { return ERR_OK; } + ErrCode OnStartUserDone(int userId, int errcode) override { return ERR_OK; } - void OnLogoutUserDone(int userId, int errcode) override {} + ErrCode OnLogoutUserDone(int userId, int errcode) override { return ERR_OK; } sptr AsObject() override { diff --git a/test/unittest/ability_manager_service_eighth_test/ability_manager_service_eighth_test.cpp b/test/unittest/ability_manager_service_eighth_test/ability_manager_service_eighth_test.cpp index 3984f0a987a4fd3de186279ae941bc021e2db083..dc7301c4e64e9b82d53e9ccaa49feb89547085fd 100644 --- a/test/unittest/ability_manager_service_eighth_test/ability_manager_service_eighth_test.cpp +++ b/test/unittest/ability_manager_service_eighth_test/ability_manager_service_eighth_test.cpp @@ -59,13 +59,10 @@ public: MockIUserCallback() = default; virtual ~MockIUserCallback() = default; - void OnStopUserDone(int userId, int errcode) override - {} - void OnStartUserDone(int userId, int errcode) override - {} + ErrCode OnStopUserDone(int userId, int errcode) override { return ERR_OK; } + ErrCode OnStartUserDone(int userId, int errcode) override { return ERR_OK; } - void OnLogoutUserDone(int userId, int errcode) override - {} + ErrCode OnLogoutUserDone(int userId, int errcode) override { return ERR_OK; } sptr AsObject() override { diff --git a/test/unittest/ability_manager_service_fourteenth_test/BUILD.gn b/test/unittest/ability_manager_service_fourteenth_test/BUILD.gn index ab184c53caf4f95061ebc084e598091e004db169..30b71cea492007903aeb1b455da859775aa10f8f 100644 --- a/test/unittest/ability_manager_service_fourteenth_test/BUILD.gn +++ b/test/unittest/ability_manager_service_fourteenth_test/BUILD.gn @@ -176,7 +176,6 @@ ohos_unittest("ability_manager_service_fourteenth_test") { "${ability_runtime_services_path}/abilitymgr/src/ui_extension/preload_uiext_state_observer.cpp", "${ability_runtime_services_path}/abilitymgr/src/ui_extension_record/ui_extension_record.cpp", "${ability_runtime_services_path}/abilitymgr/src/ui_extension_record/ui_extension_record_factory.cpp", - "${ability_runtime_services_path}/abilitymgr/src/user_callback_proxy.cpp", "${ability_runtime_services_path}/abilitymgr/src/user_controller.cpp", "${ability_runtime_services_path}/abilitymgr/src/user_event_handler.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/ability_event_util.cpp", diff --git a/test/unittest/ability_manager_service_second_test/BUILD.gn b/test/unittest/ability_manager_service_second_test/BUILD.gn index 8a6bb998d0cf66940c7c405b797adbc1e1131b3a..0bcdf3e900ae0b6404cf4ebfcb3027895acafbdb 100644 --- a/test/unittest/ability_manager_service_second_test/BUILD.gn +++ b/test/unittest/ability_manager_service_second_test/BUILD.gn @@ -181,7 +181,6 @@ ohos_unittest("ability_manager_service_second_test") { "${ability_runtime_services_path}/abilitymgr/src/ui_extension/preload_uiext_state_observer.cpp", "${ability_runtime_services_path}/abilitymgr/src/ui_extension_record/ui_extension_record.cpp", "${ability_runtime_services_path}/abilitymgr/src/ui_extension_record/ui_extension_record_factory.cpp", - "${ability_runtime_services_path}/abilitymgr/src/user_callback_proxy.cpp", "${ability_runtime_services_path}/abilitymgr/src/user_controller.cpp", "${ability_runtime_services_path}/abilitymgr/src/user_event_handler.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/ability_event_util.cpp", diff --git a/test/unittest/ability_manager_service_third_test/abilitymgr.gni b/test/unittest/ability_manager_service_third_test/abilitymgr.gni index 571d2a9352732abf5118f50bf0b2fc8d0cac0483..af9117bf388ed6e30e8677cb107103d8ef80de1b 100644 --- a/test/unittest/ability_manager_service_third_test/abilitymgr.gni +++ b/test/unittest/ability_manager_service_third_test/abilitymgr.gni @@ -79,7 +79,6 @@ abilityms_files = [ "${ability_runtime_services_path}/abilitymgr/src/ui_extension_record/ui_extension_record_factory.cpp", "${ability_runtime_services_path}/abilitymgr/src/screen_lock/unlock_screen_manager.cpp", "${ability_runtime_services_path}/abilitymgr/src/start_options.cpp", - "${ability_runtime_services_path}/abilitymgr/src/user_callback_proxy.cpp", "${ability_runtime_services_path}/abilitymgr/src/call_container.cpp", "${ability_runtime_services_path}/abilitymgr/src/call_record.cpp", "${ability_runtime_services_path}/abilitymgr/src/inner_mission_info.cpp", diff --git a/test/unittest/ability_manager_service_thirteenth_test/BUILD.gn b/test/unittest/ability_manager_service_thirteenth_test/BUILD.gn index 4b36e56edc8b519b9443705ef88bffc0890607bd..41689eb2cbe451caf1a9ab728d5e51b79d0b84c4 100644 --- a/test/unittest/ability_manager_service_thirteenth_test/BUILD.gn +++ b/test/unittest/ability_manager_service_thirteenth_test/BUILD.gn @@ -177,7 +177,6 @@ ohos_unittest("ability_manager_service_thirteenth_test") { "${ability_runtime_services_path}/abilitymgr/src/ui_extension/preload_uiext_state_observer.cpp", "${ability_runtime_services_path}/abilitymgr/src/ui_extension_record/ui_extension_record.cpp", "${ability_runtime_services_path}/abilitymgr/src/ui_extension_record/ui_extension_record_factory.cpp", - "${ability_runtime_services_path}/abilitymgr/src/user_callback_proxy.cpp", "${ability_runtime_services_path}/abilitymgr/src/user_controller.cpp", "${ability_runtime_services_path}/abilitymgr/src/user_event_handler.cpp", "${ability_runtime_services_path}/abilitymgr/src/utils/ability_event_util.cpp", diff --git a/test/unittest/ability_manager_service_twelfth_test/mock/include/mock_test_object.h b/test/unittest/ability_manager_service_twelfth_test/mock/include/mock_test_object.h index 215b46aa8e2b86ee3c13fcaf6b99958958f925b7..bb13da5d1da3f2f0cc90d9b96c76d1c885b341ed 100644 --- a/test/unittest/ability_manager_service_twelfth_test/mock/include/mock_test_object.h +++ b/test/unittest/ability_manager_service_twelfth_test/mock/include/mock_test_object.h @@ -16,16 +16,17 @@ #ifndef ABILITY_MANAGER_SERVICE_TWELFTH_TEST_MOCK_TEST_OBJECT_H #define ABILITY_MANAGER_SERVICE_TWELFTH_TEST_MOCK_TEST_OBJECT_H -#include "user_callback.h" +#include "iuser_callback.h" #include "ability_connect_callback_interface.h" +namespace OHOS { class MockIUserCallback : public OHOS::AAFwk::IUserCallback { public: MockIUserCallback() = default; virtual ~MockIUserCallback() = default; - virtual void OnStopUserDone(int userId, int errcode) override {} - virtual void OnStartUserDone(int userId, int errcode) override {} - virtual void OnLogoutUserDone(int userId, int errcode) override {} + virtual ErrCode OnStopUserDone(int userId, int errcode) override { return ERR_OK; } + virtual ErrCode OnStartUserDone(int userId, int errcode) override { return ERR_OK; } + virtual ErrCode OnLogoutUserDone(int userId, int errcode) override { return ERR_OK; } virtual OHOS::sptr AsObject() { return nullptr; @@ -44,4 +45,5 @@ public: return nullptr; } }; +} #endif // ABILITY_MANAGER_SERVICE_TWELFTH_TEST_MOCK_TEST_OBJECT_H diff --git a/test/unittest/ability_scheduler_stub_second_test/BUILD.gn b/test/unittest/ability_scheduler_stub_second_test/BUILD.gn index 537ffd064a30f5c5cf9127286e5de5cc83e19ec8..70a91787602fcff2a4ab68ea2bbd70044e2ffced 100644 --- a/test/unittest/ability_scheduler_stub_second_test/BUILD.gn +++ b/test/unittest/ability_scheduler_stub_second_test/BUILD.gn @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("ability_scheduler_stub_second_test") { module_out_path = module_output_path - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock" ] sources = [ diff --git a/test/unittest/ability_scheduler_stub_test/BUILD.gn b/test/unittest/ability_scheduler_stub_test/BUILD.gn index f8ce56fce58547aa71b7241ee88d375cb45a7863..6538b2d48dc8fe6cb52f34fffafeb9486a562979 100644 --- a/test/unittest/ability_scheduler_stub_test/BUILD.gn +++ b/test/unittest/ability_scheduler_stub_test/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 @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("ability_scheduler_stub_test") { module_out_path = module_output_path - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock" ] sources = [ diff --git a/test/unittest/ams_ability_running_record_test/BUILD.gn b/test/unittest/ams_ability_running_record_test/BUILD.gn index 5403becfe77332bd63a4d6105eacac1b3b3ec763..ca8ea03f12c06d037a64c5527fa6c0467bb8dc16 100644 --- a/test/unittest/ams_ability_running_record_test/BUILD.gn +++ b/test/unittest/ams_ability_running_record_test/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 @@ -18,6 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/appmgrservice" ohos_unittest("AmsAbilityRunningRecordTest") { module_out_path = module_output_path + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } cflags_cc = [] include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper", diff --git a/test/unittest/ams_mgr_scheduler_dump_test/BUILD.gn b/test/unittest/ams_mgr_scheduler_dump_test/BUILD.gn index 82fe5a49b19c89b0f279092f606323647e645404..91055070844c31efe8da1c72971223ecf577b256 100644 --- a/test/unittest/ams_mgr_scheduler_dump_test/BUILD.gn +++ b/test/unittest/ams_mgr_scheduler_dump_test/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 @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("ams_mgr_scheduler_dump_test") { module_out_path = module_output_path - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } sources = [ "ams_mgr_scheduler_dump_test.cpp" ] configs = [ "${ability_runtime_services_path}/appmgr:appmgr_config" ] diff --git a/test/unittest/ams_service_load_ability_process_test/BUILD.gn b/test/unittest/ams_service_load_ability_process_test/BUILD.gn index 6e21ffaa9de439eb1642d9d677d4a8ca5a62aca1..3c3939cae59c3a3e943047b81f22eef5850d5fab 100644 --- a/test/unittest/ams_service_load_ability_process_test/BUILD.gn +++ b/test/unittest/ams_service_load_ability_process_test/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 @@ -19,6 +19,12 @@ module_output_path = "ability_runtime/ability_runtime/appmgrservice" ohos_unittest("AmsServiceLoadAbilityProcessTest") { use_exceptions = true module_out_path = module_output_path + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } cflags_cc = [] include_dirs = [ "${ability_runtime_services_path}/appmgr/test/unittest/mocks", diff --git a/test/unittest/app_debug_listener_proxy_test/BUILD.gn b/test/unittest/app_debug_listener_proxy_test/BUILD.gn index 185afb3de5f50aa24312374712db22c6fb769878..1b24dfb7799385c687ae02944023b3f1abecd15a 100644 --- a/test/unittest/app_debug_listener_proxy_test/BUILD.gn +++ b/test/unittest/app_debug_listener_proxy_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 @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/appmgrservice" ohos_unittest("AppDebugListenerProxyTest") { module_out_path = module_output_path - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_services_path}/appmgr/include", "${ability_runtime_test_path}/mock/services_appmgr_test/include", diff --git a/test/unittest/app_debug_listener_proxy_test/app_debug_listener_proxy_test.cpp b/test/unittest/app_debug_listener_proxy_test/app_debug_listener_proxy_test.cpp index 18060b908299613d0ae2c6502830158dbcef8d8c..7bcc341e9b7c0ddcb77ad19322cf4a4d2d9553d0 100644 --- a/test/unittest/app_debug_listener_proxy_test/app_debug_listener_proxy_test.cpp +++ b/test/unittest/app_debug_listener_proxy_test/app_debug_listener_proxy_test.cpp @@ -1,5 +1,5 @@ /* - * 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 @@ -54,17 +54,6 @@ void AppDebugListenerProxyTest::SetUp() void AppDebugListenerProxyTest::TearDown() {} -/** - * @tc.name: WriteInterfaceToken_0100 - * @tc.desc: write token into parcel data - * @tc.type: FUNC - */ -HWTEST_F(AppDebugListenerProxyTest, WriteInterfaceToken_0100, TestSize.Level1) -{ - MessageParcel data; - EXPECT_TRUE(proxy_->WriteInterfaceToken(data)); -} - /** * @tc.name: OnAppDebugStarted_0100 * @tc.desc: Callback of app debug started, verify that AppDebugListener interface calls normally. @@ -83,7 +72,7 @@ HWTEST_F(AppDebugListenerProxyTest, OnAppDebugStarted_0100, TestSize.Level1) .Times(1) .WillOnce(Invoke(mock_.GetRefPtr(), &AppDebugListenerStubMock::InvokeSendRequest)); proxy_->OnAppDebugStarted(appDebugInfos); - auto code = static_cast(IAppDebugListener::Message::ON_APP_DEBUG_STARTED); + auto code = static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STARTED); EXPECT_EQ(code, static_cast(mock_->code_)); } @@ -105,7 +94,7 @@ HWTEST_F(AppDebugListenerProxyTest, OnAppDebugStoped_0100, TestSize.Level1) .Times(1) .WillOnce(Invoke(mock_.GetRefPtr(), &AppDebugListenerStubMock::InvokeSendRequest)); proxy_->OnAppDebugStoped(appDebugInfos); - auto code = static_cast(IAppDebugListener::Message::ON_APP_DEBUG_STOPED); + auto code = static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STOPED); EXPECT_EQ(code, static_cast(mock_->code_)); } } // namespace AppExecFwk diff --git a/test/unittest/app_debug_listener_proxy_test/app_debug_listener_stub_mock.h b/test/unittest/app_debug_listener_proxy_test/app_debug_listener_stub_mock.h index b3c81fc0dcb9c3855ed1500b02af403af1589a08..f96411fe7ae4a7efacba017283ebec17b4e97cfe 100644 --- a/test/unittest/app_debug_listener_proxy_test/app_debug_listener_stub_mock.h +++ b/test/unittest/app_debug_listener_proxy_test/app_debug_listener_stub_mock.h @@ -1,5 +1,5 @@ /* - * 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 @@ -19,7 +19,7 @@ #include #include #define private public -#include "app_debug_listener_interface.h" +#include "iapp_debug_listener.h" #undef private namespace OHOS { @@ -45,8 +45,8 @@ public: uint32_t code_ = 0; MOCK_METHOD4(SendRequest, int(uint32_t, MessageParcel &, MessageParcel &, MessageOption &)); - MOCK_METHOD1(OnAppDebugStarted, void(const std::vector &)); - MOCK_METHOD1(OnAppDebugStoped, void(const std::vector &)); + MOCK_METHOD1(OnAppDebugStarted, ErrCode(const std::vector &)); + MOCK_METHOD1(OnAppDebugStoped, ErrCode(const std::vector &)); }; } // namespace AppExecFwk } // namespace OHOS diff --git a/test/unittest/app_debug_listener_stub_test/app_debug_listener_stub_test.cpp b/test/unittest/app_debug_listener_stub_test/app_debug_listener_stub_test.cpp index 87754032c0240af3de2b7d04b46398e1bed62db0..0101270c41055514797a39d7120007c1c121bde9 100644 --- a/test/unittest/app_debug_listener_stub_test/app_debug_listener_stub_test.cpp +++ b/test/unittest/app_debug_listener_stub_test/app_debug_listener_stub_test.cpp @@ -1,5 +1,5 @@ /* - * 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 @@ -22,9 +22,9 @@ using namespace testing::ext; namespace OHOS { namespace AppExecFwk { namespace { - constexpr int32_t DEBUG_INFO_SIZE_ONE = 1; - constexpr int32_t DEBUG_INFO_SIZE_ZERO = 0; - constexpr uint32_t UNKNOWN_CODE = 2; +constexpr int32_t DEBUG_INFO_SIZE_ONE = 1; +constexpr int32_t DEBUG_INFO_SIZE_ZERO = 0; +constexpr uint32_t UNKNOWN_CODE = -1; } class AppDebugListenerStubTest : public testing::Test { public: @@ -73,7 +73,7 @@ HWTEST_F(AppDebugListenerStubTest, OnRemoteRequest_0100, TestSize.Level1) data.WriteParcelable(&debugInfo); auto result = mockStub_->OnRemoteRequest( - static_cast(IAppDebugListener::Message::ON_APP_DEBUG_STARTED), data, reply, option); + static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STARTED), data, reply, option); EXPECT_EQ(result, NO_ERROR); } @@ -91,8 +91,8 @@ HWTEST_F(AppDebugListenerStubTest, OnRemoteRequest_0200, TestSize.Level1) data.WriteInt32(DEBUG_INFO_SIZE_ZERO); auto result = mockStub_->OnRemoteRequest( - static_cast(IAppDebugListener::Message::ON_APP_DEBUG_STARTED), data, reply, option); - EXPECT_EQ(result, ERR_INVALID_STATE); + static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STARTED), data, reply, option); + EXPECT_EQ(result, ERR_TRANSACTION_FAILED); // ERR_TRANSACTION_FAILED for no interfaceToken data } /** @@ -128,8 +128,8 @@ HWTEST_F(AppDebugListenerStubTest, OnRemoteRequest_0400, TestSize.Level1) data.WriteInt32(DEBUG_INFO_SIZE_ZERO); auto result = mockStub_->OnRemoteRequest( - static_cast(IAppDebugListener::Message::ON_APP_DEBUG_STARTED), data, reply, option); - EXPECT_EQ(result, ERR_INVALID_DATA); + static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STARTED), data, reply, option); + EXPECT_EQ(result, ERR_NONE); } /** @@ -142,12 +142,14 @@ HWTEST_F(AppDebugListenerStubTest, HandleOnAppDebugStarted_0100, TestSize.Level1 EXPECT_NE(mockStub_, nullptr); MessageParcel data; MessageParcel reply; + MessageOption option(MessageOption::TF_ASYNC); AppDebugInfo debugInfo; data.WriteInt32(DEBUG_INFO_SIZE_ONE); data.WriteParcelable(&debugInfo); - EXPECT_CALL(*mockStub_, OnAppDebugStarted(_)).Times(1); - EXPECT_EQ(mockStub_->HandleOnAppDebugStarted(data, reply), NO_ERROR); + EXPECT_CALL(*mockStub_, OnAppDebugStarted(_)).Times(0); + mockStub_->OnRemoteRequest( + static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STARTED), data, reply, option); } /** @@ -160,13 +162,15 @@ HWTEST_F(AppDebugListenerStubTest, HandleOnAppDebugStarted_0200, TestSize.Level1 EXPECT_NE(mockStub_, nullptr); MessageParcel data; MessageParcel reply; + MessageOption option(MessageOption::TF_ASYNC); AppDebugInfo *debugInfo = nullptr; WriteInterfaceToken(data); data.WriteInt32(DEBUG_INFO_SIZE_ONE); data.WriteParcelable(debugInfo); EXPECT_CALL(*mockStub_, OnAppDebugStarted(_)).Times(0); - EXPECT_EQ(mockStub_->HandleOnAppDebugStarted(data, reply), ERR_INVALID_DATA); + mockStub_->OnRemoteRequest( + static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STARTED), data, reply, option); } /** @@ -179,12 +183,16 @@ HWTEST_F(AppDebugListenerStubTest, HandleOnAppDebugStoped_0100, TestSize.Level1) EXPECT_NE(mockStub_, nullptr); MessageParcel data; MessageParcel reply; + MessageOption option(MessageOption::TF_ASYNC); + WriteInterfaceToken(data); AppDebugInfo debugInfo; data.WriteInt32(DEBUG_INFO_SIZE_ONE); data.WriteParcelable(&debugInfo); EXPECT_CALL(*mockStub_, OnAppDebugStoped(_)).Times(1); - EXPECT_EQ(mockStub_->HandleOnAppDebugStoped(data, reply), NO_ERROR); + auto ret = mockStub_->OnRemoteRequest( + static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STOPED), data, reply, option); + EXPECT_EQ(ret, NO_ERROR); } /** @@ -197,13 +205,16 @@ HWTEST_F(AppDebugListenerStubTest, HandleOnAppDebugStoped_0200, TestSize.Level1) EXPECT_NE(mockStub_, nullptr); MessageParcel data; MessageParcel reply; + MessageOption option(MessageOption::TF_ASYNC); AppDebugInfo *debugInfo = nullptr; WriteInterfaceToken(data); data.WriteInt32(DEBUG_INFO_SIZE_ONE); data.WriteParcelable(debugInfo); EXPECT_CALL(*mockStub_, OnAppDebugStoped(_)).Times(0); - EXPECT_EQ(mockStub_->HandleOnAppDebugStoped(data, reply), ERR_INVALID_DATA); + auto ret = mockStub_->OnRemoteRequest( + static_cast(IAppDebugListenerIpcCode::COMMAND_ON_APP_DEBUG_STOPED), data, reply, option); + EXPECT_EQ(ret, ERR_INVALID_DATA); } } // namespace AppExecFwk } // namespace OHOS diff --git a/test/unittest/app_debug_listener_stub_test/mock_app_debug_listener_stub.h b/test/unittest/app_debug_listener_stub_test/mock_app_debug_listener_stub.h index 09418d059210b827316deaf5645456aad2a17457..010015b826c851f3faa901619367c2c726dfe137 100644 --- a/test/unittest/app_debug_listener_stub_test/mock_app_debug_listener_stub.h +++ b/test/unittest/app_debug_listener_stub_test/mock_app_debug_listener_stub.h @@ -1,5 +1,5 @@ /* - * 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 @@ -26,8 +26,8 @@ class MockAppDebugListenerStub : public AppDebugListenerStub { public: MockAppDebugListenerStub() {} virtual ~ MockAppDebugListenerStub() {} - MOCK_METHOD1(OnAppDebugStarted, void(const std::vector &debugInfos)); - MOCK_METHOD1(OnAppDebugStoped, void(const std::vector &debugInfos)); + MOCK_METHOD1(OnAppDebugStarted, ErrCode(const std::vector &debugInfos)); + MOCK_METHOD1(OnAppDebugStoped, ErrCode(const std::vector &debugInfos)); }; } // namespace AAFwk } // namespace OHOS 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 027540709f7d4abed631aac169cb92831db4f14f..ac3a16f21fb2ec55da1518359a6c612badae63bb 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 @@ -17,7 +17,6 @@ #include "ability_foreground_state_observer_interface.h" #include "ability_info.h" -#include "app_foreground_state_observer_interface.h" #include "app_malloc_info.h" #include "app_mgr_ipc_interface_code.h" #include "app_record_id.h" @@ -31,6 +30,7 @@ #include "app_cjheap_mem_info.h" #include "app_mgr_interface.h" #include "fault_data.h" +#include "iapp_foreground_state_observer.h" #include "iapp_state_callback.h" #include "iapplication_state_observer.h" #include "iconfiguration_observer.h" diff --git a/test/unittest/app_foreground_state_observer_proxy_test/BUILD.gn b/test/unittest/app_foreground_state_observer_proxy_test/BUILD.gn index e9c0e14555b7962519fa776c4de38f367e5fdce3..f33c454ea664238e3841157780ca3bcee5b03e9e 100644 --- a/test/unittest/app_foreground_state_observer_proxy_test/BUILD.gn +++ b/test/unittest/app_foreground_state_observer_proxy_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 @@ -26,7 +26,6 @@ ohos_unittest("app_foreground_state_observer_proxy_test") { ] sources = [ - "${ability_runtime_innerkits_path}/app_manager/src/appmgr/app_foreground_state_observer_proxy.cpp", "app_foreground_state_observer_proxy_test.cpp", ] diff --git a/test/unittest/app_foreground_state_observer_proxy_test/app_foreground_state_observer_proxy_test.cpp b/test/unittest/app_foreground_state_observer_proxy_test/app_foreground_state_observer_proxy_test.cpp index d7130616d3e2c3a534335809ddaee8ca5d07d278..abec790c3f5b3290278e6da9994b8fbd777075d0 100644 --- a/test/unittest/app_foreground_state_observer_proxy_test/app_foreground_state_observer_proxy_test.cpp +++ b/test/unittest/app_foreground_state_observer_proxy_test/app_foreground_state_observer_proxy_test.cpp @@ -49,17 +49,6 @@ void AppForegroundStateObserverProxyTest::SetUp() void AppForegroundStateObserverProxyTest::TearDown() {} -/** - * @tc.name: WriteInterfaceToken_0100 - * @tc.desc: Write token into parcel data. - * @tc.type: FUNC - */ -HWTEST_F(AppForegroundStateObserverProxyTest, WriteInterfaceToken_0100, TestSize.Level1) -{ - MessageParcel data; - EXPECT_TRUE(observerProxy_->WriteInterfaceToken(data)); -} - /** * @tc.name: OnAppStateChanged_0100 * @tc.desc: Test when the return of WriteInterfaceToken and diff --git a/test/unittest/app_foreground_state_observer_proxy_test/mock_app_foreground_state_observer_stub.h b/test/unittest/app_foreground_state_observer_proxy_test/mock_app_foreground_state_observer_stub.h index 6a6891932f4b27e19376eceda6f8cb37c2b9dfc9..3c280ec529804a6ef7822f5646c8c0c1f9936e09 100644 --- a/test/unittest/app_foreground_state_observer_proxy_test/mock_app_foreground_state_observer_stub.h +++ b/test/unittest/app_foreground_state_observer_proxy_test/mock_app_foreground_state_observer_stub.h @@ -1,5 +1,5 @@ /* - * 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 @@ -27,7 +27,7 @@ public: MockAppForegroundStateObserverStub() = default; virtual ~MockAppForegroundStateObserverStub() = default; - MOCK_METHOD1(OnAppStateChanged, void(const AppStateData &appStateData)); + MOCK_METHOD1(OnAppStateChanged, ErrCode(const AppStateData &appStateData)); }; } // namespace AppExecFwk } // namespace OHOS diff --git a/test/unittest/app_foreground_state_observer_stub_test/BUILD.gn b/test/unittest/app_foreground_state_observer_stub_test/BUILD.gn index f946137d66df80ca9336cc40140ac6fe43d8ff6a..d4c026264ab457f11b8117b06c07e0b4150ddbc4 100644 --- a/test/unittest/app_foreground_state_observer_stub_test/BUILD.gn +++ b/test/unittest/app_foreground_state_observer_stub_test/BUILD.gn @@ -25,11 +25,10 @@ ohos_unittest("app_foreground_state_observer_stub_test") { "${ability_runtime_test_path}/unittest/app_foreground_state_observer_proxy_test/", ] - sources = [ - "${ability_runtime_innerkits_path}/app_manager/src/appmgr/app_foreground_state_observer_stub.cpp", - "app_foreground_state_observer_stub_test.cpp", - ] + sources = [ "app_foreground_state_observer_stub_test.cpp" ] + configs = [ "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config" ] + deps = [ "${ability_runtime_innerkits_path}/app_manager:app_manager" ] external_deps = [ diff --git a/test/unittest/app_foreground_state_observer_stub_test/app_foreground_state_observer_stub_test.cpp b/test/unittest/app_foreground_state_observer_stub_test/app_foreground_state_observer_stub_test.cpp index 6643fe276bd5dd1abd22a8b33ce2d23cb602d702..dc2bbe07f3e66c3508be7b0f1b8dd675d28909b1 100644 --- a/test/unittest/app_foreground_state_observer_stub_test/app_foreground_state_observer_stub_test.cpp +++ b/test/unittest/app_foreground_state_observer_stub_test/app_foreground_state_observer_stub_test.cpp @@ -1,5 +1,5 @@ /* - * 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 @@ -51,25 +51,6 @@ void AppForegroundStateObserverStubTest::SetUp() void AppForegroundStateObserverStubTest::TearDown() {} -/** - * @tc.number: HandleOnAppStateChanged_0100 - * @tc.desc: Test when processData is not nullptr. - * @tc.type: FUNC - */ -HWTEST_F(AppForegroundStateObserverStubTest, HandleOnAppStateChanged_0100, TestSize.Level1) -{ - auto stub = new (std::nothrow) MockAppForegroundStateObserverStub(); - EXPECT_TRUE(stub); - EXPECT_CALL(*stub, OnAppStateChanged(_)).Times(1); - MessageParcel data; - AppStateData appStateData; - data.WriteParcelable(&appStateData); - MessageParcel reply; - auto result = stub->HandleOnAppStateChanged(data, reply); - EXPECT_EQ(NO_ERROR, result); - testing::Mock::AllowLeak(stub); -} - /** * @tc.number: OnRemoteRequest_0100 * @tc.desc: Test when descriptor and remoteDescriptor is different and diff --git a/test/unittest/app_foreground_state_observer_stub_test/mock_app_foreground_state_observer_stub.h b/test/unittest/app_foreground_state_observer_stub_test/mock_app_foreground_state_observer_stub.h index d61a16d97132c302aaebfe271547afd257bb85e1..ee71ee7fe5681cf58ba5b3a5531be135bba8c27a 100644 --- a/test/unittest/app_foreground_state_observer_stub_test/mock_app_foreground_state_observer_stub.h +++ b/test/unittest/app_foreground_state_observer_stub_test/mock_app_foreground_state_observer_stub.h @@ -1,5 +1,5 @@ /* - * 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 @@ -30,7 +30,7 @@ public: MockAppForegroundStateObserverStub() = default; virtual ~MockAppForegroundStateObserverStub() = default; - MOCK_METHOD1(OnAppStateChanged, void(const AppStateData &appStateData)); + MOCK_METHOD1(OnAppStateChanged, ErrCode(const AppStateData &appStateData)); }; } // namespace AppExecFwk } // namespace OHOS diff --git a/test/unittest/app_mgr_client_test/BUILD.gn b/test/unittest/app_mgr_client_test/BUILD.gn index 580be23be0891508790ce10ebf65e7050a619822..dce07e6590ec0709f8e7866407f635ed08fd8310 100644 --- a/test/unittest/app_mgr_client_test/BUILD.gn +++ b/test/unittest/app_mgr_client_test/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 @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/appmgrservice" ohos_unittest("AppMgrClientTest") { module_out_path = module_output_path - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } configs = [ "${ability_runtime_services_path}/common:common_config", "${ability_runtime_services_path}/abilitymgr:abilityms_config", diff --git a/test/unittest/app_mgr_proxy_test/app_mgr_proxy_test.cpp b/test/unittest/app_mgr_proxy_test/app_mgr_proxy_test.cpp index dcc5295348fe9d358b0fb4d80ccc62d38e5e7249..ee87429eb590d7d06dcd275fc79f93ff2bf52169 100644 --- a/test/unittest/app_mgr_proxy_test/app_mgr_proxy_test.cpp +++ b/test/unittest/app_mgr_proxy_test/app_mgr_proxy_test.cpp @@ -1,5 +1,5 @@ /* - * 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 @@ -39,8 +39,10 @@ public: AppForegroundStateObserverMock() = default; virtual ~AppForegroundStateObserverMock() = default; - void OnAppStateChanged(const AppStateData &appStateData) override - {} + ErrCode OnAppStateChanged(const AppStateData &appStateData) override + { + return ERR_OK; + } }; class RenderStateObserverMock : public RenderStateObserverStub { 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 a76ce33ce28c21a19d21319feeb2f433c99a6332..d6b2b7fe7bf553b35e2420ea3da08e4cca671452 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 @@ -104,14 +104,21 @@ public: class MyAbilityDebugResponse : public IAbilityDebugResponse { public: - void OnAbilitysDebugStarted(const std::vector> &tokens) override - {} + ErrCode OnAbilitysDebugStarted(const std::vector> &tokens) override + { + return ERR_OK; + } - void OnAbilitysDebugStoped(const std::vector> &tokens) override - {} + ErrCode OnAbilitysDebugStoped(const std::vector> &tokens) override + { + return ERR_OK; + } - void OnAbilitysAssertDebugChange(const std::vector> &tokens, - bool isAssertDebug) override {} + ErrCode OnAbilitysAssertDebugChange(const std::vector> &tokens, + bool isAssertDebug) override + { + return ERR_OK; + } sptr AsObject() override { @@ -121,16 +128,26 @@ public: class MyStartSpecifiedAbilityResponse : public IStartSpecifiedAbilityResponse { public: - void OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, int32_t requestId) override - {} - void OnTimeoutResponse(int32_t requestId) override - {} - void OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) override - {} - void OnNewProcessRequestTimeoutResponse(int32_t requestId) override - {} - void OnStartSpecifiedFailed(int32_t requestId) override - {} + ErrCode OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, int32_t requestId) override + { + return ERR_OK; + } + ErrCode OnTimeoutResponse(int32_t requestId) override + { + return ERR_OK; + } + ErrCode OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) override + { + return ERR_OK; + } + ErrCode OnNewProcessRequestTimeoutResponse(int32_t requestId) override + { + return ERR_OK; + } + ErrCode OnStartSpecifiedFailed(int32_t requestId) override + { + return ERR_OK; + } sptr AsObject() override { return nullptr; diff --git a/test/unittest/app_mgr_service_inner_fifth_test/BUILD.gn b/test/unittest/app_mgr_service_inner_fifth_test/BUILD.gn index 3b3d01c193ec3cff3c6feb33406a532fc57990df..51446b8b2bbdb2b300267c4bf9ff8d5d8ce07328 100644 --- a/test/unittest/app_mgr_service_inner_fifth_test/BUILD.gn +++ b/test/unittest/app_mgr_service_inner_fifth_test/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 @@ -45,7 +45,10 @@ ohos_unittest("AppMgrServiceInnerFifthTest") { "app_mgr_service_inner_fifth_test.cpp", ] - configs = [ "${ability_runtime_services_path}/appmgr:appmgr_config" ] + configs = [ + "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", + "${ability_runtime_services_path}/appmgr:appmgr_config", + ] deps = [ "${ability_runtime_path}/utils/server/startup:startup_util", diff --git a/test/unittest/app_mgr_service_inner_fourth_test/BUILD.gn b/test/unittest/app_mgr_service_inner_fourth_test/BUILD.gn index ba15d4f49525168df1af20b9aa3e1b8199092271..503ea10f94dd4383868e535bb84ecbb08ee97bd2 100644 --- a/test/unittest/app_mgr_service_inner_fourth_test/BUILD.gn +++ b/test/unittest/app_mgr_service_inner_fourth_test/BUILD.gn @@ -44,7 +44,10 @@ ohos_unittest("AppMgrServiceInnerFourthTest") { "mock/src/mock_permission_verification.cpp", ] - configs = [ "${ability_runtime_services_path}/appmgr:appmgr_config" ] + configs = [ + "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", + "${ability_runtime_services_path}/appmgr:appmgr_config", + ] cflags = [ "-Dprivate=public", diff --git a/test/unittest/app_mgr_service_inner_ninth_test/app_mgr_service_inner_ninth_test.cpp b/test/unittest/app_mgr_service_inner_ninth_test/app_mgr_service_inner_ninth_test.cpp index ebbdfb05c5285f435261fe900cd2a8f17acbce13..002b575b4f41087b27aa3de6ebf0fed94e45c94b 100644 --- a/test/unittest/app_mgr_service_inner_ninth_test/app_mgr_service_inner_ninth_test.cpp +++ b/test/unittest/app_mgr_service_inner_ninth_test/app_mgr_service_inner_ninth_test.cpp @@ -67,14 +67,21 @@ public: class MyAbilityDebugResponse : public IAbilityDebugResponse { public: - void OnAbilitysDebugStarted(const std::vector> &tokens) override - {} + ErrCode OnAbilitysDebugStarted(const std::vector> &tokens) override + { + return ERR_OK; + } - void OnAbilitysDebugStoped(const std::vector> &tokens) override - {} + ErrCode OnAbilitysDebugStoped(const std::vector> &tokens) override + { + return ERR_OK; + } - void OnAbilitysAssertDebugChange(const std::vector> &tokens, - bool isAssertDebug) override {} + ErrCode OnAbilitysAssertDebugChange(const std::vector> &tokens, + bool isAssertDebug) override + { + return ERR_OK; + } sptr AsObject() override { @@ -84,16 +91,12 @@ public: class MyStartSpecifiedAbilityResponse : public IStartSpecifiedAbilityResponse { public: - void OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, int32_t requestId) override - {} - void OnTimeoutResponse(int32_t requestId) override - {} - void OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) override - {} - void OnNewProcessRequestTimeoutResponse(int32_t requestId) override - {} - void OnStartSpecifiedFailed(int32_t requestId) override - {} + ErrCode OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, int32_t requestId) override + { return ERR_OK; } + ErrCode OnTimeoutResponse(int32_t requestId) override { return ERR_OK; } + ErrCode OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) override { return ERR_OK; } + ErrCode OnNewProcessRequestTimeoutResponse(int32_t requestId) override { return ERR_OK; } + ErrCode OnStartSpecifiedFailed(int32_t requestId) override { return ERR_OK; } sptr AsObject() override { return nullptr; diff --git a/test/unittest/app_mgr_service_inner_second_test/mock/include/mock_ability_debug_response_stub.h b/test/unittest/app_mgr_service_inner_second_test/mock/include/mock_ability_debug_response_stub.h index b3cd1f2cae52126ecfbb22c72faaba35c075d3d4..1c2349bb8738fde1c59522bfab76e82aded34e5c 100644 --- a/test/unittest/app_mgr_service_inner_second_test/mock/include/mock_ability_debug_response_stub.h +++ b/test/unittest/app_mgr_service_inner_second_test/mock/include/mock_ability_debug_response_stub.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 @@ -27,9 +27,9 @@ class MockAbilityDebugResponseStub : public AbilityDebugResponseStub { public: MockAbilityDebugResponseStub() {} virtual ~ MockAbilityDebugResponseStub() {} - MOCK_METHOD1(OnAbilitysDebugStarted, void(const std::vector> &tokens)); - MOCK_METHOD1(OnAbilitysDebugStoped, void(const std::vector> &tokens)); - MOCK_METHOD2(OnAbilitysAssertDebugChange, void(const std::vector> &, bool)); + MOCK_METHOD1(OnAbilitysDebugStarted, ErrCode(const std::vector> &tokens)); + MOCK_METHOD1(OnAbilitysDebugStoped, ErrCode(const std::vector> &tokens)); + MOCK_METHOD2(OnAbilitysAssertDebugChange, ErrCode(const std::vector> &, bool)); }; } // namespace AppExecFwk } // namespace OHOS diff --git a/test/unittest/app_mgr_service_inner_seventh_test/app_mgr_service_inner_seventh_test.cpp b/test/unittest/app_mgr_service_inner_seventh_test/app_mgr_service_inner_seventh_test.cpp index 65aa161005ff1c310678c365d9806260c3a0c296..3275de233108d943906df90bc90255a9965ee3c2 100644 --- a/test/unittest/app_mgr_service_inner_seventh_test/app_mgr_service_inner_seventh_test.cpp +++ b/test/unittest/app_mgr_service_inner_seventh_test/app_mgr_service_inner_seventh_test.cpp @@ -55,16 +55,26 @@ public: class MyStartSpecifiedAbilityResponse : public IStartSpecifiedAbilityResponse { public: - void OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, int32_t requestId) override - {} - void OnTimeoutResponse(int32_t requestId) override - {} - void OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) override - {} - void OnNewProcessRequestTimeoutResponse(int32_t requestId) override - {} - void OnStartSpecifiedFailed(int32_t requestId) override - {} + ErrCode OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, int32_t requestId) override + { + return ERR_OK; + } + ErrCode OnTimeoutResponse(int32_t requestId) override + { + return ERR_OK; + } + ErrCode OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) override + { + return ERR_OK; + } + ErrCode OnNewProcessRequestTimeoutResponse(int32_t requestId) override + { + return ERR_OK; + } + ErrCode OnStartSpecifiedFailed(int32_t requestId) override + { + return ERR_OK; + } sptr AsObject() override { return nullptr; diff --git a/test/unittest/app_mgr_service_inner_tenth_test/app_mgr_service_inner_tenth_test.cpp b/test/unittest/app_mgr_service_inner_tenth_test/app_mgr_service_inner_tenth_test.cpp index 74b33289f770d997880bf8b57bdc8d566f64bc89..50896942bcd30d2750682a80b28718af3d8ccb0c 100644 --- a/test/unittest/app_mgr_service_inner_tenth_test/app_mgr_service_inner_tenth_test.cpp +++ b/test/unittest/app_mgr_service_inner_tenth_test/app_mgr_service_inner_tenth_test.cpp @@ -67,14 +67,21 @@ public: class MyAbilityDebugResponse : public IAbilityDebugResponse { public: - void OnAbilitysDebugStarted(const std::vector> &tokens) override - {} + ErrCode OnAbilitysDebugStarted(const std::vector> &tokens) override + { + return ERR_OK; + } - void OnAbilitysDebugStoped(const std::vector> &tokens) override - {} + ErrCode OnAbilitysDebugStoped(const std::vector> &tokens) override + { + return ERR_OK; + } - void OnAbilitysAssertDebugChange(const std::vector> &tokens, - bool isAssertDebug) override {} + ErrCode OnAbilitysAssertDebugChange(const std::vector> &tokens, + bool isAssertDebug) override + { + return ERR_OK; + } sptr AsObject() override { return nullptr; @@ -83,16 +90,16 @@ public: class MyStartSpecifiedAbilityResponse : public IStartSpecifiedAbilityResponse { public: - void OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, int32_t requestId) override - {} - void OnTimeoutResponse(int32_t requestId) override - {} - void OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) override - {} - void OnNewProcessRequestTimeoutResponse(int32_t requestId) override - {} - void OnStartSpecifiedFailed(int32_t requestId) override - {} + ErrCode OnAcceptWantResponse(const AAFwk::Want &want, const std::string &flag, int32_t requestId) override + { return ERR_OK; } + ErrCode OnTimeoutResponse(int32_t requestId) override + { return ERR_OK; } + ErrCode OnNewProcessRequestResponse(const std::string &flag, int32_t requestId) override + { return ERR_OK; } + ErrCode OnNewProcessRequestTimeoutResponse(int32_t requestId) override + { return ERR_OK; } + ErrCode OnStartSpecifiedFailed(int32_t requestId) override + { return ERR_OK; } sptr AsObject() override { return nullptr; diff --git a/test/unittest/app_mgr_service_inner_test/app_mgr_service_inner_test.cpp b/test/unittest/app_mgr_service_inner_test/app_mgr_service_inner_test.cpp index 789b3287a5bbd0d01a02e498a0c7e317497cf635..8c790ffe6e49386b9efa72bd0c0a85317972f96a 100644 --- a/test/unittest/app_mgr_service_inner_test/app_mgr_service_inner_test.cpp +++ b/test/unittest/app_mgr_service_inner_test/app_mgr_service_inner_test.cpp @@ -117,13 +117,9 @@ public: MockIUserCallback() = default; virtual ~MockIUserCallback() = default; - void OnStopUserDone(int userId, int errcode) override - {} - void OnStartUserDone(int userId, int errcode) override - {} - - void OnLogoutUserDone(int userId, int errcode) override - {} + ErrCode OnStopUserDone(int userId, int errcode) override { return ERR_OK; } + ErrCode OnStartUserDone(int userId, int errcode) override { return ERR_OK; } + ErrCode OnLogoutUserDone(int userId, int errcode) override { return ERR_OK; } sptr AsObject() override { diff --git a/test/unittest/app_mgr_stub_test/app_mgr_stub_test.cpp b/test/unittest/app_mgr_stub_test/app_mgr_stub_test.cpp index 7cdbab6100cb6b8934dde76ddf2957e339c410c8..0c3b84b4fa46c2270fda8e6030dc681411ff5aa9 100644 --- a/test/unittest/app_mgr_stub_test/app_mgr_stub_test.cpp +++ b/test/unittest/app_mgr_stub_test/app_mgr_stub_test.cpp @@ -41,8 +41,10 @@ class AppForegroundStateObserverMock : public AppForegroundStateObserverStub { public: AppForegroundStateObserverMock() = default; virtual ~AppForegroundStateObserverMock() = default; - void OnAppStateChanged(const AppStateData &appStateData) override - {} + ErrCode OnAppStateChanged(const AppStateData &appStateData) override + { + return ERR_OK; + } }; class RenderStateObserverMock : public RenderStateObserverStub { diff --git a/test/unittest/app_preloader_test/BUILD.gn b/test/unittest/app_preloader_test/BUILD.gn index e271f94abcbddec64cbed76f09af70efe866f520..d7ef4044942c44764e5c6729b37f297d498836a6 100755 --- a/test/unittest/app_preloader_test/BUILD.gn +++ b/test/unittest/app_preloader_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,6 +33,7 @@ ohos_unittest("app_preloader_test") { ] deps = [ + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_path}/utils/server/startup:startup_util", "${ability_runtime_services_path}/appmgr:libappms", ] diff --git a/test/unittest/app_service_extension_context_test/BUILD.gn b/test/unittest/app_service_extension_context_test/BUILD.gn index d39c7285832c2316f884da6ac75b72e31f491ce0..8affea4ae647076d451cd42eec467ee1635edd9c 100644 --- a/test/unittest/app_service_extension_context_test/BUILD.gn +++ b/test/unittest/app_service_extension_context_test/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 @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/app_service_extension" ohos_unittest("app_service_extension_context_test") { module_out_path = module_output_path - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock", "${ability_runtime_native_path}/ability/native", diff --git a/test/unittest/app_state_observer_manager_test/BUILD.gn b/test/unittest/app_state_observer_manager_test/BUILD.gn index 44be34d331acf67b4cf788744e5ff9448b00bdff..7213a5762d0c862d0a1e112cb1f0074d4125d131 100755 --- a/test/unittest/app_state_observer_manager_test/BUILD.gn +++ b/test/unittest/app_state_observer_manager_test/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 @@ -18,6 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/appmgr" ohos_unittest("app_state_observer_manager_test") { module_out_path = module_output_path + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } cflags_cc = [] include_dirs = [ "${ability_runtime_services_path}/appmgr/include", diff --git a/test/unittest/app_state_observer_manager_test/app_state_observer_manager_test.cpp b/test/unittest/app_state_observer_manager_test/app_state_observer_manager_test.cpp index f111a1b1ab29fa78afdff712d7ccd3c110f578f3..58a41c6de78adcb55b14a96c480598cf0250fe6b 100644 --- a/test/unittest/app_state_observer_manager_test/app_state_observer_manager_test.cpp +++ b/test/unittest/app_state_observer_manager_test/app_state_observer_manager_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 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 @@ -69,8 +69,10 @@ class AppForegroundStateObserver : public AppForegroundStateObserverStub { public: AppForegroundStateObserver() = default; virtual ~AppForegroundStateObserver() = default; - void OnAppStateChanged(const AppStateData &appStateData) override - {} + ErrCode OnAppStateChanged(const AppStateData &appStateData) override + { + return ERR_OK; + } }; class AppSpawnSocketTest : public testing::Test { public: diff --git a/test/unittest/app_state_observer_manager_test_second/BUILD.gn b/test/unittest/app_state_observer_manager_test_second/BUILD.gn index 3d4392147642abcfbf3d67062482596c617f5fcf..fd05483526897e96b91c11ad017219e67597227c 100755 --- a/test/unittest/app_state_observer_manager_test_second/BUILD.gn +++ b/test/unittest/app_state_observer_manager_test_second/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 @@ -18,6 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/appmgr" ohos_unittest("app_state_observer_manager_test_second") { module_out_path = module_output_path + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } cflags_cc = [] include_dirs = [ "${ability_runtime_services_path}/appmgr/include", diff --git a/test/unittest/app_state_observer_manager_test_second/app_state_observer_manager_test_second.cpp b/test/unittest/app_state_observer_manager_test_second/app_state_observer_manager_test_second.cpp index 44d9810de9b59f7f5fc16c31fa970fee7a344324..c292a92eae1686ca641d8ff0cf7fd22c911261dd 100644 --- a/test/unittest/app_state_observer_manager_test_second/app_state_observer_manager_test_second.cpp +++ b/test/unittest/app_state_observer_manager_test_second/app_state_observer_manager_test_second.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 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 @@ -87,8 +87,10 @@ class AppForegroundStateObserver : public AppForegroundStateObserverStub { public: AppForegroundStateObserver() = default; virtual ~AppForegroundStateObserver() = default; - void OnAppStateChanged(const AppStateData &appStateData) override - {} + ErrCode OnAppStateChanged(const AppStateData &appStateData) override + { + return ERR_OK; + } }; class AppStateObserverManagerTestSecond : public testing::Test { public: diff --git a/test/unittest/call_record_test/BUILD.gn b/test/unittest/call_record_test/BUILD.gn index a9bfa99149f9d97d2661f71574762b425265c7b3..e0a4790d7ca847f87d90436f2bd04274d79b43f2 100644 --- a/test/unittest/call_record_test/BUILD.gn +++ b/test/unittest/call_record_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 @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("call_record_test") { module_out_path = module_output_path - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_test_path}/mock/frameworks_kits_ability_ability_runtime_test/AMS", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/ability_scheduler_mock", diff --git a/test/unittest/data_ability_manager_test/BUILD.gn b/test/unittest/data_ability_manager_test/BUILD.gn index 2596754c4780c6b1778a2eab8691c50836d7eedd..2d1908956a8e87c960fad0518b846f02f37798ae 100644 --- a/test/unittest/data_ability_manager_test/BUILD.gn +++ b/test/unittest/data_ability_manager_test/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 @@ -24,9 +24,11 @@ ohos_unittest("data_ability_manager_test") { "${ability_runtime_test_path}/mock/services_abilitymgr_test/include", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock", "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/ability_scheduler_mock", + "${ability_runtime_innerkits_path}/app_manager/include", "${ability_runtime_innerkits_path}/ability_manager/include", "${ability_runtime_path}/interfaces/kits/native/ability/native", "${ability_runtime_services_path}/common/include", + "${ability_runtime_services_path}/include", ] sources = [ diff --git a/test/unittest/dfr_test/watchdog_test/BUILD.gn b/test/unittest/dfr_test/watchdog_test/BUILD.gn index 7d977ca14785d8bdd9e5f2bf001f48a3bcf0deb2..1b119fb9764edff6b9c94cb57ad5c1fa02b8a499 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 @@ -64,6 +64,7 @@ ohos_unittest("watchdog_test") { ] deps = [ + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_innerkits_path}/runtime:runtime", "${ability_runtime_native_path}/appkit:appkit_native", ] diff --git a/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn b/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn index bea5089ae746e30037f88870954e304eaa757e26..0e87078bdf3efefaaa70632585f4fe2577485e6d 100644 --- a/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn +++ b/test/unittest/frameworks_kits_appkit_native_test/BUILD.gn @@ -37,6 +37,10 @@ config("module_private_config") { config("module_context_config") { visibility = [ ":*" ] + configs = [ + "${ability_runtime_innerkits_path}/ability_manager:ability_manager_innerkits_config", + "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", + ] include_dirs = [ "${ability_runtime_innerkits_path}/app_manager/include/appmgr", "${ability_runtime_test_path}/mock/frameworks_kits_appkit_native_test/include", @@ -1019,7 +1023,10 @@ ohos_unittest("idle_time_test") { configs = [ ":module_context_config" ] - deps = [ "${ability_runtime_native_path}/appkit:appkit_native" ] + deps = [ + "${ability_runtime_innerkits_path}/app_manager:app_manager", + "${ability_runtime_native_path}/appkit:appkit_native", + ] external_deps = [ "ability_runtime:runtime", diff --git a/test/unittest/mission_list_test/BUILD.gn b/test/unittest/mission_list_test/BUILD.gn index 00cbd596216ca16957039d9788f99f6b112db8c5..65a64913010576da47f9168a6270562d27417284 100644 --- a/test/unittest/mission_list_test/BUILD.gn +++ b/test/unittest/mission_list_test/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 @@ -84,6 +84,7 @@ ohos_unittest("mission_list_test_call") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", "${ability_runtime_services_path}/abilitymgr:mission_list", diff --git a/test/unittest/multi_instance_utils_second_test/mock_iapp_mgr.h b/test/unittest/multi_instance_utils_second_test/mock_iapp_mgr.h index 536be151058a382a8a5c478902745bd818b5941d..cabfac5285b30d519892ac4e4d9f5228cffe10ca 100644 --- a/test/unittest/multi_instance_utils_second_test/mock_iapp_mgr.h +++ b/test/unittest/multi_instance_utils_second_test/mock_iapp_mgr.h @@ -17,7 +17,6 @@ #include "ability_foreground_state_observer_interface.h" #include "ability_info.h" -#include "app_foreground_state_observer_interface.h" #include "app_malloc_info.h" #include "app_mgr_ipc_interface_code.h" #include "app_record_id.h" @@ -31,6 +30,7 @@ #include "app_mgr_interface.h" #include "fault_data.h" #include "iapp_state_callback.h" +#include "iapp_foreground_state_observer.h" #include "iapplication_state_observer.h" #include "iconfiguration_observer.h" #include "iquick_fix_callback.h" diff --git a/test/unittest/pending_want_test/BUILD.gn b/test/unittest/pending_want_test/BUILD.gn index b9a780e467e0e8f143b459de15eff686dcc02a30..db803aab578e76e3dd82866531377a4196277fa3 100644 --- a/test/unittest/pending_want_test/BUILD.gn +++ b/test/unittest/pending_want_test/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 @@ -19,6 +19,12 @@ module_output_path = "ability_runtime/ability_runtime/wantagent" ohos_unittest("pending_want_test") { module_out_path = module_output_path + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context/", "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime", diff --git a/test/unittest/quick_fix/quick_fix_manager_service_test/BUILD.gn b/test/unittest/quick_fix/quick_fix_manager_service_test/BUILD.gn index e35e6e9b2e2805d76a2f31464c1bbdc23962e566..f9bf19ec8eedb5295a4e6ec55cb072d1386c98b6 100644 --- a/test/unittest/quick_fix/quick_fix_manager_service_test/BUILD.gn +++ b/test/unittest/quick_fix/quick_fix_manager_service_test/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 @@ -68,7 +68,11 @@ ohos_unittest("quick_fix_manager_service_test") { ohos_unittest("quick_fix_manager_apply_task_test") { module_out_path = "ability_runtime/ability_runtime/quick_fix" - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_bundle_manager_helper", "${ability_runtime_test_path}/unittest/quick_fix/mock/include", diff --git a/test/unittest/service_extension_context_test/BUILD.gn b/test/unittest/service_extension_context_test/BUILD.gn index b6a7c73efc1f222d54cbf5566233f4ee6690cc3c..23dbc979e4d33eb2cb3bdcad53a4df020915081a 100644 --- a/test/unittest/service_extension_context_test/BUILD.gn +++ b/test/unittest/service_extension_context_test/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 @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("service_extension_context_test") { module_out_path = module_output_path - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock", "${ability_runtime_native_path}/ability/native", diff --git a/test/unittest/state_utils_test/BUILD.gn b/test/unittest/state_utils_test/BUILD.gn index 99bec30e48bed5b3e973f08c13a6f2c614b38265..bbde094090acc3d16101d55c8209bd29f6ac7580 100644 --- a/test/unittest/state_utils_test/BUILD.gn +++ b/test/unittest/state_utils_test/BUILD.gn @@ -31,7 +31,7 @@ ohos_unittest("state_utils_test") { ] include_dirs = [] - deps = [] + deps = [ "${ability_runtime_path}/utils/server/startup:startup_util" ] external_deps = [ "ability_runtime:abilitykit_native", diff --git a/test/unittest/stop_user_callback_proxy_test/BUILD.gn b/test/unittest/stop_user_callback_proxy_test/BUILD.gn index bf90b09291f48073ed4a9b40f45c128f11bbee6b..20c03e2ac265ec229e862ea63f3e3d15486eb653 100755 --- a/test/unittest/stop_user_callback_proxy_test/BUILD.gn +++ b/test/unittest/stop_user_callback_proxy_test/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 @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("stop_user_callback_proxy_test") { module_out_path = module_output_path - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock" ] sources = [ diff --git a/test/unittest/stop_user_callback_proxy_test/stop_user_callback_proxy_test.cpp b/test/unittest/stop_user_callback_proxy_test/stop_user_callback_proxy_test.cpp index bea826a0aa508985527c648c197ee242ae7aaf38..2318c78e8f56993bc69aaa03ab2997dc04c3e4be 100755 --- a/test/unittest/stop_user_callback_proxy_test/stop_user_callback_proxy_test.cpp +++ b/test/unittest/stop_user_callback_proxy_test/stop_user_callback_proxy_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 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 @@ -64,7 +64,7 @@ HWTEST_F(StopUserCallbackProxyTest, OnStopUserDone_001, TestSize.Level1) int userId = 0; int errcode = 0; proxy_->OnStopUserDone(userId, errcode); - EXPECT_EQ(IUserCallback::UserCallbackCmd::ON_STOP_USER_DONE, mock_->code_); + EXPECT_EQ(static_cast(IUserCallbackIpcCode::COMMAND_ON_STOP_USER_DONE), mock_->code_); } /* @@ -83,7 +83,7 @@ HWTEST_F(StopUserCallbackProxyTest, OnStopUserDone_002, TestSize.Level1) int userId = 0; int errcode = 0; proxy_->OnStopUserDone(userId, errcode); - EXPECT_EQ(IUserCallback::UserCallbackCmd::ON_STOP_USER_DONE, mock_->code_); + EXPECT_EQ(static_cast(IUserCallbackIpcCode::COMMAND_ON_STOP_USER_DONE), mock_->code_); } } // namespace AAFwk } // namespace OHOS diff --git a/test/unittest/stop_user_callback_proxy_test/stop_user_callback_stub_mock.h b/test/unittest/stop_user_callback_proxy_test/stop_user_callback_stub_mock.h index 59a6b0595612f5fab2961051b1f3ef512e5896ed..4c7456b77577340b9c1b9ef2a7161994adda8f60 100755 --- a/test/unittest/stop_user_callback_proxy_test/stop_user_callback_stub_mock.h +++ b/test/unittest/stop_user_callback_proxy_test/stop_user_callback_stub_mock.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 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 @@ -18,7 +18,7 @@ #include #include #include -#include "user_callback.h" +#include "iuser_callback.h" namespace OHOS { namespace AAFwk { @@ -45,9 +45,9 @@ public: int code_ = 0; - virtual void OnStopUserDone(int userId, int errcode) {}; - virtual void OnStartUserDone(int userId, int errcode) {} - virtual void OnLogoutUserDone(int userId, int errcode) {} + virtual ErrCode OnStopUserDone(int userId, int errcode) { return ERR_OK; }; + virtual ErrCode OnStartUserDone(int userId, int errcode) { return ERR_OK; } + virtual ErrCode OnLogoutUserDone(int userId, int errcode) { return ERR_OK; } }; } // namespace AAFwk } // namespace OHOS diff --git a/test/unittest/stop_user_callback_stub_test/BUILD.gn b/test/unittest/stop_user_callback_stub_test/BUILD.gn index 3f8036ff4f229e0e92946d981ab85d315f994402..dab1f292a8fd6c653682ca42be23359775a1c1b4 100644 --- a/test/unittest/stop_user_callback_stub_test/BUILD.gn +++ b/test/unittest/stop_user_callback_stub_test/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 @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("stop_user_callback_stub_test") { module_out_path = module_output_path - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock", "${ability_runtime_innerkits_path}/test/fuzztest/stopusercallbackstub_fuzzer", diff --git a/test/unittest/stop_user_callback_stub_test/stop_user_callback_stub_test.cpp b/test/unittest/stop_user_callback_stub_test/stop_user_callback_stub_test.cpp index 7e6b49e383dcb0f8207e54e2c1e292eb8dc90c5a..c7a64817d19bc1bc7653430a2becf58b4863f1f7 100644 --- a/test/unittest/stop_user_callback_stub_test/stop_user_callback_stub_test.cpp +++ b/test/unittest/stop_user_callback_stub_test/stop_user_callback_stub_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 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 @@ -27,11 +27,13 @@ public: MockStopUserCallbackStub() = default; virtual ~MockStopUserCallbackStub() {} - void OnStopUserDone(int userId, int errcode) override - {} - void OnStartUserDone(int userId, int errcode) override {} + ErrCode OnStopUserDone(int userId, int errcode) override + { + return ERR_OK; + } + ErrCode OnStartUserDone(int userId, int errcode) override { return ERR_OK; } - void OnLogoutUserDone(int userId, int errcode) override {} + ErrCode OnLogoutUserDone(int userId, int errcode) override { return ERR_OK; } }; class StopUserCallbackStubTest : public testing::Test { @@ -68,7 +70,7 @@ HWTEST_F(StopUserCallbackStubTest, StopUserCallbackStubTest_001, TestSize.Level1 data.WriteString16(value); auto result = backStub->OnRemoteRequest(code, data, reply, option); - EXPECT_EQ(result, ERR_INVALID_STATE); + EXPECT_EQ(result, ERR_TRANSACTION_FAILED); GTEST_LOG_(INFO) << "StopUserCallbackStubTest_001 end"; } @@ -85,11 +87,11 @@ HWTEST_F(StopUserCallbackStubTest, StopUserCallbackStubTest_002, TestSize.Level1 MessageParcel data; MessageParcel reply; MessageOption option; - std::u16string metaDescriptor_ = u"ohos.aafwk.UserCallback"; + std::u16string metaDescriptor_ = u"OHOS.AAFwk.IUserCallback"; data.WriteInterfaceToken(metaDescriptor_); auto result = backStub->OnRemoteRequest(code, data, reply, option); - EXPECT_EQ(result, IPC_STUB_UNKNOW_TRANS_ERR); + EXPECT_EQ(result, ERR_NONE); GTEST_LOG_(INFO) << "StopUserCallbackStubTest_002 end"; } @@ -106,10 +108,10 @@ HWTEST_F(StopUserCallbackStubTest, StopUserCallbackStubTest_003, TestSize.Level1 MessageParcel data; MessageParcel reply; MessageOption option; - std::u16string metaDescriptor_ = u"ohos.aafwk.UserCallback"; + std::u16string metaDescriptor_ = u"OHOS.AAFwk.IUserCallback"; data.WriteInterfaceToken(metaDescriptor_); auto result = backStub->OnRemoteRequest(code, data, reply, option); - EXPECT_EQ(result, ERR_NONE); + EXPECT_EQ(result, IPC_STUB_UNKNOW_TRANS_ERR); GTEST_LOG_(INFO) << "StopUserCallbackStubTest_003 end"; } diff --git a/test/unittest/timeout_state_utils_test/BUILD.gn b/test/unittest/timeout_state_utils_test/BUILD.gn index 4b9f11b64778d59b5b1583ca04b2bf3e85d4b35b..1e9e6a196ffddc6af10a83235b5cba6b9e246549 100644 --- a/test/unittest/timeout_state_utils_test/BUILD.gn +++ b/test/unittest/timeout_state_utils_test/BUILD.gn @@ -19,7 +19,10 @@ module_output_path = "ability_runtime/ability_runtime/state_utils_test" ohos_unittest("timeout_state_utils_test") { module_out_path = module_output_path - configs = [ "${ability_runtime_services_path}/abilitymgr:abilityms_config" ] + configs = [ + "${ability_runtime_services_path}/abilitymgr:abilityms_config", + "${ability_runtime_path}/utils/server/startup:startup_util_config", + ] if (target_cpu == "arm") { cflags = [ "-DBINDER_IPC_32BIT" ] diff --git a/test/unittest/unlock_screen_test/BUILD.gn b/test/unittest/unlock_screen_test/BUILD.gn index 5032698033c2dc9b684091ac3ef7788db0f71a4b..7e6f119e2463d7fc33999fb46cca878b35d586e7 100644 --- a/test/unittest/unlock_screen_test/BUILD.gn +++ b/test/unittest/unlock_screen_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 @@ -38,6 +38,7 @@ ohos_unittest("unlock_screen_test") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ + "${ability_runtime_innerkits_path}/app_manager:app_manager", "${ability_runtime_native_path}/ability/native:abilitykit_native", "${ability_runtime_services_path}/abilitymgr:abilityms", ] diff --git a/test/unittest/user_controller_test/BUILD.gn b/test/unittest/user_controller_test/BUILD.gn index 0fbe66cd0d182a729c556b18cfd7cbfd1a33a755..120a32b4bfa7e225dae36acb5e691a51779559cc 100644 --- a/test/unittest/user_controller_test/BUILD.gn +++ b/test/unittest/user_controller_test/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 @@ -18,6 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("user_controller_test") { module_out_path = module_output_path + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } sources = [ "user_controller_test.cpp" ] diff --git a/test/unittest/user_controller_test/user_controller_test.cpp b/test/unittest/user_controller_test/user_controller_test.cpp index 83088ea5f10fdfdfc3c842f210dd0f100dd4a3ef..9b4710642f875c047a863a47a550afb7e99e612c 100644 --- a/test/unittest/user_controller_test/user_controller_test.cpp +++ b/test/unittest/user_controller_test/user_controller_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 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 @@ -51,21 +51,22 @@ void UserControllerTest::TearDown() class TestUserCallback : public UserCallbackStub { public: - void OnStopUserDone(int userId, int errcode) override; - void OnStartUserDone(int userId, int errcode) override; - void OnLogoutUserDone(int userId, int errcode) override; + ErrCode OnStopUserDone(int userId, int errcode) override; + ErrCode OnStartUserDone(int userId, int errcode) override; + ErrCode OnLogoutUserDone(int userId, int errcode) override; int errCode_ = -1; }; -void TestUserCallback::OnStartUserDone(int userId, int errcode) +ErrCode TestUserCallback::OnStartUserDone(int userId, int errcode) { errCode_ = errcode; + return ERR_OK; } -void TestUserCallback::OnStopUserDone(int userId, int errcode) {} +ErrCode TestUserCallback::OnStopUserDone(int userId, int errcode) { return ERR_OK; } -void TestUserCallback::OnLogoutUserDone(int userId, int errcode) {} +ErrCode TestUserCallback::OnLogoutUserDone(int userId, int errcode) { return ERR_OK; } /** * @tc.name: UserItemSetState_0100 diff --git a/test/unittest/want_sender_info_test/BUILD.gn b/test/unittest/want_sender_info_test/BUILD.gn index 2ae36e4a825a5c7c4b89274af517640883a8fdab..fed944b2617215fb32ae6f5bf15a766bae4d9be9 100644 --- a/test/unittest/want_sender_info_test/BUILD.gn +++ b/test/unittest/want_sender_info_test/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 @@ -18,7 +18,12 @@ module_output_path = "ability_runtime/ability_runtime/abilitymgr" ohos_unittest("want_sender_info_test") { module_out_path = module_output_path - + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + blocklist = "../../cfi_blocklist.txt" + } include_dirs = [ "${ability_runtime_test_path}/mock/services_abilitymgr_test/libs/system_ability_mock" ] sources = [ diff --git a/tools/aa/BUILD.gn b/tools/aa/BUILD.gn index d6ec4e440c24ab088a7c976c62ade9d8402e6b8c..f04905ae2222e4bd1c6e61eb51b4a3a6600f1190 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 @@ -21,6 +21,7 @@ config("ability_command_config") { "${ability_runtime_services_path}/abilitymgr/include/utils", "${ability_runtime_services_path}/abilitymgr/include", ] + configs = [ "${ability_runtime_innerkits_path}/app_manager:appmgr_innerkits_config", ] } config("ability_command_exception_config") {