From 8f6fe060c08107367694dff358782a6b60d708ef Mon Sep 17 00:00:00 2001 From: zhongjianfei Date: Fri, 11 Mar 2022 00:42:28 +0800 Subject: [PATCH] Revert "fix aafwk bugs." This reverts commit c5047264dca9c263a7ae9529f14c864e1ae4bffd. Signed-off-by: zhongjianfei Change-Id: Id2c10501a3860c5caa6f6f439a3f01d23c1a9b07 --- aafwk.gni | 8 -- common/BUILD.gn | 2 +- common/task_dispatcher/BUILD.gn | 2 +- .../include/dispatcher/base_task_dispatcher.h | 7 +- .../include/dispatcher/blocking_queue.h | 3 +- .../dispatcher/global_task_dispatcher.h | 2 +- .../include/dispatcher/group_impl.h | 2 +- .../dispatcher/parallel_task_dispatcher.h | 2 +- .../parallel_task_dispatcher_base.h | 2 +- .../dispatcher/serial_task_dispatcher.h | 3 +- .../dispatcher/spec_dispatcher_config.h | 2 +- .../include/dispatcher/spec_task_dispatcher.h | 2 +- .../dispatcher/task_dispatcher_context.h | 2 +- .../include/task/barrier_handler.h | 2 +- .../task_dispatcher/include/task/sync_task.h | 2 +- common/task_dispatcher/include/task/task.h | 2 +- .../task/task_handler_libevent_adapter.h | 2 +- .../include/task/task_listener.h | 2 +- .../task_dispatcher/include/task/task_stage.h | 2 +- .../include/threading/concurrent_queue.h | 2 +- .../threading/default_thread_factory.h | 2 +- .../threading/default_worker_pool_config.h | 2 +- .../include/threading/delay_execute_service.h | 2 +- .../include/threading/delay_queue.h | 2 +- .../include/threading/runnable.h | 2 +- .../threading/task_execute_interceptor.h | 2 +- .../include/threading/task_executor.h | 2 +- .../include/threading/thread_factory.h | 2 +- .../include/threading/work_thread.h | 2 +- .../include/threading/worker_pool.h | 2 +- .../include/threading/worker_pool_config.h | 2 +- .../src/dispatcher/global_task_dispatcher.cpp | 2 +- .../src/dispatcher/group_impl.cpp | 2 +- .../src/dispatcher/serial_task_dispatcher.cpp | 2 +- .../src/dispatcher/spec_task_dispatcher.cpp | 2 +- .../dispatcher/task_dispatcher_context.cpp | 2 +- .../src/task/barrier_handler.cpp | 2 +- common/task_dispatcher/src/task/sync_task.cpp | 2 +- common/task_dispatcher/src/task/task.cpp | 9 +- .../src/threading/default_thread_factory.cpp | 2 +- .../threading/default_worker_pool_config.cpp | 2 +- .../src/threading/work_thread.cpp | 2 +- .../src/threading/worker_pool.cpp | 2 +- common/task_dispatcher/test/BUILD.gn | 2 +- .../unittest/barrier_handler_test/BUILD.gn | 2 +- .../barrier_handler_test.cpp | 2 +- .../base_task_dispatcher_test/BUILD.gn | 2 +- .../base_task_dispatcher_test.cpp | 2 +- .../global_task_dispatcher_test/BUILD.gn | 2 +- .../global_task_dispatcher_test.cpp | 2 +- .../test/unittest/groupImpl_test/BUILD.gn | 2 +- .../groupImpl_test/groupImpl_test.cpp | 2 +- .../BUILD.gn | 2 +- .../parallel_task_dispatcher_base_test.cpp | 2 +- .../parallel_task_dispatcher_test/BUILD.gn | 2 +- .../parallel_task_dispatcher_test.cpp | 2 +- .../serial_task_dispatcher_test/BUILD.gn | 2 +- .../spec_dispatcher_config_test/BUILD.gn | 2 +- .../spec_dispatcher_config_test.cpp | 2 +- .../test/unittest/sync_task_test/BUILD.gn | 2 +- .../task_dispatcher_context_test/BUILD.gn | 2 +- .../task_dispatcher_context_test.cpp | 2 +- .../test/unittest/task_executor_test/BUILD.gn | 2 +- .../task_executor_test/task_executor_test.cpp | 2 +- .../BUILD.gn | 2 +- .../task_handler_libevent_adapter_test.cpp | 2 +- .../test/unittest/task_test/BUILD.gn | 2 +- .../test/unittest/task_test/task_test.cpp | 2 +- .../test/unittest/work_thread_test/BUILD.gn | 2 +- .../test/unittest/worker_pool_test/BUILD.gn | 2 +- .../worker_pool_test/worker_pool_test.cpp | 2 +- common/test/BUILD.gn | 2 +- .../BUILD.gn | 2 +- .../BUILD.gn | 2 +- .../parallel_task_dispatcher_module_test.cpp | 10 +- .../BUILD.gn | 2 +- .../serial_task_dispatcher_module_test.cpp | 2 +- .../spec_task_dispatcher_module_test/BUILD.gn | 2 +- .../spec_task_dispatcher_module_test.cpp | 2 +- .../src/ability_connection.cpp | 2 - .../src/ability_context_impl.cpp | 2 +- .../AMS/mock_serviceability_manager_service.h | 3 +- .../ability_caller_fw_module_test.cpp | 2 +- frameworks/kits/ability/native/BUILD.gn | 8 +- .../ability/native/include/ability_impl.h | 18 +-- .../kits/ability/native/src/ability.cpp | 16 +-- .../ability/native/src/ability_window.cpp | 4 +- ...se_continuation_scheduler_replica_stub.cpp | 2 +- .../native/src/data_ability_helper.cpp | 35 +++--- .../native/src/data_ability_operation.cpp | 2 +- .../js_form_extension_context.cpp | 2 +- .../native/src/js_datashare_ext_ability.cpp | 1 - .../ability/native/src/new_ability_impl.cpp | 2 +- .../ability/native/src/page_ability_impl.cpp | 2 +- .../include/mock_ability_manager_service.cpp | 8 +- .../include/mock_ability_manager_service.h | 3 +- .../mock/include/mock_bundle_manager_form.h | 4 +- .../test/unittest/ability_context_test.cpp | 2 +- .../test/unittest/ability_permission_test.cpp | 4 +- .../ability_runtime/context/context_impl.cpp | 2 +- .../context/js_context_utils.cpp | 2 +- .../appkit/native/app/include/main_thread.h | 26 ++-- .../appkit/native/app/src/main_thread.cpp | 95 +++++++-------- .../mock_resourceManager_interface1.cpp | 3 +- .../Mock/include/mock_ability_mgr_service.h | 3 +- .../src/ohos/aafwk/content/extra_params.cpp | 1 - .../cpp/src/ohos/aafwk/content/want.cpp | 4 +- .../src/ohos/aafwk/content/want_params.cpp | 2 +- .../native/js_data_struct_converter.cpp | 1 + frameworks/kits/runtime/native/js_runtime.cpp | 2 +- .../mock/AMS/mock_ability_manager_service.h | 3 +- .../AMS/mock_serviceability_manager_service.h | 3 +- .../mock_ability_thread_for_data_observer.h | 3 - .../cpp/abilitytest/ability_context_test.cpp | 2 +- .../kits/wantagent/src/pending_want.cpp | 6 +- .../kits/wantagent/src/want_agent_helper.cpp | 4 +- .../include/ability_manager_client.h | 9 -- .../include/ability_manager_interface.h | 16 +-- .../include/ability_scheduler_interface.h | 4 +- .../include/appmgr/app_mgr_client.h | 7 -- .../include/appmgr/app_mgr_interface.h | 8 -- .../include/appmgr/app_mgr_proxy.h | 7 -- .../app_manager/include/appmgr/app_mgr_stub.h | 1 - .../include/appmgr/app_scheduler_host.h | 1 - .../include/appmgr/app_scheduler_interface.h | 10 -- .../include/appmgr/app_scheduler_proxy.h | 9 -- .../src/appmgr/ability_controller_stub.cpp | 2 +- .../app_manager/src/appmgr/ams_mgr_stub.cpp | 2 +- .../app_manager/src/appmgr/app_mgr_client.cpp | 11 -- .../app_manager/src/appmgr/app_mgr_proxy.cpp | 26 ---- .../app_manager/src/appmgr/app_mgr_stub.cpp | 11 +- .../src/appmgr/app_scheduler_host.cpp | 11 +- .../src/appmgr/app_scheduler_proxy.cpp | 20 ---- .../src/appmgr/app_state_callback_host.cpp | 2 +- .../application_state_observer_stub.cpp | 2 +- .../src/appmgr/render_scheduler_host.cpp | 2 +- .../start_specified_ability_response_stub.cpp | 2 +- .../form_manager/include/form_constants.h | 2 - .../form_manager/src/form_host_stub.cpp | 2 +- .../form_manager/src/form_mgr_stub.cpp | 2 +- .../form_manager/src/form_provider_stub.cpp | 6 +- .../form_manager/src/form_supply_stub.cpp | 2 +- .../want/include/ohos/aafwk/content/want.h | 4 +- interfaces/kits/napi/aafwk/dataShare/BUILD.gn | 1 - .../kits/napi/aafwk/featureAbility/BUILD.gn | 6 +- .../aafwk/featureAbility/napi_context.cpp | 2 +- .../napi_data_ability_operation.cpp | 8 +- .../napi/aafwk/inner/napi_common/BUILD.gn | 5 +- .../inner/napi_common/napi_common_ability.cpp | 8 +- .../napi_common/napi_common_configuration.cpp | 2 +- .../inner/napi_common/napi_common_util.cpp | 4 +- .../kits/napi/aafwk/particleAbility/BUILD.gn | 4 +- .../kits/napi/aafwk/wantConstant/BUILD.gn | 3 +- .../include/ability_connect_manager.h | 2 - .../include/ability_manager_proxy.h | 13 +- .../include/ability_manager_service.h | 10 +- .../abilitymgr/include/ability_manager_stub.h | 1 - services/abilitymgr/include/app_scheduler.h | 16 --- .../abilitymgr/include/inner_mission_info.h | 2 - .../abilitymgr/include/mission_info_mgr.h | 5 - services/abilitymgr/include/mission_list.h | 9 -- .../abilitymgr/include/mission_list_manager.h | 4 - .../include/mission_listener_controller.h | 2 - .../abilitymgr/include/pending_want_manager.h | 4 +- services/abilitymgr/include/user_controller.h | 2 +- .../src/ability_connect_callback_stub.cpp | 1 - .../src/ability_connect_manager.cpp | 19 --- .../abilitymgr/src/ability_manager_client.cpp | 17 --- .../abilitymgr/src/ability_manager_proxy.cpp | 41 +------ .../src/ability_manager_service.cpp | 113 +++--------------- .../abilitymgr/src/ability_manager_stub.cpp | 15 +-- .../src/ams_configuration_parameter.cpp | 4 +- services/abilitymgr/src/app_scheduler.cpp | 19 --- .../abilitymgr/src/data_ability_manager.cpp | 3 +- .../abilitymgr/src/inner_mission_info.cpp | 90 +++++--------- services/abilitymgr/src/mission_info_mgr.cpp | 35 +----- services/abilitymgr/src/mission_list.cpp | 35 ------ .../abilitymgr/src/mission_list_manager.cpp | 60 +--------- .../src/mission_listener_controller.cpp | 25 ---- .../abilitymgr/src/pending_want_manager.cpp | 8 +- services/abilitymgr/src/shared_memory.cpp | 5 +- .../src/appmgr_test_service.cpp | 4 +- .../ability_connect_manage_test/BUILD.gn | 3 +- .../ability_manager_stub_mock_test.h | 7 +- .../ability_manager_stub_mock.h | 7 +- .../ability_manager_service_test.cpp | 2 +- .../ability_manager_stub_impl_mock.h | 6 +- .../ability_manager_stub_mock.h | 3 +- .../ability_stack_manager_test.cpp | 8 +- .../phone/data_ability_manager_test/BUILD.gn | 3 +- .../pending_want_manager_test.cpp | 6 +- services/appmgr/include/app_mgr_service.h | 8 -- services/appmgr/include/app_running_record.h | 1 - .../appmgr/include/module_running_record.h | 4 +- services/appmgr/src/app_death_recipient.cpp | 3 +- services/appmgr/src/app_mgr_service.cpp | 20 ---- services/appmgr/src/app_mgr_service_inner.cpp | 9 +- services/appmgr/src/app_running_record.cpp | 13 -- .../src/system_environment_information.cpp | 2 +- .../test/mock/include/mock_app_mgr_service.h | 1 - .../test/mock/include/mock_app_scheduler.h | 1 - .../test/mock/include/mock_application.h | 1 - .../ams_workflow_test.cpp | 6 +- .../src/data_ability_observer_proxy.cpp | 7 +- .../mock_dataobs_mgr_client.h | 10 +- services/formmgr/include/form_timer.h | 2 +- services/formmgr/include/form_timer_mgr.h | 12 +- services/formmgr/src/form_timer_mgr.cpp | 49 ++++---- .../test/mock/include/mock_ability_manager.h | 16 +-- .../test/mock/include/mock_bundle_manager.h | 6 +- .../test/mock/include/mock_form_host_client.h | 7 +- .../mock/src/mock_form_provider_client.cpp | 1 - .../unittest/fms_form_data_mgr_test/BUILD.gn | 4 +- .../fms_form_data_mgr_test.cpp | 4 +- .../unittest/fms_form_db_record_test/BUILD.gn | 4 +- .../fms_form_mgr_add_form_test/BUILD.gn | 4 +- .../fms_form_mgr_death_callback_test/BUILD.gn | 4 +- .../include/appmgr/mock_ability_mgr_host.h | 2 +- .../mock/include/mock_ability_manager_proxy.h | 3 +- .../mock/include/mock_ability_mgr_service.h | 3 +- .../test/mock/include/mock_app_scheduler.h | 1 - .../ability_mgr_module_test.cpp | 8 +- .../ability_stack_module_test.cpp | 12 +- ...ams_ability_running_record_module_test.cpp | 3 - .../ams_app_mgr_service_module_test.cpp | 2 - .../ams/app_running_record_test/BUILD.gn | 3 +- .../ams_app_service_flow_module_test.cpp | 4 +- .../specified_ability_service_test/BUILD.gn | 3 +- .../static_start_ability_test/BUILD.gn | 3 +- .../amsKitSystemTest/src/second_ability.cpp | 8 +- .../src/ams_st_service_ability_b3.cpp | 17 +-- .../src/ams_st_service_ability_c4.cpp | 15 +-- .../src/ams_st_service_ability_d1.cpp | 15 +-- .../src/ams_st_service_ability_e2.cpp | 19 +-- .../src/ams_st_service_ability_f3.cpp | 10 +- .../src/ams_st_service_ability_g1.cpp | 19 +-- .../src/ams_st_service_ability_h1.cpp | 19 +-- .../serviceAbilityA/src/service_ability_a.cpp | 12 +- .../src/verify_act_first_ability.cpp | 8 +- .../abilitySrc/taskDispatcherTestB/BUILD.gn | 3 +- .../src/form_ability_commona.cpp | 12 +- .../src/form_ability_commonb.cpp | 12 +- .../src/form_ability_no_perm.cpp | 8 +- .../src/form_ability_a.cpp | 35 +----- .../src/form_ability_deleteform.cpp | 28 +---- .../src/form_ability_releaseform.cpp | 17 +-- .../src/form_ability_b.cpp | 14 +-- .../ams_service_ability_test.cpp | 4 +- tools/aa/src/ability_command.cpp | 9 +- tools/test/mock/mock_ability_manager_stub.h | 3 +- tools/test/moduletest/aa/BUILD.gn | 3 +- zidl/test/native/src/test_client.cpp | 1 + 252 files changed, 488 insertions(+), 1352 deletions(-) diff --git a/aafwk.gni b/aafwk.gni index 9e1a559076f..0e00cbd507b 100644 --- a/aafwk.gni +++ b/aafwk.gni @@ -24,11 +24,3 @@ dispatcher_path = "${aafwk_path}/common/task_dispatcher" system_test_app_path = "${aafwk_path}/test/resource/amssystemtestability/abilitySrc" - -declare_args() { - background_task_mgr_continuous_task_enable = true - - if (!defined(global_parts_info.resourceschedule_background_task_mgr)) { - background_task_mgr_continuous_task_enable = false - } -} diff --git a/common/BUILD.gn b/common/BUILD.gn index 39040c9b8c0..b58b035353d 100644 --- a/common/BUILD.gn +++ b/common/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/task_dispatcher/BUILD.gn b/common/task_dispatcher/BUILD.gn index 8fa9150d0fe..ceba1aafa69 100644 --- a/common/task_dispatcher/BUILD.gn +++ b/common/task_dispatcher/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/dispatcher/base_task_dispatcher.h b/common/task_dispatcher/include/dispatcher/base_task_dispatcher.h index f1cce7186b2..f55a2b6f081 100644 --- a/common/task_dispatcher/include/dispatcher/base_task_dispatcher.h +++ b/common/task_dispatcher/include/dispatcher/base_task_dispatcher.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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,6 +30,7 @@ namespace AppExecFwk { /** * Base implementation for interface of TaskDispatcher. */ + class BaseTaskDispatcher : public TaskDispatcher { public: BaseTaskDispatcher(const std::string &dispatcherName, const TaskPriority priority); @@ -89,7 +90,7 @@ public: /** * Synchronously waiting all tasks in the group to be done. - * @param group contains a serial of jobs. + * @param group contains a serial of jobs. * @param timeout is the max waiting time for jobs in group execute, in ms. * @return true if all jobs in group has finished or false if timeout occurs. * @@ -109,7 +110,7 @@ public: /** * Called to dispatch |task| |iterations| times and wait. * - * @param task is the job to execute multi times. + * @param task is the job to execute multi times. * @param iterations indicates times the task should be executed. * */ diff --git a/common/task_dispatcher/include/dispatcher/blocking_queue.h b/common/task_dispatcher/include/dispatcher/blocking_queue.h index 05d2fd2e1b4..305c8614227 100644 --- a/common/task_dispatcher/include/dispatcher/blocking_queue.h +++ b/common/task_dispatcher/include/dispatcher/blocking_queue.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -55,7 +55,6 @@ struct PriorityTaskWrapper { static constexpr int DEFAULT_PRIORITY_WEIGHT = 1; static constexpr int LOW_PRIORITY_WEIGHT = 0; }; - struct CompareTaskPriority { bool operator()(const std::shared_ptr &wrapper1, const std::shared_ptr &wrapper2) const diff --git a/common/task_dispatcher/include/dispatcher/global_task_dispatcher.h b/common/task_dispatcher/include/dispatcher/global_task_dispatcher.h index f0416a1824e..3af52cc747f 100644 --- a/common/task_dispatcher/include/dispatcher/global_task_dispatcher.h +++ b/common/task_dispatcher/include/dispatcher/global_task_dispatcher.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/dispatcher/group_impl.h b/common/task_dispatcher/include/dispatcher/group_impl.h index 388942ad7ff..4075ee5f59e 100644 --- a/common/task_dispatcher/include/dispatcher/group_impl.h +++ b/common/task_dispatcher/include/dispatcher/group_impl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/dispatcher/parallel_task_dispatcher.h b/common/task_dispatcher/include/dispatcher/parallel_task_dispatcher.h index 8f85c544b0e..8c429313a59 100644 --- a/common/task_dispatcher/include/dispatcher/parallel_task_dispatcher.h +++ b/common/task_dispatcher/include/dispatcher/parallel_task_dispatcher.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/dispatcher/parallel_task_dispatcher_base.h b/common/task_dispatcher/include/dispatcher/parallel_task_dispatcher_base.h index 39a5fcf4ab1..87381bd557b 100644 --- a/common/task_dispatcher/include/dispatcher/parallel_task_dispatcher_base.h +++ b/common/task_dispatcher/include/dispatcher/parallel_task_dispatcher_base.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/dispatcher/serial_task_dispatcher.h b/common/task_dispatcher/include/dispatcher/serial_task_dispatcher.h index 3348ad1a0bb..0777833e7ae 100644 --- a/common/task_dispatcher/include/dispatcher/serial_task_dispatcher.h +++ b/common/task_dispatcher/include/dispatcher/serial_task_dispatcher.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #ifndef OHOS_APP_DISPATCHER_SERIAL_TASK_DISPATCHER_H #define OHOS_APP_DISPATCHER_SERIAL_TASK_DISPATCHER_H diff --git a/common/task_dispatcher/include/dispatcher/spec_dispatcher_config.h b/common/task_dispatcher/include/dispatcher/spec_dispatcher_config.h index 8a5ecab5dfa..64ecdb2e320 100644 --- a/common/task_dispatcher/include/dispatcher/spec_dispatcher_config.h +++ b/common/task_dispatcher/include/dispatcher/spec_dispatcher_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/dispatcher/spec_task_dispatcher.h b/common/task_dispatcher/include/dispatcher/spec_task_dispatcher.h index 377ccd5e413..138f78aa768 100644 --- a/common/task_dispatcher/include/dispatcher/spec_task_dispatcher.h +++ b/common/task_dispatcher/include/dispatcher/spec_task_dispatcher.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/dispatcher/task_dispatcher_context.h b/common/task_dispatcher/include/dispatcher/task_dispatcher_context.h index ffb0cc90dcd..f289bec7e59 100644 --- a/common/task_dispatcher/include/dispatcher/task_dispatcher_context.h +++ b/common/task_dispatcher/include/dispatcher/task_dispatcher_context.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/task/barrier_handler.h b/common/task_dispatcher/include/task/barrier_handler.h index 7bf29df1d27..c2c52234bec 100644 --- a/common/task_dispatcher/include/task/barrier_handler.h +++ b/common/task_dispatcher/include/task/barrier_handler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/task/sync_task.h b/common/task_dispatcher/include/task/sync_task.h index 4c5c57a38a0..5901e6bbc27 100644 --- a/common/task_dispatcher/include/task/sync_task.h +++ b/common/task_dispatcher/include/task/sync_task.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/task/task.h b/common/task_dispatcher/include/task/task.h index e43309c5ba8..b73c09578cf 100644 --- a/common/task_dispatcher/include/task/task.h +++ b/common/task_dispatcher/include/task/task.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/task/task_handler_libevent_adapter.h b/common/task_dispatcher/include/task/task_handler_libevent_adapter.h index df1c5cd4ceb..84d9973e046 100644 --- a/common/task_dispatcher/include/task/task_handler_libevent_adapter.h +++ b/common/task_dispatcher/include/task/task_handler_libevent_adapter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/task/task_listener.h b/common/task_dispatcher/include/task/task_listener.h index f0b6e46494b..b1891899515 100644 --- a/common/task_dispatcher/include/task/task_listener.h +++ b/common/task_dispatcher/include/task/task_listener.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/task/task_stage.h b/common/task_dispatcher/include/task/task_stage.h index 8c2da3aebeb..e0244d0fbee 100644 --- a/common/task_dispatcher/include/task/task_stage.h +++ b/common/task_dispatcher/include/task/task_stage.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/threading/concurrent_queue.h b/common/task_dispatcher/include/threading/concurrent_queue.h index 9c6c53d085b..7e9286e0fbe 100644 --- a/common/task_dispatcher/include/threading/concurrent_queue.h +++ b/common/task_dispatcher/include/threading/concurrent_queue.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/threading/default_thread_factory.h b/common/task_dispatcher/include/threading/default_thread_factory.h index 1c457d94a62..6ee8ef91d81 100644 --- a/common/task_dispatcher/include/threading/default_thread_factory.h +++ b/common/task_dispatcher/include/threading/default_thread_factory.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/threading/default_worker_pool_config.h b/common/task_dispatcher/include/threading/default_worker_pool_config.h index 45e19983389..8ec371262e2 100644 --- a/common/task_dispatcher/include/threading/default_worker_pool_config.h +++ b/common/task_dispatcher/include/threading/default_worker_pool_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/threading/delay_execute_service.h b/common/task_dispatcher/include/threading/delay_execute_service.h index 5f218ddfcc3..4b62e2cd3cf 100644 --- a/common/task_dispatcher/include/threading/delay_execute_service.h +++ b/common/task_dispatcher/include/threading/delay_execute_service.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/threading/delay_queue.h b/common/task_dispatcher/include/threading/delay_queue.h index 5938064c5a2..d010f661a29 100644 --- a/common/task_dispatcher/include/threading/delay_queue.h +++ b/common/task_dispatcher/include/threading/delay_queue.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/threading/runnable.h b/common/task_dispatcher/include/threading/runnable.h index fd84ab2a566..af541d17cae 100644 --- a/common/task_dispatcher/include/threading/runnable.h +++ b/common/task_dispatcher/include/threading/runnable.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/threading/task_execute_interceptor.h b/common/task_dispatcher/include/threading/task_execute_interceptor.h index 4c3e6acd846..51794fc3495 100644 --- a/common/task_dispatcher/include/threading/task_execute_interceptor.h +++ b/common/task_dispatcher/include/threading/task_execute_interceptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/threading/task_executor.h b/common/task_dispatcher/include/threading/task_executor.h index 5e4509a6162..7c6294c036a 100644 --- a/common/task_dispatcher/include/threading/task_executor.h +++ b/common/task_dispatcher/include/threading/task_executor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/threading/thread_factory.h b/common/task_dispatcher/include/threading/thread_factory.h index 3e1c25baee9..f1d685ed0f2 100644 --- a/common/task_dispatcher/include/threading/thread_factory.h +++ b/common/task_dispatcher/include/threading/thread_factory.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/threading/work_thread.h b/common/task_dispatcher/include/threading/work_thread.h index 02b27834174..6aca9c78c3d 100644 --- a/common/task_dispatcher/include/threading/work_thread.h +++ b/common/task_dispatcher/include/threading/work_thread.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/threading/worker_pool.h b/common/task_dispatcher/include/threading/worker_pool.h index 6ce8fdda977..5b5b3cc5ce6 100644 --- a/common/task_dispatcher/include/threading/worker_pool.h +++ b/common/task_dispatcher/include/threading/worker_pool.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/include/threading/worker_pool_config.h b/common/task_dispatcher/include/threading/worker_pool_config.h index 0e5066bb9c9..83f1fd9d943 100644 --- a/common/task_dispatcher/include/threading/worker_pool_config.h +++ b/common/task_dispatcher/include/threading/worker_pool_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/src/dispatcher/global_task_dispatcher.cpp b/common/task_dispatcher/src/dispatcher/global_task_dispatcher.cpp index e816dc455d8..6a794d8eafd 100644 --- a/common/task_dispatcher/src/dispatcher/global_task_dispatcher.cpp +++ b/common/task_dispatcher/src/dispatcher/global_task_dispatcher.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/src/dispatcher/group_impl.cpp b/common/task_dispatcher/src/dispatcher/group_impl.cpp index 4be1ec7b1cf..ff4ceee648f 100644 --- a/common/task_dispatcher/src/dispatcher/group_impl.cpp +++ b/common/task_dispatcher/src/dispatcher/group_impl.cpp @@ -95,7 +95,7 @@ bool GroupImpl::AddNotification(const std::shared_ptr ¬ification) if (count_.load() != 0) { std::unique_lock lock(dataMutex_); if (notifications_.size() == MAX_TASK) { - HILOG_WARN("GroupImpl::AddNotification called maximum number of tasks exceeded"); + HILOG_WARN("GroupImpl::AddNotification called maximun number of tasks exceeded"); return false; } if (count_.load() != 0) { diff --git a/common/task_dispatcher/src/dispatcher/serial_task_dispatcher.cpp b/common/task_dispatcher/src/dispatcher/serial_task_dispatcher.cpp index f7d96a688bb..676fd491749 100644 --- a/common/task_dispatcher/src/dispatcher/serial_task_dispatcher.cpp +++ b/common/task_dispatcher/src/dispatcher/serial_task_dispatcher.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/src/dispatcher/spec_task_dispatcher.cpp b/common/task_dispatcher/src/dispatcher/spec_task_dispatcher.cpp index 41f3dce63cb..63fe1a334d9 100644 --- a/common/task_dispatcher/src/dispatcher/spec_task_dispatcher.cpp +++ b/common/task_dispatcher/src/dispatcher/spec_task_dispatcher.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/src/dispatcher/task_dispatcher_context.cpp b/common/task_dispatcher/src/dispatcher/task_dispatcher_context.cpp index a760c32b9e0..528180e67cc 100644 --- a/common/task_dispatcher/src/dispatcher/task_dispatcher_context.cpp +++ b/common/task_dispatcher/src/dispatcher/task_dispatcher_context.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/src/task/barrier_handler.cpp b/common/task_dispatcher/src/task/barrier_handler.cpp index 0e18d9cc8fb..971b042e407 100644 --- a/common/task_dispatcher/src/task/barrier_handler.cpp +++ b/common/task_dispatcher/src/task/barrier_handler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/src/task/sync_task.cpp b/common/task_dispatcher/src/task/sync_task.cpp index 065df40d3f0..e2c12b62e40 100644 --- a/common/task_dispatcher/src/task/sync_task.cpp +++ b/common/task_dispatcher/src/task/sync_task.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/src/task/task.cpp b/common/task_dispatcher/src/task/task.cpp index 8fd7976ed71..d14616124df 100644 --- a/common/task_dispatcher/src/task/task.cpp +++ b/common/task_dispatcher/src/task/task.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -208,10 +208,9 @@ void Task::ConcurrentQueueStatusUpdate(const TaskStage::TASKSTAGE taskstage) bool Task::operator==(std::shared_ptr &rec) const { - return ((this->sequence_ == rec->sequence_) && (this->state_ == rec->state_) && - (this->priority_ == rec->priority_) && - (this->revocable_ == rec->revocable_) && (this->runnable_ == rec->runnable_) && - (this->baseTaskDispatcher_ == rec->baseTaskDispatcher_)); + return this->sequence_ == rec->sequence_ && this->state_ == rec->state_ && this->priority_ == rec->priority_ && + this->revocable_ == rec->revocable_ && this->runnable_ == rec->runnable_ && + this->baseTaskDispatcher_ == rec->baseTaskDispatcher_; } } // namespace AppExecFwk } // namespace OHOS diff --git a/common/task_dispatcher/src/threading/default_thread_factory.cpp b/common/task_dispatcher/src/threading/default_thread_factory.cpp index 5dbf3147e33..0e8eedaa47d 100644 --- a/common/task_dispatcher/src/threading/default_thread_factory.cpp +++ b/common/task_dispatcher/src/threading/default_thread_factory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/src/threading/default_worker_pool_config.cpp b/common/task_dispatcher/src/threading/default_worker_pool_config.cpp index 404567290f8..a42d13a2d5b 100644 --- a/common/task_dispatcher/src/threading/default_worker_pool_config.cpp +++ b/common/task_dispatcher/src/threading/default_worker_pool_config.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/src/threading/work_thread.cpp b/common/task_dispatcher/src/threading/work_thread.cpp index 9f840d7badf..dc049bd9463 100644 --- a/common/task_dispatcher/src/threading/work_thread.cpp +++ b/common/task_dispatcher/src/threading/work_thread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/src/threading/worker_pool.cpp b/common/task_dispatcher/src/threading/worker_pool.cpp index 117fc41bb8d..7a9672fc29e 100644 --- a/common/task_dispatcher/src/threading/worker_pool.cpp +++ b/common/task_dispatcher/src/threading/worker_pool.cpp @@ -49,7 +49,7 @@ WorkerPool::~WorkerPool() bool WorkerPool::Init(const std::shared_ptr &config) { - if (!CheckConfigParams(config)) { + if (CheckConfigParams(config) == false) { HILOG_ERROR("WorkerPool::checkConfigParams parameters are illegal"); return false; } diff --git a/common/task_dispatcher/test/BUILD.gn b/common/task_dispatcher/test/BUILD.gn index c27637c77d8..1c43d56c4b1 100644 --- a/common/task_dispatcher/test/BUILD.gn +++ b/common/task_dispatcher/test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/barrier_handler_test/BUILD.gn b/common/task_dispatcher/test/unittest/barrier_handler_test/BUILD.gn index e9fd2c2940f..f4d1aeae48b 100644 --- a/common/task_dispatcher/test/unittest/barrier_handler_test/BUILD.gn +++ b/common/task_dispatcher/test/unittest/barrier_handler_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/barrier_handler_test/barrier_handler_test.cpp b/common/task_dispatcher/test/unittest/barrier_handler_test/barrier_handler_test.cpp index 9c705156c44..57eedb0cf96 100644 --- a/common/task_dispatcher/test/unittest/barrier_handler_test/barrier_handler_test.cpp +++ b/common/task_dispatcher/test/unittest/barrier_handler_test/barrier_handler_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/base_task_dispatcher_test/BUILD.gn b/common/task_dispatcher/test/unittest/base_task_dispatcher_test/BUILD.gn index 58c6730325a..125246d8aef 100644 --- a/common/task_dispatcher/test/unittest/base_task_dispatcher_test/BUILD.gn +++ b/common/task_dispatcher/test/unittest/base_task_dispatcher_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/base_task_dispatcher_test/base_task_dispatcher_test.cpp b/common/task_dispatcher/test/unittest/base_task_dispatcher_test/base_task_dispatcher_test.cpp index 10eb4715a95..b86f345d621 100644 --- a/common/task_dispatcher/test/unittest/base_task_dispatcher_test/base_task_dispatcher_test.cpp +++ b/common/task_dispatcher/test/unittest/base_task_dispatcher_test/base_task_dispatcher_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/global_task_dispatcher_test/BUILD.gn b/common/task_dispatcher/test/unittest/global_task_dispatcher_test/BUILD.gn index 7ab2580ed98..fb64f1340f3 100644 --- a/common/task_dispatcher/test/unittest/global_task_dispatcher_test/BUILD.gn +++ b/common/task_dispatcher/test/unittest/global_task_dispatcher_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/global_task_dispatcher_test/global_task_dispatcher_test.cpp b/common/task_dispatcher/test/unittest/global_task_dispatcher_test/global_task_dispatcher_test.cpp index 58c204fbd6e..636b8e1059e 100644 --- a/common/task_dispatcher/test/unittest/global_task_dispatcher_test/global_task_dispatcher_test.cpp +++ b/common/task_dispatcher/test/unittest/global_task_dispatcher_test/global_task_dispatcher_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/groupImpl_test/BUILD.gn b/common/task_dispatcher/test/unittest/groupImpl_test/BUILD.gn index fd04fe6fd7c..3ce7d0beb41 100644 --- a/common/task_dispatcher/test/unittest/groupImpl_test/BUILD.gn +++ b/common/task_dispatcher/test/unittest/groupImpl_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/groupImpl_test/groupImpl_test.cpp b/common/task_dispatcher/test/unittest/groupImpl_test/groupImpl_test.cpp index 72f3a9228c2..344cfbc9267 100644 --- a/common/task_dispatcher/test/unittest/groupImpl_test/groupImpl_test.cpp +++ b/common/task_dispatcher/test/unittest/groupImpl_test/groupImpl_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/parallel_task_dispatcher_base_test/BUILD.gn b/common/task_dispatcher/test/unittest/parallel_task_dispatcher_base_test/BUILD.gn index 72f51bd87eb..034e2735ffe 100644 --- a/common/task_dispatcher/test/unittest/parallel_task_dispatcher_base_test/BUILD.gn +++ b/common/task_dispatcher/test/unittest/parallel_task_dispatcher_base_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/parallel_task_dispatcher_base_test/parallel_task_dispatcher_base_test.cpp b/common/task_dispatcher/test/unittest/parallel_task_dispatcher_base_test/parallel_task_dispatcher_base_test.cpp index 38c25387f13..a7e924cf023 100644 --- a/common/task_dispatcher/test/unittest/parallel_task_dispatcher_base_test/parallel_task_dispatcher_base_test.cpp +++ b/common/task_dispatcher/test/unittest/parallel_task_dispatcher_base_test/parallel_task_dispatcher_base_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/parallel_task_dispatcher_test/BUILD.gn b/common/task_dispatcher/test/unittest/parallel_task_dispatcher_test/BUILD.gn index e32d1db4542..2d806681b24 100644 --- a/common/task_dispatcher/test/unittest/parallel_task_dispatcher_test/BUILD.gn +++ b/common/task_dispatcher/test/unittest/parallel_task_dispatcher_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/parallel_task_dispatcher_test/parallel_task_dispatcher_test.cpp b/common/task_dispatcher/test/unittest/parallel_task_dispatcher_test/parallel_task_dispatcher_test.cpp index c861e62bbbd..0fa744cf871 100644 --- a/common/task_dispatcher/test/unittest/parallel_task_dispatcher_test/parallel_task_dispatcher_test.cpp +++ b/common/task_dispatcher/test/unittest/parallel_task_dispatcher_test/parallel_task_dispatcher_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/serial_task_dispatcher_test/BUILD.gn b/common/task_dispatcher/test/unittest/serial_task_dispatcher_test/BUILD.gn index 70660016a4f..0c5f1598c3e 100644 --- a/common/task_dispatcher/test/unittest/serial_task_dispatcher_test/BUILD.gn +++ b/common/task_dispatcher/test/unittest/serial_task_dispatcher_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/spec_dispatcher_config_test/BUILD.gn b/common/task_dispatcher/test/unittest/spec_dispatcher_config_test/BUILD.gn index 383b08f4977..44da5792008 100644 --- a/common/task_dispatcher/test/unittest/spec_dispatcher_config_test/BUILD.gn +++ b/common/task_dispatcher/test/unittest/spec_dispatcher_config_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/spec_dispatcher_config_test/spec_dispatcher_config_test.cpp b/common/task_dispatcher/test/unittest/spec_dispatcher_config_test/spec_dispatcher_config_test.cpp index c008fcccd14..0292695e797 100644 --- a/common/task_dispatcher/test/unittest/spec_dispatcher_config_test/spec_dispatcher_config_test.cpp +++ b/common/task_dispatcher/test/unittest/spec_dispatcher_config_test/spec_dispatcher_config_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/sync_task_test/BUILD.gn b/common/task_dispatcher/test/unittest/sync_task_test/BUILD.gn index 57009126a2b..c72beab2a9e 100644 --- a/common/task_dispatcher/test/unittest/sync_task_test/BUILD.gn +++ b/common/task_dispatcher/test/unittest/sync_task_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/task_dispatcher_context_test/BUILD.gn b/common/task_dispatcher/test/unittest/task_dispatcher_context_test/BUILD.gn index 0c96d0037f5..9118bf33c64 100644 --- a/common/task_dispatcher/test/unittest/task_dispatcher_context_test/BUILD.gn +++ b/common/task_dispatcher/test/unittest/task_dispatcher_context_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/task_dispatcher_context_test/task_dispatcher_context_test.cpp b/common/task_dispatcher/test/unittest/task_dispatcher_context_test/task_dispatcher_context_test.cpp index dfca77d5fa3..ae5fd1d92be 100644 --- a/common/task_dispatcher/test/unittest/task_dispatcher_context_test/task_dispatcher_context_test.cpp +++ b/common/task_dispatcher/test/unittest/task_dispatcher_context_test/task_dispatcher_context_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/task_executor_test/BUILD.gn b/common/task_dispatcher/test/unittest/task_executor_test/BUILD.gn index 13c94fb8a77..273b89ce879 100644 --- a/common/task_dispatcher/test/unittest/task_executor_test/BUILD.gn +++ b/common/task_dispatcher/test/unittest/task_executor_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/task_executor_test/task_executor_test.cpp b/common/task_dispatcher/test/unittest/task_executor_test/task_executor_test.cpp index 5069a2279ca..47f70eb1da1 100644 --- a/common/task_dispatcher/test/unittest/task_executor_test/task_executor_test.cpp +++ b/common/task_dispatcher/test/unittest/task_executor_test/task_executor_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/task_handler_libevent_adapter_test/BUILD.gn b/common/task_dispatcher/test/unittest/task_handler_libevent_adapter_test/BUILD.gn index ae5d9ec39d6..87822b59359 100644 --- a/common/task_dispatcher/test/unittest/task_handler_libevent_adapter_test/BUILD.gn +++ b/common/task_dispatcher/test/unittest/task_handler_libevent_adapter_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/task_handler_libevent_adapter_test/task_handler_libevent_adapter_test.cpp b/common/task_dispatcher/test/unittest/task_handler_libevent_adapter_test/task_handler_libevent_adapter_test.cpp index bedbc6e2b6f..5146ec09942 100644 --- a/common/task_dispatcher/test/unittest/task_handler_libevent_adapter_test/task_handler_libevent_adapter_test.cpp +++ b/common/task_dispatcher/test/unittest/task_handler_libevent_adapter_test/task_handler_libevent_adapter_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/task_test/BUILD.gn b/common/task_dispatcher/test/unittest/task_test/BUILD.gn index 91a6ee6eac2..3cc8ee274b3 100644 --- a/common/task_dispatcher/test/unittest/task_test/BUILD.gn +++ b/common/task_dispatcher/test/unittest/task_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/task_test/task_test.cpp b/common/task_dispatcher/test/unittest/task_test/task_test.cpp index 1fdc4299941..0fa06c0642c 100644 --- a/common/task_dispatcher/test/unittest/task_test/task_test.cpp +++ b/common/task_dispatcher/test/unittest/task_test/task_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/work_thread_test/BUILD.gn b/common/task_dispatcher/test/unittest/work_thread_test/BUILD.gn index e5899e7892d..e6b418d7801 100644 --- a/common/task_dispatcher/test/unittest/work_thread_test/BUILD.gn +++ b/common/task_dispatcher/test/unittest/work_thread_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/worker_pool_test/BUILD.gn b/common/task_dispatcher/test/unittest/worker_pool_test/BUILD.gn index 6784b7f6ded..0bd65420cf0 100644 --- a/common/task_dispatcher/test/unittest/worker_pool_test/BUILD.gn +++ b/common/task_dispatcher/test/unittest/worker_pool_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/task_dispatcher/test/unittest/worker_pool_test/worker_pool_test.cpp b/common/task_dispatcher/test/unittest/worker_pool_test/worker_pool_test.cpp index dc460e18a43..594fcb73c94 100644 --- a/common/task_dispatcher/test/unittest/worker_pool_test/worker_pool_test.cpp +++ b/common/task_dispatcher/test/unittest/worker_pool_test/worker_pool_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/test/BUILD.gn b/common/test/BUILD.gn index a837c31baae..c2f769c0c60 100644 --- a/common/test/BUILD.gn +++ b/common/test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/test/moduletest/task_dispatcher/global_task_dispatcher_module_test/BUILD.gn b/common/test/moduletest/task_dispatcher/global_task_dispatcher_module_test/BUILD.gn index 86300bfbf18..fd7cc87971d 100644 --- a/common/test/moduletest/task_dispatcher/global_task_dispatcher_module_test/BUILD.gn +++ b/common/test/moduletest/task_dispatcher/global_task_dispatcher_module_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/test/moduletest/task_dispatcher/parallel_task_dispatcher_module_test/BUILD.gn b/common/test/moduletest/task_dispatcher/parallel_task_dispatcher_module_test/BUILD.gn index 8d0afe32e47..9796fb4748b 100644 --- a/common/test/moduletest/task_dispatcher/parallel_task_dispatcher_module_test/BUILD.gn +++ b/common/test/moduletest/task_dispatcher/parallel_task_dispatcher_module_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/test/moduletest/task_dispatcher/parallel_task_dispatcher_module_test/parallel_task_dispatcher_module_test.cpp b/common/test/moduletest/task_dispatcher/parallel_task_dispatcher_module_test/parallel_task_dispatcher_module_test.cpp index 7dbcd3070ae..63a2cac60af 100644 --- a/common/test/moduletest/task_dispatcher/parallel_task_dispatcher_module_test/parallel_task_dispatcher_module_test.cpp +++ b/common/test/moduletest/task_dispatcher/parallel_task_dispatcher_module_test/parallel_task_dispatcher_module_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ std::shared_ptr ParallelTaskDispatcherModuleTest::Create HWTEST_F(ParallelTaskDispatcherModuleTest, ParallelTaskDispatcher_LifeCycleTest_001, TestSize.Level1) { auto name = std::string("ParallelTaskDispatcher_LifeCycleTest_001"); - GTEST_LOG_(INFO) << (name + " start"); + GTEST_LOG_(INFO) << name + " start"; std::shared_ptr ptr = CreateMtParallelTaskDispatcher(name, TaskPriority::DEFAULT); std::atomic count(0); std::shared_ptr runnable = std::make_shared([&]() { @@ -161,7 +161,7 @@ HWTEST_F(ParallelTaskDispatcherModuleTest, ParallelTaskDispatcher_AsyncDispatchT HWTEST_F(ParallelTaskDispatcherModuleTest, ParallelTaskDispatcher_AsyncGroupDispatchTest_001, TestSize.Level1) { auto name = std::string("ParallelTaskDispatcher_AsyncGroupDispatchTest_001"); - GTEST_LOG_(INFO) << (name + " start"); + GTEST_LOG_(INFO) << name + " start"; std::shared_ptr ptr = CreateMtParallelTaskDispatcher(name, TaskPriority::DEFAULT); std::atomic count(0); long sleep1 = 200; @@ -205,7 +205,7 @@ HWTEST_F(ParallelTaskDispatcherModuleTest, ParallelTaskDispatcher_AsyncGroupDisp HWTEST_F(ParallelTaskDispatcherModuleTest, ParallelTaskDispatcher_AsyncGroupDispatchTest_002, TestSize.Level1) { auto name = std::string("ParallelTaskDispatcher_AsyncGroupDispatchTest_002"); - GTEST_LOG_(INFO) << (name + " start"); + GTEST_LOG_(INFO) << name + " start"; std::shared_ptr ptr = CreateMtParallelTaskDispatcher(name, TaskPriority::DEFAULT); std::shared_ptr group = ptr->CreateDispatchGroup(); ptr->AsyncGroupDispatch(group, std::make_shared([&]() { @@ -246,7 +246,7 @@ HWTEST_F(ParallelTaskDispatcherModuleTest, ParallelTaskDispatcher_ApplyDispatchT int index = count.fetch_add(1); EXPECT_TRUE(index >= repeatCount); EXPECT_TRUE(index < repeatCount * 2); - GTEST_LOG_(INFO) << (name + " repeats1"); + GTEST_LOG_(INFO) << name + " repeats1"; }); ptr->ApplyDispatch(repeats1, repeatCount); diff --git a/common/test/moduletest/task_dispatcher/serial_task_dispatcher_module_test/BUILD.gn b/common/test/moduletest/task_dispatcher/serial_task_dispatcher_module_test/BUILD.gn index 0be1fa9d00b..cb7313d728c 100644 --- a/common/test/moduletest/task_dispatcher/serial_task_dispatcher_module_test/BUILD.gn +++ b/common/test/moduletest/task_dispatcher/serial_task_dispatcher_module_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/test/moduletest/task_dispatcher/serial_task_dispatcher_module_test/serial_task_dispatcher_module_test.cpp b/common/test/moduletest/task_dispatcher/serial_task_dispatcher_module_test/serial_task_dispatcher_module_test.cpp index 1fd76d728ad..603077fff5e 100644 --- a/common/test/moduletest/task_dispatcher/serial_task_dispatcher_module_test/serial_task_dispatcher_module_test.cpp +++ b/common/test/moduletest/task_dispatcher/serial_task_dispatcher_module_test/serial_task_dispatcher_module_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/common/test/moduletest/task_dispatcher/spec_task_dispatcher_module_test/BUILD.gn b/common/test/moduletest/task_dispatcher/spec_task_dispatcher_module_test/BUILD.gn index 1d5740c3416..551b443ff04 100644 --- a/common/test/moduletest/task_dispatcher/spec_task_dispatcher_module_test/BUILD.gn +++ b/common/test/moduletest/task_dispatcher/spec_task_dispatcher_module_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 diff --git a/common/test/moduletest/task_dispatcher/spec_task_dispatcher_module_test/spec_task_dispatcher_module_test.cpp b/common/test/moduletest/task_dispatcher/spec_task_dispatcher_module_test/spec_task_dispatcher_module_test.cpp index 9de8ea35361..528c9af9cff 100644 --- a/common/test/moduletest/task_dispatcher/spec_task_dispatcher_module_test/spec_task_dispatcher_module_test.cpp +++ b/common/test/moduletest/task_dispatcher/spec_task_dispatcher_module_test/spec_task_dispatcher_module_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 diff --git a/frameworks/kits/ability/ability_runtime/src/ability_connection.cpp b/frameworks/kits/ability/ability_runtime/src/ability_connection.cpp index 81d87f96fd3..d9ca5ee0f40 100755 --- a/frameworks/kits/ability/ability_runtime/src/ability_connection.cpp +++ b/frameworks/kits/ability/ability_runtime/src/ability_connection.cpp @@ -34,7 +34,6 @@ void AbilityConnection::OnAbilityConnectDone( HILOG_DEBUG("%{public}s begin.", __func__); if (abilityConnectCallback_ == nullptr) { HILOG_ERROR("%{public}s abilityConnectCallback is nullptr.", __func__); - return; } SetRemoteObject(remoteObject); SetResultCode(resultCode); @@ -48,7 +47,6 @@ void AbilityConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementName &e HILOG_DEBUG("%{public}s begin, resultCode:%{public}d.", __func__, resultCode); if (abilityConnectCallback_ == nullptr) { HILOG_ERROR("%{public}s abilityConnectCallback is nullptr.", __func__); - return; } // if resultCode < 0 that means the connectReceiver is died if (resultCode == DIED) { diff --git a/frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp b/frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp index 27e44039eb6..e8591266b9c 100644 --- a/frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp +++ b/frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp @@ -344,7 +344,7 @@ ErrCode AbilityContextImpl::RestoreWindowStage(NativeEngine& engine, NativeValue ErrCode AbilityContextImpl::StartAbility( const AAFwk::Want& want, const std::shared_ptr &callback) { - if (localCallContainer_ == nullptr) { + if (!localCallContainer_) { localCallContainer_ = new (std::nothrow)LocalCallContainer(); } diff --git a/frameworks/kits/ability/ability_runtime/test/mock/AMS/mock_serviceability_manager_service.h b/frameworks/kits/ability/ability_runtime/test/mock/AMS/mock_serviceability_manager_service.h index c829801f5b6..a5ad2966ef4 100644 --- a/frameworks/kits/ability/ability_runtime/test/mock/AMS/mock_serviceability_manager_service.h +++ b/frameworks/kits/ability/ability_runtime/test/mock/AMS/mock_serviceability_manager_service.h @@ -95,7 +95,7 @@ public: MOCK_METHOD1(GetAllStackInfo, int(StackInfo &stackInfo)); MOCK_METHOD1(MoveMissionToTop, int(int32_t missionId)); MOCK_METHOD1(KillProcess, int(const std::string &bundleName)); - MOCK_METHOD2(UninstallApp, int(const std::string &bundleName, int32_t uid)); + MOCK_METHOD1(UninstallApp, int(const std::string &bundleName)); MOCK_METHOD2( GetWantSender, sptr(const WantSenderInfo &wantSenderInfo, const sptr &callerToken)); MOCK_METHOD2(SendWantSender, int(const sptr &target, const SenderInfo &senderInfo)); @@ -140,7 +140,6 @@ public: MOCK_METHOD0(CleanAllMissions, int()); MOCK_METHOD1(MoveMissionToFront, int(int32_t missionId)); MOCK_METHOD2(MoveMissionToFront, int(int32_t missionId, const StartOptions &startOptions)); - MOCK_METHOD1(GetMissionIdByToken, int32_t(const sptr &token)); MOCK_METHOD2(GetWantSenderInfo, int(const sptr &target, std::shared_ptr &info)); diff --git a/frameworks/kits/ability/ability_runtime/test/moduletest/ability_caller_fw_module_test.cpp b/frameworks/kits/ability/ability_runtime/test/moduletest/ability_caller_fw_module_test.cpp index ebd9437fcea..79bf37ab2f6 100644 --- a/frameworks/kits/ability/ability_runtime/test/moduletest/ability_caller_fw_module_test.cpp +++ b/frameworks/kits/ability/ability_runtime/test/moduletest/ability_caller_fw_module_test.cpp @@ -55,7 +55,7 @@ void AbilityCallerTest::SetUpTestCase(void) OHOS::sptr abilityObject = new (std::nothrow) MockServiceAbilityManagerService(); auto sysMgr = OHOS::DelayedSingleton::GetInstance(); - if (sysMgr == nullptr) { + if (sysMgr == NULL) { GTEST_LOG_(ERROR) << "fail to get ISystemAbilityManager"; return; } diff --git a/frameworks/kits/ability/native/BUILD.gn b/frameworks/kits/ability/native/BUILD.gn index 7522047b169..89547165049 100644 --- a/frameworks/kits/ability/native/BUILD.gn +++ b/frameworks/kits/ability/native/BUILD.gn @@ -12,7 +12,6 @@ # limitations under the License. import("//build/ohos.gni") -import("//foundation/aafwk/standard/aafwk.gni") import("//foundation/aafwk/standard/feature.gni") SUBSYSTEM_DIR = "//foundation/aafwk/standard/frameworks/kits/ability/native" INNERKITS_PATH = "//foundation/aafwk/standard/interfaces/innerkits" @@ -254,6 +253,7 @@ ohos_shared_library("abilitykit_native") { "ability_runtime:task_dispatcher", "ability_runtime:wantagent_innerkits", "access_token:libaccesstoken_sdk", + "background_task_mgr:bgtaskmgr_innerkits", "bundle_framework:appexecfwk_base", "bundle_framework:appexecfwk_core", "bytrace_standard:bytrace_core", @@ -270,12 +270,6 @@ ohos_shared_library("abilitykit_native") { "utils_base:utils", ] - defines = [] - if (background_task_mgr_continuous_task_enable) { - external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ] - defines += [ "BGTASKMGR_CONTINUOUS_TASK_ENABLE" ] - } - public_deps = [ "//base/global/resmgr_standard/frameworks/resmgr:global_resmgr", "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", diff --git a/frameworks/kits/ability/native/include/ability_impl.h b/frameworks/kits/ability/native/include/ability_impl.h index c870115cf24..c994331a2a9 100755 --- a/frameworks/kits/ability/native/include/ability_impl.h +++ b/frameworks/kits/ability/native/include/ability_impl.h @@ -49,17 +49,17 @@ public: std::shared_ptr &contextDeal); /** - * @brief Set if use new mission. - * - * @param useNewMission new mission flag. - */ + * @brief Set if use new mission. + * + * @param useNewMission new mission flag. + */ static void SetUseNewMission(bool useNewMission); - /** - * @brief Get if use new mission. - * - * @return return true if use new mission. - */ + /** + * @brief Get if use new mission. + * + * @return return true if use new mission. + */ static bool IsUseNewMission(); /** diff --git a/frameworks/kits/ability/native/src/ability.cpp b/frameworks/kits/ability/native/src/ability.cpp index 862ce08984f..62cd57c035e 100755 --- a/frameworks/kits/ability/native/src/ability.cpp +++ b/frameworks/kits/ability/native/src/ability.cpp @@ -23,9 +23,7 @@ #include "ability_post_event_timeout.h" #include "ability_runtime/js_ability.h" #include "abs_shared_result_set.h" -#ifdef BGTASKMGR_CONTINUOUS_TASK_ENABLE #include "background_task_mgr_helper.h" -#endif #include "bytrace.h" #include "configuration_convertor.h" #include "connection_manager.h" @@ -33,9 +31,7 @@ #include "continuation_manager.h" #include "continuation_register_manager.h" #include "continuation_register_manager_proxy.h" -#ifdef BGTASKMGR_CONTINUOUS_TASK_ENABLE #include "continuous_task_param.h" -#endif #include "data_ability_operation.h" #include "data_ability_predicates.h" #include "data_ability_result.h" @@ -2120,14 +2116,10 @@ ErrCode Ability::DeleteForm(const int64_t formId) */ int Ability::StartBackgroundRunning(const AbilityRuntime::WantAgent::WantAgent &wantAgent) { -#ifdef BGTASKMGR_CONTINUOUS_TASK_ENABLE uint32_t defaultBgMode = 0; BackgroundTaskMgr::ContinuousTaskParam taskParam = BackgroundTaskMgr::ContinuousTaskParam(false, defaultBgMode, std::make_shared(wantAgent), abilityInfo_->name, GetToken()); return BackgroundTaskMgr::BackgroundTaskMgrHelper::RequestStartBackgroundRunning(taskParam); -#else - return ERR_INVALID_OPERATION; -#endif } /** @@ -2137,11 +2129,7 @@ int Ability::StartBackgroundRunning(const AbilityRuntime::WantAgent::WantAgent & */ int Ability::StopBackgroundRunning() { -#ifdef BGTASKMGR_CONTINUOUS_TASK_ENABLE return BackgroundTaskMgr::BackgroundTaskMgrHelper::RequestStopBackgroundRunning(abilityInfo_->name, GetToken()); -#else - return ERR_INVALID_OPERATION; -#endif } #ifdef SUPPORT_GRAPHICS @@ -3247,9 +3235,7 @@ std::shared_ptr Ability::ParsePredictionArgsRe HILOG_INFO("Ability::ParsePredictionArgsReference push_back done"); } - if (predicates) { - predicates->SetWhereArgs(strPredicatesList); - } + predicates->SetWhereArgs(strPredicatesList); return predicates; } diff --git a/frameworks/kits/ability/native/src/ability_window.cpp b/frameworks/kits/ability/native/src/ability_window.cpp index 6040330a5f0..722ecce9d0d 100644 --- a/frameworks/kits/ability/native/src/ability_window.cpp +++ b/frameworks/kits/ability/native/src/ability_window.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -195,7 +195,7 @@ void AbilityWindow::OnPostAbilityStop() if (windowScene_) { windowScene_ = nullptr; - HILOG_INFO("AbilityWindow::window windowScene_ release end."); + HILOG_INFO("AbilityWindow::widow windowScene_ release end."); } isWindowAttached = false; diff --git a/frameworks/kits/ability/native/src/continuation/distributed/reverse_continuation_scheduler_replica_stub.cpp b/frameworks/kits/ability/native/src/continuation/distributed/reverse_continuation_scheduler_replica_stub.cpp index db6e9504bc2..63a3a10f0e6 100644 --- a/frameworks/kits/ability/native/src/continuation/distributed/reverse_continuation_scheduler_replica_stub.cpp +++ b/frameworks/kits/ability/native/src/continuation/distributed/reverse_continuation_scheduler_replica_stub.cpp @@ -58,7 +58,7 @@ int32_t ReverseContinuationSchedulerReplicaStub::NotifyReverseResultInner(Messag int ReverseContinuationSchedulerReplicaStub::OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - HILOG_INFO("%{public}s called begin, code = %{public}u, flags= %{public}d.", __func__, code, option.GetFlags()); + HILOG_INFO("%{public}s called begin, code = %{public}d, flags= %{public}d.", __func__, code, option.GetFlags()); std::u16string remoteDescriptor = data.ReadInterfaceToken(); if (remoteDescriptor != ReverseContinuationSchedulerReplicaStub::GetDescriptor()) { HILOG_ERROR("ReverseContinuationSchedulerReplicaStub::OnRemoteRequest token is invalid"); diff --git a/frameworks/kits/ability/native/src/data_ability_helper.cpp b/frameworks/kits/ability/native/src/data_ability_helper.cpp index 571894a5a7d..4a516be3cea 100644 --- a/frameworks/kits/ability/native/src/data_ability_helper.cpp +++ b/frameworks/kits/ability/native/src/data_ability_helper.cpp @@ -250,7 +250,8 @@ std::shared_ptr DataAbilityHelper::Creator( if (uri->GetScheme() != SchemeOhos) { HILOG_ERROR("DataAbilityHelper::Creator (context, uri, tryBind) failed, the Scheme is not dataability, Scheme: " - "%{public}s", uri->GetScheme().c_str()); + "%{public}s", + uri->GetScheme().c_str()); return nullptr; } @@ -854,31 +855,25 @@ bool DataAbilityHelper::CheckUriParam(const Uri &uri) return false; } - // do not directly use uri_ here, otherwise, it will probably crash. - std::vector segments; - { - std::lock_guard guard(lock_); - if (!uri_) { - HILOG_INFO("DataAbilityHelper::CheckUriParam uri_ is nullptr, no need check"); - return true; - } - - if (!CheckOhosUri(*uri_)) { - HILOG_ERROR("DataAbilityHelper::CheckUriParam failed. CheckOhosUri uri_ failed"); + auto uriSp = uri_; // do not directly use uri_ here, otherwise, it will crash. + if (uriSp != nullptr) { + if (!CheckOhosUri(*uriSp)) { + HILOG_ERROR("DataAbilityHelper::CheckUriParam failed. CheckOhosUri uriSp failed"); return false; } - uri_->GetPathSegments(segments); - } + std::vector checkSegments; + checkUri.GetPathSegments(checkSegments); - std::vector checkSegments; - checkUri.GetPathSegments(checkSegments); + std::vector segments; + uriSp->GetPathSegments(segments); - if (checkSegments.empty() || segments.empty() || checkSegments[0] != segments[0]) { - HILOG_ERROR("DataAbilityHelper::CheckUriParam failed. dataability in uri doesn't equal the one in uri_."); - return false; + if (checkSegments.empty() || segments.empty() || checkSegments[0] != segments[0]) { + HILOG_ERROR( + "DataAbilityHelper::CheckUriParam failed. the dataability in uri doesn't equal the one in uriSp."); + return false; + } } - HILOG_INFO("DataAbilityHelper::CheckUriParam end."); return true; } diff --git a/frameworks/kits/ability/native/src/data_ability_operation.cpp b/frameworks/kits/ability/native/src/data_ability_operation.cpp index 8f67c0c7dd5..13d8f44d518 100644 --- a/frameworks/kits/ability/native/src/data_ability_operation.cpp +++ b/frameworks/kits/ability/native/src/data_ability_operation.cpp @@ -374,7 +374,7 @@ DataAbilityOperation *DataAbilityOperation::Unmarshalling(Parcel &in) HILOG_DEBUG("DataAbilityOperation::Unmarshalling start"); DataAbilityOperation *dataAbilityOperation = new (std::nothrow) DataAbilityOperation(); if (dataAbilityOperation != nullptr && !dataAbilityOperation->ReadFromParcel(in)) { - HILOG_ERROR("DataAbilityOperation::Unmarshalling dataAbilityOperation error"); + HILOG_ERROR("DataAbilityOperation::Unmarshalling dataAbilityOperation(%p) error", dataAbilityOperation); delete dataAbilityOperation; dataAbilityOperation = nullptr; } diff --git a/frameworks/kits/ability/native/src/form_runtime/js_form_extension_context.cpp b/frameworks/kits/ability/native/src/form_runtime/js_form_extension_context.cpp index 1b14d3818cb..28cd18d18b9 100644 --- a/frameworks/kits/ability/native/src/form_runtime/js_form_extension_context.cpp +++ b/frameworks/kits/ability/native/src/form_runtime/js_form_extension_context.cpp @@ -116,7 +116,7 @@ private: }; NativeValue* lastParam = - (info.argc == UPDATE_FORM_PARAMS_SIZE) ? nullptr : info.argv[UPDATE_FORM_PARAMS_SIZE - 1]; + (info.argc == UPDATE_FORM_PARAMS_SIZE) ? nullptr : info.argv[UPDATE_FORM_PARAMS_SIZE]; NativeValue* result = nullptr; AsyncTask::Schedule( engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result)); diff --git a/frameworks/kits/ability/native/src/js_datashare_ext_ability.cpp b/frameworks/kits/ability/native/src/js_datashare_ext_ability.cpp index abca98562d5..cd75d025206 100644 --- a/frameworks/kits/ability/native/src/js_datashare_ext_ability.cpp +++ b/frameworks/kits/ability/native/src/js_datashare_ext_ability.cpp @@ -452,7 +452,6 @@ std::shared_ptr JsDataShareExtAbility::Query(cons HILOG_INFO("%{public}s begin.", __func__); std::shared_ptr ret; if (!CheckCallingPermission(abilityInfo_->readPermission)) { - HILOG_ERROR("%{public}s Check calling permission failed.", __func__); return ret; } diff --git a/frameworks/kits/ability/native/src/new_ability_impl.cpp b/frameworks/kits/ability/native/src/new_ability_impl.cpp index b7fa9fd453d..a890ba24e62 100644 --- a/frameworks/kits/ability/native/src/new_ability_impl.cpp +++ b/frameworks/kits/ability/native/src/new_ability_impl.cpp @@ -46,7 +46,7 @@ void NewAbilityImpl::HandleAbilityTransaction(const Want &want, const AAFwk::Lif #endif SetLifeCycleStateInfo(targetState); - if (ability_ && lifecycleState_ == AAFwk::ABILITY_STATE_INITIAL) { + if (lifecycleState_ == AAFwk::ABILITY_STATE_INITIAL) { ability_->SetStartAbilitySetting(targetState.setting); ability_->SetLaunchParam(targetState.launchParam); Start(want); diff --git a/frameworks/kits/ability/native/src/page_ability_impl.cpp b/frameworks/kits/ability/native/src/page_ability_impl.cpp index c2622d6689d..594c105c238 100644 --- a/frameworks/kits/ability/native/src/page_ability_impl.cpp +++ b/frameworks/kits/ability/native/src/page_ability_impl.cpp @@ -45,7 +45,7 @@ void PageAbilityImpl::HandleAbilityTransaction(const Want &want, const AAFwk::Li SetLifeCycleStateInfo(targetState); - if (ability_ && lifecycleState_ == AAFwk::ABILITY_STATE_INITIAL) { + if (lifecycleState_ == AAFwk::ABILITY_STATE_INITIAL) { ability_->SetStartAbilitySetting(targetState.setting); Start(want); CheckAndRestore(); diff --git a/frameworks/kits/ability/native/test/mock/include/mock_ability_manager_service.cpp b/frameworks/kits/ability/native/test/mock/include/mock_ability_manager_service.cpp index b314bce0a31..afac3de2feb 100644 --- a/frameworks/kits/ability/native/test/mock/include/mock_ability_manager_service.cpp +++ b/frameworks/kits/ability/native/test/mock/include/mock_ability_manager_service.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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,9 @@ using OHOS::AppExecFwk::ElementName; namespace OHOS { namespace AAFwk { MockAbilityManagerService::MockAbilityManagerService() : abilityScheduler_(nullptr) -{} +{ + abilityScheduler_ = nullptr; +} MockAbilityManagerService::~MockAbilityManagerService() {} @@ -171,7 +173,7 @@ int MockAbilityManagerService::KillProcess(const std::string &bundleName) return 0; } -int MockAbilityManagerService::UninstallApp(const std::string &bundleName, int32_t uid) +int MockAbilityManagerService::UninstallApp(const std::string &bundleName) { return 0; } diff --git a/frameworks/kits/ability/native/test/mock/include/mock_ability_manager_service.h b/frameworks/kits/ability/native/test/mock/include/mock_ability_manager_service.h index 69b72785fcc..21f571f8d06 100644 --- a/frameworks/kits/ability/native/test/mock/include/mock_ability_manager_service.h +++ b/frameworks/kits/ability/native/test/mock/include/mock_ability_manager_service.h @@ -160,7 +160,6 @@ public: MOCK_METHOD2(SetMissionLabel, int(const sptr &token, const std::string &label)); MOCK_METHOD1(MoveMissionToFront, int(int32_t missionId)); MOCK_METHOD2(MoveMissionToFront, int(int32_t missionId, const StartOptions &startOptions)); - MOCK_METHOD1(GetMissionIdByToken, int32_t(const sptr &token)); MOCK_METHOD1(GetAbilityRunningInfos, int(std::vector &info)); MOCK_METHOD2(GetExtensionRunningInfos, int(int upperLimit, std::vector &info)); @@ -199,7 +198,7 @@ public: int KillProcess(const std::string &bundleName) override; - int UninstallApp(const std::string &bundleName, int32_t uid) override; + int UninstallApp(const std::string &bundleName) override; int TerminateAbilityByCaller(const sptr &callerToken, int requestCode) override { diff --git a/frameworks/kits/ability/native/test/mock/include/mock_bundle_manager_form.h b/frameworks/kits/ability/native/test/mock/include/mock_bundle_manager_form.h index 73ad44e1286..340a7b37c24 100644 --- a/frameworks/kits/ability/native/test/mock/include/mock_bundle_manager_form.h +++ b/frameworks/kits/ability/native/test/mock/include/mock_bundle_manager_form.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -287,7 +287,7 @@ public: { return ""; }; - // obtains information about an application bundle contained in an ohos Ability Package (HAP). + // obtains information about an application bundle contained in a ohos Ability Package (HAP). virtual bool GetBundleArchiveInfo( const std::string &hapFilePath, const BundleFlag flag, BundleInfo &bundleInfo) override { diff --git a/frameworks/kits/ability/native/test/unittest/ability_context_test.cpp b/frameworks/kits/ability/native/test/unittest/ability_context_test.cpp index 6eba768327b..c705e2aa06c 100644 --- a/frameworks/kits/ability/native/test/unittest/ability_context_test.cpp +++ b/frameworks/kits/ability/native/test/unittest/ability_context_test.cpp @@ -59,7 +59,7 @@ void AbilityContextTest::SetUpTestCase(void) GTEST_LOG_(INFO) << "AppExecFwk_AbilityContext_SetUpTestCase abilityObject->" << abilityObject.GetRefPtr(); auto sysMgr = OHOS::DelayedSingleton::GetInstance(); - if (sysMgr == nullptr) { + if (sysMgr == NULL) { GTEST_LOG_(ERROR) << "fail to get ISystemAbilityManager"; return; } diff --git a/frameworks/kits/ability/native/test/unittest/ability_permission_test.cpp b/frameworks/kits/ability/native/test/unittest/ability_permission_test.cpp index 39ec8600af9..06f9bd1c321 100644 --- a/frameworks/kits/ability/native/test/unittest/ability_permission_test.cpp +++ b/frameworks/kits/ability/native/test/unittest/ability_permission_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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,7 +51,7 @@ void AbilityPermissionTest::SetUpTestCase(void) auto sysMgr = OHOS::DelayedSingleton::GetInstance(); - if (sysMgr == nullptr) { + if (sysMgr == NULL) { GTEST_LOG_(ERROR) << "fail to get ISystemAbilityManager"; return; } diff --git a/frameworks/kits/appkit/native/ability_runtime/context/context_impl.cpp b/frameworks/kits/appkit/native/ability_runtime/context/context_impl.cpp index 029c9df2244..be24cd79b68 100644 --- a/frameworks/kits/appkit/native/ability_runtime/context/context_impl.cpp +++ b/frameworks/kits/appkit/native/ability_runtime/context/context_impl.cpp @@ -73,7 +73,7 @@ std::string ContextImpl::GetBundleCodeDir() if (IsCreateBySystemApp()) { dir = std::regex_replace(appInfo->codePath, std::regex(ABS_CODE_PATH), LOCAL_BUNDLES); } else { - dir = LOCAL_CODE_PATH; + dir = CONTEXT_DATA_STORAGE + CONTEXT_ELS[0] + CONTEXT_BUNDLE; } CreateDirIfNotExist(dir); HILOG_DEBUG("ContextImpl::GetBundleCodeDir:%{public}s", dir.c_str()); diff --git a/frameworks/kits/appkit/native/ability_runtime/context/js_context_utils.cpp b/frameworks/kits/appkit/native/ability_runtime/context/js_context_utils.cpp index 983ffe9ac68..627c34d3a95 100755 --- a/frameworks/kits/appkit/native/ability_runtime/context/js_context_utils.cpp +++ b/frameworks/kits/appkit/native/ability_runtime/context/js_context_utils.cpp @@ -43,7 +43,7 @@ public: NativeValue* OnGetDatabaseDir(NativeEngine& engine, NativeCallbackInfo& info); NativeValue* OnGetStorageDir(NativeEngine& engine, NativeCallbackInfo& info); NativeValue* OnGetBundleCodeDir(NativeEngine& engine, NativeCallbackInfo& info); - + static NativeValue* GetCacheDir(NativeEngine* engine, NativeCallbackInfo* info); static NativeValue* GetTempDir(NativeEngine* engine, NativeCallbackInfo* info); static NativeValue* GetFilesDir(NativeEngine* engine, NativeCallbackInfo* info); diff --git a/frameworks/kits/appkit/native/app/include/main_thread.h b/frameworks/kits/appkit/native/app/include/main_thread.h index 973a6169616..4d8427212f1 100644 --- a/frameworks/kits/appkit/native/app/include/main_thread.h +++ b/frameworks/kits/appkit/native/app/include/main_thread.h @@ -210,13 +210,6 @@ public: void ScheduleAcceptWant(const AAFwk::Want &want, const std::string &moduleName) override; - /** - * - * @brief The handle of application not response process. - * - */ - void ScheduleANRProcess() override; - private: /** * @@ -385,6 +378,15 @@ private: */ void TaskTimeoutDetected(const std::shared_ptr& runner); + /** + * + * @brief The handle of application not response process. + * + * @param sigMessage Receive the sig message. + * + */ + static void HandleANRProcess(int sigMessage); + /** * * @brief Check whether the OHOSApplication is ready. @@ -406,15 +408,6 @@ private: */ bool PrepareAbilityDelegator(const std::shared_ptr &record); - /** - * - * @brief The handle of application not response process. - * - * @param sigMessage Recieve the sig message. - * - */ - void HandleScheduleANRProcess(); - class MainHandler : public EventHandler { public: MainHandler(const std::shared_ptr &runner, const sptr &thread); @@ -442,7 +435,6 @@ private: std::shared_ptr applicationImpl_ = nullptr; std::shared_ptr mainHandler_ = nullptr; std::shared_ptr watchDogHandler_ = nullptr; - std::shared_ptr handleANRThread_ = nullptr; std::shared_ptr abilityRecordMgr_ = nullptr; MainThreadState mainThreadState_ = MainThreadState::INIT; sptr appMgr_ = nullptr; // appMgrService Handler diff --git a/frameworks/kits/appkit/native/app/src/main_thread.cpp b/frameworks/kits/appkit/native/app/src/main_thread.cpp index a65ead41952..10a61b102a1 100644 --- a/frameworks/kits/appkit/native/app/src/main_thread.cpp +++ b/frameworks/kits/appkit/native/app/src/main_thread.cpp @@ -623,11 +623,6 @@ void MainThread::HandleTerminateApplicationLocal() if (watchDogHandler_ != nullptr) { watchDogHandler_->Stop(); } - if (handleANRThread_ != nullptr && handleANRThread_->joinable()) { - handleANRThread_->join(); - handleANRThread_ = nullptr; - } - int ret = runner->Stop(); if (ret != ERR_OK) { HILOG_ERROR("MainThread::HandleTerminateApplicationLocal failed. runner->Run failed ret = %{public}d", ret); @@ -890,7 +885,7 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con HILOG_ERROR("OHOSApplication::OHOSApplication: Failed to create runtime"); return; } - auto& jsEngine = (static_cast(*runtime)).GetNativeEngine(); + // auto& jsEngine = (static_cast(*runtime)).GetNativeEngine(); auto bundleName = appInfo.bundleName; auto uid = appInfo.uid; auto processName = processInfo.GetProcessName(); @@ -947,7 +942,7 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con appThread->ScheduleProcessSecurityExit(); HILOG_INFO("RegisterUncaughtExceptionHandler End ret = %{public}d", ret); }; - jsEngine.RegisterUncaughtExceptionHandler(uncaughtTask); + // jsEngine.RegisterUncaughtExceptionHandler(uncaughtTask); application_->SetRuntime(std::move(runtime)); AbilityLoader::GetInstance().RegisterAbility("Ability", [application = application_]() { @@ -1037,6 +1032,10 @@ void MainThread::HandleAbilityStage(const HapModuleInfo &abilityStage) return; } + if (!appMgr_ || !applicationImpl_) { + HILOG_ERROR("appMgr_ is nullptr"); + return; + } appMgr_->AddAbilityStageDone(applicationImpl_->GetRecordId()); } @@ -1338,11 +1337,6 @@ void MainThread::HandleTerminateApplication() if (watchDogHandler_ != nullptr) { watchDogHandler_->Stop(); } - if (handleANRThread_ != nullptr && handleANRThread_->joinable()) { - handleANRThread_->join(); - handleANRThread_ = nullptr; - } - HILOG_INFO("MainThread::handleTerminateApplication before stop runner"); int ret = runner->Stop(); HILOG_INFO("MainThread::handleTerminateApplication after stop runner"); @@ -1352,9 +1346,9 @@ void MainThread::HandleTerminateApplication() SetRunnerStarted(false); #ifdef ABILITY_LIBRARY_LOADER - HILOG_INFO("MainThread::handleTerminateApplication. Start calling CloseAbilityLibrary."); + HILOG_INFO("MainThread::handleTerminateApplication. Start callint CloseAbilityLibrary."); CloseAbilityLibrary(); - HILOG_INFO("MainThread::handleTerminateApplication. End calling CloseAbilityLibrary."); + HILOG_INFO("MainThread::handleTerminateApplication. End callint CloseAbilityLibrary."); #endif // ABILITY_LIBRARY_LOADER #ifdef APPLICATION_LIBRARY_LOADER if (handleAppLib_ != nullptr) { @@ -1463,48 +1457,35 @@ void MainThread::Init(const std::shared_ptr &runner, const std::sha HILOG_INFO("MainThread:Init end."); } -void MainThread::ScheduleANRProcess() -{ - HILOG_INFO("MainThread::ScheduleANRProcess called begin"); - if (handleANRThread_ == nullptr) { - handleANRThread_ = std::make_shared(&MainThread::HandleScheduleANRProcess, this); - } - HILOG_INFO("MainThread::ScheduleANRProcess called end."); -} - -void MainThread::HandleScheduleANRProcess() +void MainThread::HandleANRProcess(int sigMessage) { - HILOG_INFO("MainThread:HandleScheduleANRProcess start."); - int rFD = -1; - std::string mainThreadStackInfo; - if ((rFD = RequestFileDescriptor(int32_t(FaultLoggerType::CPP_STACKTRACE))) < 0) { - HILOG_ERROR("MainThread::HandleScheduleANRProcess request file eescriptor failed"); - return; - } - HILOG_INFO("MainThread:HandleScheduleANRProcess RequestFileDescriptor end."); - auto jsRuntime = std::move((std::unique_ptr&)applicationForAnr_->GetRuntime()); - if (jsRuntime != nullptr) { - mainThreadStackInfo= jsRuntime->BuildNativeAndJsBackStackTrace(); - if (write(rFD, mainThreadStackInfo.c_str(), mainThreadStackInfo.size()) != mainThreadStackInfo.size()) { - HILOG_ERROR("MainThread::HandleScheduleANRProcess write main thread stack info failed"); + if (sigMessage == SIGUSR1) { + HILOG_INFO("MainThread:HandleANRProcess start."); + int rFD = -1; + std::string mainThreadStackInfo; + if ((rFD = RequestFileDescriptor(int32_t(FaultLoggerType::CPP_STACKTRACE))) < 0) { + HILOG_ERROR("MainThread::HandleANRProcess request file eescriptor failed"); + return; + } + auto jsRuntime = std::move((std::unique_ptr&)applicationForAnr_->GetRuntime()); + if (jsRuntime != nullptr) { + mainThreadStackInfo= jsRuntime->BuildNativeAndJsBackStackTrace(); + if (write(rFD, mainThreadStackInfo.c_str(), mainThreadStackInfo.size()) != mainThreadStackInfo.size()) { + HILOG_ERROR("MainThread::HandleANRProcess write main thread stack info failed"); + } + } + OHOS::HiviewDFX::DfxDumpCatcher dumplog; + std::string proStackInfo; + if (dumplog.DumpCatch(getpid(), 0, proStackInfo) == false) { + HILOG_ERROR("MainThread::HandleANRProcess get process stack info failed"); + } + if (write(rFD, proStackInfo.c_str(), proStackInfo.size()) != proStackInfo.size()) { + HILOG_ERROR("MainThread::HandleANRProcess write process stack info failed"); + } + if (rFD != -1) { + close(rFD); } } - HILOG_INFO("HandleScheduleANRProcess write main thread stack info size: %{public}d", mainThreadStackInfo.size()); - HILOG_INFO("MainThread:HandleScheduleANRProcess BuildNativeAndJsBackStackTrace end."); - OHOS::HiviewDFX::DfxDumpCatcher dumplog; - std::string proStackInfo; - if (dumplog.DumpCatch(getpid(), 0, proStackInfo) == false) { - HILOG_ERROR("MainThread::HandleScheduleANRProcess get process stack info failed"); - } - HILOG_INFO("MainThread:HandleScheduleANRProcess DumpCatch end."); - if (write(rFD, proStackInfo.c_str(), proStackInfo.size()) != proStackInfo.size()) { - HILOG_ERROR("MainThread::HandleScheduleANRProcess write process stack info failed"); - } - HILOG_INFO("HandleScheduleANRProcess DumpCatch write process stack info size: %{public}d", proStackInfo.size()); - if (rFD != -1) { - close(rFD); - } - HILOG_INFO("MainThread:HandleScheduleANRProcess end."); } void MainThread::Start() @@ -1527,6 +1508,14 @@ void MainThread::Start() return; } + HILOG_INFO("MainThread::main Register sig handle start"); + struct sigaction sigAct; + sigemptyset(&sigAct.sa_mask); + sigAct.sa_flags = 0; + sigAct.sa_handler = &MainThread::HandleANRProcess; + sigaction(SIGUSR1, &sigAct, NULL); + HILOG_INFO("MainThread::main Register sig handle end"); + HILOG_INFO("MainThread::main called start Init"); thread->Init(runner, runnerWatchDog); HILOG_INFO("MainThread::main called end Init"); diff --git a/frameworks/kits/appkit/native/test/mock/include/mock_resourceManager_interface1.cpp b/frameworks/kits/appkit/native/test/mock/include/mock_resourceManager_interface1.cpp index e1bcd3c2eeb..a57281033d9 100644 --- a/frameworks/kits/appkit/native/test/mock/include/mock_resourceManager_interface1.cpp +++ b/frameworks/kits/appkit/native/test/mock/include/mock_resourceManager_interface1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -265,6 +265,7 @@ public: std::map> IntArrayById_; std::map ColorById_; + // static ResourceManagerTestInstance* instance; static std::shared_ptr instance; }; diff --git a/frameworks/kits/appkit/test/Mock/include/mock_ability_mgr_service.h b/frameworks/kits/appkit/test/Mock/include/mock_ability_mgr_service.h index d6588ed87ac..936f084101c 100644 --- a/frameworks/kits/appkit/test/Mock/include/mock_ability_mgr_service.h +++ b/frameworks/kits/appkit/test/Mock/include/mock_ability_mgr_service.h @@ -60,7 +60,7 @@ public: MOCK_METHOD1(MoveMissionToTop, int(int32_t)); MOCK_METHOD1(KillProcess, int(const std::string &bundleName)); - MOCK_METHOD2(UninstallApp, int(const std::string &bundleName, int32_t uid)); + MOCK_METHOD2(UninstallApp, int(const std::string &bundleName, const int userId)); MOCK_METHOD1(TerminateAbilityByRecordId, int(const int64_t recordId)); MOCK_METHOD1(LockMissionForCleanup, int(int32_t missionId)); @@ -74,7 +74,6 @@ public: MOCK_METHOD0(CleanAllMissions, int()); MOCK_METHOD1(MoveMissionToFront, int(int32_t missionId)); MOCK_METHOD2(MoveMissionToFront, int(int32_t missionId, const StartOptions &startOptions)); - MOCK_METHOD1(GetMissionIdByToken, int32_t(const sptr &token)); MOCK_METHOD1(GetAbilityRunningInfos, int(std::vector &info)); MOCK_METHOD2(GetExtensionRunningInfos, int(int upperLimit, std::vector &info)); diff --git a/frameworks/kits/content/cpp/src/ohos/aafwk/content/extra_params.cpp b/frameworks/kits/content/cpp/src/ohos/aafwk/content/extra_params.cpp index f4358176681..9433ead0d14 100644 --- a/frameworks/kits/content/cpp/src/ohos/aafwk/content/extra_params.cpp +++ b/frameworks/kits/content/cpp/src/ohos/aafwk/content/extra_params.cpp @@ -156,7 +156,6 @@ string ExtraParams::GetTargetBundleName() const { return targetBundleName_; } - /** * @brief Sets the description used for device filtering. * diff --git a/frameworks/kits/content/cpp/src/ohos/aafwk/content/want.cpp b/frameworks/kits/content/cpp/src/ohos/aafwk/content/want.cpp index ce30c18c1fb..2641b5e684d 100644 --- a/frameworks/kits/content/cpp/src/ohos/aafwk/content/want.cpp +++ b/frameworks/kits/content/cpp/src/ohos/aafwk/content/want.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -1341,7 +1341,7 @@ Want &Want::SetUriAndType(const Uri &uri, const std::string &type) /** * @description: Converts a Want into a URI string containing a representation of it. * @param want Indicates the want description.--Want. - * @return Returns an encoding URI string describing the Want object. + * @return Returns a encoding URI string describing the Want object. */ std::string Want::WantToUri(Want &want) { diff --git a/frameworks/kits/content/cpp/src/ohos/aafwk/content/want_params.cpp b/frameworks/kits/content/cpp/src/ohos/aafwk/content/want_params.cpp index 8a2a1ec8cd9..ecb52051305 100644 --- a/frameworks/kits/content/cpp/src/ohos/aafwk/content/want_params.cpp +++ b/frameworks/kits/content/cpp/src/ohos/aafwk/content/want_params.cpp @@ -1350,7 +1350,7 @@ void WantParams::DumpInfo(int level) const if (typeId != VALUE_TYPE_NULL) { std::string value = WantParams::GetStringByType(it.second, typeId); ABILITYBASE_LOGI( - "=WantParams::params_[%{public}s] : %{private}s =============", it.first.c_str(), value.c_str()); + "=WantParams::params_[%{public}s] : %{public}s =============", it.first.c_str(), value.c_str()); } else { ABILITYBASE_LOGI("=WantParams::params_[%{public}s] : type error =============", it.first.c_str()); } diff --git a/frameworks/kits/runtime/native/js_data_struct_converter.cpp b/frameworks/kits/runtime/native/js_data_struct_converter.cpp index 80641366805..161a6454c21 100644 --- a/frameworks/kits/runtime/native/js_data_struct_converter.cpp +++ b/frameworks/kits/runtime/native/js_data_struct_converter.cpp @@ -171,6 +171,7 @@ NativeValue* CreateJsApplicationInfo(NativeEngine& engine, const AppExecFwk::App } } object->SetProperty("moduleInfo", arrayValue); + // metaData: Map>; for (auto &item : applicationInfo.metaData) { object->SetProperty(item.first.c_str(), CreateJsCustomizeDataArray(engine, item.second)); } diff --git a/frameworks/kits/runtime/native/js_runtime.cpp b/frameworks/kits/runtime/native/js_runtime.cpp index 0a7d8f3bc6b..baef798a1f1 100644 --- a/frameworks/kits/runtime/native/js_runtime.cpp +++ b/frameworks/kits/runtime/native/js_runtime.cpp @@ -524,7 +524,7 @@ NativeValue* JsRuntime::ClearCallbackTimer(NativeEngine& engine, NativeCallbackI std::string JsRuntime::BuildNativeAndJsBackStackTrace() { std::string straceStr = ""; - // [[maybe_unused]]bool temp = nativeEngine_->BuildNativeAndJsBackStackTrace(straceStr) + // [[maybe_unused]]bool temp = nativeEngine_->BuildNativeAndJsBackStackTrace(straceStr); return straceStr; } } // namespace AbilityRuntime diff --git a/frameworks/kits/test/mock/AMS/mock_ability_manager_service.h b/frameworks/kits/test/mock/AMS/mock_ability_manager_service.h index f64569134fa..5f7106cf5b4 100644 --- a/frameworks/kits/test/mock/AMS/mock_ability_manager_service.h +++ b/frameworks/kits/test/mock/AMS/mock_ability_manager_service.h @@ -91,7 +91,7 @@ public: MOCK_METHOD1(MoveMissionToTop, int(int32_t missionId)); MOCK_METHOD1(KillProcess, int(const std::string &bundleName)); - MOCK_METHOD2(UninstallApp, int(const std::string &bundleName, int32_t uid)); + MOCK_METHOD1(UninstallApp, int(const std::string &bundleName)); MOCK_METHOD2( GetWantSender, sptr(const WantSenderInfo &wantSenderInfo, const sptr &callerToken)); MOCK_METHOD2(SendWantSender, int(const sptr &target, const SenderInfo &senderInfo)); @@ -142,7 +142,6 @@ public: MOCK_METHOD2(GetExtensionRunningInfos, int(int upperLimit, std::vector &info)); MOCK_METHOD1(GetProcessRunningInfos, int(std::vector &info)); MOCK_METHOD3(StartAbilityByCall, int(const Want &, const sptr &, const sptr &)); - MOCK_METHOD1(GetMissionIdByToken, int32_t(const sptr &token)); int MoveMissionToEnd(const sptr &token, const bool nonFirst) override; bool IsFirstInMission(const sptr &token) override; diff --git a/frameworks/kits/test/mock/AMS/mock_serviceability_manager_service.h b/frameworks/kits/test/mock/AMS/mock_serviceability_manager_service.h index 35cc923d832..5101d21735a 100644 --- a/frameworks/kits/test/mock/AMS/mock_serviceability_manager_service.h +++ b/frameworks/kits/test/mock/AMS/mock_serviceability_manager_service.h @@ -91,7 +91,7 @@ public: MOCK_METHOD1(GetAllStackInfo, int(StackInfo &stackInfo)); MOCK_METHOD1(MoveMissionToTop, int(int32_t missionId)); MOCK_METHOD1(KillProcess, int(const std::string &bundleName)); - MOCK_METHOD2(UninstallApp, int(const std::string &bundleName, int32_t uid)); + MOCK_METHOD1(UninstallApp, int(const std::string &bundleName)); MOCK_METHOD2( GetWantSender, sptr(const WantSenderInfo &wantSenderInfo, const sptr &callerToken)); MOCK_METHOD2(SendWantSender, int(const sptr &target, const SenderInfo &senderInfo)); @@ -131,7 +131,6 @@ public: MOCK_METHOD3( GetMissionInfos, int(const std::string& deviceId, int32_t numMax, std::vector &missionInfos)); MOCK_METHOD3(GetMissionInfo, int(const std::string& deviceId, int32_t missionId, MissionInfo &missionInfo)); - MOCK_METHOD1(GetMissionIdByToken, int32_t(const sptr &token)); MOCK_METHOD1(CleanMission, int(int32_t missionId)); MOCK_METHOD0(CleanAllMissions, int()); MOCK_METHOD1(MoveMissionToFront, int(int32_t missionId)); diff --git a/frameworks/kits/test/mock/DemoObServer/mock_ability_thread_for_data_observer.h b/frameworks/kits/test/mock/DemoObServer/mock_ability_thread_for_data_observer.h index 8db35922a30..8a3e95caa16 100644 --- a/frameworks/kits/test/mock/DemoObServer/mock_ability_thread_for_data_observer.h +++ b/frameworks/kits/test/mock/DemoObServer/mock_ability_thread_for_data_observer.h @@ -36,19 +36,16 @@ sptr MockCreateAbilityThread() sptr abilitythread(new (std::nothrow) AppExecFwk::AbilityThread()); if (abilitythread == nullptr) { GTEST_LOG_(INFO) << "mock_ability_thread_for_data_observer:mock abilityhreadptr is nullptr called"; - return nullptr; } std::shared_ptr application = std::make_shared(); if (application == nullptr) { GTEST_LOG_(INFO) << "mock_ability_thread_for_data_observer:mock applicationptr is nullptr called"; - return nullptr; } std::shared_ptr info = std::make_shared(); if (info == nullptr) { GTEST_LOG_(INFO) << "mock_ability_thread_for_data_observer:mock AbilityInfo::info is nullptr called"; - return nullptr; } info->name = std::string("MockAbilityTest"); diff --git a/frameworks/kits/test/moduletest/cpp/abilitytest/ability_context_test.cpp b/frameworks/kits/test/moduletest/cpp/abilitytest/ability_context_test.cpp index e86f616a2cd..c198d37047c 100644 --- a/frameworks/kits/test/moduletest/cpp/abilitytest/ability_context_test.cpp +++ b/frameworks/kits/test/moduletest/cpp/abilitytest/ability_context_test.cpp @@ -50,7 +50,7 @@ void AbilityContextTest::SetUpTestCase(void) OHOS::sptr abilityObject = new (std::nothrow) MockServiceAbilityManagerService(); auto sysMgr = OHOS::DelayedSingleton::GetInstance(); - if (sysMgr == nullptr) { + if (sysMgr == NULL) { GTEST_LOG_(ERROR) << "fail to get ISystemAbilityManager"; return; } diff --git a/frameworks/kits/wantagent/src/pending_want.cpp b/frameworks/kits/wantagent/src/pending_want.cpp index b18bd56d754..262e56d0a7c 100644 --- a/frameworks/kits/wantagent/src/pending_want.cpp +++ b/frameworks/kits/wantagent/src/pending_want.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -265,10 +265,10 @@ int PendingWant::SendAndReturnResult(int resultCode, const std::shared_ptr bool PendingWant::Equals( const std::shared_ptr &targetPendingWant, const std::shared_ptr &otherPendingWant) { - if ((targetPendingWant == nullptr) && (otherPendingWant == nullptr)) { + if (targetPendingWant == nullptr && otherPendingWant == nullptr) { return true; } - if ((targetPendingWant == nullptr) || (otherPendingWant == nullptr)) { + if (targetPendingWant == nullptr || otherPendingWant == nullptr) { return false; } return targetPendingWant->GetHashCode(targetPendingWant->GetTarget()) == diff --git a/frameworks/kits/wantagent/src/want_agent_helper.cpp b/frameworks/kits/wantagent/src/want_agent_helper.cpp index 00a98755f58..14e9c459a20 100644 --- a/frameworks/kits/wantagent/src/want_agent_helper.cpp +++ b/frameworks/kits/wantagent/src/want_agent_helper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -169,7 +169,7 @@ std::shared_ptr WantAgentHelper::GetWantAgent(const WantAgentInfo &pa WantAgentConstant::OperationType WantAgentHelper::GetType(const std::shared_ptr &agent) { - if ((agent == nullptr) || (agent->GetPendingWant() == nullptr)) { + if (agent == nullptr || agent->GetPendingWant() == nullptr) { return WantAgentConstant::OperationType::UNKNOWN_TYPE; } diff --git a/interfaces/innerkits/ability_manager/include/ability_manager_client.h b/interfaces/innerkits/ability_manager/include/ability_manager_client.h index ab61c4eeac2..e8bd70cb0b1 100644 --- a/interfaces/innerkits/ability_manager/include/ability_manager_client.h +++ b/interfaces/innerkits/ability_manager/include/ability_manager_client.h @@ -636,15 +636,6 @@ public: ErrCode MoveMissionToFront(int32_t missionId); ErrCode MoveMissionToFront(int32_t missionId, const StartOptions &startOptions); - /** - * @brief Get mission id by ability token. - * - * @param token ability token. - * @param missionId output mission id. - * @return Returns ERR_OK on success, others on failure. - */ - ErrCode GetMissionIdByToken(const sptr &token, int32_t &missionId); - /** * Start Ability, connect session with common ability. * diff --git a/interfaces/innerkits/ability_manager/include/ability_manager_interface.h b/interfaces/innerkits/ability_manager/include/ability_manager_interface.h index 123e08e5cef..c1e73ed03a6 100644 --- a/interfaces/innerkits/ability_manager/include/ability_manager_interface.h +++ b/interfaces/innerkits/ability_manager/include/ability_manager_interface.h @@ -394,11 +394,10 @@ public: /** * Uninstall app * - * @param bundleName bundle name of uninstalling app. - * @param uid uid of bundle. + * @param bundleName. * @return Returns ERR_OK on success, others on failure. */ - virtual int UninstallApp(const std::string &bundleName, int32_t uid) = 0; + virtual int UninstallApp(const std::string &bundleName) = 0; /** * Moving mission to the specified stack by mission option(Enter floating window mode). @@ -728,14 +727,6 @@ public: */ virtual int SendANRProcessID(int pid) = 0; - /** - * Get mission id by ability token. - * - * @param token The token of ability. - * @return Returns -1 if do not find mission, otherwise return mission id. - */ - virtual int32_t GetMissionIdByToken(const sptr &token) = 0; - enum { // ipc id 1-1000 for kit // ipc id for terminating ability (1) @@ -906,9 +897,6 @@ public: // ipc id for move mission to front by options (56) MOVE_MISSION_TO_FRONT_BY_OPTIONS, - // ipc for get mission id by ability token (57) - GET_MISSION_ID_BY_ABILITY_TOKEN, - // ipc id 1001-2000 for DMS // ipc id for starting ability (1001) START_ABILITY = 1001, diff --git a/interfaces/innerkits/ability_manager/include/ability_scheduler_interface.h b/interfaces/innerkits/ability_manager/include/ability_scheduler_interface.h index 14bbfb31f6e..7696ce30911 100644 --- a/interfaces/innerkits/ability_manager/include/ability_scheduler_interface.h +++ b/interfaces/innerkits/ability_manager/include/ability_scheduler_interface.h @@ -368,8 +368,8 @@ public: // ipc id for continue ability CONTINUE_ABILITY, - - // ipc id for dump ability runner + + // ipc id for dump ability runner DUMP_ABILITY_RUNNER_INNER }; }; diff --git a/interfaces/innerkits/app_manager/include/appmgr/app_mgr_client.h b/interfaces/innerkits/app_manager/include/appmgr/app_mgr_client.h index e8d43c6ec3b..9626b64b112 100644 --- a/interfaces/innerkits/app_manager/include/appmgr/app_mgr_client.h +++ b/interfaces/innerkits/app_manager/include/appmgr/app_mgr_client.h @@ -264,13 +264,6 @@ public: */ virtual void AttachRenderProcess(const sptr &renderScheduler); - /** - * Post a task to the not response process. - * - * @param pid, the not response process id. - */ - virtual void PostANRTaskByProcessID(const pid_t pid); - private: void SetServiceManager(std::unique_ptr serviceMgr); diff --git a/interfaces/innerkits/app_manager/include/appmgr/app_mgr_interface.h b/interfaces/innerkits/app_manager/include/appmgr/app_mgr_interface.h index 5fb8ffff4bf..c05c45c6544 100644 --- a/interfaces/innerkits/app_manager/include/appmgr/app_mgr_interface.h +++ b/interfaces/innerkits/app_manager/include/appmgr/app_mgr_interface.h @@ -214,13 +214,6 @@ public: */ virtual void AttachRenderProcess(const sptr &renderScheduler) = 0; - /** - * Post a task to the not response process. - * - * @param pid, the not response process id. - */ - virtual void PostANRTaskByProcessID(const pid_t pid) = 0; - enum class Message { APP_ATTACH_APPLICATION = 0, APP_APPLICATION_FOREGROUNDED, @@ -244,7 +237,6 @@ public: APP_GET_ABILITY_RECORDS_BY_PROCESS_ID, START_RENDER_PROCESS, ATTACH_RENDER_PROCESS, - POST_ANR_TASK_BY_PID, }; }; } // namespace AppExecFwk diff --git a/interfaces/innerkits/app_manager/include/appmgr/app_mgr_proxy.h b/interfaces/innerkits/app_manager/include/appmgr/app_mgr_proxy.h index 845f139539c..cb1bb6f8bfb 100644 --- a/interfaces/innerkits/app_manager/include/appmgr/app_mgr_proxy.h +++ b/interfaces/innerkits/app_manager/include/appmgr/app_mgr_proxy.h @@ -207,13 +207,6 @@ public: */ virtual void AttachRenderProcess(const sptr &renderApp) override; - /** - * Post a task to the not response process. - * - * @param pid, the not response process id. - */ - virtual void PostANRTaskByProcessID(const pid_t pid) override; - private: bool SendTransactCmd(IAppMgr::Message code, MessageParcel &data, MessageParcel &reply); bool WriteInterfaceToken(MessageParcel &data); diff --git a/interfaces/innerkits/app_manager/include/appmgr/app_mgr_stub.h b/interfaces/innerkits/app_manager/include/appmgr/app_mgr_stub.h index e9513f2fb14..36c330d19d6 100644 --- a/interfaces/innerkits/app_manager/include/appmgr/app_mgr_stub.h +++ b/interfaces/innerkits/app_manager/include/appmgr/app_mgr_stub.h @@ -77,7 +77,6 @@ private: int32_t HandleGetAbilityRecordsByProcessID(MessageParcel &data, MessageParcel &reply); int32_t HandleStartRenderProcess(MessageParcel &data, MessageParcel &reply); int32_t HandleAttachRenderProcess(MessageParcel &data, MessageParcel &reply); - int32_t HandlePostANRTaskByProcessID(MessageParcel &data, MessageParcel &reply); using AppMgrFunc = int32_t (AppMgrStub::*)(MessageParcel &data, MessageParcel &reply); std::map memberFuncMap_; diff --git a/interfaces/innerkits/app_manager/include/appmgr/app_scheduler_host.h b/interfaces/innerkits/app_manager/include/appmgr/app_scheduler_host.h index 6c07b1963df..5d5c9e4bc5d 100644 --- a/interfaces/innerkits/app_manager/include/appmgr/app_scheduler_host.h +++ b/interfaces/innerkits/app_manager/include/appmgr/app_scheduler_host.h @@ -48,7 +48,6 @@ private: int32_t HandleScheduleConfigurationUpdated(MessageParcel &data, MessageParcel &reply); int32_t HandleScheduleProcessSecurityExit(MessageParcel &data, MessageParcel &reply); int32_t HandleScheduleAcceptWant(MessageParcel &data, MessageParcel &reply); - int32_t HandleScheduleANRProcess(MessageParcel &data, MessageParcel &reply); using AppSchedulerFunc = int32_t (AppSchedulerHost::*)(MessageParcel &data, MessageParcel &reply); std::map memberFuncMap_; diff --git a/interfaces/innerkits/app_manager/include/appmgr/app_scheduler_interface.h b/interfaces/innerkits/app_manager/include/appmgr/app_scheduler_interface.h index 334ec2bc93b..d80f7d2166e 100644 --- a/interfaces/innerkits/app_manager/include/appmgr/app_scheduler_interface.h +++ b/interfaces/innerkits/app_manager/include/appmgr/app_scheduler_interface.h @@ -131,15 +131,6 @@ public: virtual void ScheduleAcceptWant(const AAFwk::Want &want, const std::string &moduleName) = 0; - /** - * - * @brief The handle of application not response process. - * - * @param sigMessage Recieve the sig message. - * - */ - virtual void ScheduleANRProcess() = 0; - enum class Message { SCHEDULE_FOREGROUND_APPLICATION_TRANSACTION = 0, SCHEDULE_BACKGROUND_APPLICATION_TRANSACTION, @@ -154,7 +145,6 @@ public: SCHEDULE_PROCESS_SECURITY_EXIT_TRANSACTION, SCHEDULE_ABILITY_STAGE_INFO, SCHEDULE_ACCEPT_WANT, - SCHEDULE_ANR_PROCESS, }; }; } // namespace AppExecFwk diff --git a/interfaces/innerkits/app_manager/include/appmgr/app_scheduler_proxy.h b/interfaces/innerkits/app_manager/include/appmgr/app_scheduler_proxy.h index f72e8b35708..74462aaadee 100644 --- a/interfaces/innerkits/app_manager/include/appmgr/app_scheduler_proxy.h +++ b/interfaces/innerkits/app_manager/include/appmgr/app_scheduler_proxy.h @@ -134,15 +134,6 @@ public: virtual void ScheduleAcceptWant(const AAFwk::Want &want, const std::string &moduleName) override; - /** - * - * @brief The handle of application not response process. - * - * @param sigMessage Recieve the sig message. - * - */ - virtual void ScheduleANRProcess() override; - private: bool WriteInterfaceToken(MessageParcel &data); static inline BrokerDelegator delegator_; diff --git a/interfaces/innerkits/app_manager/src/appmgr/ability_controller_stub.cpp b/interfaces/innerkits/app_manager/src/appmgr/ability_controller_stub.cpp index 58d345f4867..e9b3a04d80b 100644 --- a/interfaces/innerkits/app_manager/src/appmgr/ability_controller_stub.cpp +++ b/interfaces/innerkits/app_manager/src/appmgr/ability_controller_stub.cpp @@ -39,7 +39,7 @@ AbilityControllerStub::~AbilityControllerStub() int AbilityControllerStub::OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - HILOG_INFO("AbilityControllerStub::OnReceived, code = %{public}u, flags= %{public}d.", code, option.GetFlags()); + HILOG_INFO("AbilityControllerStub::OnReceived, code = %{public}d, flags= %{public}d.", code, option.GetFlags()); std::u16string descriptor = AbilityControllerStub::GetDescriptor(); std::u16string remoteDescriptor = data.ReadInterfaceToken(); if (descriptor != remoteDescriptor) { diff --git a/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_stub.cpp b/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_stub.cpp index 1666833ee72..71d298be2e6 100644 --- a/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_stub.cpp +++ b/interfaces/innerkits/app_manager/src/appmgr/ams_mgr_stub.cpp @@ -76,7 +76,7 @@ AmsMgrStub::~AmsMgrStub() int AmsMgrStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - HILOG_INFO("AmsMgrStub::OnReceived, code = %{public}u, flags= %{public}d.", code, option.GetFlags()); + HILOG_INFO("AmsMgrStub::OnReceived, code = %{public}d, flags= %{public}d.", code, option.GetFlags()); std::u16string descriptor = AmsMgrStub::GetDescriptor(); std::u16string remoteDescriptor = data.ReadInterfaceToken(); if (descriptor != remoteDescriptor) { diff --git a/interfaces/innerkits/app_manager/src/appmgr/app_mgr_client.cpp b/interfaces/innerkits/app_manager/src/appmgr/app_mgr_client.cpp index b21bed8c4e1..ce9ece8a858 100644 --- a/interfaces/innerkits/app_manager/src/appmgr/app_mgr_client.cpp +++ b/interfaces/innerkits/app_manager/src/appmgr/app_mgr_client.cpp @@ -457,16 +457,5 @@ void AppMgrClient::AttachRenderProcess(const sptr &renderSched service->AttachRenderProcess(renderScheduler->AsObject()); } } - -void AppMgrClient::PostANRTaskByProcessID(const pid_t pid) -{ - sptr service = iface_cast(remote_); - if (service == nullptr) { - HILOG_ERROR("service is nullptr"); - return; - } - - service->PostANRTaskByProcessID(pid); -} } // namespace AppExecFwk } // namespace OHOS diff --git a/interfaces/innerkits/app_manager/src/appmgr/app_mgr_proxy.cpp b/interfaces/innerkits/app_manager/src/appmgr/app_mgr_proxy.cpp index 5a00a9768f8..b5726463380 100644 --- a/interfaces/innerkits/app_manager/src/appmgr/app_mgr_proxy.cpp +++ b/interfaces/innerkits/app_manager/src/appmgr/app_mgr_proxy.cpp @@ -651,31 +651,5 @@ void AppMgrProxy::AttachRenderProcess(const sptr &renderScheduler return; } } - -void AppMgrProxy::PostANRTaskByProcessID(const pid_t pid) -{ - HILOG_DEBUG("start"); - MessageParcel data; - MessageParcel reply; - MessageOption option(MessageOption::TF_SYNC); - if (!WriteInterfaceToken(data)) { - return; - } - if (!data.WriteInt32(pid)) { - HILOG_ERROR("parcel WriteInt32 failed"); - return; - } - sptr remote = Remote(); - if (remote == nullptr) { - HILOG_ERROR("Remote() is NULL"); - return; - } - int32_t ret = - remote->SendRequest(static_cast(IAppMgr::Message::POST_ANR_TASK_BY_PID), data, reply, option); - if (ret != NO_ERROR) { - HILOG_WARN("SendRequest is failed, error code: %{public}d", ret); - } - HILOG_DEBUG("end"); -} } // namespace AppExecFwk } // namespace OHOS diff --git a/interfaces/innerkits/app_manager/src/appmgr/app_mgr_stub.cpp b/interfaces/innerkits/app_manager/src/appmgr/app_mgr_stub.cpp index 68361bcd002..bad33a92ec4 100644 --- a/interfaces/innerkits/app_manager/src/appmgr/app_mgr_stub.cpp +++ b/interfaces/innerkits/app_manager/src/appmgr/app_mgr_stub.cpp @@ -76,8 +76,6 @@ AppMgrStub::AppMgrStub() &AppMgrStub::HandleStartRenderProcess; memberFuncMap_[static_cast(IAppMgr::Message::ATTACH_RENDER_PROCESS)] = &AppMgrStub::HandleAttachRenderProcess; - memberFuncMap_[static_cast(IAppMgr::Message::POST_ANR_TASK_BY_PID)] = - &AppMgrStub::HandlePostANRTaskByProcessID; } AppMgrStub::~AppMgrStub() @@ -87,7 +85,7 @@ AppMgrStub::~AppMgrStub() int AppMgrStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - HILOG_INFO("AppMgrStub::OnReceived, code = %{public}u, flags= %{public}d.", code, option.GetFlags()); + HILOG_INFO("AppMgrStub::OnReceived, code = %{public}d, flags= %{public}d.", code, option.GetFlags()); std::u16string descriptor = AppMgrStub::GetDescriptor(); std::u16string remoteDescriptor = data.ReadInterfaceToken(); if (descriptor != remoteDescriptor) { @@ -387,12 +385,5 @@ int32_t AppMgrStub::HandleAttachRenderProcess(MessageParcel &data, MessageParcel AttachRenderProcess(scheduler); return NO_ERROR; } - -int32_t AppMgrStub::HandlePostANRTaskByProcessID(MessageParcel &data, MessageParcel &reply) -{ - auto pid = data.ReadInt32(); - PostANRTaskByProcessID(pid); - return NO_ERROR; -} } // namespace AppExecFwk } // namespace OHOS diff --git a/interfaces/innerkits/app_manager/src/appmgr/app_scheduler_host.cpp b/interfaces/innerkits/app_manager/src/appmgr/app_scheduler_host.cpp index 4a9a096ed95..a2aa882fcec 100644 --- a/interfaces/innerkits/app_manager/src/appmgr/app_scheduler_host.cpp +++ b/interfaces/innerkits/app_manager/src/appmgr/app_scheduler_host.cpp @@ -50,8 +50,6 @@ AppSchedulerHost::AppSchedulerHost() &AppSchedulerHost::HandleScheduleAbilityStage; memberFuncMap_[static_cast(IAppScheduler::Message::SCHEDULE_ACCEPT_WANT)] = &AppSchedulerHost::HandleScheduleAcceptWant; - memberFuncMap_[static_cast(IAppScheduler::Message::SCHEDULE_ANR_PROCESS)] = - &AppSchedulerHost::HandleScheduleANRProcess; } AppSchedulerHost::~AppSchedulerHost() @@ -61,7 +59,7 @@ AppSchedulerHost::~AppSchedulerHost() int AppSchedulerHost::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - HILOG_INFO("AppSchedulerHost::OnReceived, code = %{public}u, flags= %{public}d.", code, option.GetFlags()); + HILOG_INFO("AppSchedulerHost::OnReceived, code = %{public}d, flags= %{public}d.", code, option.GetFlags()); std::u16string descriptor = AppSchedulerHost::GetDescriptor(); std::u16string remoteDescriptor = data.ReadInterfaceToken(); if (descriptor != remoteDescriptor) { @@ -213,12 +211,5 @@ int32_t AppSchedulerHost::HandleScheduleAcceptWant(MessageParcel &data, MessageP ScheduleAcceptWant(*want, moduleName); return NO_ERROR; } - -int32_t AppSchedulerHost::HandleScheduleANRProcess(MessageParcel &data, MessageParcel &reply) -{ - BYTRACE(BYTRACE_TAG_APP); - ScheduleANRProcess(); - return NO_ERROR; -} } // namespace AppExecFwk } // namespace OHOS diff --git a/interfaces/innerkits/app_manager/src/appmgr/app_scheduler_proxy.cpp b/interfaces/innerkits/app_manager/src/appmgr/app_scheduler_proxy.cpp index 005c8f4e45c..1305571339d 100644 --- a/interfaces/innerkits/app_manager/src/appmgr/app_scheduler_proxy.cpp +++ b/interfaces/innerkits/app_manager/src/appmgr/app_scheduler_proxy.cpp @@ -337,25 +337,5 @@ void AppSchedulerProxy::ScheduleAcceptWant(const AAFwk::Want &want, const std::s HILOG_WARN("SendRequest is failed, error code: %{public}d", ret); } } - -void AppSchedulerProxy::ScheduleANRProcess() -{ - MessageParcel data; - MessageParcel reply; - MessageOption option(MessageOption::TF_SYNC); - if (!WriteInterfaceToken(data)) { - return; - } - sptr remote = Remote(); - if (remote == nullptr) { - HILOG_ERROR("Remote() is NULL"); - return; - } - int32_t ret = remote->SendRequest( - static_cast(IAppScheduler::Message::SCHEDULE_ANR_PROCESS), data, reply, option); - if (ret != NO_ERROR) { - HILOG_WARN("SendRequest is failed, error code: %{public}d", ret); - } -} } // namespace AppExecFwk } // namespace OHOS diff --git a/interfaces/innerkits/app_manager/src/appmgr/app_state_callback_host.cpp b/interfaces/innerkits/app_manager/src/appmgr/app_state_callback_host.cpp index 53187150543..9636dbaf4a2 100644 --- a/interfaces/innerkits/app_manager/src/appmgr/app_state_callback_host.cpp +++ b/interfaces/innerkits/app_manager/src/appmgr/app_state_callback_host.cpp @@ -41,7 +41,7 @@ AppStateCallbackHost::~AppStateCallbackHost() int AppStateCallbackHost::OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - HILOG_INFO("AppStateCallbackHost::OnReceived, code = %{public}u, flags= %{public}d.", code, option.GetFlags()); + HILOG_INFO("AppStateCallbackHost::OnReceived, code = %{public}d, flags= %{public}d.", code, option.GetFlags()); std::u16string descriptor = AppStateCallbackHost::GetDescriptor(); std::u16string remoteDescriptor = data.ReadInterfaceToken(); if (descriptor != remoteDescriptor) { diff --git a/interfaces/innerkits/app_manager/src/appmgr/application_state_observer_stub.cpp b/interfaces/innerkits/app_manager/src/appmgr/application_state_observer_stub.cpp index f2a5ede0472..3bf6e6e6bc6 100644 --- a/interfaces/innerkits/app_manager/src/appmgr/application_state_observer_stub.cpp +++ b/interfaces/innerkits/app_manager/src/appmgr/application_state_observer_stub.cpp @@ -52,7 +52,7 @@ ApplicationStateObserverStub::~ApplicationStateObserverStub() int ApplicationStateObserverStub::OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - HILOG_INFO("ApplicationStateObserverStub::OnReceived, code = %{public}u, flags= %{public}d.", code, option.GetFlags()); + HILOG_INFO("ApplicationStateObserverStub::OnReceived, code = %{public}d, flags= %{public}d.", code, option.GetFlags()); std::u16string descriptor = ApplicationStateObserverStub::GetDescriptor(); std::u16string remoteDescriptor = data.ReadInterfaceToken(); if (descriptor != remoteDescriptor) { diff --git a/interfaces/innerkits/app_manager/src/appmgr/render_scheduler_host.cpp b/interfaces/innerkits/app_manager/src/appmgr/render_scheduler_host.cpp index 018c0291acd..d2118654f74 100644 --- a/interfaces/innerkits/app_manager/src/appmgr/render_scheduler_host.cpp +++ b/interfaces/innerkits/app_manager/src/appmgr/render_scheduler_host.cpp @@ -34,7 +34,7 @@ RenderSchedulerHost::~RenderSchedulerHost() int RenderSchedulerHost::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - HILOG_INFO("RenderSchedulerHost::OnReceived, code = %{public}u, flags= %{public}d.", code, option.GetFlags()); + HILOG_INFO("RenderSchedulerHost::OnReceived, code = %{public}d, flags= %{public}d.", code, option.GetFlags()); std::u16string descriptor = RenderSchedulerHost::GetDescriptor(); std::u16string remoteDescriptor = data.ReadInterfaceToken(); if (descriptor != remoteDescriptor) { diff --git a/interfaces/innerkits/app_manager/src/appmgr/start_specified_ability_response_stub.cpp b/interfaces/innerkits/app_manager/src/appmgr/start_specified_ability_response_stub.cpp index a39e5498890..94ce53749bd 100644 --- a/interfaces/innerkits/app_manager/src/appmgr/start_specified_ability_response_stub.cpp +++ b/interfaces/innerkits/app_manager/src/appmgr/start_specified_ability_response_stub.cpp @@ -65,7 +65,7 @@ int32_t StartSpecifiedAbilityResponseStub::HandleOnTimeoutResponse(MessageParcel int StartSpecifiedAbilityResponseStub::OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - HILOG_INFO("StartSpecifiedAbilityResponseStub::OnReceived, code = %{public}u, flags= %{public}d.", + HILOG_INFO("StartSpecifiedAbilityResponseStub::OnReceived, code = %{public}d, flags= %{public}d.", code, option.GetFlags()); std::u16string descriptor = StartSpecifiedAbilityResponseStub::GetDescriptor(); std::u16string remoteDescriptor = data.ReadInterfaceToken(); diff --git a/interfaces/innerkits/form_manager/include/form_constants.h b/interfaces/innerkits/form_manager/include/form_constants.h index fe474794aa6..f0e2178af28 100644 --- a/interfaces/innerkits/form_manager/include/form_constants.h +++ b/interfaces/innerkits/form_manager/include/form_constants.h @@ -43,8 +43,6 @@ namespace Constants { const std::string SYSTEM_PARAM_FORM_REFRESH_MIN_TIME = "persist.sys.fms.form.refresh.min.time"; const std::string ACTION_UPDATEATTIMER = "form_update_at_timer"; const std::string KEY_WAKEUP_TIME = "wakeUpTime"; - const std::string KEY_WAKEUP_TIME_LEFT = "wakeUpTimeLeft"; - const std::string KEY_WAKEUP_TIME_RIGHT = "wakeUpTimeRight"; const std::string KEY_ACTION_TYPE = "form_update_action_type"; const std::string ABS_CODE_PATH = "/data/app/el1/bundle/public"; const std::string LOCAL_CODE_PATH = "/data/storage/el1/bundle"; diff --git a/interfaces/innerkits/form_manager/src/form_host_stub.cpp b/interfaces/innerkits/form_manager/src/form_host_stub.cpp index e7ddc4da67f..fcbcfa72e52 100644 --- a/interfaces/innerkits/form_manager/src/form_host_stub.cpp +++ b/interfaces/innerkits/form_manager/src/form_host_stub.cpp @@ -47,7 +47,7 @@ FormHostStub::~FormHostStub() */ int FormHostStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - HILOG_INFO("FormHostStub::OnReceived, code = %{public}u, flags= %{public}d.", code, option.GetFlags()); + HILOG_INFO("FormHostStub::OnReceived, code = %{public}d, flags= %{public}d.", code, option.GetFlags()); std::u16string descriptor = FormHostStub::GetDescriptor(); std::u16string remoteDescriptor = data.ReadInterfaceToken(); if (descriptor != remoteDescriptor) { diff --git a/interfaces/innerkits/form_manager/src/form_mgr_stub.cpp b/interfaces/innerkits/form_manager/src/form_mgr_stub.cpp index b39e597b63b..9c02fe52f6f 100644 --- a/interfaces/innerkits/form_manager/src/form_mgr_stub.cpp +++ b/interfaces/innerkits/form_manager/src/form_mgr_stub.cpp @@ -98,7 +98,7 @@ FormMgrStub::~FormMgrStub() */ int FormMgrStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - HILOG_INFO("FormMgrStub::OnReceived, code = %{public}u, flags= %{public}d.", code, option.GetFlags()); + HILOG_INFO("FormMgrStub::OnReceived, code = %{public}d, flags= %{public}d.", code, option.GetFlags()); std::u16string descriptor = FormMgrStub::GetDescriptor(); std::u16string remoteDescriptor = data.ReadInterfaceToken(); if (descriptor != remoteDescriptor) { diff --git a/interfaces/innerkits/form_manager/src/form_provider_stub.cpp b/interfaces/innerkits/form_manager/src/form_provider_stub.cpp index 20898728ca0..aae547f49c4 100644 --- a/interfaces/innerkits/form_manager/src/form_provider_stub.cpp +++ b/interfaces/innerkits/form_manager/src/form_provider_stub.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -12,10 +12,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "form_provider_stub.h" #include "appexecfwk_errors.h" #include "app_scheduler_interface.h" #include "errors.h" +#include "form_provider_stub.h" #include "hilog_wrapper.h" #include "ipc_skeleton.h" #include "ipc_types.h" @@ -54,7 +54,7 @@ FormProviderStub::~FormProviderStub() */ int FormProviderStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - HILOG_INFO("FormProviderStub::OnReceived, code = %{public}u, flags= %{public}d.", code, option.GetFlags()); + HILOG_INFO("FormProviderStub::OnReceived, code = %{public}d, flags= %{public}d.", code, option.GetFlags()); std::u16string descriptor = FormProviderStub::GetDescriptor(); std::u16string remoteDescriptor = data.ReadInterfaceToken(); if (descriptor != remoteDescriptor) { diff --git a/interfaces/innerkits/form_manager/src/form_supply_stub.cpp b/interfaces/innerkits/form_manager/src/form_supply_stub.cpp index 97c7e828e91..fbebe28689e 100644 --- a/interfaces/innerkits/form_manager/src/form_supply_stub.cpp +++ b/interfaces/innerkits/form_manager/src/form_supply_stub.cpp @@ -44,7 +44,7 @@ FormSupplyStub::~FormSupplyStub() */ int FormSupplyStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - HILOG_INFO("FormSupplyStub::OnReceived, code = %{public}u, flags= %{public}d.", code, option.GetFlags()); + HILOG_INFO("FormSupplyStub::OnReceived, code = %{public}d, flags= %{public}d.", code, option.GetFlags()); std::u16string descriptor = FormSupplyStub::GetDescriptor(); std::u16string remoteDescriptor = data.ReadInterfaceToken(); if (descriptor != remoteDescriptor) { diff --git a/interfaces/innerkits/want/include/ohos/aafwk/content/want.h b/interfaces/innerkits/want/include/ohos/aafwk/content/want.h index 7ce18829cb9..8cbea1e7b33 100644 --- a/interfaces/innerkits/want/include/ohos/aafwk/content/want.h +++ b/interfaces/innerkits/want/include/ohos/aafwk/content/want.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -234,7 +234,7 @@ public: /** * @description: Converts a Want into a URI string containing a representation of it. * @param want Indicates the want description.--Want. - * @return Returns an encoding URI string describing the Want object. + * @return Returns a encoding URI string describing the Want object. */ std::string WantToUri(Want &want); diff --git a/interfaces/kits/napi/aafwk/dataShare/BUILD.gn b/interfaces/kits/napi/aafwk/dataShare/BUILD.gn index 91055a5981b..7a198f290fb 100644 --- a/interfaces/kits/napi/aafwk/dataShare/BUILD.gn +++ b/interfaces/kits/napi/aafwk/dataShare/BUILD.gn @@ -20,7 +20,6 @@ ohos_shared_library("datashare") { "//foundation/aafwk/standard/frameworks/kits/ability/native/include", "//foundation/aafwk/standard/interfaces/kits/napi/aafwk/dataShare", "//foundation/aafwk/standard/interfaces/kits/napi/aafwk/inner/napi_common", - "//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/napi_rdb/include", "//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/common/include", "//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/napi_dataability/include", "//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/napi_rdb/include", diff --git a/interfaces/kits/napi/aafwk/featureAbility/BUILD.gn b/interfaces/kits/napi/aafwk/featureAbility/BUILD.gn index 059c975da36..55b5667da00 100644 --- a/interfaces/kits/napi/aafwk/featureAbility/BUILD.gn +++ b/interfaces/kits/napi/aafwk/featureAbility/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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,12 +11,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +# import("//build/config/ohos/rules.gni") import("//build/ohos.gni") ohos_shared_library("featureability") { include_dirs = [ "//foundation/aafwk/standard/interfaces/kits/napi/aafwk/featureAbility", "//foundation/aafwk/standard/interfaces/kits/napi/aafwk/inner/napi_common", - "//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/napi_rdb/include", "//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/common/include", "//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/napi_dataability/include", "//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/napi_rdb/include", @@ -26,6 +26,8 @@ ohos_shared_library("featureability") { sources = [ "//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/common/src/js_utils.cpp", + + #"//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/napi_resultset/napi_resultset_predicates.cpp", "//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/napi_dataability/src/napi_data_ability_predicates.cpp", "//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/napi_rdb/src/napi_result_set.cpp", "feature_ability.cpp", diff --git a/interfaces/kits/napi/aafwk/featureAbility/napi_context.cpp b/interfaces/kits/napi/aafwk/featureAbility/napi_context.cpp index 8cc2d2267d3..abcd15a5d77 100644 --- a/interfaces/kits/napi/aafwk/featureAbility/napi_context.cpp +++ b/interfaces/kits/napi/aafwk/featureAbility/napi_context.cpp @@ -1640,7 +1640,7 @@ void GetElementNameExecuteCB(napi_env env, void *data) } std::shared_ptr elementName = elementNameCB->cbBase.ability->GetElementName(); - if (elementName != nullptr) { + if (elementNameCB != nullptr) { elementNameCB->deviceId = elementName->GetDeviceID(); elementNameCB->bundleName = elementName->GetBundleName(); elementNameCB->abilityName = elementName->GetAbilityName(); diff --git a/interfaces/kits/napi/aafwk/featureAbility/napi_data_ability_operation.cpp b/interfaces/kits/napi/aafwk/featureAbility/napi_data_ability_operation.cpp index 98945710552..8174f23870f 100644 --- a/interfaces/kits/napi/aafwk/featureAbility/napi_data_ability_operation.cpp +++ b/interfaces/kits/napi/aafwk/featureAbility/napi_data_ability_operation.cpp @@ -94,13 +94,17 @@ napi_value BuildDataAbilityOperation( valuesBucket->Clear(); napi_value jsValueBucket = GetPropertyValueByPropertyName(env, param, "valuesBucket", napi_object); UnwrapValuesBucket(valuesBucket, env, jsValueBucket); - builder->WithValuesBucket(valuesBucket); + if (valuesBucket != nullptr) { + builder->WithValuesBucket(valuesBucket); + } // get dataAbilityPredicates property std::shared_ptr predicates = std::make_shared(); napi_value jsPredicates = GetPropertyValueByPropertyName(env, param, "predicates", napi_object); UnwrapDataAbilityPredicates(*predicates, env, jsPredicates); - builder->WithPredicates(predicates); + if (predicates != nullptr) { + builder->WithPredicates(predicates); + } // get expectedcount property int expectedCount = 0; diff --git a/interfaces/kits/napi/aafwk/inner/napi_common/BUILD.gn b/interfaces/kits/napi/aafwk/inner/napi_common/BUILD.gn index 972cbdf0abd..5a4d4d0e0e4 100644 --- a/interfaces/kits/napi/aafwk/inner/napi_common/BUILD.gn +++ b/interfaces/kits/napi/aafwk/inner/napi_common/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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/ohos/rules.gni") import("//build/ohos.gni") import("//foundation/aafwk/standard/feature.gni") ohos_shared_library("napi_common") { @@ -56,6 +57,8 @@ ohos_shared_library("napi_common") { "native_appdatamgr:native_dataability", "native_appdatamgr:native_rdb", "utils_base:utils", + + #"samgr_standard:samgr_proxy", ] if (ability_runtime_graphics) { diff --git a/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_ability.cpp b/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_ability.cpp index 225d8d6c61b..bffb159ba84 100644 --- a/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_ability.cpp +++ b/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_ability.cpp @@ -694,7 +694,7 @@ void GetExternalCacheDirExecuteCallback(napi_env env, void *data) asyncCallbackInfo->native_data.data_type = NVT_STRING; asyncCallbackInfo->native_data.str_value = asyncCallbackInfo->ability->GetExternalCacheDir(); HILOG_INFO( - "%{public}s end. ExternalCacheDir=%{private}s", __func__, asyncCallbackInfo->native_data.str_value.c_str()); + "%{public}s end. ExternalCacheDir=%{public}s", __func__, asyncCallbackInfo->native_data.str_value.c_str()); } /** @@ -2952,12 +2952,12 @@ void UnwrapAbilityStartSettingForNumber( bool isReadValue32 = false; bool isReadDouble = false; if (napi_get_value_int32(env, param, &natValue32) == napi_ok) { - HILOG_INFO("%{public}s called. Property value=%{private}d.", __func__, natValue32); + HILOG_INFO("%{public}s called. Property value=%{public}d.", __func__, natValue32); isReadValue32 = true; } if (napi_get_value_double(env, param, &natValueDouble) == napi_ok) { - HILOG_INFO("%{public}s called. Property value=%{private}lf.", __func__, natValueDouble); + HILOG_INFO("%{public}s called. Property value=%{public}lf.", __func__, natValueDouble); isReadDouble = true; } @@ -3003,7 +3003,7 @@ bool UnwrapAbilityStartSetting(napi_env env, napi_value param, AAFwk::AbilitySta switch (jsValueType) { case napi_string: { std::string natValue = UnwrapStringFromJS(env, jsProValue); - HILOG_INFO("%{public}s called. Property value=%{private}s.", __func__, natValue.c_str()); + HILOG_INFO("%{public}s called. Property value=%{public}s.", __func__, natValue.c_str()); setting.AddProperty(strProName, natValue); break; } diff --git a/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_configuration.cpp b/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_configuration.cpp index e8c37750251..ba2c69a9e06 100644 --- a/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_configuration.cpp +++ b/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_configuration.cpp @@ -27,7 +27,7 @@ bool InnerWrapConfigurationString( napi_env env, napi_value jsObject, const std::string &key, const std::string &value) { if (!value.empty()) { - HILOG_INFO("%{public}s called. key=%{public}s, value=%{private}s", __func__, key.c_str(), value.c_str()); + HILOG_INFO("%{public}s called. key=%{public}s, value=%{public}s", __func__, key.c_str(), value.c_str()); napi_value jsValue = WrapStringToJS(env, value); if (jsValue != nullptr) { NAPI_CALL_BASE(env, napi_set_named_property(env, jsObject, key.c_str(), jsValue), false); diff --git a/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_util.cpp b/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_util.cpp index 4d724479b32..903cd9e6a95 100644 --- a/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_util.cpp +++ b/interfaces/kits/napi/aafwk/inner/napi_common/napi_common_util.cpp @@ -230,7 +230,7 @@ std::string UnwrapStringFromJS(napi_env env, napi_value param, const std::string if (buf == nullptr) { return value; } - (void)memset_s(buf, size + 1, 0, size + 1); + memset_s(buf, size + 1, 0, size + 1); bool rev = napi_get_value_string_utf8(env, param, buf, size + 1, &size) == napi_ok; if (rev) { @@ -260,7 +260,7 @@ bool UnwrapStringFromJS2(napi_env env, napi_value param, std::string &value) if (buf == nullptr) { return false; } - (void)memset_s(buf, (size + 1), 0, (size + 1)); + memset_s(buf, (size + 1), 0, (size + 1)); bool rev = napi_get_value_string_utf8(env, param, buf, size + 1, &size) == napi_ok; if (rev) { diff --git a/interfaces/kits/napi/aafwk/particleAbility/BUILD.gn b/interfaces/kits/napi/aafwk/particleAbility/BUILD.gn index bbbb31acd16..6e2cf8ce3f2 100644 --- a/interfaces/kits/napi/aafwk/particleAbility/BUILD.gn +++ b/interfaces/kits/napi/aafwk/particleAbility/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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/ohos/rules.gni") import("//build/ohos.gni") ohos_shared_library("particleability") { include_dirs = [ @@ -20,7 +21,6 @@ ohos_shared_library("particleability") { "//foundation/aafwk/standard/interfaces/kits/napi/aafwk/featureAbility", "//foundation/aafwk/standard/services/common/include", "//foundation/aafwk/standard/interfaces/innerkits/ability_manager/include", - "//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/napi_rdb/include", "//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/common/include", "//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/napi_dataability/include", "//foundation/distributeddatamgr/appdatamgr/frameworks/jskitsimpl/napi_rdb/include", diff --git a/interfaces/kits/napi/aafwk/wantConstant/BUILD.gn b/interfaces/kits/napi/aafwk/wantConstant/BUILD.gn index 5facb27a223..554f9c249ea 100644 --- a/interfaces/kits/napi/aafwk/wantConstant/BUILD.gn +++ b/interfaces/kits/napi/aafwk/wantConstant/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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/ohos/rules.gni") import("//build/ohos.gni") ohos_shared_library("wantconstant") { include_dirs = [ diff --git a/services/abilitymgr/include/ability_connect_manager.h b/services/abilitymgr/include/ability_connect_manager.h index 12b1324ec3c..166c225ae19 100644 --- a/services/abilitymgr/include/ability_connect_manager.h +++ b/services/abilitymgr/include/ability_connect_manager.h @@ -230,8 +230,6 @@ public: void DumpState(std::vector &info, bool isClient, const std::string &args = "") const; - void StopAllExtensions(); - // MSG 0 - 20 represents timeout message static constexpr uint32_t LOAD_TIMEOUT_MSG = 0; static constexpr uint32_t CONNECT_TIMEOUT_MSG = 1; diff --git a/services/abilitymgr/include/ability_manager_proxy.h b/services/abilitymgr/include/ability_manager_proxy.h index 9170e39f30d..737b3f193dc 100644 --- a/services/abilitymgr/include/ability_manager_proxy.h +++ b/services/abilitymgr/include/ability_manager_proxy.h @@ -357,11 +357,10 @@ public: /** * Uninstall app * - * @param bundleName bundle name of uninstalling app. - * @param uid uid of bundle. + * @param bundleName. * @return Returns ERR_OK on success, others on failure. */ - virtual int UninstallApp(const std::string &bundleName, int32_t uid) override; + virtual int UninstallApp(const std::string &bundleName) override; /** * Moving mission to the specified stack by mission option(Enter floating window mode). @@ -682,14 +681,6 @@ public: */ virtual int SendANRProcessID(int pid) override; - /** - * Get mission id by ability token. - * - * @param token The token of ability. - * @return Returns -1 if do not find mission, otherwise return mission id. - */ - virtual int32_t GetMissionIdByToken(const sptr &token) override; - private: template int GetParcelableInfos(MessageParcel &reply, std::vector &parcelableInfos); diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index 57a1963cf85..7bbd8160257 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -475,11 +475,10 @@ public: /** * Uninstall app * - * @param bundleName bundle name of uninstalling app. - * @param uid uid of bundle. + * @param bundleName. * @return Returns ERR_OK on success, others on failure. */ - virtual int UninstallApp(const std::string &bundleName, int32_t uid) override; + virtual int UninstallApp(const std::string &bundleName) override; /** * Moving mission to the specified stack by mission option(Enter floating window mode). @@ -679,8 +678,6 @@ public: virtual int MoveMissionToFront(int32_t missionId, const StartOptions &startOptions) override; - virtual int32_t GetMissionIdByToken(const sptr &token) override; - virtual int StartSyncRemoteMissions(const std::string& devId, bool fixConflict, int64_t tag) override; virtual int StopSyncRemoteMissions(const std::string& devId) override; @@ -863,8 +860,6 @@ public: bool IsAbilityControllerForeground(const std::string &bundleName); - bool IsAbilityControllerStartById(int32_t missionId); - void GrantUriPermission(const Want &want, int32_t validUserId, uint32_t targetTokenId); /** @@ -1120,7 +1115,6 @@ private: void PauseOldUser(int32_t userId); void PauseOldStackManager(int32_t userId); void PauseOldMissionListManager(int32_t userId); - void PauseOldConnectManager(int32_t userId); bool IsSystemUI(const std::string &bundleName) const; bool VerificationAllToken(const sptr &token); diff --git a/services/abilitymgr/include/ability_manager_stub.h b/services/abilitymgr/include/ability_manager_stub.h index 0504dd36b00..402f451790d 100644 --- a/services/abilitymgr/include/ability_manager_stub.h +++ b/services/abilitymgr/include/ability_manager_stub.h @@ -144,7 +144,6 @@ private: int CleanMissionInner(MessageParcel &data, MessageParcel &reply); int CleanAllMissionsInner(MessageParcel &data, MessageParcel &reply); int MoveMissionToFrontInner(MessageParcel &data, MessageParcel &reply); - int GetMissionIdByTokenInner(MessageParcel &data, MessageParcel &reply); // for new version ability (call ability) int StartAbilityByCallInner(MessageParcel &data, MessageParcel &reply); diff --git a/services/abilitymgr/include/app_scheduler.h b/services/abilitymgr/include/app_scheduler.h index 929a29c040e..dbf3c483d02 100644 --- a/services/abilitymgr/include/app_scheduler.h +++ b/services/abilitymgr/include/app_scheduler.h @@ -210,15 +210,6 @@ public: */ int KillApplication(const std::string &bundleName); - /** - * kill the application by uid - * - * @param bundleName name of bundle. - * @param uid uid of bundle. - * @return 0 if success. - */ - int KillApplicationByUid(const std::string &bundleName, int32_t uid); - /** * clear the application data * @@ -295,13 +286,6 @@ public: */ int GetAbilityRecordsByProcessID(const int pid, std::vector> &tokens); - /** - * Post a task to the not response process. - * - * @param pid, the not response process id. - */ - void PostANRTaskByProcessID(const pid_t pid); - protected: /** * OnAbilityRequestDone, app manager service call this interface after ability request done. diff --git a/services/abilitymgr/include/inner_mission_info.h b/services/abilitymgr/include/inner_mission_info.h index 0b811ec6bd3..af13a48e350 100644 --- a/services/abilitymgr/include/inner_mission_info.h +++ b/services/abilitymgr/include/inner_mission_info.h @@ -45,8 +45,6 @@ struct InnerMissionInfo { std::string missionName; bool isSingletonMode; int32_t startMethod; - std::string bundleName; - int32_t uid; std::string ToJsonStr() const; bool FromJsonStr(const std::string &jsonStr); diff --git a/services/abilitymgr/include/mission_info_mgr.h b/services/abilitymgr/include/mission_info_mgr.h index 5289421796e..f3757a4e462 100644 --- a/services/abilitymgr/include/mission_info_mgr.h +++ b/services/abilitymgr/include/mission_info_mgr.h @@ -157,8 +157,6 @@ public: * @param handler the snapshotHandler */ void RegisterSnapshotHandler(const sptr& handler); - - void HandleUnInstallApp(const std::string &bundleName, int32_t uid, std::list &missions); private: /** * @brief Boot query mission info. @@ -166,10 +164,7 @@ private: */ bool LoadAllMissionInfo(); - void GetMatchedMission(const std::string &bundleName, int32_t uid, std::list &missions); - private: - int32_t currentMisionId_ = MIN_MISSION_ID; std::unordered_map missionIdMap_; // key:distributed misisonid, vaule: has been saved std::list missionInfoList_; std::shared_ptr taskDataPersistenceMgr_; diff --git a/services/abilitymgr/include/mission_list.h b/services/abilitymgr/include/mission_list.h index 34de25fd73d..93c74aad320 100644 --- a/services/abilitymgr/include/mission_list.h +++ b/services/abilitymgr/include/mission_list.h @@ -161,14 +161,6 @@ public: */ sptr GetAbilityTokenByMissionId(int32_t missionId); - /** - * Handle uninstall bundle. - * - * @param bundleName name of bundle. - * @param uid the uid of bundle. - */ - void HandleUnInstallApp(const std::string &bundleName, int32_t uid); - /** * @brief dump mission * @@ -189,7 +181,6 @@ public: std::shared_ptr GetMissionBySpecifiedFlag(const AAFwk::Want &want, const std::string &flag) const; private: std::string GetTypeName(); - bool MatchedInitialMission(const std::shared_ptr& mission, const std::string &bundleName, int32_t uid); MissionListType type_; std::list> missions_ {}; diff --git a/services/abilitymgr/include/mission_list_manager.h b/services/abilitymgr/include/mission_list_manager.h index b6e3b5b2c65..5f25a748703 100644 --- a/services/abilitymgr/include/mission_list_manager.h +++ b/services/abilitymgr/include/mission_list_manager.h @@ -339,8 +339,6 @@ public: */ std::shared_ptr GetCurrentTopAbility(const std::string &bundleName); - void UninstallApp(const std::string &bundleName, int32_t uid); - bool IsStarted(); void PauseManager(); void ResumeManager(); @@ -409,8 +407,6 @@ private: int CallAbilityLocked(const AbilityRequest &abilityRequest); void UpdateMissionSnapshot(const std::shared_ptr& abilityRecord); - void AddUninstallTags(const std::string &bundleName, int32_t uid); - private: int userId_; std::recursive_mutex managerLock_; diff --git a/services/abilitymgr/include/mission_listener_controller.h b/services/abilitymgr/include/mission_listener_controller.h index ee003f2b378..7a20272afc1 100644 --- a/services/abilitymgr/include/mission_listener_controller.h +++ b/services/abilitymgr/include/mission_listener_controller.h @@ -82,8 +82,6 @@ public: */ void NotifyMissionMovedToFront(int32_t missionId); - void HandleUnInstallApp(const std::list &missions); - private: void NotifyListeners(int32_t missionId, IMissionListener::MissionListenerCmd cmd); void OnListenerDied(const wptr &remote); diff --git a/services/abilitymgr/include/pending_want_manager.h b/services/abilitymgr/include/pending_want_manager.h index 7c5d2c38bed..55852046f41 100644 --- a/services/abilitymgr/include/pending_want_manager.h +++ b/services/abilitymgr/include/pending_want_manager.h @@ -156,7 +156,7 @@ public: int32_t DeviceIdDetermine( const Want &want, const sptr &callerToken, int32_t requestCode, const int32_t callerUid); int32_t PendingWantPublishCommonEvent(const Want &want, const SenderInfo &senderInfo, int32_t callerUid); - void ClearPendingWantRecord(const std::string &bundleName, int32_t uid); + void ClearPendingWantRecord(const std::string &bundleName); void Dump(std::vector &info); void DumpByRecordId(std::vector &info, const std::string &args); @@ -172,7 +172,7 @@ private: sptr GetPendingWantRecordByCode(int32_t code); static int32_t PendingRecordIdCreate(); - void ClearPendingWantRecordTask(const std::string &bundleName, int32_t uid); + void ClearPendingWantRecordTask(const std::string &bundleName); private: std::map, sptr> wantRecords_; diff --git a/services/abilitymgr/include/user_controller.h b/services/abilitymgr/include/user_controller.h index 17c55e4eb5a..de5adfbcd73 100644 --- a/services/abilitymgr/include/user_controller.h +++ b/services/abilitymgr/include/user_controller.h @@ -119,7 +119,7 @@ private: private: std::recursive_mutex userLock_; - int32_t currentUserId_ = USER_ID_DEFAULT; + int32_t currentUserId_ = USER_ID_NO_HEAD; std::unordered_map> userItems_; std::shared_ptr eventHandler_; }; diff --git a/services/abilitymgr/src/ability_connect_callback_stub.cpp b/services/abilitymgr/src/ability_connect_callback_stub.cpp index 49c2e203eab..783df6ab6e9 100644 --- a/services/abilitymgr/src/ability_connect_callback_stub.cpp +++ b/services/abilitymgr/src/ability_connect_callback_stub.cpp @@ -116,7 +116,6 @@ int AbilityConnectionStub::OnRemoteRequest( auto remoteObject = data.ReadRemoteObject(); if (remoteObject == nullptr) { HILOG_ERROR("callback stub receive remoteObject is nullptr"); - delete element; return ERR_INVALID_VALUE; } auto resultCode = data.ReadInt32(); diff --git a/services/abilitymgr/src/ability_connect_manager.cpp b/services/abilitymgr/src/ability_connect_manager.cpp index b4e8cf3202c..b8836846642 100755 --- a/services/abilitymgr/src/ability_connect_manager.cpp +++ b/services/abilitymgr/src/ability_connect_manager.cpp @@ -559,9 +559,6 @@ std::shared_ptr AbilityConnectManager::GetServiceRecordByToken(co { std::lock_guard guard(Lock_); auto IsMatch = [token](auto service) { - if (!service.second) { - return false; - } sptr srcToken = service.second->GetToken(); return srcToken == token; }; @@ -1110,21 +1107,5 @@ void AbilityConnectManager::GetExtensionRunningInfo(std::shared_ptr guard(Lock_); - auto mgr = shared_from_this(); - auto task = [mgr](ServiceMapType::reference service) { - auto abilityRecord = service.second; - CHECK_POINTER(abilityRecord); - if (abilityRecord->GetAbilityInfo().type == AbilityType::EXTENSION) { - mgr->TerminateAbilityLocked(abilityRecord->GetToken()); - } - }; - std::for_each(serviceMap_.begin(), serviceMap_.end(), task); - HILOG_INFO("StopAllExtensions end."); -} } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/src/ability_manager_client.cpp b/services/abilitymgr/src/ability_manager_client.cpp index 71356161bdd..486f96063e7 100644 --- a/services/abilitymgr/src/ability_manager_client.cpp +++ b/services/abilitymgr/src/ability_manager_client.cpp @@ -811,23 +811,6 @@ ErrCode AbilityManagerClient::MoveMissionToFront(int32_t missionId, const StartO sptr abms = iface_cast(remoteObject_); return abms->MoveMissionToFront(missionId, startOptions); } - -ErrCode AbilityManagerClient::GetMissionIdByToken(const sptr &token, int32_t &missionId) -{ - CHECK_REMOTE_OBJECT_AND_RETURN(remoteObject_, ABILITY_SERVICE_NOT_CONNECTED); - sptr abms = iface_cast(remoteObject_); - if (!abms) { - HILOG_ERROR("ability manager service connect failed!"); - return ABILITY_SERVICE_NOT_CONNECTED; - } - - missionId = abms->GetMissionIdByToken(token); - if (missionId <= 0) { - HILOG_ERROR("get missionid by token failed!"); - return MISSION_NOT_FOUND; - } - return ERR_OK; -} #endif ErrCode AbilityManagerClient::StartAbilityByCall( diff --git a/services/abilitymgr/src/ability_manager_proxy.cpp b/services/abilitymgr/src/ability_manager_proxy.cpp index b3cae91f4e8..f713cac88f2 100644 --- a/services/abilitymgr/src/ability_manager_proxy.cpp +++ b/services/abilitymgr/src/ability_manager_proxy.cpp @@ -503,7 +503,7 @@ void AbilityManagerProxy::AddWindowInfo(const sptr &token, int32_ } void AbilityManagerProxy::DumpSysState( - const std::string& args, std::vector& state, bool isClient, bool isUserId, int UserId) + const std::string& args, std::vector& state, bool isClient, bool isUserID, int UserID) { int error; MessageParcel data; @@ -519,11 +519,11 @@ void AbilityManagerProxy::DumpSysState( HILOG_ERROR("data write failed."); return ; } - if (!data.WriteBool(isUserId)) { + if (!data.WriteBool(isUserID)) { HILOG_ERROR("data write failed."); return ; } - if (!data.WriteInt32(UserId)) { + if (!data.WriteInt32(UserID)) { HILOG_ERROR("data write failed."); return ; } @@ -931,7 +931,7 @@ int AbilityManagerProxy::ClearUpApplicationData(const std::string &bundleName) return reply.ReadInt32(); } -int AbilityManagerProxy::UninstallApp(const std::string &bundleName, int32_t uid) +int AbilityManagerProxy::UninstallApp(const std::string &bundleName) { MessageParcel data; MessageParcel reply; @@ -944,10 +944,6 @@ int AbilityManagerProxy::UninstallApp(const std::string &bundleName, int32_t uid HILOG_ERROR("bundleName write failed."); return ERR_INVALID_VALUE; } - if (!data.WriteInt32(uid)) { - HILOG_ERROR("uid write failed."); - return ERR_INVALID_VALUE; - } int error = Remote()->SendRequest(IAbilityManager::UNINSTALL_APP, data, reply, option); if (error != NO_ERROR) { HILOG_ERROR("Send request error: %{public}d", error); @@ -2670,34 +2666,5 @@ int AbilityManagerProxy::SendANRProcessID(int pid) } return reply.ReadInt32(); } - -int32_t AbilityManagerProxy::GetMissionIdByToken(const sptr &token) -{ - if (!token) { - HILOG_ERROR("token is nullptr."); - return -1; - } - - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!WriteInterfaceToken(data)) { - HILOG_ERROR("data interface token failed."); - return -1; - } - - if (!data.WriteParcelable(token)) { - HILOG_ERROR("data write failed."); - return -1; - } - - auto error = Remote()->SendRequest(IAbilityManager::GET_MISSION_ID_BY_ABILITY_TOKEN, data, reply, option); - if (error != NO_ERROR) { - HILOG_ERROR("Send request error: %{public}d", error); - return -1; - } - - return reply.ReadInt32(); -} } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 3e43d70a15c..a17f04b500a 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -192,10 +192,14 @@ bool AbilityManagerService::Init() systemDataAbilityManager_ = std::make_shared(); amsConfigResolver_ = std::make_shared(); - amsConfigResolver_->Parse(); - HILOG_INFO("ams config parse"); + if (amsConfigResolver_) { + amsConfigResolver_->Parse(); + HILOG_INFO("ams config parse"); + } useNewMission_ = amsConfigResolver_->IsUseNewMission(); #ifdef SUPPORT_GRAPHICS + SetStackManager(userId, true); + InitMissionListManager(userId, true); #endif SwitchManagers(U0_USER_ID, false); @@ -1508,13 +1512,6 @@ int AbilityManagerService::CleanAllMissions() return CHECK_PERMISSION_FAILED; } - Want want; - want.SetElementName(AbilityConfig::LAUNCHER_BUNDLE_NAME, AbilityConfig::LAUNCHER_ABILITY_NAME); - if (!IsAbilityControllerStart(want, AbilityConfig::LAUNCHER_BUNDLE_NAME)) { - HILOG_ERROR("IsAbilityControllerStart failed: %{public}s", want.GetBundle().c_str()); - return ERR_WOULD_BLOCK; - } - return currentMissionListManager_->ClearAllMissions(); } @@ -1528,11 +1525,6 @@ int AbilityManagerService::MoveMissionToFront(int32_t missionId) return CHECK_PERMISSION_FAILED; } - if (!IsAbilityControllerStartById(missionId)) { - HILOG_ERROR("IsAbilityControllerStart false"); - return ERR_WOULD_BLOCK; - } - return currentMissionListManager_->MoveMissionToFront(missionId); } @@ -1546,49 +1538,11 @@ int AbilityManagerService::MoveMissionToFront(int32_t missionId, const StartOpti return CHECK_PERMISSION_FAILED; } - if (!IsAbilityControllerStartById(missionId)) { - HILOG_ERROR("IsAbilityControllerStart false"); - return ERR_WOULD_BLOCK; - } - auto options = std::make_shared(startOptions); return currentMissionListManager_->MoveMissionToFront(missionId, options); } - -int32_t AbilityManagerService::GetMissionIdByToken(const sptr &token) -{ - HILOG_INFO("request GetMissionIdByToken."); - if (!token) { - HILOG_ERROR("token is invalid."); - return -1; - } - - if (IPCSkeleton::GetCallingPid() != getpid()) { - HILOG_ERROR("%{public}s: Only support same process call.", __func__); - return -1; - } - - return GetMissionIdByAbilityToken(token); -} #endif -bool AbilityManagerService::IsAbilityControllerStartById(int32_t missionId) -{ - InnerMissionInfo innerMissionInfo; - int getMission = DelayedSingleton::GetInstance()->GetInnerMissionInfoById( - missionId, innerMissionInfo); - if (getMission != ERR_OK) { - HILOG_ERROR("cannot find mission info from MissionInfoList by missionId: %{public}d", missionId); - return true; - } - if (!IsAbilityControllerStart(innerMissionInfo.missionInfo.want, innerMissionInfo.missionInfo.want.GetBundle())) { - HILOG_ERROR("IsAbilityControllerStart failed: %{public}s", - innerMissionInfo.missionInfo.want.GetBundle().c_str()); - return false; - } - return true; -} - std::shared_ptr AbilityManagerService::GetServiceRecordByElementName(const std::string &element) { return connectManager_->GetServiceRecordByElementName(element); @@ -1685,11 +1639,6 @@ int AbilityManagerService::ReleaseDataAbility( sptr dataAbilityScheduler, const sptr &callerToken) { HILOG_INFO("%{public}s, called.", __func__); - if (!dataAbilityScheduler || !callerToken) { - HILOG_ERROR("dataAbilitySchedule or callerToken is nullptr"); - return ERR_INVALID_VALUE; - } - bool isSystem = (IPCSkeleton::GetCallingUid() <= AppExecFwk::Constants::BASE_SYS_UID); if (!isSystem) { HILOG_INFO("callerToken not system %{public}s", __func__); @@ -2786,7 +2735,7 @@ int AbilityManagerService::ClearUpApplicationData(const std::string &bundleName) return ERR_OK; } -int AbilityManagerService::UninstallApp(const std::string &bundleName, int32_t uid) +int AbilityManagerService::UninstallApp(const std::string &bundleName) { HILOG_DEBUG("Uninstall app, bundleName: %{public}s", bundleName.c_str()); pid_t callingPid = IPCSkeleton::GetCallingPid(); @@ -2796,13 +2745,11 @@ int AbilityManagerService::UninstallApp(const std::string &bundleName, int32_t u return CHECK_PERMISSION_FAILED; } - int32_t targetUserId = uid / BASE_USER_RANGE; - auto listManager = GetListManagerByUserId(targetUserId); - CHECK_POINTER_AND_RETURN(listManager, ERR_NO_INIT); - listManager->UninstallApp(bundleName, uid); + CHECK_POINTER_AND_RETURN(currentStackManager_, ERR_NO_INIT); + currentStackManager_->UninstallApp(bundleName); CHECK_POINTER_AND_RETURN(pendingWantManager_, ERR_NO_INIT); - pendingWantManager_->ClearPendingWantRecord(bundleName, uid); - int ret = DelayedSingleton::GetInstance()->KillApplicationByUid(bundleName, uid); + pendingWantManager_->ClearPendingWantRecord(bundleName); + int ret = DelayedSingleton::GetInstance()->KillApplication(bundleName); if (ret != ERR_OK) { return UNINSTALL_APP_FAILED; } @@ -3859,7 +3806,6 @@ void AbilityManagerService::SwitchToUser(int32_t oldUserId, int32_t userId) isBoot = true; } StartUserApps(userId, isBoot); - PauseOldConnectManager(oldUserId); } void AbilityManagerService::SwitchManagers(int32_t userId, bool switchUser) @@ -3901,29 +3847,6 @@ void AbilityManagerService::PauseOldMissionListManager(int32_t userId) HILOG_INFO("%{public}s, PauseOldMissionListManager:%{public}d-----end", __func__, userId); } -void AbilityManagerService::PauseOldConnectManager(int32_t userId) -{ - HILOG_INFO("%{public}s, PauseOldConnectManager:%{public}d-----begin", __func__, userId); - if (userId == U0_USER_ID) { - HILOG_INFO("%{public}s, u0 not stop, id:%{public}d-----nullptr", __func__, userId); - return; - } - - std::shared_lock lock(managersMutex_); - auto it = connectManagers_.find(userId); - if (it == connectManagers_.end()) { - HILOG_INFO("%{public}s, PauseOldConnectManager:%{public}d-----no user", __func__, userId); - return; - } - auto manager = it->second; - if (!manager) { - HILOG_INFO("%{public}s, PauseOldConnectManager:%{public}d-----nullptr", __func__, userId); - return; - } - manager->StopAllExtensions(); - HILOG_INFO("%{public}s, PauseOldConnectManager:%{public}d-----end", __func__, userId); -} - void AbilityManagerService::PauseOldStackManager(int32_t userId) { auto it = stackManagers_.find(userId); @@ -4120,7 +4043,10 @@ int AbilityManagerService::SendANRProcessID(int pid) } #endif handler_->PostTask(timeoutTask, "TIME_OUT_TASK", anrTimeOut); - appScheduler_->PostANRTaskByProcessID(pid); + if (kill(pid, SIGUSR1) != ERR_OK) { + HILOG_ERROR("Send sig to app not response process failed"); + return SEND_USR1_SIG_FAIL; + } return ERR_OK; } @@ -4292,7 +4218,7 @@ int AbilityManagerService::DelegatorDoAbilityBackground(const sptr &token, uint32_t flag) { - HILOG_DEBUG("DoAbilityForeground, sceneFlag:%{public}u", flag); + HILOG_DEBUG("DoAbilityForeground, sceneFlag:%{public}d", flag); CHECK_POINTER_AND_RETURN(token, ERR_INVALID_VALUE); if (!VerificationToken(token) && !VerificationAllToken(token)) { HILOG_ERROR("%{public}s token error.", __func__); @@ -4325,7 +4251,7 @@ int AbilityManagerService::DoAbilityForeground(const sptr &token, int AbilityManagerService::DoAbilityBackground(const sptr &token, uint32_t flag) { - HILOG_DEBUG("DoAbilityBackground, sceneFlag:%{public}u", flag); + HILOG_DEBUG("DoAbilityBackground, sceneFlag:%{public}d", flag); CHECK_POINTER_AND_RETURN(token, ERR_INVALID_VALUE); auto abilityRecord = Token::GetAbilityRecordByToken(token); @@ -4343,11 +4269,6 @@ int AbilityManagerService::DelegatorMoveMissionToFront(int32_t missionId) HILOG_INFO("enter missionId : %{public}d", missionId); CHECK_POINTER_AND_RETURN(currentMissionListManager_, ERR_NO_INIT); - if (!IsAbilityControllerStartById(missionId)) { - HILOG_ERROR("IsAbilityControllerStart false"); - return ERR_WOULD_BLOCK; - } - return currentMissionListManager_->MoveMissionToFront(missionId); } diff --git a/services/abilitymgr/src/ability_manager_stub.cpp b/services/abilitymgr/src/ability_manager_stub.cpp index 8fd323709e5..54580c6b32b 100644 --- a/services/abilitymgr/src/ability_manager_stub.cpp +++ b/services/abilitymgr/src/ability_manager_stub.cpp @@ -152,7 +152,6 @@ void AbilityManagerStub::ThirdStepInit() requestFuncMap_[DELEGATOR_DO_ABILITY_BACKGROUND] = &AbilityManagerStub::DelegatorDoAbilityBackgroundInner; requestFuncMap_[DO_ABILITY_FOREGROUND] = &AbilityManagerStub::DoAbilityForegroundInner; requestFuncMap_[DO_ABILITY_BACKGROUND] = &AbilityManagerStub::DoAbilityBackgroundInner; - requestFuncMap_[GET_MISSION_ID_BY_ABILITY_TOKEN] = &AbilityManagerStub::GetMissionIdByTokenInner; } int AbilityManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) @@ -423,8 +422,7 @@ int AbilityManagerStub::ClearUpApplicationDataInner(MessageParcel &data, Message int AbilityManagerStub::UninstallAppInner(MessageParcel &data, MessageParcel &reply) { std::string bundleName = Str16ToStr8(data.ReadString16()); - int32_t uid = data.ReadInt32(); - int result = UninstallApp(bundleName, uid); + int result = UninstallApp(bundleName); if (!reply.WriteInt32(result)) { HILOG_ERROR("remove stack error"); return ERR_INVALID_VALUE; @@ -1181,17 +1179,6 @@ int AbilityManagerStub::MoveMissionToFrontInner(MessageParcel &data, MessageParc return NO_ERROR; } -int AbilityManagerStub::GetMissionIdByTokenInner(MessageParcel &data, MessageParcel &reply) -{ - sptr token = data.ReadParcelable(); - int32_t missionId = GetMissionIdByToken(token); - if (!reply.WriteInt32(missionId)) { - HILOG_ERROR("GetMissionIdByToken write missionId failed."); - return ERR_INVALID_VALUE; - } - return NO_ERROR; -} - int AbilityManagerStub::MoveMissionToFrontByOptionsInner(MessageParcel &data, MessageParcel &reply) { int32_t missionId = data.ReadInt32(); diff --git a/services/abilitymgr/src/ams_configuration_parameter.cpp b/services/abilitymgr/src/ams_configuration_parameter.cpp index 1eee7ad008d..889dbc03af8 100644 --- a/services/abilitymgr/src/ams_configuration_parameter.cpp +++ b/services/abilitymgr/src/ams_configuration_parameter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -144,7 +144,7 @@ int AmsConfigurationParameter::LoadAmsConfiguration(const std::string &filePath) } } - HILOG_INFO("read ams config success!"); + HILOG_INFO("read ams config succes!"); return READ_OK; } diff --git a/services/abilitymgr/src/app_scheduler.cpp b/services/abilitymgr/src/app_scheduler.cpp index 2d97db18838..6cd186b67c9 100644 --- a/services/abilitymgr/src/app_scheduler.cpp +++ b/services/abilitymgr/src/app_scheduler.cpp @@ -198,19 +198,6 @@ int AppScheduler::KillApplication(const std::string &bundleName) return ERR_OK; } -int AppScheduler::KillApplicationByUid(const std::string &bundleName, int32_t uid) -{ - HILOG_INFO("[%{public}s(%{public}s)] enter", __FILE__, __FUNCTION__); - CHECK_POINTER_AND_RETURN(appMgrClient_, INNER_ERR); - int ret = (int)appMgrClient_->KillApplicationByUid(bundleName, uid); - if (ret != ERR_OK) { - HILOG_ERROR("Fail to kill application by uid."); - return INNER_ERR; - } - - return ERR_OK; -} - int AppScheduler::ClearUpApplicationData(const std::string &bundleName) { CHECK_POINTER_AND_RETURN(appMgrClient_, INNER_ERR); @@ -377,11 +364,5 @@ int AppScheduler::GetAbilityRecordsByProcessID(const int pid, std::vectorPostANRTaskByProcessID(pid); -} } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/src/data_ability_manager.cpp b/services/abilitymgr/src/data_ability_manager.cpp index 221497a6492..c930a6d0de3 100644 --- a/services/abilitymgr/src/data_ability_manager.cpp +++ b/services/abilitymgr/src/data_ability_manager.cpp @@ -135,8 +135,7 @@ int DataAbilityManager::Release( DataAbilityRecordPtr dataAbilityRecord; for (it = dataAbilityRecordsLoaded_.begin(); it != dataAbilityRecordsLoaded_.end(); ++it) { - if (it->second && it->second->GetScheduler() && - it->second->GetScheduler()->AsObject() == scheduler->AsObject()) { + if (it->second->GetScheduler() != nullptr && it->second->GetScheduler()->AsObject() == scheduler->AsObject()) { dataAbilityRecord = it->second; break; } diff --git a/services/abilitymgr/src/inner_mission_info.cpp b/services/abilitymgr/src/inner_mission_info.cpp index 9902f6d3c4f..2198f0df7ed 100644 --- a/services/abilitymgr/src/inner_mission_info.cpp +++ b/services/abilitymgr/src/inner_mission_info.cpp @@ -20,36 +20,20 @@ namespace OHOS { namespace AAFwk { -namespace { -const std::string KEY_MISSION_NAME = "MissionName"; -const std::string KEY_IS_SINGLETON = "IsSingleton"; -const std::string KEY_MISSION_ID = "MissionId"; -const std::string KEY_RUNNING_STATE = "RunningState"; -const std::string KEY_LOCKED_STATE = "LockedState"; -const std::string KEY_CONTINUABLE = "Continuable"; -const std::string KEY_TIME = "Time"; -const std::string KEY_LABEL = "Label"; -const std::string KEY_ICON_PATH = "IconPath"; -const std::string KEY_WANT = "Want"; -const std::string KEY_START_METHOD = "StartMethod"; -const std::string KEY_BUNDLE_NAME = "BundleName"; -const std::string KEY_UID = "Uid"; -} std::string InnerMissionInfo::ToJsonStr() const { nlohmann::json value; - value[KEY_MISSION_NAME] = missionName; - value[KEY_IS_SINGLETON] = isSingletonMode; - value[KEY_BUNDLE_NAME] = bundleName; - value[KEY_UID] = uid; - value[KEY_MISSION_ID] = missionInfo.id; - value[KEY_RUNNING_STATE] = missionInfo.runningState; - value[KEY_LOCKED_STATE] = missionInfo.lockedState; - value[KEY_CONTINUABLE] = missionInfo.continuable; - value[KEY_TIME] = missionInfo.time; - value[KEY_LABEL] = missionInfo.label; - value[KEY_ICON_PATH] = missionInfo.iconPath; - value[KEY_WANT] = missionInfo.want.ToUri(); + value["MissionName"] = missionName; + value["IsSingleton"] = isSingletonMode; + value["StartMethod"] = startMethod; + value["MissionId"] = missionInfo.id; + value["RunningState"] = missionInfo.runningState; + value["LockedState"] = missionInfo.lockedState; + value["Continuable"] = missionInfo.continuable; + value["Time"] = missionInfo.time; + value["Label"] = missionInfo.label; + value["IconPath"] = missionInfo.iconPath; + value["Want"] = missionInfo.want.ToUri(); return value.dump(); } @@ -80,58 +64,50 @@ bool InnerMissionInfo::FromJsonStr(const std::string &jsonStr) } return false; }; - if (!CheckJsonNode(KEY_MISSION_NAME, JsonType::STRING)) { - return false; - } - missionName = value[KEY_MISSION_NAME].get(); - if (!CheckJsonNode(KEY_IS_SINGLETON, JsonType::BOOLEAN)) { - return false; - } - isSingletonMode = value[KEY_IS_SINGLETON].get(); - if (!CheckJsonNode(KEY_START_METHOD, JsonType::NUMBER)) { + if (!CheckJsonNode("MissionName", JsonType::STRING)) { return false; } - startMethod = value[KEY_START_METHOD].get(); - if (!CheckJsonNode(KEY_BUNDLE_NAME, JsonType::STRING)) { + missionName = value["MissionName"].get(); + if (!CheckJsonNode("IsSingleton", JsonType::BOOLEAN)) { return false; } - bundleName = value[KEY_BUNDLE_NAME].get(); - if (!CheckJsonNode(KEY_UID, JsonType::NUMBER)) { + isSingletonMode = value["IsSingleton"].get(); + if (!CheckJsonNode("StartMethod", JsonType::NUMBER)) { return false; } - uid = value[KEY_UID].get(); - if (!CheckJsonNode(KEY_MISSION_ID, JsonType::NUMBER)) { + startMethod = value["StartMethod"].get(); + if (!CheckJsonNode("MissionId", JsonType::NUMBER)) { return false; } - missionInfo.id = value[KEY_MISSION_ID].get(); - if (!CheckJsonNode(KEY_RUNNING_STATE, JsonType::NUMBER)) { + missionInfo.id = value["MissionId"].get(); + if (!CheckJsonNode("RunningState", JsonType::NUMBER)) { return false; } - missionInfo.runningState = value[KEY_RUNNING_STATE].get(); - if (!CheckJsonNode(KEY_LOCKED_STATE, JsonType::BOOLEAN)) { + missionInfo.runningState = value["RunningState"].get(); + if (!CheckJsonNode("LockedState", JsonType::BOOLEAN)) { return false; } - missionInfo.lockedState = value[KEY_LOCKED_STATE].get(); - if (!CheckJsonNode(KEY_CONTINUABLE, JsonType::BOOLEAN)) { + missionInfo.lockedState = value["LockedState"].get(); + if (!CheckJsonNode("Continuable", JsonType::BOOLEAN)) { return false; } - missionInfo.continuable = value[KEY_CONTINUABLE].get(); - if (!CheckJsonNode(KEY_TIME, JsonType::STRING)) { + missionInfo.continuable = value["Continuable"].get(); + if (!CheckJsonNode("Time", JsonType::STRING)) { return false; } - missionInfo.time = value[KEY_TIME].get(); - if (!CheckJsonNode(KEY_LABEL, JsonType::STRING)) { + missionInfo.time = value["Time"].get(); + if (!CheckJsonNode("Label", JsonType::STRING)) { return false; } - missionInfo.label = value[KEY_LABEL].get(); - if (!CheckJsonNode(KEY_ICON_PATH, JsonType::STRING)) { + missionInfo.label = value["Label"].get(); + if (!CheckJsonNode("IconPath", JsonType::STRING)) { return false; } - missionInfo.iconPath = value[KEY_ICON_PATH].get(); - if (!CheckJsonNode(KEY_WANT, JsonType::STRING)) { + missionInfo.iconPath = value["IconPath"].get(); + if (!CheckJsonNode("Want", JsonType::STRING)) { return false; } - Want* want = Want::ParseUri(value[KEY_WANT].get()); + Want* want = Want::ParseUri(value["Want"].get()); if (want) { missionInfo.want = *want; } diff --git a/services/abilitymgr/src/mission_info_mgr.cpp b/services/abilitymgr/src/mission_info_mgr.cpp index aeaa0e3207a..224364b1b2c 100644 --- a/services/abilitymgr/src/mission_info_mgr.cpp +++ b/services/abilitymgr/src/mission_info_mgr.cpp @@ -29,17 +29,12 @@ MissionInfoMgr::~MissionInfoMgr() HILOG_INFO("MissionInfoMgr instance is destroyed"); } -bool MissionInfoMgr::GenerateMissionId(int32_t &missionId) +bool MissionInfoMgr::GenerateMissionId(int32_t &misisonId) { - if (currentMisionId_ == MAX_MISSION_ID) { - currentMisionId_ = MIN_MISSION_ID; - } - - for (int32_t index = currentMisionId_; index < MAX_MISSION_ID; index++) { + for (int32_t index = MIN_MISSION_ID; index <= MAX_MISSION_ID; index++) { if (missionIdMap_.find(index) == missionIdMap_.end()) { - missionId = index; - missionIdMap_[missionId] = false; - currentMisionId_ = missionId + 1; + misisonId = index; + missionIdMap_[misisonId] = false; return true; } } @@ -356,28 +351,6 @@ bool MissionInfoMgr::LoadAllMissionInfo() return true; } -void MissionInfoMgr::HandleUnInstallApp(const std::string &bundleName, int32_t uid, std::list &missions) -{ - HILOG_INFO("HandleUnInstallApp, bundleName:%{public}s, uid:%{public}d", bundleName.c_str(), uid); - GetMatchedMission(bundleName, uid, missions); - if (missions.empty()) { - return; - } - - for (auto missionId : missions) { - DeleteMissionInfo(missionId); - } -} - -void MissionInfoMgr::GetMatchedMission(const std::string &bundleName, int32_t uid, std::list &missions) -{ - for (const auto& innerMissionInfo : missionInfoList_) { - if (innerMissionInfo.bundleName == bundleName && innerMissionInfo.uid == uid) { - missions.push_back(innerMissionInfo.missionInfo.id); - } - } -} - void MissionInfoMgr::Dump(std::vector &info) { for (const auto& innerMissionInfo : missionInfoList_) { diff --git a/services/abilitymgr/src/mission_list.cpp b/services/abilitymgr/src/mission_list.cpp index 742dfa0b070..b127d033804 100644 --- a/services/abilitymgr/src/mission_list.cpp +++ b/services/abilitymgr/src/mission_list.cpp @@ -259,41 +259,6 @@ std::string MissionList::GetTypeName() } } -void MissionList::HandleUnInstallApp(const std::string &bundleName, int32_t uid) -{ - for (auto it = missions_.begin(); it != missions_.end();) { - auto mission = *it; - if (MatchedInitialMission(mission, bundleName, uid)) { - missions_.erase(it++); - } else { - it++; - } - } -} - -bool MissionList::MatchedInitialMission(const std::shared_ptr& mission, - const std::string &bundleName, int32_t uid) -{ - if (!mission) { - return false; - } - - auto abilityRecord = mission->GetAbilityRecord(); - if (!abilityRecord) { - return false; - } - - if (abilityRecord->GetAbilityInfo().bundleName == bundleName && abilityRecord->GetUid() == uid) { - abilityRecord->SetIsUninstallAbility(); - if (abilityRecord->IsAbilityState(AbilityState::INITIAL)) { - return true; - } - } - - return false; -} - - void MissionList::Dump(std::vector& info) { std::string dumpInfo = " MissionList Type #" + GetTypeName(); diff --git a/services/abilitymgr/src/mission_list_manager.cpp b/services/abilitymgr/src/mission_list_manager.cpp index 17f1166cd8a..c1fb9290a48 100644 --- a/services/abilitymgr/src/mission_list_manager.cpp +++ b/services/abilitymgr/src/mission_list_manager.cpp @@ -351,8 +351,6 @@ void MissionListManager::GetTargetMissionAndAbility(const AbilityRequest &abilit info.missionName = missionName; info.isSingletonMode = isSingleton; info.startMethod = startMethod; - info.bundleName = abilityRequest.abilityInfo.bundleName; - info.uid = abilityRequest.uid; info.missionInfo.runningState = 0; info.missionInfo.continuable = abilityRequest.abilityInfo.continuable; info.missionInfo.time = Time2str(time(0)); @@ -933,7 +931,7 @@ void MissionListManager::CompleteBackground(const std::shared_ptr // new version. started by caller, sdheduler call request if (abilityRecord->IsStartedByCall() && abilityRecord->IsStartToBackground() && abilityRecord->IsReady()) { - HILOG_DEBUG("call request after completing background state"); + HILOG_DEBUG("call request after completing backgroud state"); abilityRecord->CallRequest(); abilityRecord->SetStartToBackground(false); } @@ -1179,15 +1177,10 @@ void MissionListManager::CompleteTerminateAndUpdateMission(const std::shared_ptr std::shared_ptr MissionListManager::GetAbilityFromTerminateList(const sptr &token) { - if (!token) { - return nullptr; - } - std::lock_guard guard(managerLock_); for (auto abilityRecord : terminateAbilityList_) { // token is type of IRemoteObject, abilityRecord->GetToken() is type of Token extending from IRemoteObject. - if (abilityRecord && abilityRecord->GetToken() && - abilityRecord->GetToken() && token == abilityRecord->GetToken()->AsObject()) { + if (abilityRecord && token == abilityRecord->GetToken()->AsObject()) { return abilityRecord; } } @@ -1800,13 +1793,10 @@ void MissionListManager::HandleAbilityDiedByDefault(std::shared_ptrIsUninstallAbility()) { - InnerMissionInfo info; - if (DelayedSingleton::GetInstance()->GetInnerMissionInfoById( - mission->GetMissionId(), info) == 0) { - info.missionInfo.runningState = -1; - DelayedSingleton::GetInstance()->UpdateMissionInfo(info); - } + InnerMissionInfo info; + if (DelayedSingleton::GetInstance()->GetInnerMissionInfoById(mission->GetMissionId(), info) == 0) { + info.missionInfo.runningState = -1; + DelayedSingleton::GetInstance()->UpdateMissionInfo(info); } // start launcher @@ -2318,44 +2308,6 @@ std::shared_ptr MissionListManager::GetCurrentTopAbility(const st return {}; } -void MissionListManager::UninstallApp(const std::string &bundleName, int32_t uid) -{ - HILOG_INFO("Uninstall app, bundleName: %{public}s, uid:%{public}d", bundleName.c_str(), uid); - auto abilityManagerService = DelayedSingleton::GetInstance(); - CHECK_POINTER(abilityManagerService); - auto handler = abilityManagerService->GetEventHandler(); - CHECK_POINTER(handler); - std::weak_ptr wpMgr = shared_from_this(); - auto task = [wpMgr, bundleName, uid]() { - HILOG_INFO("Handle Uninstall app, bundleName: %{public}s, uid:%{public}d", bundleName.c_str(), uid); - auto mgr = wpMgr.lock(); - if (mgr) { - mgr->AddUninstallTags(bundleName, uid); - } - }; - handler->PostTask(task); -} - -void MissionListManager::AddUninstallTags(const std::string &bundleName, int32_t uid) -{ - HILOG_INFO("AddUninstallTags, bundleName: %{public}s, uid:%{public}d", bundleName.c_str(), uid); - for (auto& missionList : currentMissionLists_) { - if (missionList) { - missionList->HandleUnInstallApp(bundleName, uid); // add tag here. - if (missionList->IsEmpty()) { - currentMissionLists_.remove(missionList); - } - } - } - defaultSingleList_->HandleUnInstallApp(bundleName, uid); - defaultStandardList_->HandleUnInstallApp(bundleName, uid); - std::list matchedMissions; - DelayedSingleton::GetInstance()->HandleUnInstallApp(bundleName, uid, matchedMissions); - if (listenerController_) { - listenerController_->HandleUnInstallApp(matchedMissions); - } -} - bool MissionListManager::IsStarted() { std::lock_guard guard(managerLock_); diff --git a/services/abilitymgr/src/mission_listener_controller.cpp b/services/abilitymgr/src/mission_listener_controller.cpp index c53591d8e05..fc3b6753b82 100644 --- a/services/abilitymgr/src/mission_listener_controller.cpp +++ b/services/abilitymgr/src/mission_listener_controller.cpp @@ -133,31 +133,6 @@ void MissionListenerController::NotifyMissionDestroyed(int32_t missionId) handler_->PostTask(task); } -void MissionListenerController::HandleUnInstallApp(const std::list &missions) -{ - if (!handler_) { - HILOG_ERROR("handler not init"); - return; - } - - if (missions.empty()) { - return; - } - - auto task = [weak = weak_from_this(), missions]() { - auto self = weak.lock(); - if (self == nullptr) { - HILOG_ERROR("self is nullptr, NotifyMissionDestroyed failed."); - return; - } - for (auto id : missions) { - self->NotifyListeners(id, Cmd::ON_MISSION_DESTROYED); - } - }; - handler_->PostTask(task); - -} - void MissionListenerController::NotifyMissionSnapshotChanged(int32_t missionId) { if (!handler_) { diff --git a/services/abilitymgr/src/pending_want_manager.cpp b/services/abilitymgr/src/pending_want_manager.cpp index 665e4dcafc0..0f4c522e1bf 100644 --- a/services/abilitymgr/src/pending_want_manager.cpp +++ b/services/abilitymgr/src/pending_want_manager.cpp @@ -481,18 +481,18 @@ int32_t PendingWantManager::GetWantSenderInfo(const sptr &target, s return NO_ERROR; } -void PendingWantManager::ClearPendingWantRecord(const std::string &bundleName, int32_t uid) +void PendingWantManager::ClearPendingWantRecord(const std::string &bundleName) { HILOG_INFO("ClearPendingWantRecord, bundleName: %{public}s", bundleName.c_str()); auto abilityManagerService = DelayedSingleton::GetInstance(); CHECK_POINTER(abilityManagerService); auto handler = abilityManagerService->GetEventHandler(); CHECK_POINTER(handler); - auto task = [bundleName, uid, self = shared_from_this()]() { self->ClearPendingWantRecordTask(bundleName, uid); }; + auto task = [bundleName, self = shared_from_this()]() { self->ClearPendingWantRecordTask(bundleName); }; handler->PostTask(task); } -void PendingWantManager::ClearPendingWantRecordTask(const std::string &bundleName, int32_t uid) +void PendingWantManager::ClearPendingWantRecordTask(const std::string &bundleName) { HILOG_INFO("ClearPendingWantRecordTask, bundleName: %{public}s", bundleName.c_str()); std::lock_guard locker(mutex_); @@ -503,7 +503,7 @@ void PendingWantManager::ClearPendingWantRecordTask(const std::string &bundleNam if ((pendingRecord != nullptr)) { auto wantInfos = pendingRecord->GetKey()->GetAllWantsInfos(); for (const auto &wantInfo: wantInfos) { - if (wantInfo.want.GetBundle() == bundleName && uid == pendingRecord->GetUid()) { + if (wantInfo.want.GetBundle() == bundleName) { hasBundle = true; break; } diff --git a/services/abilitymgr/src/shared_memory.cpp b/services/abilitymgr/src/shared_memory.cpp index d73188b7a85..621209f63bd 100644 --- a/services/abilitymgr/src/shared_memory.cpp +++ b/services/abilitymgr/src/shared_memory.cpp @@ -93,7 +93,7 @@ void* SharedMemory::PopSharedMemory(int shmKey, int size) HILOG_ERROR("size is invalid: %{public}d.", size); return nullptr; } - + void *data = reinterpret_cast(malloc(size)); int shmId = shmget(shmKey, 0, 0 | SHM_READ_WRITE_PERMISSIONS); if (shmId == -1) { HILOG_ERROR("shmId is invalid: %{public}d, %{public}d.", shmId, errno); @@ -107,20 +107,17 @@ void* SharedMemory::PopSharedMemory(int shmKey, int size) return nullptr; } - void *data = reinterpret_cast(malloc(size)); int retCode = memcpy_s(data, size, shared, size); if (retCode != EOK) { shmdt(shared); ReleaseShmId(shmId); HILOG_ERROR("Failed to memory copy, retCode[%{public}d].", retCode); - free(data); return nullptr; } if (shmdt(shared) == -1) { ReleaseShmId(shmId); HILOG_ERROR("shmdt failed: %{public}d.", errno); - free(data); return nullptr; } diff --git a/services/abilitymgr/test/mock/appmgr_test_service/src/appmgr_test_service.cpp b/services/abilitymgr/test/mock/appmgr_test_service/src/appmgr_test_service.cpp index e7a725cadbb..0be423eb874 100644 --- a/services/abilitymgr/test/mock/appmgr_test_service/src/appmgr_test_service.cpp +++ b/services/abilitymgr/test/mock/appmgr_test_service/src/appmgr_test_service.cpp @@ -96,7 +96,7 @@ void AppMgrEventHandler::ScheduleAbilityTransaction(const AppExecFwk::InnerEvent auto abilityToken = tokenMap_[abilitySched]; if (abilityToken == nullptr) { - HILOG_ERROR("abilityToken unavailable."); + HILOG_ERROR("abilityToken unavailable. object: %p", object.get()); return; } @@ -139,7 +139,7 @@ void AppMgrEventHandler::ScheduleDisconnectAbilityTransaction(const AppExecFwk:: auto abilityToken = tokenMap_[abilitySched]; if (abilityToken == nullptr) { - HILOG_ERROR("abilityToken unavailable."); + HILOG_ERROR("abilityToken unavailable. object: %p", object.get()); return; } diff --git a/services/abilitymgr/test/unittest/phone/ability_connect_manage_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/ability_connect_manage_test/BUILD.gn index 1a82cb08819..a22b1865f31 100755 --- a/services/abilitymgr/test/unittest/phone/ability_connect_manage_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/ability_connect_manage_test/BUILD.gn @@ -66,5 +66,6 @@ ohos_unittest("ability_connect_manage_test") { group("unittest") { testonly = true - # deps = [ ":ability_connect_manage_test" ] + + deps = [ ":ability_connect_manage_test" ] } diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/ability_manager_stub_mock_test.h b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/ability_manager_stub_mock_test.h index 9eefea72f5b..2d4167321ee 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_client_test/ability_manager_stub_mock_test.h +++ b/services/abilitymgr/test/unittest/phone/ability_manager_client_test/ability_manager_stub_mock_test.h @@ -212,12 +212,7 @@ public: return 0; } - virtual int UninstallApp(const std::string &bundleName, int32_t uid) - { - return 0; - } - - virtual int32_t GetMissionIdByToken(const sptr &token) override + virtual int UninstallApp(const std::string &bundleName) { return 0; } diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_proxy_test/ability_manager_stub_mock.h b/services/abilitymgr/test/unittest/phone/ability_manager_proxy_test/ability_manager_stub_mock.h index e2825bd7839..3c2a6b1714f 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_proxy_test/ability_manager_stub_mock.h +++ b/services/abilitymgr/test/unittest/phone/ability_manager_proxy_test/ability_manager_stub_mock.h @@ -212,12 +212,7 @@ public: return 0; } - virtual int UninstallApp(const std::string &bundleName, int32_t uid) - { - return 0; - } - - virtual int32_t GetMissionIdByToken(const sptr &token) override + virtual int UninstallApp(const std::string &bundleName) { return 0; } diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_service_test/ability_manager_service_test.cpp b/services/abilitymgr/test/unittest/phone/ability_manager_service_test/ability_manager_service_test.cpp index bb85e1dfd8a..c75b01ef44c 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_service_test/ability_manager_service_test.cpp +++ b/services/abilitymgr/test/unittest/phone/ability_manager_service_test/ability_manager_service_test.cpp @@ -1262,7 +1262,7 @@ HWTEST_F(AbilityManagerServiceTest, Interface_029, TestSize.Level1) HWTEST_F(AbilityManagerServiceTest, Interface_030, TestSize.Level1) { abilityMs_->currentStackManager_ = nullptr; - auto result = abilityMs_->UninstallApp("bundle", -1); + auto result = abilityMs_->UninstallApp("bundle"); EXPECT_EQ(ERR_NO_INIT, result); } diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_stub_test/ability_manager_stub_impl_mock.h b/services/abilitymgr/test/unittest/phone/ability_manager_stub_test/ability_manager_stub_impl_mock.h index e73a6da9c49..9a128f97072 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_stub_test/ability_manager_stub_impl_mock.h +++ b/services/abilitymgr/test/unittest/phone/ability_manager_stub_test/ability_manager_stub_impl_mock.h @@ -225,7 +225,7 @@ public: return 0; } - virtual int UninstallApp(const std::string &bundleName, int32_t uid) + virtual int UninstallApp(const std::string &bundleName) { return 0; } @@ -365,10 +365,6 @@ public: { return 0; } - virtual int32_t GetMissionIdByToken(const sptr &token) override - { - return 0; - } virtual int GetMissionInfos(const std::string& deviceId, int32_t numMax, std::vector &missionInfos) override { diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_test/ability_manager_stub_mock.h b/services/abilitymgr/test/unittest/phone/ability_manager_test/ability_manager_stub_mock.h index 0d9c5591c09..86e8505154f 100644 --- a/services/abilitymgr/test/unittest/phone/ability_manager_test/ability_manager_stub_mock.h +++ b/services/abilitymgr/test/unittest/phone/ability_manager_test/ability_manager_stub_mock.h @@ -65,8 +65,7 @@ public: MOCK_METHOD1(RemoveStack, int(int)); MOCK_METHOD1(MoveMissionToTop, int(int32_t)); MOCK_METHOD1(KillProcess, int(const std::string &)); - MOCK_METHOD2(UninstallApp, int(const std::string &, int32_t)); - MOCK_METHOD1(GetMissionIdByToken, int32_t(const sptr &token)); + MOCK_METHOD1(UninstallApp, int(const std::string &)); MOCK_METHOD2(TerminateAbilityByCaller, int(const sptr &callerToken, int requestCode)); MOCK_METHOD3(StartAbility, int(const Want &want, const sptr &callerToken, int requestCode)); MOCK_METHOD2(MoveMissionToEnd, int(const sptr &token, const bool nonFirst)); diff --git a/services/abilitymgr/test/unittest/phone/ability_stack_manager_test/ability_stack_manager_test.cpp b/services/abilitymgr/test/unittest/phone/ability_stack_manager_test/ability_stack_manager_test.cpp index 05d94121bd2..b16d19871ed 100644 --- a/services/abilitymgr/test/unittest/phone/ability_stack_manager_test/ability_stack_manager_test.cpp +++ b/services/abilitymgr/test/unittest/phone/ability_stack_manager_test/ability_stack_manager_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -2199,7 +2199,7 @@ HWTEST_F(AbilityStackManagerTest, ability_stack_manager_operating_061, TestSize. stackManager_->Init(); auto abilityStartSetting = AbilityStartSetting::GetEmptySetting(); - // default mission id + // defult mission id abilityStartSetting->AddProperty(AbilityStartSetting::WINDOW_MODE_KEY, std::to_string(AbilityWindowConfiguration::MULTI_WINDOW_DISPLAY_FULLSCREEN)); EXPECT_TRUE(abilityStartSetting); @@ -2289,7 +2289,7 @@ HWTEST_F(AbilityStackManagerTest, ability_stack_manager_operating_062, TestSize. * SubFunction: NA * FunctionPoints: Start the floating window according to the parameters * EnvConditions: NA - * CaseDescription: a default ability + Start a floating window application + * CaseDescription: a defult ability + Start a floating window application */ HWTEST_F(AbilityStackManagerTest, ability_stack_manager_operating_063, TestSize.Level1) { @@ -2414,7 +2414,7 @@ HWTEST_F(AbilityStackManagerTest, ability_stack_manager_operating_065, TestSize. EXPECT_TRUE(stact); EXPECT_EQ(stact->GetMissionStackId(), FLOATING_MISSION_STACK_ID); - // radioAbility in the default stack + // radioAbility in the defult stack EXPECT_EQ(redioMissionRecord->GetMissionStack()->GetMissionStackId(), DEFAULT_MISSION_STACK_ID); } diff --git a/services/abilitymgr/test/unittest/phone/data_ability_manager_test/BUILD.gn b/services/abilitymgr/test/unittest/phone/data_ability_manager_test/BUILD.gn index 3bf6449c2e3..f88bd33be43 100755 --- a/services/abilitymgr/test/unittest/phone/data_ability_manager_test/BUILD.gn +++ b/services/abilitymgr/test/unittest/phone/data_ability_manager_test/BUILD.gn @@ -76,5 +76,6 @@ ohos_unittest("data_ability_manager_test") { group("unittest") { testonly = true - # deps = [ ":data_ability_manager_test" ] + + deps = [ ":data_ability_manager_test" ] } diff --git a/services/abilitymgr/test/unittest/phone/pending_want_manager_test/pending_want_manager_test.cpp b/services/abilitymgr/test/unittest/phone/pending_want_manager_test/pending_want_manager_test.cpp index 38d97defaae..3007f1aed71 100644 --- a/services/abilitymgr/test/unittest/phone/pending_want_manager_test/pending_want_manager_test.cpp +++ b/services/abilitymgr/test/unittest/phone/pending_want_manager_test/pending_want_manager_test.cpp @@ -928,7 +928,7 @@ HWTEST_F(PendingWantManagerTest, PendingWantManagerTest_3500, TestSize.Level1) pendingManager_->GetWantSenderLocked(1, 1, wantSenderInfo1.userId, wantSenderInfo1, nullptr)->AsObject()); EXPECT_NE(pendingRecord1, nullptr); EXPECT_EQ((int)pendingManager_->wantRecords_.size(), 2); - pendingManager_->ClearPendingWantRecordTask("bundleName2", 1); + pendingManager_->ClearPendingWantRecordTask("bundleName2"); EXPECT_EQ((int)pendingManager_->wantRecords_.size(), 0); } @@ -965,7 +965,7 @@ HWTEST_F(PendingWantManagerTest, PendingWantManagerTest_3600, TestSize.Level1) pendingManager_->GetWantSenderLocked(1, 1, wantSenderInfo1.userId, wantSenderInfo1, nullptr)->AsObject()); EXPECT_NE(pendingRecord1, nullptr); EXPECT_EQ((int)pendingManager_->wantRecords_.size(), 2); - pendingManager_->ClearPendingWantRecordTask("bundleName1", 1); + pendingManager_->ClearPendingWantRecordTask("bundleName1"); EXPECT_EQ((int)pendingManager_->wantRecords_.size(), 1); } @@ -1002,7 +1002,7 @@ HWTEST_F(PendingWantManagerTest, PendingWantManagerTest_3700, TestSize.Level1) pendingManager_->GetWantSenderLocked(1, 1, wantSenderInfo1.userId, wantSenderInfo1, nullptr)->AsObject()); EXPECT_NE(pendingRecord1, nullptr); EXPECT_EQ((int)pendingManager_->wantRecords_.size(), 2); - pendingManager_->ClearPendingWantRecordTask("bundleName3", 1); + pendingManager_->ClearPendingWantRecordTask("bundleName3"); EXPECT_EQ((int)pendingManager_->wantRecords_.size(), 2); } diff --git a/services/appmgr/include/app_mgr_service.h b/services/appmgr/include/app_mgr_service.h index c53f4049b63..7c9d8f8cfda 100644 --- a/services/appmgr/include/app_mgr_service.h +++ b/services/appmgr/include/app_mgr_service.h @@ -36,7 +36,6 @@ #include "app_running_record.h" #include "app_scheduler_proxy.h" #include "ams_mgr_scheduler.h" -#include "ams_mgr_scheduler.h" namespace OHOS { namespace AppExecFwk { @@ -215,13 +214,6 @@ public: virtual void AttachRenderProcess(const sptr &shceduler) override; - /** - * Post a task to the not response process. - * - * @param pid, the not response process id. - */ - virtual void PostANRTaskByProcessID(const pid_t pid) override; - private: /** * Init, Initialize application services. diff --git a/services/appmgr/include/app_running_record.h b/services/appmgr/include/app_running_record.h index a82e44c9037..7782b001111 100644 --- a/services/appmgr/include/app_running_record.h +++ b/services/appmgr/include/app_running_record.h @@ -485,7 +485,6 @@ public: bool IsStartSpecifiedAbility() const; void ScheduleAcceptWant(const std::string &moduleName); void ScheduleAcceptWantDone(); - void ApplicationTerminated(); const AAFwk::Want &GetSpecifiedWant() const; void SetDebugApp(bool isDebugApp); void SetRenderRecord(const std::shared_ptr &record); diff --git a/services/appmgr/include/module_running_record.h b/services/appmgr/include/module_running_record.h index a877f3d63a0..8d45bb39837 100644 --- a/services/appmgr/include/module_running_record.h +++ b/services/appmgr/include/module_running_record.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -174,7 +174,7 @@ private: void SendEvent(uint32_t msg, int64_t timeOut, const std::shared_ptr &abilityRecord); ModuleRecordState GetState() const; - + private: std::map, std::shared_ptr> abilities_; std::map, std::shared_ptr> terminateAbilitys_; diff --git a/services/appmgr/src/app_death_recipient.cpp b/services/appmgr/src/app_death_recipient.cpp index 9dde4a875d8..64112141172 100644 --- a/services/appmgr/src/app_death_recipient.cpp +++ b/services/appmgr/src/app_death_recipient.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -14,6 +14,7 @@ */ #include "app_death_recipient.h" + #include "app_mgr_service_inner.h" #include "hilog_wrapper.h" diff --git a/services/appmgr/src/app_mgr_service.cpp b/services/appmgr/src/app_mgr_service.cpp index 2c191af31fb..72426c43a66 100755 --- a/services/appmgr/src/app_mgr_service.cpp +++ b/services/appmgr/src/app_mgr_service.cpp @@ -435,25 +435,5 @@ void AppMgrService::AttachRenderProcess(const sptr &scheduler) appMgrServiceInner_, pid, iface_cast(scheduler)); handler_->PostTask(fun, TASK_ATTACH_RENDER_PROCESS); } - -void AppMgrService::PostANRTaskByProcessID(const pid_t pid) -{ - HILOG_DEBUG("PostANRTaskByProcessID called."); - if (!IsReady()) { - HILOG_ERROR("AttachRenderProcess failed, not ready."); - return; - } - auto appRecord = appMgrServiceInner_->GetAppRunningRecordByPid(pid); - if (!appRecord) { - HILOG_ERROR("no such appRecord"); - return; - } - auto object = appRecord->GetApplicationClient(); - if (!object) { - HILOG_ERROR("GetApplicationClient failed."); - return; - } - object->ScheduleANRProcess(); -} } // namespace AppExecFwk } // namespace OHOS diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index 62c8d239b21..c5f8a27088d 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -365,7 +365,6 @@ void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId) HILOG_ERROR("get app record failed"); return; } - appRecord->ApplicationTerminated(); // Maybe can't get in here if (appRecord->IsKeepAliveApp()) { return; @@ -920,7 +919,7 @@ void AppMgrServiceInner::KillProcessByAbilityToken(const sptr &to return; } - // before exec ScheduleProcessSecurityExit return + // befor exec ScheduleProcessSecurityExit return // The resident process won't let him die if (appRecord->IsKeepAliveApp()) { return; @@ -1484,6 +1483,12 @@ void AppMgrServiceInner::HandleTerminateApplicationTimeOut(const int64_t eventId HILOG_ERROR("appRecord is nullptr"); return; } + + auto abilityRecord = appRecord->GetAbilityRunningRecord(eventId); + if (!abilityRecord) { + HILOG_ERROR("abilityRecord is nullptr"); + return; + } appRecord->SetState(ApplicationState::APP_STATE_TERMINATED); appRecord->RemoveAppDeathRecipient(); OnAppStateChanged(appRecord, ApplicationState::APP_STATE_TERMINATED); diff --git a/services/appmgr/src/app_running_record.cpp b/services/appmgr/src/app_running_record.cpp index 51b73361f80..01822e7c72f 100644 --- a/services/appmgr/src/app_running_record.cpp +++ b/services/appmgr/src/app_running_record.cpp @@ -1009,19 +1009,6 @@ void AppRunningRecord::ScheduleAcceptWantDone() eventHandler_->RemoveEvent(AMSEventHandler::START_SPECIFIED_ABILITY_TIMEOUT_MSG, eventId_); } -void AppRunningRecord::ApplicationTerminated() -{ - HILOG_DEBUG("Application terminated bundle %{public}s and eventId %{public}d", mainBundleName_.c_str(), - static_cast(eventId_)); - - if (!eventHandler_) { - HILOG_ERROR("eventHandler_ is nullptr"); - return; - } - - eventHandler_->RemoveEvent(AMSEventHandler::TERMINATE_APPLICATION_TIMEOUT_MSG, eventId_); -} - const AAFwk::Want &AppRunningRecord::GetSpecifiedWant() const { return SpecifiedWant_; diff --git a/services/appmgr/src/system_environment_information.cpp b/services/appmgr/src/system_environment_information.cpp index 5f316aeec95..38a1ef322cd 100644 --- a/services/appmgr/src/system_environment_information.cpp +++ b/services/appmgr/src/system_environment_information.cpp @@ -98,7 +98,7 @@ static void RequestSystemMemoryInfo(std::map &memInfo) while (fgets(buff, sizeof(buff), fp) != nullptr) { std::string strbuf(buff); - (void)memset_s(buff, sizeof(buff), 0x00, sizeof(buff)); + memset_s(buff, sizeof(buff), 0x00, sizeof(buff)); std::smatch sm; std::smatch smData; bool flag = false; diff --git a/services/appmgr/test/mock/include/mock_app_mgr_service.h b/services/appmgr/test/mock/include/mock_app_mgr_service.h index aa60310a252..d90d4bcea8d 100644 --- a/services/appmgr/test/mock/include/mock_app_mgr_service.h +++ b/services/appmgr/test/mock/include/mock_app_mgr_service.h @@ -55,7 +55,6 @@ public: MOCK_METHOD3(ScheduleAcceptWantDone, void(const int32_t recordId, const AAFwk::Want &want, const std::string &flag)); MOCK_METHOD2(GetAbilityRecordsByProcessID, int(const int pid, std::vector> &tokens)); - MOCK_METHOD1(PostANRTaskByProcessID, void(const pid_t pid)); virtual int StartUserTestProcess( const AAFwk::Want &want, const sptr &observer, const BundleInfo &bundleInfo) diff --git a/services/appmgr/test/mock/include/mock_app_scheduler.h b/services/appmgr/test/mock/include/mock_app_scheduler.h index f17c4be3a43..1b45cb5e141 100644 --- a/services/appmgr/test/mock/include/mock_app_scheduler.h +++ b/services/appmgr/test/mock/include/mock_app_scheduler.h @@ -42,7 +42,6 @@ public: MOCK_METHOD0(ScheduleProcessSecurityExit, void()); MOCK_METHOD1(ScheduleAbilityStage, void(const HapModuleInfo &)); MOCK_METHOD2(ScheduleAcceptWant, void(const AAFwk::Want &want, const std::string &moduleName)); - MOCK_METHOD0(ScheduleANRProcess, void()); }; } // namespace AppExecFwk } // namespace OHOS diff --git a/services/appmgr/test/mock/include/mock_application.h b/services/appmgr/test/mock/include/mock_application.h index b8a99828852..b537cb26e26 100644 --- a/services/appmgr/test/mock/include/mock_application.h +++ b/services/appmgr/test/mock/include/mock_application.h @@ -37,7 +37,6 @@ public: MOCK_METHOD0(ScheduleProcessSecurityExit, void()); MOCK_METHOD1(ScheduleAbilityStage, void(const HapModuleInfo &)); MOCK_METHOD2(ScheduleAcceptWant, void(const AAFwk::Want &want, const std::string &moduleName)); - MOCK_METHOD0(ScheduleANRProcess, void()); void Post() { diff --git a/services/appmgr/test/unittest/ams_app_workflow_test/ams_workflow_test.cpp b/services/appmgr/test/unittest/ams_app_workflow_test/ams_workflow_test.cpp index 7ce5889de8c..9432cf07206 100644 --- a/services/appmgr/test/unittest/ams_app_workflow_test/ams_workflow_test.cpp +++ b/services/appmgr/test/unittest/ams_app_workflow_test/ams_workflow_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -639,7 +639,7 @@ HWTEST_F(AmsWorkFlowTest, ScreenOn_001, TestSize.Level1) * Function: AppLifeCycle * SubFunction: WorkFlow * FunctionPoints: ScreenOn - * CaseDescription: when multiple abilities on background, previous is one ability, simulate screen on + * CaseDescription: when multiple abilities on backgroud, previous is one ability, simulate screen on */ HWTEST_F(AmsWorkFlowTest, ScreenOn_002, TestSize.Level1) { @@ -666,7 +666,7 @@ HWTEST_F(AmsWorkFlowTest, ScreenOn_002, TestSize.Level1) * Function: AppLifeCycle * SubFunction: WorkFlow * FunctionPoints: ScreenOn - * CaseDescription: when multiple abilities on background, all abilities are previous, simulate screen on + * CaseDescription: when multiple abilities on backgroud, all abilities are previous, simulate screen on */ HWTEST_F(AmsWorkFlowTest, ScreenOn_003, TestSize.Level1) { diff --git a/services/dataobsmgr/src/data_ability_observer_proxy.cpp b/services/dataobsmgr/src/data_ability_observer_proxy.cpp index 157fb562f4b..2d4b0cc6491 100644 --- a/services/dataobsmgr/src/data_ability_observer_proxy.cpp +++ b/services/dataobsmgr/src/data_ability_observer_proxy.cpp @@ -48,9 +48,14 @@ void DataAbilityObserverProxy::OnChange() } int result = remote->SendRequest(IDataAbilityObserver::DATA_ABILITY_OBSERVER_CHANGE, data, reply, option); - if (result != ERR_NONE) { + if (result == ERR_NONE) { + HILOG_INFO("%{public}s SendRequest ok, retval is %d", __func__, reply.ReadInt32()); + return; + } else { HILOG_ERROR("%{public}s SendRequest error, result=%{public}d", __func__, result); + return; } } + } // namespace AAFwk } // namespace OHOS \ No newline at end of file diff --git a/services/dataobsmgr/test/unittest/phone/dataobs_mgr_client_test/mock_dataobs_mgr_client.h b/services/dataobsmgr/test/unittest/phone/dataobs_mgr_client_test/mock_dataobs_mgr_client.h index 07d51498d99..8d0b9dfd45e 100644 --- a/services/dataobsmgr/test/unittest/phone/dataobs_mgr_client_test/mock_dataobs_mgr_client.h +++ b/services/dataobsmgr/test/unittest/phone/dataobs_mgr_client_test/mock_dataobs_mgr_client.h @@ -40,11 +40,13 @@ public: std::shared_ptr MockDataObsMgrClient::GetInstance() { if (instance_ == nullptr) { - std::shared_ptr client {new (std::nothrow) MockDataObsMgrClient()}; - if (client != nullptr) { - ((MockDataObsMgrClient *)client.get())->Connect(); + if (instance_ == nullptr) { + std::shared_ptr client {new (std::nothrow) MockDataObsMgrClient()}; + if (client != nullptr) { + ((MockDataObsMgrClient *)client.get())->Connect(); + } + instance_ = client; } - instance_ = client; } return instance_; } diff --git a/services/formmgr/include/form_timer.h b/services/formmgr/include/form_timer.h index 97fccd2e1ad..cffaeb9bdb0 100644 --- a/services/formmgr/include/form_timer.h +++ b/services/formmgr/include/form_timer.h @@ -115,7 +115,7 @@ public: class DynamicRefreshItem { public: int64_t formId = 0L; - int64_t settedTime = INT64_MAX; + int64_t settedTime = LONG_MAX; int32_t userId = -1; DynamicRefreshItem(){} diff --git a/services/formmgr/include/form_timer_mgr.h b/services/formmgr/include/form_timer_mgr.h index c6541e1f459..14f4d14a191 100644 --- a/services/formmgr/include/form_timer_mgr.h +++ b/services/formmgr/include/form_timer_mgr.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -138,7 +138,7 @@ public: * @param updateTime Update time. * @return Returns true on success, false on failure. */ - bool OnDynamicTimeTrigger(int64_t updateTime); + bool OnDynamicTimeTrigger(long updateTime); /** * @brief Get interval timer task. * @param formId The Id of the form. @@ -266,7 +266,7 @@ private: * @param updateAtItem Next at timer item. * @return Returns true on success, false on failure. */ - bool FindNextAtTimerItem(const long nowTime, UpdateAtItem &updateAtItem); + bool FindNextAtTimerItem(const int nowTime, UpdateAtItem &updateAtItem); /** * @brief Clear update at timer resource. */ @@ -316,7 +316,7 @@ private: * @param nextTime The next update time. * @return Returns WantAgent. */ - std::shared_ptr GetDynamicWantAgent(int64_t nextTime, int32_t userId); + std::shared_ptr GetDynamicWantAgent(long nextTime, int32_t userId); /** * @brief check if user is active or not. @@ -362,13 +362,13 @@ private: std::shared_ptr intervalTimer_ = nullptr; uint64_t updateAtTimerId_ = 0L; uint64_t dynamicAlarmTimerId_ = 0L; - uint64_t limiterTimerId_ = 0L; + uint64_t limiterTimerId_= 0L; std::shared_ptr currentUpdateAtWantAgent = nullptr; std::shared_ptr currentDynamicWantAgent = nullptr; std::shared_ptr currentLimiterWantAgent = nullptr; - int64_t dynamicWakeUpTime_ = INT64_MAX; + long dynamicWakeUpTime_ = LONG_MAX; long atTimerWakeUpTime_ = LONG_MAX; }; } // namespace AppExecFwk diff --git a/services/formmgr/src/form_timer_mgr.cpp b/services/formmgr/src/form_timer_mgr.cpp index 541502ab31f..b751267e6a1 100644 --- a/services/formmgr/src/form_timer_mgr.cpp +++ b/services/formmgr/src/form_timer_mgr.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ namespace AppExecFwk { const int REQUEST_UPDATE_AT_CODE = 1; const int REQUEST_LIMITER_CODE = 2; const int REQUEST_DYNAMIC_CODE = 3; -const int SHIFT_BIT_LENGTH = 32; FormTimerMgr::FormTimerMgr() { @@ -292,7 +291,7 @@ bool FormTimerMgr::AtTimerToIntervalTimer(const int64_t formId, const FormTimerC } targetItem.refreshTask.isUpdateAt = false; targetItem.refreshTask.period = timerCfg.updateDuration; - targetItem.refreshTask.refreshTime = INT64_MAX; + targetItem.refreshTask.refreshTime = LONG_MAX; if (!AddIntervalTimer(targetItem.refreshTask)) { HILOG_ERROR("%{public}s, failed to add interval timer", __func__); return false; @@ -549,15 +548,15 @@ bool FormTimerMgr::OnUpdateAtTrigger(long updateTime) * @param updateTime Update time. * @return Returns true on success, false on failure. */ -bool FormTimerMgr::OnDynamicTimeTrigger(int64_t updateTime) +bool FormTimerMgr::OnDynamicTimeTrigger(long updateTime) { - HILOG_INFO("%{public}s start, updateTime:%{public}" PRId64 "", __func__, updateTime); + HILOG_INFO("%{public}s start, updateTime:%{public}ld", __func__, updateTime); std::vector updateList; { std::lock_guard lock(dynamicMutex_); auto timeSinceEpoch = std::chrono::steady_clock::now().time_since_epoch(); auto timeInSec = std::chrono::duration_cast(timeSinceEpoch).count(); - int64_t markedTime = timeInSec + Constants::ABS_REFRESH_MS; + long markedTime = timeInSec + Constants::ABS_REFRESH_MS; std::vector::iterator itItem; for (itItem = dynamicRefreshTasks_.begin(); itItem != dynamicRefreshTasks_.end();) { if (itItem->settedTime <= updateTime || itItem->settedTime <= markedTime) { @@ -582,7 +581,7 @@ bool FormTimerMgr::OnDynamicTimeTrigger(int64_t updateTime) } if (!updateList.empty()) { - HILOG_INFO("%{public}s triggered, trigged time: %{public}" PRId64 "", __func__, updateTime); + HILOG_INFO("%{public}s triggered, trigged time: %{public}ld", __func__, updateTime); for (auto &task : updateList) { ExecTimerTask(task); } @@ -742,8 +741,8 @@ bool FormTimerMgr::DeleteUpdateAtTimer(const int64_t formId) HILOG_ERROR("%{public}s, failed to update attimer alarm.", __func__); return false; } - HILOG_INFO("%{public}s end", __func__); return true; + HILOG_INFO("%{public}s end", __func__); } /** * @brief Delete dynamic refresh item. @@ -769,8 +768,8 @@ bool FormTimerMgr::DeleteDynamicItem(const int64_t formId) HILOG_ERROR("%{public}s, failed to UpdateDynamicAlarm", __func__); return false; } - HILOG_INFO("%{public}s end", __func__); return true; + HILOG_INFO("%{public}s end", __func__); } /** * @brief interval timer task timeout. @@ -814,8 +813,8 @@ bool FormTimerMgr::UpdateAtTimerAlarm() return false; } - long nowAtTime = tmAtTime.tm_hour * Constants::MIN_PER_HOUR + tmAtTime.tm_min; - int64_t currentTime = FormUtil::GetCurrentMillisecond(); + int nowAtTime = tmAtTime.tm_hour * Constants::MIN_PER_HOUR + tmAtTime.tm_min; + long currentTime = FormUtil::GetCurrentMillisecond(); UpdateAtItem findedItem; bool bFinded = FindNextAtTimerItem(nowAtTime, findedItem); if (!bFinded) { @@ -833,7 +832,7 @@ bool FormTimerMgr::UpdateAtTimerAlarm() tmAtTime.tm_sec = 0; tmAtTime.tm_hour = findedItem.refreshTask.hour; tmAtTime.tm_min = findedItem.refreshTask.min; - int64_t selectTime = FormUtil::GetMillisecondFromTm(tmAtTime); + long selectTime = FormUtil::GetMillisecondFromTm(tmAtTime); if (selectTime < currentTime) { tmAtTime.tm_mday += 1; nextWakeUpTime += (Constants::HOUR_PER_DAY * Constants::MIN_PER_HOUR); @@ -940,7 +939,7 @@ bool FormTimerMgr::UpdateLimiterAlarm() tmAtTime.tm_sec = Constants::MAX_SECOND; // max value can be 61 tmAtTime.tm_hour = Constants::MAX_HOUR; tmAtTime.tm_min = Constants::MAX_MININUTE; - int64_t limiterWakeUpTime = FormUtil::GetMillisecondFromTm(tmAtTime); + uint64_t limiterWakeUpTime = FormUtil::GetMillisecondFromTm(tmAtTime); auto timerOption = std::make_shared(); timerOption->SetType(timerOption->TIMER_TYPE_WAKEUP); @@ -1016,7 +1015,7 @@ bool FormTimerMgr::UpdateDynamicAlarm() HILOG_INFO("%{public}s start", __func__); if (dynamicRefreshTasks_.empty()) { ClearDynamicResource(); - dynamicWakeUpTime_ = INT64_MAX; + dynamicWakeUpTime_ = LONG_MAX; return true; } @@ -1054,7 +1053,9 @@ bool FormTimerMgr::UpdateDynamicAlarm() if (!bRet) { HILOG_ERROR("%{public}s failed, init dynamic timer task error", __func__); } - HILOG_INFO("%{public}s end, dynamicWakeUpTime_ : %{public}" PRId64 ".", __func__, dynamicWakeUpTime_); + + HILOG_INFO("%{public}s end, dynamicWakeUpTime_ : %{pubilc}ld.", __func__, dynamicWakeUpTime_); + return true; } /** @@ -1062,18 +1063,14 @@ bool FormTimerMgr::UpdateDynamicAlarm() * @param nextTime The next update time. * @return Returns WantAgent. */ -std::shared_ptr FormTimerMgr::GetDynamicWantAgent(int64_t nextTime, int32_t userId) +std::shared_ptr FormTimerMgr::GetDynamicWantAgent(long nextTime, int32_t userId) { std::shared_ptr want = std::make_shared(); ElementName element("", "", ""); want->SetElement(element); want->SetAction(Constants::ACTION_UPDATEATTIMER); want->SetParam(Constants::KEY_ACTION_TYPE, Constants::TYPE_DYNAMIC_UPDATE); - int nextTimeRight = static_cast(nextTime); - int nextTimLeft = static_cast(nextTime >> SHIFT_BIT_LENGTH); - - want->SetParam(Constants::KEY_WAKEUP_TIME_LEFT, nextTimLeft); - want->SetParam(Constants::KEY_WAKEUP_TIME_RIGHT, nextTimeRight); + want->SetParam(Constants::KEY_WAKEUP_TIME, nextTime); std::vector> wants; wants.emplace_back(want); WantAgentInfo wantAgentInfo(REQUEST_DYNAMIC_CODE, WantAgentConstant::OperationType::SEND_COMMON_EVENT, @@ -1107,7 +1104,7 @@ void FormTimerMgr::ClearDynamicResource() * @param updateAtItem Next at timer item. * @return Returns true on success, false on failure. */ -bool FormTimerMgr::FindNextAtTimerItem(const long nowTime, UpdateAtItem &updateAtItem) +bool FormTimerMgr::FindNextAtTimerItem(const int nowTime, UpdateAtItem &updateAtItem) { HILOG_INFO("%{public}s start", __func__); if (updateAtTimerTasks_.empty()) { @@ -1260,13 +1257,9 @@ void FormTimerMgr::TimerReceiver::OnReceiveEvent(const EventFwk::CommonEventData } FormTimerMgr::GetInstance().OnUpdateAtTrigger(updateTime); } else if (type == Constants::TYPE_DYNAMIC_UPDATE) { - int updateTimeLeft = want.GetIntParam(Constants::KEY_WAKEUP_TIME_LEFT, -1); - int updateTimeRight = want.GetIntParam(Constants::KEY_WAKEUP_TIME_RIGHT, -1); - int64_t updateTime = static_cast(updateTimeLeft); - updateTime = updateTime << SHIFT_BIT_LENGTH; - updateTime |= updateTimeRight; + long updateTime = want.GetLongParam(Constants::KEY_WAKEUP_TIME, 0); if (updateTime <= 0) { - HILOG_ERROR("%{public}s failed, invalid updateTime:%{public}" PRId64 "", __func__, updateTime); + HILOG_ERROR("%{public}s failed, invalid updateTime:%{public}ld.", __func__, updateTime); return; } FormTimerMgr::GetInstance().OnDynamicTimeTrigger(updateTime); diff --git a/services/formmgr/test/mock/include/mock_ability_manager.h b/services/formmgr/test/mock/include/mock_ability_manager.h index 15d377d2f54..1f8ee784e80 100644 --- a/services/formmgr/test/mock/include/mock_ability_manager.h +++ b/services/formmgr/test/mock/include/mock_ability_manager.h @@ -213,12 +213,6 @@ public: { return 0; } - - virtual int32_t GetMissionIdByToken(const sptr &token) override - { - return 0; - } - virtual int RemoveMission(int id) { return 0; @@ -231,7 +225,7 @@ public: { return 0; } - virtual int UninstallApp(const std::string &bundleName, int32_t uid) + virtual int UninstallApp(const std::string &bundleName) { return 0; } @@ -610,12 +604,6 @@ public: { return 0; } - - virtual int32_t GetMissionIdByToken(const sptr &token) override - { - return 0; - } - virtual int RemoveMission(int id) { return 0; @@ -628,7 +616,7 @@ public: { return 0; } - virtual int UninstallApp(const std::string &bundleName, int32_t uid) + virtual int UninstallApp(const std::string &bundleName) { return 0; } diff --git a/services/formmgr/test/mock/include/mock_bundle_manager.h b/services/formmgr/test/mock/include/mock_bundle_manager.h index b01f66ef6c8..b833123f9a4 100755 --- a/services/formmgr/test/mock/include/mock_bundle_manager.h +++ b/services/formmgr/test/mock/include/mock_bundle_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -200,7 +200,7 @@ public: } /** - * @brief Obtains the CommonEventInfo objects provided by an event key on the device. + * @brief Obtains the CommonEventInfo objects provided by a event key on the device. * @param eventKey Indicates the event of the subscribe. * @param commonEventInfos List of CommonEventInfo objects if obtained. * @return Returns true if this function is successfully called; returns false otherwise. @@ -427,7 +427,7 @@ public: } /** - * @brief Obtains the CommonEventInfo objects provided by an event key on the device. + * @brief Obtains the CommonEventInfo objects provided by a event key on the device. * @param eventKey Indicates the event of the subscribe. * @param commonEventInfos List of CommonEventInfo objects if obtained. * @return Returns true if this function is successfully called; returns false otherwise. diff --git a/services/formmgr/test/mock/include/mock_form_host_client.h b/services/formmgr/test/mock/include/mock_form_host_client.h index 1c4c4fce1a7..b242c4080ac 100644 --- a/services/formmgr/test/mock/include/mock_form_host_client.h +++ b/services/formmgr/test/mock/include/mock_form_host_client.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -50,6 +50,11 @@ public: sem_.Post(); } + // void AddForm(const Ability& slice, int64_t formId); + + // void RemoveForm(const Ability& slice, int64_t formId); + + // bool ContainsForm(int64_t formId); /** * Request to give back a Form. * diff --git a/services/formmgr/test/mock/src/mock_form_provider_client.cpp b/services/formmgr/test/mock/src/mock_form_provider_client.cpp index bbfedfdb46f..e582ddb0ce1 100644 --- a/services/formmgr/test/mock/src/mock_form_provider_client.cpp +++ b/services/formmgr/test/mock/src/mock_form_provider_client.cpp @@ -39,7 +39,6 @@ int MockFormProviderClient::AcquireProviderFormInfo(const int64_t formId, const sptr formSupply = iface_cast(callerToken); if (formSupply == nullptr) { HILOG_ERROR("failed to get formSupplyProxy"); - return ERR_OK; } FormProviderInfo formProviderInfo; diff --git a/services/formmgr/test/unittest/fms_form_data_mgr_test/BUILD.gn b/services/formmgr/test/unittest/fms_form_data_mgr_test/BUILD.gn index 46cdf6ed868..7ad8fc83d98 100644 --- a/services/formmgr/test/unittest/fms_form_data_mgr_test/BUILD.gn +++ b/services/formmgr/test/unittest/fms_form_data_mgr_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 @@ -29,6 +29,8 @@ ohos_unittest("FmsFormDataMgrTest") { "//foundation/appexecfwk/standard/common/log/include/", "//foundation/aafwk/standard/services/formmgr/include", + #"//foundation/appexecfwk/standard/services/bundlemgr/include", + #"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include", "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base/include/", "//foundation/aafwk/standard/interfaces/innerkits/form_manager/include", "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core/include/bundlemgr/", diff --git a/services/formmgr/test/unittest/fms_form_data_mgr_test/fms_form_data_mgr_test.cpp b/services/formmgr/test/unittest/fms_form_data_mgr_test/fms_form_data_mgr_test.cpp index 4f656ee0a77..e82ef5566e8 100644 --- a/services/formmgr/test/unittest/fms_form_data_mgr_test/fms_form_data_mgr_test.cpp +++ b/services/formmgr/test/unittest/fms_form_data_mgr_test/fms_form_data_mgr_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -259,7 +259,7 @@ HWTEST_F(FmsFormDataMgrTest, FmsFormDataMgrTest_AllotFormRecord_006, TestSize.Le * @tc.desc: Verify that the return value is correct. * @tc.details: * SetUpdateDuration is 0.(call ParseAtTimerConfig) - * Gets the configuration item scheduledUpdateTime_ an invalid value. + * 获取配置项scheduledUpdateTime_为无效值 */ HWTEST_F(FmsFormDataMgrTest, FmsFormDataMgrTest_AllotFormRecord_007, TestSize.Level0) { diff --git a/services/formmgr/test/unittest/fms_form_db_record_test/BUILD.gn b/services/formmgr/test/unittest/fms_form_db_record_test/BUILD.gn index 0fb84ce4175..f3cde572b1d 100644 --- a/services/formmgr/test/unittest/fms_form_db_record_test/BUILD.gn +++ b/services/formmgr/test/unittest/fms_form_db_record_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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,6 +26,8 @@ ohos_unittest("FmsFormDbRecordTest") { "//foundation/appexecfwk/standard/common/log/include/", "//foundation/aafwk/standard/services/formmgr/include", + #"//foundation/appexecfwk/standard/services/bundlemgr/include", + #"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include", "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base/include/", "//foundation/aafwk/standard/interfaces/innerkits/form_manager/include", "//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core/include/bundlemgr/", diff --git a/services/formmgr/test/unittest/fms_form_mgr_add_form_test/BUILD.gn b/services/formmgr/test/unittest/fms_form_mgr_add_form_test/BUILD.gn index 1d01331d618..7a480b2f0a7 100644 --- a/services/formmgr/test/unittest/fms_form_mgr_add_form_test/BUILD.gn +++ b/services/formmgr/test/unittest/fms_form_mgr_add_form_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 @@ -63,6 +63,8 @@ ohos_unittest("FmsFormMgrAddFormTest") { "//foundation/aafwk/standard/interfaces/innerkits/app_manager:app_manager", "//foundation/aafwk/standard/interfaces/innerkits/base:base", "//foundation/aafwk/standard/interfaces/innerkits/want:want", + + #"${appexecfwk_path}/services/bundlemgr:bms_target", "//foundation/aafwk/standard/services/abilitymgr:abilityms_target", "//foundation/distributeddatamgr/distributeddatamgr/interfaces/innerkits/distributeddata:distributeddata_inner", "//foundation/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_fwk", diff --git a/services/formmgr/test/unittest/fms_form_mgr_death_callback_test/BUILD.gn b/services/formmgr/test/unittest/fms_form_mgr_death_callback_test/BUILD.gn index f1efa22d431..9c20fdb068f 100644 --- a/services/formmgr/test/unittest/fms_form_mgr_death_callback_test/BUILD.gn +++ b/services/formmgr/test/unittest/fms_form_mgr_death_callback_test/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 @@ -48,6 +48,8 @@ ohos_unittest("FmsFormMgrDeathCallbackTest") { configs = [ "${services_path}/formmgr/test:formmgr_test_config", "//foundation/aafwk/standard/services/abilitymgr:abilityms_config", + + # "${appexecfwk_path}/interfaces/innerkits/appexecfwk_core:bundlemgr_sdk_config", ] cflags = [] if (target_cpu == "arm") { diff --git a/services/test/mock/include/appmgr/mock_ability_mgr_host.h b/services/test/mock/include/appmgr/mock_ability_mgr_host.h index 8cfefb75165..f0f005064d2 100644 --- a/services/test/mock/include/appmgr/mock_ability_mgr_host.h +++ b/services/test/mock/include/appmgr/mock_ability_mgr_host.h @@ -150,7 +150,7 @@ public: { return 0; } - virtual int UninstallApp(const std::string &bundleName, int32_t uid) override + virtual int UninstallApp(const std::string &bundleName) override { return 0; } diff --git a/services/test/mock/include/mock_ability_manager_proxy.h b/services/test/mock/include/mock_ability_manager_proxy.h index fb9b4583ec8..c65309aabf5 100644 --- a/services/test/mock/include/mock_ability_manager_proxy.h +++ b/services/test/mock/include/mock_ability_manager_proxy.h @@ -55,9 +55,8 @@ public: MOCK_METHOD1(RemoveMission, int(int)); MOCK_METHOD1(RemoveStack, int(int)); MOCK_METHOD1(MoveMissionToTop, int(int32_t)); - MOCK_METHOD1(GetMissionIdByToken, int32_t(const sptr &token)); MOCK_METHOD1(KillProcess, int(const std::string &)); - MOCK_METHOD2(UninstallApp, int(const std::string &, int32_t)); + MOCK_METHOD1(UninstallApp, int(const std::string &)); MOCK_METHOD4(OnRemoteRequest, int(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)); MOCK_METHOD2(TerminateAbilityByCaller, int(const sptr &callerToken, int requestCode)); MOCK_METHOD3(StartAbility, int(const Want &want, const sptr &callerToken, int requestCode)); diff --git a/services/test/mock/include/mock_ability_mgr_service.h b/services/test/mock/include/mock_ability_mgr_service.h index 414c563ada3..ad54fb74ae0 100644 --- a/services/test/mock/include/mock_ability_mgr_service.h +++ b/services/test/mock/include/mock_ability_mgr_service.h @@ -63,9 +63,8 @@ public: MOCK_METHOD1(RemoveMission, int(int)); MOCK_METHOD1(RemoveStack, int(int)); MOCK_METHOD1(MoveMissionToTop, int(int32_t)); - MOCK_METHOD1(GetMissionIdByToken, int32_t(const sptr &token)); MOCK_METHOD1(KillProcess, int(const std::string &)); - MOCK_METHOD2(UninstallApp, int(const std::string &, int32_t)); + MOCK_METHOD1(UninstallApp, int(const std::string &)); MOCK_METHOD4(OnRemoteRequest, int(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)); MOCK_METHOD2(MoveMissionToEnd, int(const sptr &token, const bool nonFirst)); MOCK_METHOD1(IsFirstInMission, bool(const sptr &token)); diff --git a/services/test/mock/include/mock_app_scheduler.h b/services/test/mock/include/mock_app_scheduler.h index e1960e809e0..df33e11b7a9 100644 --- a/services/test/mock/include/mock_app_scheduler.h +++ b/services/test/mock/include/mock_app_scheduler.h @@ -41,7 +41,6 @@ public: MOCK_METHOD1(ScheduleConfigurationUpdated, void(const AppExecFwk::Configuration &config)); MOCK_METHOD1(ScheduleShrinkMemory, void(const int)); MOCK_METHOD0(ScheduleLowMemory, void()); - MOCK_METHOD0(ScheduleANRProcess, void()); }; } // namespace AAFwk } // namespace OHOS diff --git a/services/test/moduletest/ability_mgr_service_test/ability_mgr_module_test.cpp b/services/test/moduletest/ability_mgr_service_test/ability_mgr_module_test.cpp index 9d030f31fcf..12e14d6aecf 100644 --- a/services/test/moduletest/ability_mgr_service_test/ability_mgr_module_test.cpp +++ b/services/test/moduletest/ability_mgr_service_test/ability_mgr_module_test.cpp @@ -1245,7 +1245,7 @@ HWTEST_F(AbilityMgrModuleTest, UninstallApp_001, TestSize.Level1) wantSenderInfo1, nullptr)->AsObject()); EXPECT_NE(pendingRecord1, nullptr); EXPECT_EQ((int)abilityMgrServ_->pendingWantManager_->wantRecords_.size(), 2); - abilityMgrServ_->UninstallApp("bundleName3", 1); + abilityMgrServ_->UninstallApp("bundleName3"); WaitAMS(); EXPECT_EQ((int)abilityMgrServ_->pendingWantManager_->wantRecords_.size(), 2); } @@ -1288,7 +1288,7 @@ HWTEST_F(AbilityMgrModuleTest, UninstallApp_002, TestSize.Level1) wantSenderInfo1, nullptr)->AsObject()); EXPECT_NE(pendingRecord1, nullptr); EXPECT_EQ((int)abilityMgrServ_->pendingWantManager_->wantRecords_.size(), 2); - abilityMgrServ_->UninstallApp("bundleName2", 1); + abilityMgrServ_->UninstallApp("bundleName2"); WaitAMS(); EXPECT_EQ((int)abilityMgrServ_->pendingWantManager_->wantRecords_.size(), 0); } @@ -1331,7 +1331,7 @@ HWTEST_F(AbilityMgrModuleTest, UninstallApp_003, TestSize.Level1) wantSenderInfo1, nullptr)->AsObject()); EXPECT_NE(pendingRecord1, nullptr); EXPECT_EQ((int)abilityMgrServ_->pendingWantManager_->wantRecords_.size(), 2); - abilityMgrServ_->UninstallApp("bundleName1", 1); + abilityMgrServ_->UninstallApp("bundleName1"); WaitAMS(); EXPECT_EQ((int)abilityMgrServ_->pendingWantManager_->wantRecords_.size(), 1); } @@ -1374,7 +1374,7 @@ HWTEST_F(AbilityMgrModuleTest, UninstallApp_004, TestSize.Level1) wantSenderInfo1, nullptr)->AsObject()); EXPECT_NE(pendingRecord1, nullptr); EXPECT_EQ((int)abilityMgrServ_->pendingWantManager_->wantRecords_.size(), 2); - abilityMgrServ_->UninstallApp("bundleName3", 1); + abilityMgrServ_->UninstallApp("bundleName3"); WaitAMS(); EXPECT_EQ((int)abilityMgrServ_->pendingWantManager_->wantRecords_.size(), 1); } diff --git a/services/test/moduletest/ability_stack_test/ability_stack_module_test.cpp b/services/test/moduletest/ability_stack_test/ability_stack_module_test.cpp index 268565fdf0a..92a14dbb7a8 100644 --- a/services/test/moduletest/ability_stack_test/ability_stack_module_test.cpp +++ b/services/test/moduletest/ability_stack_test/ability_stack_module_test.cpp @@ -1831,7 +1831,7 @@ HWTEST_F(AbilityStackModuleTest, ability_stack_test_035, TestSize.Level1) EXPECT_TRUE(topAbilityRecordRadio); topAbilityRecordRadio->SetAbilityState(OHOS::AAFwk::ACTIVE); - // start default ability, put in float stack + // start defult ability, put in float stack auto musicAbilityRequest = GenerateAbilityRequest("device", "MusicAbility", "music", "com.ix.hiMusic"); ref = stackManager_->StartAbility(musicAbilityRequest); EXPECT_EQ(ERR_OK, ref); @@ -1877,7 +1877,7 @@ HWTEST_F(AbilityStackModuleTest, ability_stack_test_036, TestSize.Level1) EXPECT_TRUE(topAbilityRecordRadio); topAbilityRecordRadio->SetAbilityState(OHOS::AAFwk::ACTIVE); - // start default singleton ability, put in float stack + // start defult singleton ability, put in float stack auto musicTonAbilityRequest = GenerateAbilityRequest("device", "MusicSAbility", "music", "com.ix.hiMusic"); ref = stackManager_->StartAbility(musicTonAbilityRequest); EXPECT_EQ(ERR_OK, ref); @@ -1906,7 +1906,7 @@ HWTEST_F(AbilityStackModuleTest, ability_stack_test_037, TestSize.Level1) auto topAbilityRecord1 = stackManager_->GetCurrentTopAbility(); topAbilityRecord1->SetAbilityState(OHOS::AAFwk::ACTIVE); - // start default singleton ability, put in float stack + // start defult singleton ability, put in float stack auto musicTonAbilityRequest = GenerateAbilityRequest("device", "MusicSAbility", "music", "com.ix.hiMusic"); ref = stackManager_->StartAbility(musicTonAbilityRequest); EXPECT_EQ(ERR_OK, ref); @@ -1971,7 +1971,7 @@ HWTEST_F(AbilityStackModuleTest, ability_stack_test_038, TestSize.Level1) * SubFunction: Try moving other applications to the floating window stack * FunctionPoints: * EnvConditions: NA - * CaseDescription: Move the default ability to the floating window stack + * CaseDescription: Move the defult ability to the floating window stack */ HWTEST_F(AbilityStackModuleTest, ability_stack_test_039, TestSize.Level1) { @@ -2166,7 +2166,7 @@ HWTEST_F(AbilityStackModuleTest, ability_stack_test_043, TestSize.Level1) * SubFunction: moving other applications to the floating window stack or Full screen stack * FunctionPoints: * EnvConditions: NA - * CaseDescription: Move the float ability to the default stack + * CaseDescription: Move the float ability to the defult stack */ HWTEST_F(AbilityStackModuleTest, ability_stack_test_044, TestSize.Level1) { @@ -2250,7 +2250,7 @@ HWTEST_F(AbilityStackModuleTest, ability_stack_test_045, TestSize.Level1) EXPECT_CALL(*scheduler, AsObject()).WillRepeatedly(Return(nullptr)); radioAbilityRecord->SetScheduler(scheduler); - // top float ability move to default stack + // top float ability move to defult stack ref = stackManager_->MaximizeMultiWindow(radioAbilityRecord->GetMissionRecordId()); EXPECT_EQ(ERR_OK, ref); diff --git a/services/test/moduletest/common/ams/ability_running_record_test/ams_ability_running_record_module_test.cpp b/services/test/moduletest/common/ams/ability_running_record_test/ams_ability_running_record_module_test.cpp index 39d2bf5df2f..70ef4d43d1a 100644 --- a/services/test/moduletest/common/ams/ability_running_record_test/ams_ability_running_record_module_test.cpp +++ b/services/test/moduletest/common/ams/ability_running_record_test/ams_ability_running_record_module_test.cpp @@ -136,9 +136,6 @@ public: appLaunchTime = 0; } - void ScheduleANRProcess() override - {} - private: int abilityLaunchTime = 0; int appLaunchTime = 0; diff --git a/services/test/moduletest/common/ams/app_mgr_service_test/ams_app_mgr_service_module_test.cpp b/services/test/moduletest/common/ams/app_mgr_service_test/ams_app_mgr_service_module_test.cpp index 394f93d1368..c590912c289 100644 --- a/services/test/moduletest/common/ams/app_mgr_service_test/ams_app_mgr_service_module_test.cpp +++ b/services/test/moduletest/common/ams/app_mgr_service_test/ams_app_mgr_service_module_test.cpp @@ -68,8 +68,6 @@ public: {} void ScheduleAcceptWant(const AAFwk::Want &want, const std::string &moduleName) override {} - void ScheduleANRProcess() override - {} }; class AppMgrServiceModuleTest : public testing::Test { public: diff --git a/services/test/moduletest/common/ams/app_running_record_test/BUILD.gn b/services/test/moduletest/common/ams/app_running_record_test/BUILD.gn index ea863f61668..174ccbfebca 100755 --- a/services/test/moduletest/common/ams/app_running_record_test/BUILD.gn +++ b/services/test/moduletest/common/ams/app_running_record_test/BUILD.gn @@ -38,5 +38,6 @@ ohos_moduletest("AmsAppRunningRecordModuleTest") { group("moduletest") { testonly = true - # deps = [ ":AmsAppRunningRecordModuleTest" ] + + deps = [ ":AmsAppRunningRecordModuleTest" ] } diff --git a/services/test/moduletest/common/ams/app_service_flow_test/ams_app_service_flow_module_test.cpp b/services/test/moduletest/common/ams/app_service_flow_test/ams_app_service_flow_module_test.cpp index 01cab016ef3..a7ddbf433ee 100644 --- a/services/test/moduletest/common/ams/app_service_flow_test/ams_app_service_flow_module_test.cpp +++ b/services/test/moduletest/common/ams/app_service_flow_test/ams_app_service_flow_module_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -355,7 +355,7 @@ HWTEST_F(AmsAppServiceFlowModuleTest, ServiceFlow_BackKey_005, TestSize.Level1) EXPECT_CALL(*(testAppA.mockAppScheduler_), ScheduleBackgroundApplication()).Times(1); EXPECT_CALL(*(testAppA.mockAppScheduler_), ScheduleCleanAbility(_)).Times(1); - // simulate press back key, AppA to background and exit. + // simulate press back key, AppA to backgroud and exit. serviceInner_->UpdateAbilityState(testAppB.GetToken("abilityB1"), AbilityState::ABILITY_STATE_FOREGROUND); serviceInner_->ApplicationForegrounded(testAppB.appRecord_->GetRecordId()); serviceInner_->UpdateAbilityState(testAppA.GetToken("abilityA1"), AbilityState::ABILITY_STATE_BACKGROUND); diff --git a/services/test/moduletest/common/ams/specified_ability_service_test/BUILD.gn b/services/test/moduletest/common/ams/specified_ability_service_test/BUILD.gn index 423c213955d..9d27752489f 100644 --- a/services/test/moduletest/common/ams/specified_ability_service_test/BUILD.gn +++ b/services/test/moduletest/common/ams/specified_ability_service_test/BUILD.gn @@ -90,5 +90,6 @@ ohos_moduletest("specified_ability_service_test") { group("moduletest") { testonly = true - # deps = [ ":specified_ability_service_test" ] + + deps = [ ":specified_ability_service_test" ] } diff --git a/services/test/moduletest/static_start_ability_test/BUILD.gn b/services/test/moduletest/static_start_ability_test/BUILD.gn index bda339be0fe..cba78198677 100644 --- a/services/test/moduletest/static_start_ability_test/BUILD.gn +++ b/services/test/moduletest/static_start_ability_test/BUILD.gn @@ -128,5 +128,6 @@ ohos_moduletest("static_start_ability_test") { group("moduletest") { testonly = true - # deps = [ ":static_start_ability_test" ] + + deps = [ ":static_start_ability_test" ] } diff --git a/test/resource/amssystemtestability/abilitySrc/amsKitSystemTest/src/second_ability.cpp b/test/resource/amssystemtestability/abilitySrc/amsKitSystemTest/src/second_ability.cpp index a4348b7d5e5..2616d1b8992 100755 --- a/test/resource/amssystemtestability/abilitySrc/amsKitSystemTest/src/second_ability.cpp +++ b/test/resource/amssystemtestability/abilitySrc/amsKitSystemTest/src/second_ability.cpp @@ -4601,7 +4601,7 @@ void SecondAbility::WantSetParamShortCase3(int code) { std::string key = "key"; short value = 999; - short size = 5; + int size = 5; Want want; for (short i = 0; i < size; i++) { want.SetParam(key, static_cast(i * value)); @@ -4615,7 +4615,7 @@ void SecondAbility::WantSetParamShortCase4(int code) { std::string key = "key"; short value = 999; - short size = 5; + int size = 5; Want want; for (short i = 0; i < size; i++) { want.SetParam(key + std::to_string(i), static_cast(i * value)); @@ -4667,7 +4667,7 @@ void SecondAbility::WantSetParamShortArrayCase2(int code) void SecondAbility::WantSetParamShortArrayCase3(int code) { std::string key = "key"; - short size = 5; + int size = 5; short sValue = 999; std::vector value(size, sValue * size); Want want; @@ -4683,7 +4683,7 @@ void SecondAbility::WantSetParamShortArrayCase3(int code) void SecondAbility::WantSetParamShortArrayCase4(int code) { std::string key = "key"; - short size = 5; + int size = 5; short value = 999; Want want; for (short i = 1; i <= size; i++) { diff --git a/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceB/src/ams_st_service_ability_b3.cpp b/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceB/src/ams_st_service_ability_b3.cpp index b051dfe4482..f5e3129610a 100644 --- a/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceB/src/ams_st_service_ability_b3.cpp +++ b/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceB/src/ams_st_service_ability_b3.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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,7 +54,6 @@ std::vector AmsStServiceAbilityB3::Split(std::string str, const std } return splitString; } - void AmsStServiceAbilityB3::StartOtherAbility() { HILOG_INFO("AmsStServiceAbilityB3::StartOtherAbility begin targetBundle=%{public}s, targetAbility=%{public}s", @@ -81,7 +80,6 @@ void AmsStServiceAbilityB3::StartOtherAbility() } } } - void AmsStServiceAbilityB3::ConnectOtherAbility() { HILOG_INFO( @@ -143,7 +141,6 @@ void AmsStServiceAbilityB3::OnStart(const Want &want) PublishEvent(APP_B3_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INACTIVE, "OnStart"); SubscribeEvent(); } - void AmsStServiceAbilityB3::OnNewWant(const Want &want) { HILOG_INFO("AmsStServiceAbilityB3::OnNewWant"); @@ -151,7 +148,6 @@ void AmsStServiceAbilityB3::OnNewWant(const Want &want) GetWantInfo(want); Ability::OnNewWant(want); } - void AmsStServiceAbilityB3::OnCommand(const AAFwk::Want &want, bool restart, int startId) { HILOG_INFO("AmsStServiceAbilityB3::OnCommand"); @@ -160,7 +156,6 @@ void AmsStServiceAbilityB3::OnCommand(const AAFwk::Want &want, bool restart, int Ability::OnCommand(want, restart, startId); PublishEvent(APP_B3_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::ACTIVE, "OnCommand"); } - void AmsStServiceAbilityB3::OnStop() { HILOG_INFO("AmsStServiceAbilityB3::onStop"); @@ -168,7 +163,6 @@ void AmsStServiceAbilityB3::OnStop() Ability::OnStop(); PublishEvent(APP_B3_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INITIAL, "OnStop"); } - void AmsStServiceAbilityB3::OnActive() { HILOG_INFO("AmsStServiceAbilityB3::OnActive"); @@ -176,7 +170,6 @@ void AmsStServiceAbilityB3::OnActive() Ability::OnActive(); PublishEvent(APP_B3_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::ACTIVE, "OnActive"); } - void AmsStServiceAbilityB3::OnInactive() { HILOG_INFO("AmsStServiceAbilityB3::OnInactive"); @@ -184,7 +177,6 @@ void AmsStServiceAbilityB3::OnInactive() Ability::OnInactive(); PublishEvent(APP_B3_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INACTIVE, "OnInactive"); } - void AmsStServiceAbilityB3::OnBackground() { HILOG_INFO("AmsStServiceAbilityB3::OnBackground"); @@ -192,7 +184,6 @@ void AmsStServiceAbilityB3::OnBackground() Ability::OnBackground(); PublishEvent(APP_B3_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::BACKGROUND, "OnBackground"); } - sptr AmsStServiceAbilityB3::OnConnect(const Want &want) { HILOG_INFO("AmsStServiceAbilityB3::OnConnect"); @@ -201,7 +192,6 @@ sptr AmsStServiceAbilityB3::OnConnect(const Want &want) PublishEvent(APP_B3_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::ACTIVE, "OnConnect"); return remote; } - void AmsStServiceAbilityB3::OnDisconnect(const Want &want) { HILOG_INFO("AmsStServiceAbilityB3::OnDisconnect"); @@ -209,7 +199,6 @@ void AmsStServiceAbilityB3::OnDisconnect(const Want &want) Ability::OnDisconnect(want); PublishEvent(APP_B3_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::BACKGROUND, "OnDisconnect"); } - void AmsStServiceAbilityB3::Clear() { shouldReturn_ = ""; @@ -223,7 +212,6 @@ void AmsStServiceAbilityB3::Clear() nextTargetAbilityConn_ = ""; AmsStServiceAbilityB3::AbilityConnectCallback::onAbilityConnectDoneCount = 0; } - void AmsStServiceAbilityB3::GetWantInfo(const Want &want) { Want mWant(want); @@ -238,7 +226,6 @@ void AmsStServiceAbilityB3::GetWantInfo(const Want &want) nextTargetAbilityConn_ = mWant.GetStringParam("nextTargetAbilityConn"); AmsStServiceAbilityB3::AbilityConnectCallback::onAbilityConnectDoneCount = 0; } - bool AmsStServiceAbilityB3::PublishEvent(const std::string &eventName, const int &code, const std::string &data) { HILOG_INFO("AmsStServiceAbilityB3::PublishEvent eventName = %{public}s, code = %{public}d, data = %{public}s", @@ -254,7 +241,6 @@ bool AmsStServiceAbilityB3::PublishEvent(const std::string &eventName, const int commonData.SetData(data); return CommonEventManager::PublishCommonEvent(commonData); } - bool AmsStServiceAbilityB3::SubscribeEvent() { HILOG_INFO("AmsStServiceAbilityB3::SubscribeEvent"); @@ -267,7 +253,6 @@ bool AmsStServiceAbilityB3::SubscribeEvent() subscriber_->mainAbility_ = this; return CommonEventManager::SubscribeCommonEvent(subscriber_); } - void AmsStServiceAbilityB3::AppEventSubscriber::OnReceiveEvent(const CommonEventData &data) { auto eventName = data.GetWant().GetAction(); diff --git a/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceC/src/ams_st_service_ability_c4.cpp b/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceC/src/ams_st_service_ability_c4.cpp index 8dbbc988f3f..8c9308a6265 100644 --- a/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceC/src/ams_st_service_ability_c4.cpp +++ b/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceC/src/ams_st_service_ability_c4.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -43,7 +43,6 @@ void AmsStServiceAbilityC4::OnStart(const Want &want) PublishEvent(APP_C4_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INACTIVE, "OnStart"); SubscribeEvent(); } - void AmsStServiceAbilityC4::OnCommand(const AAFwk::Want &want, bool restart, int startId) { HILOG_INFO("AmsStServiceAbilityC4::OnCommand"); @@ -52,7 +51,6 @@ void AmsStServiceAbilityC4::OnCommand(const AAFwk::Want &want, bool restart, int Ability::OnCommand(want, restart, startId); PublishEvent(APP_C4_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::ACTIVE, "OnCommand"); } - void AmsStServiceAbilityC4::OnNewWant(const Want &want) { HILOG_INFO("AmsStServiceAbilityC4::OnNewWant"); @@ -60,7 +58,6 @@ void AmsStServiceAbilityC4::OnNewWant(const Want &want) GetWantInfo(want); Ability::OnNewWant(want); } - void AmsStServiceAbilityC4::OnStop() { HILOG_INFO("AmsStServiceAbilityC4::OnStop"); @@ -68,7 +65,6 @@ void AmsStServiceAbilityC4::OnStop() Ability::OnStop(); PublishEvent(APP_C4_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INITIAL, "OnStop"); } - void AmsStServiceAbilityC4::OnActive() { HILOG_INFO("AmsStServiceAbilityC4::OnActive"); @@ -76,7 +72,6 @@ void AmsStServiceAbilityC4::OnActive() Ability::OnActive(); PublishEvent(APP_C4_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::ACTIVE, "OnActive"); } - void AmsStServiceAbilityC4::OnInactive() { HILOG_INFO("AmsStServiceAbilityC4::OnInactive"); @@ -84,7 +79,6 @@ void AmsStServiceAbilityC4::OnInactive() Ability::OnInactive(); PublishEvent(APP_C4_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INACTIVE, "OnInactive"); } - void AmsStServiceAbilityC4::OnBackground() { HILOG_INFO("AmsStServiceAbilityC4::OnBackground"); @@ -92,7 +86,6 @@ void AmsStServiceAbilityC4::OnBackground() Ability::OnBackground(); PublishEvent(APP_C4_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::BACKGROUND, "OnBackground"); } - sptr AmsStServiceAbilityC4::OnConnect(const Want &want) { HILOG_INFO("AmsStServiceAbilityC4::OnConnect"); @@ -101,7 +94,6 @@ sptr AmsStServiceAbilityC4::OnConnect(const Want &want) PublishEvent(APP_C4_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::ACTIVE, "OnConnect"); return ret; } - void AmsStServiceAbilityC4::OnDisconnect(const Want &want) { HILOG_INFO("AmsStServiceAbilityC4::OnDisconnect"); @@ -109,28 +101,24 @@ void AmsStServiceAbilityC4::OnDisconnect(const Want &want) Ability::OnDisconnect(want); PublishEvent(APP_C4_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::BACKGROUND, "OnDisconnect"); } - void AmsStServiceAbilityC4::StopSelfAbility() { HILOG_INFO("AmsStServiceAbilityC4::StopSelfAbility"); TerminateAbility(); } - void AmsStServiceAbilityC4::DisConnectOtherAbility() { HILOG_INFO("AmsStServiceAbilityC4::DisConnectOtherAbility begin"); HILOG_INFO("AmsStServiceAbilityB3::DisConnectOtherAbility end"); } - void AmsStServiceAbilityC4::Clear() { shouldReturn_ = ""; targetBundle_ = ""; targetAbility_ = ""; } - void AmsStServiceAbilityC4::GetWantInfo(const Want &want) { Want mWant(want); @@ -138,7 +126,6 @@ void AmsStServiceAbilityC4::GetWantInfo(const Want &want) targetBundle_ = mWant.GetStringParam("targetBundle"); targetAbility_ = mWant.GetStringParam("targetAbility"); } - bool AmsStServiceAbilityC4::PublishEvent(const std::string &eventName, const int &code, const std::string &data) { HILOG_INFO("AmsStServiceAbilityC4::PublishEvent eventName = %{public}s, code = %{public}d, data = %{public}s", diff --git a/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceD/src/ams_st_service_ability_d1.cpp b/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceD/src/ams_st_service_ability_d1.cpp index 9d7f87929e3..28580675bfa 100644 --- a/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceD/src/ams_st_service_ability_d1.cpp +++ b/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceD/src/ams_st_service_ability_d1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -55,7 +55,6 @@ std::vector AmsStServiceAbilityD1::Split(std::string str, const std } return splitString; } - void AmsStServiceAbilityD1::StartOtherAbility() { HILOG_INFO("AmsStServiceAbilityD1::StartOtherAbility begin targetBundle=%{public}s, targetAbility=%{public}s", @@ -82,7 +81,6 @@ void AmsStServiceAbilityD1::StartOtherAbility() } } } - void AmsStServiceAbilityD1::ConnectOtherAbility() { HILOG_INFO( @@ -145,7 +143,6 @@ void AmsStServiceAbilityD1::OnStart(const Want &want) PublishEvent(APP_D1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INACTIVE, "OnStart"); SubscribeEvent(); } - void AmsStServiceAbilityD1::OnNewWant(const Want &want) { HILOG_INFO("AmsStServiceAbilityD1::OnNewWant"); @@ -153,7 +150,6 @@ void AmsStServiceAbilityD1::OnNewWant(const Want &want) GetWantInfo(want); Ability::OnNewWant(want); } - void AmsStServiceAbilityD1::OnCommand(const AAFwk::Want &want, bool restart, int startId) { HILOG_INFO("AmsStServiceAbilityD1::OnCommand"); @@ -162,7 +158,6 @@ void AmsStServiceAbilityD1::OnCommand(const AAFwk::Want &want, bool restart, int Ability::OnCommand(want, restart, startId); PublishEvent(APP_D1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::ACTIVE, "OnCommand"); } - void AmsStServiceAbilityD1::OnStop() { HILOG_INFO("AmsStServiceAbilityD1::OnStop"); @@ -170,7 +165,6 @@ void AmsStServiceAbilityD1::OnStop() Ability::OnStop(); PublishEvent(APP_D1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INITIAL, "OnStop"); } - void AmsStServiceAbilityD1::GetDataByDataAbility() { HILOG_INFO("AmsStServiceAbilityD1::GetDataByDataAbility"); @@ -194,7 +188,6 @@ void AmsStServiceAbilityD1::GetDataByDataAbility() PublishEvent(APP_D1_RESP_EVENT_NAME, 0, "GetDataByDataAbility"); } } - void AmsStServiceAbilityD1::OnActive() { HILOG_INFO("AmsStServiceAbilityD1::OnActive"); @@ -202,7 +195,6 @@ void AmsStServiceAbilityD1::OnActive() Ability::OnActive(); PublishEvent(APP_D1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::ACTIVE, "OnActive"); } - void AmsStServiceAbilityD1::OnInactive() { HILOG_INFO("AmsStServiceAbilityD1::OnInactive"); @@ -210,7 +202,6 @@ void AmsStServiceAbilityD1::OnInactive() Ability::OnInactive(); PublishEvent(APP_D1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INACTIVE, "OnInactive"); } - void AmsStServiceAbilityD1::OnBackground() { HILOG_INFO("AmsStServiceAbilityD1::OnBackground"); @@ -232,7 +223,6 @@ void AmsStServiceAbilityD1::Clear() nextTargetAbilityConn_ = ""; AmsStServiceAbilityD1::AbilityConnectCallback::onAbilityConnectDoneCount = 0; } - void AmsStServiceAbilityD1::GetWantInfo(const Want &want) { Want mWant(want); @@ -247,7 +237,6 @@ void AmsStServiceAbilityD1::GetWantInfo(const Want &want) nextTargetAbilityConn_ = mWant.GetStringParam("nextTargetAbilityConn"); AmsStServiceAbilityD1::AbilityConnectCallback::onAbilityConnectDoneCount = 0; } - bool AmsStServiceAbilityD1::PublishEvent(const std::string &eventName, const int &code, const std::string &data) { HILOG_INFO("AmsStServiceAbilityD1::PublishEvent eventName = %{public}s, code = %{public}d, data = %{public}s", @@ -263,7 +252,6 @@ bool AmsStServiceAbilityD1::PublishEvent(const std::string &eventName, const int commonData.SetData(data); return CommonEventManager::PublishCommonEvent(commonData); } - bool AmsStServiceAbilityD1::SubscribeEvent() { MatchingSkills matchingSkills; @@ -274,7 +262,6 @@ bool AmsStServiceAbilityD1::SubscribeEvent() subscriber_->mainAbility_ = this; return CommonEventManager::SubscribeCommonEvent(subscriber_); } - void AmsStServiceAbilityD1::AppEventSubscriber::OnReceiveEvent(const CommonEventData &data) { auto eventName = data.GetWant().GetAction(); diff --git a/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceE/src/ams_st_service_ability_e2.cpp b/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceE/src/ams_st_service_ability_e2.cpp index 88917ef087d..b77b1876175 100644 --- a/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceE/src/ams_st_service_ability_e2.cpp +++ b/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceE/src/ams_st_service_ability_e2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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,7 +54,6 @@ std::vector AmsStServiceAbilityE2::Split(std::string str, const std } return splitString; } - void AmsStServiceAbilityE2::StartOtherAbility() { HILOG_INFO("AmsStServiceAbilityE2::StartOtherAbility begin targetBundle=%{public}s, targetAbility=%{public}s", @@ -81,7 +80,6 @@ void AmsStServiceAbilityE2::StartOtherAbility() } } } - void AmsStServiceAbilityE2::ConnectOtherAbility() { HILOG_INFO( @@ -117,7 +115,6 @@ void AmsStServiceAbilityE2::ConnectOtherAbility() } HILOG_INFO("AmsStServiceAbilityE2::ConnectOtherAbility end"); } - void AmsStServiceAbilityE2::OnStart(const Want &want) { HILOG_INFO("AmsStServiceAbilityE2::OnStart"); @@ -127,7 +124,6 @@ void AmsStServiceAbilityE2::OnStart(const Want &want) PublishEvent(APP_E2_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INACTIVE, "OnStart"); SubscribeEvent(); } - void AmsStServiceAbilityE2::OnCommand(const AAFwk::Want &want, bool restart, int startId) { HILOG_INFO("AmsStServiceAbilityE2::OnCommand"); @@ -136,7 +132,6 @@ void AmsStServiceAbilityE2::OnCommand(const AAFwk::Want &want, bool restart, int Ability::OnCommand(want, restart, startId); PublishEvent(APP_E2_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::ACTIVE, "OnCommand"); } - void AmsStServiceAbilityE2::OnNewWant(const Want &want) { HILOG_INFO("AmsStServiceAbilityE2::OnNewWant"); @@ -144,7 +139,6 @@ void AmsStServiceAbilityE2::OnNewWant(const Want &want) GetWantInfo(want); Ability::OnNewWant(want); } - void AmsStServiceAbilityE2::DisConnectOtherAbility() { HILOG_INFO("AmsStServiceAbilityE2::DisConnectOtherAbility begin"); @@ -162,7 +156,6 @@ void AmsStServiceAbilityE2::OnStop() Ability::OnStop(); PublishEvent(APP_E2_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INITIAL, "OnStop"); } - void AmsStServiceAbilityE2::GetDataByDataAbility() { std::shared_ptr helper = DataAbilityHelper::Creator(GetContext()); @@ -184,7 +177,6 @@ void AmsStServiceAbilityE2::GetDataByDataAbility() PublishEvent(APP_E2_RESP_EVENT_NAME, 0, "GetDataByDataAbility"); } } - void AmsStServiceAbilityE2::OnActive() { HILOG_INFO("AmsStServiceAbilityE2::OnActive"); @@ -192,7 +184,6 @@ void AmsStServiceAbilityE2::OnActive() Ability::OnActive(); PublishEvent(APP_E2_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::ACTIVE, "OnActive"); } - void AmsStServiceAbilityE2::OnInactive() { HILOG_INFO("AmsStServiceAbilityE2::OnInactive"); @@ -200,7 +191,6 @@ void AmsStServiceAbilityE2::OnInactive() Ability::OnInactive(); PublishEvent(APP_E2_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INACTIVE, "OnInactive"); } - void AmsStServiceAbilityE2::OnBackground() { HILOG_INFO("AmsStServiceAbilityE2::OnBackground"); @@ -208,7 +198,6 @@ void AmsStServiceAbilityE2::OnBackground() Ability::OnBackground(); PublishEvent(APP_E2_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::BACKGROUND, "OnBackground"); } - sptr AmsStServiceAbilityE2::OnConnect(const Want &want) { HILOG_INFO("AmsStServiceAbilityE2::OnConnect"); @@ -217,7 +206,6 @@ sptr AmsStServiceAbilityE2::OnConnect(const Want &want) PublishEvent(APP_E2_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::ACTIVE, "OnConnect"); return nullptr; } - void AmsStServiceAbilityE2::OnDisconnect(const Want &want) { HILOG_INFO("AmsStServiceAbilityE2::OnDisconnect"); @@ -225,7 +213,6 @@ void AmsStServiceAbilityE2::OnDisconnect(const Want &want) Ability::OnDisconnect(want); PublishEvent(APP_E2_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::BACKGROUND, "OnDisconnect"); } - void AmsStServiceAbilityE2::Clear() { shouldReturn_ = ""; @@ -239,7 +226,6 @@ void AmsStServiceAbilityE2::Clear() nextTargetAbilityConn_ = ""; AmsStServiceAbilityE2::AbilityConnectCallback::onAbilityConnectDoneCount = 0; } - void AmsStServiceAbilityE2::GetWantInfo(const Want &want) { Want mWant(want); @@ -254,7 +240,6 @@ void AmsStServiceAbilityE2::GetWantInfo(const Want &want) nextTargetAbilityConn_ = mWant.GetStringParam("nextTargetAbilityConn"); AmsStServiceAbilityE2::AbilityConnectCallback::onAbilityConnectDoneCount = 0; } - bool AmsStServiceAbilityE2::PublishEvent(const std::string &eventName, const int &code, const std::string &data) { HILOG_INFO("AmsStServiceAbilityE2::PublishEvent eventName = %{public}s, code = %{public}d, data = %{public}s", @@ -270,7 +255,6 @@ bool AmsStServiceAbilityE2::PublishEvent(const std::string &eventName, const int commonData.SetData(data); return CommonEventManager::PublishCommonEvent(commonData); } - bool AmsStServiceAbilityE2::SubscribeEvent() { MatchingSkills matchingSkills; @@ -281,7 +265,6 @@ bool AmsStServiceAbilityE2::SubscribeEvent() subscriber_->mainAbility_ = this; return CommonEventManager::SubscribeCommonEvent(subscriber_); } - void AmsStServiceAbilityE2::AppEventSubscriber::OnReceiveEvent(const CommonEventData &data) { auto eventName = data.GetWant().GetAction(); diff --git a/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceF/src/ams_st_service_ability_f3.cpp b/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceF/src/ams_st_service_ability_f3.cpp index a9c7577fe6a..5ad88c511e9 100644 --- a/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceF/src/ams_st_service_ability_f3.cpp +++ b/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceF/src/ams_st_service_ability_f3.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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,7 +39,6 @@ void AmsStServiceAbilityF3::OnStart(const Want &want) Ability::OnStart(want); PublishEvent(APP_F3_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INACTIVE, "OnStart"); } - void AmsStServiceAbilityF3::OnNewWant(const Want &want) { HILOG_INFO("AmsStServiceAbilityF3::OnNewWant"); @@ -47,7 +46,6 @@ void AmsStServiceAbilityF3::OnNewWant(const Want &want) GetWantInfo(want); Ability::OnNewWant(want); } - void AmsStServiceAbilityF3::OnCommand(const AAFwk::Want &want, bool restart, int startId) { HILOG_INFO("AmsStServiceAbilityF3::OnCommand"); @@ -56,7 +54,6 @@ void AmsStServiceAbilityF3::OnCommand(const AAFwk::Want &want, bool restart, int Ability::OnCommand(want, restart, startId); PublishEvent(APP_F3_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::ACTIVE, "OnCommand"); } - void AmsStServiceAbilityF3::OnStop() { HILOG_INFO("AmsStServiceAbilityF3::onStop"); @@ -64,7 +61,6 @@ void AmsStServiceAbilityF3::OnStop() Ability::OnStop(); PublishEvent(APP_F3_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INITIAL, "OnStop"); } - void AmsStServiceAbilityF3::OnActive() { HILOG_INFO("AmsStServiceAbilityF3::OnActive"); @@ -72,7 +68,6 @@ void AmsStServiceAbilityF3::OnActive() Ability::OnActive(); PublishEvent(APP_F3_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::ACTIVE, "OnActive"); } - void AmsStServiceAbilityF3::OnInactive() { HILOG_INFO("AmsStServiceAbilityF3::OnInactive"); @@ -80,7 +75,6 @@ void AmsStServiceAbilityF3::OnInactive() Ability::OnInactive(); PublishEvent(APP_F3_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INACTIVE, "OnInactive"); } - void AmsStServiceAbilityF3::OnBackground() { HILOG_INFO("AmsStServiceAbilityF3::OnBackground"); @@ -95,7 +89,6 @@ void AmsStServiceAbilityF3::Clear() targetBundle_ = ""; targetAbility_ = ""; } - void AmsStServiceAbilityF3::GetWantInfo(const Want &want) { Want mWant(want); @@ -103,7 +96,6 @@ void AmsStServiceAbilityF3::GetWantInfo(const Want &want) targetBundle_ = mWant.GetStringParam("targetBundle"); targetAbility_ = mWant.GetStringParam("targetAbility"); } - bool AmsStServiceAbilityF3::PublishEvent(const std::string &eventName, const int &code, const std::string &data) { HILOG_INFO("AmsStServiceAbilityF3::PublishEvent eventName = %s, code = %d, data = %s", diff --git a/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceG/src/ams_st_service_ability_g1.cpp b/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceG/src/ams_st_service_ability_g1.cpp index 4c0039dbc09..44b5651ab18 100644 --- a/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceG/src/ams_st_service_ability_g1.cpp +++ b/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceG/src/ams_st_service_ability_g1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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,7 +54,6 @@ std::vector AmsStServiceAbilityG1::Split(std::string str, const std } return splitString; } - void AmsStServiceAbilityG1::StartOtherAbility() { HILOG_INFO("AmsStServiceAbilityG1::StartOtherAbility begin targetBundle=%{public}s, targetAbility=%{public}s", @@ -81,7 +80,6 @@ void AmsStServiceAbilityG1::StartOtherAbility() } } } - void AmsStServiceAbilityG1::ConnectOtherAbility() { HILOG_INFO( @@ -117,7 +115,6 @@ void AmsStServiceAbilityG1::ConnectOtherAbility() } HILOG_INFO("AmsStServiceAbilityG1::ConnectOtherAbility end"); } - void AmsStServiceAbilityG1::OnStart(const Want &want) { HILOG_INFO("AmsStServiceAbilityG1::OnStart"); @@ -127,7 +124,6 @@ void AmsStServiceAbilityG1::OnStart(const Want &want) PublishEvent(APP_G1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INACTIVE, "OnStart"); SubscribeEvent(); } - void AmsStServiceAbilityG1::OnCommand(const AAFwk::Want &want, bool restart, int startId) { HILOG_INFO("AmsStServiceAbilityG1::OnCommand"); @@ -136,7 +132,6 @@ void AmsStServiceAbilityG1::OnCommand(const AAFwk::Want &want, bool restart, int Ability::OnCommand(want, restart, startId); PublishEvent(APP_G1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::ACTIVE, "OnCommand"); } - void AmsStServiceAbilityG1::OnNewWant(const Want &want) { HILOG_INFO("AmsStServiceAbilityG1::OnNewWant"); @@ -144,7 +139,6 @@ void AmsStServiceAbilityG1::OnNewWant(const Want &want) GetWantInfo(want); Ability::OnNewWant(want); } - void AmsStServiceAbilityG1::DisConnectOtherAbility() { HILOG_INFO("AmsStServiceAbilityG1::DisConnectOtherAbility begin"); @@ -162,7 +156,6 @@ void AmsStServiceAbilityG1::OnStop() Ability::OnStop(); PublishEvent(APP_G1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INITIAL, "OnStop"); } - void AmsStServiceAbilityG1::GetDataByDataAbility() { std::shared_ptr helper = DataAbilityHelper::Creator(std::shared_ptr(this)); @@ -184,7 +177,6 @@ void AmsStServiceAbilityG1::GetDataByDataAbility() PublishEvent(APP_G1_RESP_EVENT_NAME, 0, "GetDataByDataAbility"); } } - void AmsStServiceAbilityG1::OnActive() { HILOG_INFO("AmsStServiceAbilityG1::OnActive"); @@ -192,7 +184,6 @@ void AmsStServiceAbilityG1::OnActive() Ability::OnActive(); PublishEvent(APP_G1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::ACTIVE, "OnActive"); } - void AmsStServiceAbilityG1::OnInactive() { HILOG_INFO("AmsStServiceAbilityG1::OnInactive"); @@ -200,7 +191,6 @@ void AmsStServiceAbilityG1::OnInactive() Ability::OnInactive(); PublishEvent(APP_G1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INACTIVE, "OnInactive"); } - void AmsStServiceAbilityG1::OnBackground() { HILOG_INFO("AmsStServiceAbilityG1::OnBackground"); @@ -208,7 +198,6 @@ void AmsStServiceAbilityG1::OnBackground() Ability::OnBackground(); PublishEvent(APP_G1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::BACKGROUND, "OnBackground"); } - sptr AmsStServiceAbilityG1::OnConnect(const Want &want) { HILOG_INFO("AmsStServiceAbilityG1::OnConnect"); @@ -217,7 +206,6 @@ sptr AmsStServiceAbilityG1::OnConnect(const Want &want) PublishEvent(APP_G1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::ACTIVE, "OnConnect"); return nullptr; } - void AmsStServiceAbilityG1::OnDisconnect(const Want &want) { HILOG_INFO("AmsStServiceAbilityG1::OnDisconnect"); @@ -225,7 +213,6 @@ void AmsStServiceAbilityG1::OnDisconnect(const Want &want) Ability::OnDisconnect(want); PublishEvent(APP_G1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::BACKGROUND, "OnDisconnect"); } - void AmsStServiceAbilityG1::Clear() { shouldReturn_ = ""; @@ -239,7 +226,6 @@ void AmsStServiceAbilityG1::Clear() nextTargetAbilityConn_ = ""; AmsStServiceAbilityG1::AbilityConnectCallback::onAbilityConnectDoneCount = 0; } - void AmsStServiceAbilityG1::GetWantInfo(const Want &want) { Want mWant(want); @@ -254,7 +240,6 @@ void AmsStServiceAbilityG1::GetWantInfo(const Want &want) nextTargetAbilityConn_ = mWant.GetStringParam("nextTargetAbilityConn"); AmsStServiceAbilityG1::AbilityConnectCallback::onAbilityConnectDoneCount = 0; } - bool AmsStServiceAbilityG1::PublishEvent(const std::string &eventName, const int &code, const std::string &data) { HILOG_INFO("AmsStServiceAbilityG1::PublishEvent eventName = %{public}s, code = %{public}d, data = %{public}s", @@ -270,7 +255,6 @@ bool AmsStServiceAbilityG1::PublishEvent(const std::string &eventName, const int commonData.SetData(data); return CommonEventManager::PublishCommonEvent(commonData); } - bool AmsStServiceAbilityG1::SubscribeEvent() { MatchingSkills matchingSkills; @@ -281,7 +265,6 @@ bool AmsStServiceAbilityG1::SubscribeEvent() subscriber_->mainAbility_ = this; return CommonEventManager::SubscribeCommonEvent(subscriber_); } - void AmsStServiceAbilityG1::AppEventSubscriber::OnReceiveEvent(const CommonEventData &data) { auto eventName = data.GetWant().GetAction(); diff --git a/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceH/src/ams_st_service_ability_h1.cpp b/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceH/src/ams_st_service_ability_h1.cpp index 7293ba61811..80d609c5e0a 100644 --- a/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceH/src/ams_st_service_ability_h1.cpp +++ b/test/resource/amssystemtestability/abilitySrc/amsSystemTestServiceH/src/ams_st_service_ability_h1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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,7 +54,6 @@ std::vector AmsStServiceAbilityH1::Split(std::string str, const std } return splitString; } - void AmsStServiceAbilityH1::StartOtherAbility() { HILOG_INFO("AmsStServiceAbilityH1::StartOtherAbility begin targetBundle=%{public}s, targetAbility=%{public}s", @@ -81,7 +80,6 @@ void AmsStServiceAbilityH1::StartOtherAbility() } } } - void AmsStServiceAbilityH1::ConnectOtherAbility() { HILOG_INFO( @@ -117,7 +115,6 @@ void AmsStServiceAbilityH1::ConnectOtherAbility() } HILOG_INFO("AmsStServiceAbilityH1::ConnectOtherAbility end"); } - void AmsStServiceAbilityH1::OnStart(const Want &want) { HILOG_INFO("AmsStServiceAbilityH1::OnStart"); @@ -127,7 +124,6 @@ void AmsStServiceAbilityH1::OnStart(const Want &want) PublishEvent(APP_H1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INACTIVE, "OnStart"); SubscribeEvent(); } - void AmsStServiceAbilityH1::OnCommand(const AAFwk::Want &want, bool restart, int startId) { HILOG_INFO("AmsStServiceAbilityH1::OnCommand"); @@ -136,7 +132,6 @@ void AmsStServiceAbilityH1::OnCommand(const AAFwk::Want &want, bool restart, int Ability::OnCommand(want, restart, startId); PublishEvent(APP_H1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::ACTIVE, "OnCommand"); } - void AmsStServiceAbilityH1::OnNewWant(const Want &want) { HILOG_INFO("AmsStServiceAbilityH1::OnNewWant"); @@ -144,7 +139,6 @@ void AmsStServiceAbilityH1::OnNewWant(const Want &want) GetWantInfo(want); Ability::OnNewWant(want); } - void AmsStServiceAbilityH1::DisConnectOtherAbility() { HILOG_INFO("AmsStServiceAbilityH1::DisConnectOtherAbility begin"); @@ -162,7 +156,6 @@ void AmsStServiceAbilityH1::OnStop() Ability::OnStop(); PublishEvent(APP_H1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INITIAL, "OnStop"); } - void AmsStServiceAbilityH1::GetDataByDataAbility() { std::shared_ptr helper = DataAbilityHelper::Creator(std::shared_ptr(this)); @@ -184,7 +177,6 @@ void AmsStServiceAbilityH1::GetDataByDataAbility() PublishEvent(APP_H1_RESP_EVENT_NAME, 0, "GetDataByDataAbility"); } } - void AmsStServiceAbilityH1::OnActive() { HILOG_INFO("AmsStServiceAbilityH1::OnActive"); @@ -192,7 +184,6 @@ void AmsStServiceAbilityH1::OnActive() Ability::OnActive(); PublishEvent(APP_H1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::ACTIVE, "OnActive"); } - void AmsStServiceAbilityH1::OnInactive() { HILOG_INFO("AmsStServiceAbilityH1::OnInactive"); @@ -200,7 +191,6 @@ void AmsStServiceAbilityH1::OnInactive() Ability::OnInactive(); PublishEvent(APP_H1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::INACTIVE, "OnInactive"); } - void AmsStServiceAbilityH1::OnBackground() { HILOG_INFO("AmsStServiceAbilityH1::OnBackground"); @@ -208,7 +198,6 @@ void AmsStServiceAbilityH1::OnBackground() Ability::OnBackground(); PublishEvent(APP_H1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::BACKGROUND, "OnBackground"); } - sptr AmsStServiceAbilityH1::OnConnect(const Want &want) { HILOG_INFO("AmsStServiceAbilityH1::OnConnect"); @@ -217,7 +206,6 @@ sptr AmsStServiceAbilityH1::OnConnect(const Want &want) PublishEvent(APP_H1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::ACTIVE, "OnConnect"); return nullptr; } - void AmsStServiceAbilityH1::OnDisconnect(const Want &want) { HILOG_INFO("AmsStServiceAbilityH1::OnDisconnect"); @@ -225,7 +213,6 @@ void AmsStServiceAbilityH1::OnDisconnect(const Want &want) Ability::OnDisconnect(want); PublishEvent(APP_H1_RESP_EVENT_NAME, AbilityLifecycleExecutor::LifecycleState::BACKGROUND, "OnDisconnect"); } - void AmsStServiceAbilityH1::Clear() { shouldReturn_ = ""; @@ -239,7 +226,6 @@ void AmsStServiceAbilityH1::Clear() nextTargetAbilityConn_ = ""; AmsStServiceAbilityH1::AbilityConnectCallback::onAbilityConnectDoneCount = 0; } - void AmsStServiceAbilityH1::GetWantInfo(const Want &want) { Want mWant(want); @@ -254,7 +240,6 @@ void AmsStServiceAbilityH1::GetWantInfo(const Want &want) nextTargetAbilityConn_ = mWant.GetStringParam("nextTargetAbilityConn"); AmsStServiceAbilityH1::AbilityConnectCallback::onAbilityConnectDoneCount = 0; } - bool AmsStServiceAbilityH1::PublishEvent(const std::string &eventName, const int &code, const std::string &data) { HILOG_INFO("AmsStServiceAbilityH1::PublishEvent eventName = %{public}s, code = %{public}d, data = %{public}s", @@ -270,7 +255,6 @@ bool AmsStServiceAbilityH1::PublishEvent(const std::string &eventName, const int commonData.SetData(data); return CommonEventManager::PublishCommonEvent(commonData); } - bool AmsStServiceAbilityH1::SubscribeEvent() { MatchingSkills matchingSkills; @@ -281,7 +265,6 @@ bool AmsStServiceAbilityH1::SubscribeEvent() subscriber_->mainAbility_ = this; return CommonEventManager::SubscribeCommonEvent(subscriber_); } - void AmsStServiceAbilityH1::AppEventSubscriber::OnReceiveEvent(const CommonEventData &data) { auto eventName = data.GetWant().GetAction(); diff --git a/test/resource/amssystemtestability/abilitySrc/serviceAbilityA/src/service_ability_a.cpp b/test/resource/amssystemtestability/abilitySrc/serviceAbilityA/src/service_ability_a.cpp index df7d2410864..123e907fada 100644 --- a/test/resource/amssystemtestability/abilitySrc/serviceAbilityA/src/service_ability_a.cpp +++ b/test/resource/amssystemtestability/abilitySrc/serviceAbilityA/src/service_ability_a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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,6 +13,12 @@ * limitations under the License. */ #include "service_ability_a.h" +// #include "hilog_wrapper.h" +// #include "iremote_broker.h" +// #include "iremote_object.h" +// #include "iremote_proxy.h" +// #include "iremote_stub.h" +// #include "main_service_ability.h" #include "test_ability_connection.h" namespace OHOS { @@ -22,13 +28,11 @@ void ServiceAbilityA::OnStart(const Want &want) HILOG_INFO("ServiceAbilityA OnStart"); Ability::OnStart(want); } - void ServiceAbilityA::OnCommand(const AAFwk::Want &want, bool restart, int startId) { HILOG_INFO("ServiceAbilityA::OnCommand"); Ability::OnCommand(want, restart, startId); } - sptr ServiceAbilityA::OnConnect(const Want &want) { HILOG_INFO("ServiceAbilityA::OnConnect"); @@ -37,13 +41,11 @@ sptr ServiceAbilityA::OnConnect(const Want &want) Ability::OnConnect(want); return remoteObject->AsObject(); } - void ServiceAbilityA::OnDisconnect(const Want &want) { HILOG_INFO("ServiceAbilityA::OnDisconnect"); Ability::OnDisconnect(want); } - void ServiceAbilityA::OnStop() { HILOG_INFO("ServiceAbilityA::OnStop"); diff --git a/test/resource/amssystemtestability/abilitySrc/serviceAbilityA/src/verify_act_first_ability.cpp b/test/resource/amssystemtestability/abilitySrc/serviceAbilityA/src/verify_act_first_ability.cpp index e4ec061d522..f47ad90b8ad 100644 --- a/test/resource/amssystemtestability/abilitySrc/serviceAbilityA/src/verify_act_first_ability.cpp +++ b/test/resource/amssystemtestability/abilitySrc/serviceAbilityA/src/verify_act_first_ability.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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,6 @@ void AbilityConnectionActFirst::OnAbilityDisconnectDone(const AppExecFwk::Elemen HILOG_INFO("AbilityConnectionActFirst OnAbilityDisconnectDone resultCode: %{public}d", resultCode); HILOG_INFO("AbilityConnectionActFirst OnAbilityDisconnectDone : %{public}s", element.GetAbilityName().c_str()); } - void VerifyIOAbilityLifecycleCallbacks::OnAbilityStart(const std::shared_ptr &ability) { HILOG_INFO("----------VerifyIOAbilityLifecycleCallbacks::OnAbilityStart called. AbilityName is %{public}s", @@ -70,7 +69,6 @@ void VerifyIOAbilityLifecycleCallbacks::OnAbilityStop(const std::shared_ptrGetAbilityName().c_str()); } - void VerifyIOAbilityLifecycleCallbacks::OnAbilitySaveState(const PacMap &outState) { HILOG_INFO("----------VerifyIOAbilityLifecycleCallbacks::OnAbilitySaveState called.----------"); @@ -100,28 +98,24 @@ void VerifyActFirstAbility::OnStart(const Want &want) Ability::OnStart(want); } - void VerifyActFirstAbility::OnStop() { HILOG_INFO("----------VerifyActFirstAbility::onStop begin----------"); HILOG_INFO("----------VerifyActFirstAbility::onStop end----------"); Ability::OnStop(); } - void VerifyActFirstAbility::OnActive() { HILOG_INFO("----------VerifyActFirstAbility::OnActive begin----------"); HILOG_INFO("----------VerifyActFirstAbility::OnActive end----------"); Ability::OnActive(); } - void VerifyActFirstAbility::OnInactive() { HILOG_INFO("----------VerifyActFirstAbility::OnInactive begin----------"); HILOG_INFO("----------VerifyActFirstAbility::OnInactive end----------"); Ability::OnInactive(); } - void VerifyActFirstAbility::OnBackground() { HILOG_INFO("----------VerifyActFirstAbility::OnBackground begin----------"); diff --git a/test/resource/amssystemtestability/abilitySrc/taskDispatcherTestB/BUILD.gn b/test/resource/amssystemtestability/abilitySrc/taskDispatcherTestB/BUILD.gn index faba4c317db..4557c046ecf 100755 --- a/test/resource/amssystemtestability/abilitySrc/taskDispatcherTestB/BUILD.gn +++ b/test/resource/amssystemtestability/abilitySrc/taskDispatcherTestB/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022 Huawei Device Co., Ltd. +# Copyright (c) 2021 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 @@ -40,7 +40,6 @@ config("taskDispatcherTestBConfig") { cflags += [ "-DBINDER_IPC_32BIT" ] } } - ohos_shared_library("taskDispatcherTestB") { sources = [ "${SUBDEMOSYSTEM_DIR}/src/main_ability.cpp", diff --git a/test/resource/formsystemtestability/fmsSystemTestHostCommonA/src/form_ability_commona.cpp b/test/resource/formsystemtestability/fmsSystemTestHostCommonA/src/form_ability_commona.cpp index f17b9f9ff9b..10b06b93123 100644 --- a/test/resource/formsystemtestability/fmsSystemTestHostCommonA/src/form_ability_commona.cpp +++ b/test/resource/formsystemtestability/fmsSystemTestHostCommonA/src/form_ability_commona.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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,7 +35,6 @@ void FormAbilityCommonA::AcquireFormCallback::OnAcquired(const int32_t result, c { HILOG_INFO("%{public}s called[%{public}s]", __func__, std::to_string(formJsInfo.formId).c_str()); } - void FormAbilityCommonA::AcquireFormCallback::OnUpdate(const int32_t result, const FormJsInfo &formJsInfo) const { HILOG_INFO("%{public}s called", __func__); @@ -72,7 +71,6 @@ void FormAbilityCommonA::FMS_acquireForm(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ONE_NORMAL_FORM, EVENT_CODE_100, ""); } } - void FormAbilityCommonA::FMS_deleteForm(std::string data) { HILOG_INFO("%{public}s formId: %{public}s", __func__, data.c_str()); @@ -85,7 +83,6 @@ void FormAbilityCommonA::FMS_deleteForm(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ONE_NORMAL_FORM_DEL, EVENT_CODE_101, "false"); } } - void FormAbilityCommonA::FMS_acquireForm_batch(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -110,7 +107,6 @@ void FormAbilityCommonA::FMS_acquireForm_batch(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_BATCH, EVENT_CODE_BATCH, "false"); } } - void FormAbilityCommonA::FMS_deleteFormBatch(std::string strFormId) { HILOG_INFO("%{public}s called", __func__); @@ -123,18 +119,15 @@ void FormAbilityCommonA::FMS_deleteFormBatch(std::string strFormId) FormTestUtils::PublishEvent(FORM_EVENT_RECV_CLEAR_FORM_BATCH, EVENT_CODE_CLEAR_BATCH, "false"); } } - FormAbilityCommonA::~FormAbilityCommonA() { CommonEventManager::UnSubscribeCommonEvent(subscriber_); } - void FormAbilityCommonA::OnStart(const Want &want) { HILOG_INFO("FormAbilityCommonA::onStart"); Ability::OnStart(want); } - void FormAbilityCommonA::OnActive() { HILOG_INFO("FormAbilityCommonA::OnActive"); @@ -149,21 +142,18 @@ void FormAbilityCommonA::OnStop() Ability::OnStop(); } - void FormAbilityCommonA::OnInactive() { HILOG_INFO("FormAbilityCommonA::OnInactive"); Ability::OnInactive(); } - void FormAbilityCommonA::OnBackground() { HILOG_INFO("FormAbilityCommonA::OnBackground"); Ability::OnBackground(); } - void FormAbilityCommonA::SubscribeEvent() { HILOG_INFO("FormAbilityCommonA::SubscribeEvent"); diff --git a/test/resource/formsystemtestability/fmsSystemTestHostCommonB/src/form_ability_commonb.cpp b/test/resource/formsystemtestability/fmsSystemTestHostCommonB/src/form_ability_commonb.cpp index 7ee493ced51..fb5e9f5641c 100644 --- a/test/resource/formsystemtestability/fmsSystemTestHostCommonB/src/form_ability_commonb.cpp +++ b/test/resource/formsystemtestability/fmsSystemTestHostCommonB/src/form_ability_commonb.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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,7 +35,6 @@ void FormAbilityCommonB::AcquireFormCallback::OnAcquired(const int32_t result, c { HILOG_INFO("%{public}s called[%{public}s]", __func__, std::to_string(formJsInfo.formId).c_str()); } - void FormAbilityCommonB::AcquireFormCallback::OnUpdate(const int32_t result, const FormJsInfo &formJsInfo) const { HILOG_INFO("%{public}s called", __func__); @@ -72,7 +71,6 @@ void FormAbilityCommonB::FMS_acquireForm(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ONE_NORMAL_FORM_B, EVENT_CODE_100, ""); } } - void FormAbilityCommonB::FMS_acquireForm_batch(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -97,7 +95,6 @@ void FormAbilityCommonB::FMS_acquireForm_batch(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_BATCH, EVENT_CODE_BATCH, "false"); } } - void FormAbilityCommonB::FMS_deleteFormBatch(std::string strFormId) { HILOG_INFO("%{public}s called", __func__); @@ -110,7 +107,6 @@ void FormAbilityCommonB::FMS_deleteFormBatch(std::string strFormId) FormTestUtils::PublishEvent(FORM_EVENT_RECV_CLEAR_FORM_BATCH, EVENT_CODE_CLEAR_BATCH, "false"); } } - void FormAbilityCommonB::FMS_deleteForm(std::string data) { HILOG_INFO("%{public}s formId: %{public}s", __func__, data.c_str()); @@ -123,18 +119,15 @@ void FormAbilityCommonB::FMS_deleteForm(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ONE_NORMAL_FORM_B_DEL, EVENT_CODE_101, "false"); } } - FormAbilityCommonB::~FormAbilityCommonB() { CommonEventManager::UnSubscribeCommonEvent(subscriber_); } - void FormAbilityCommonB::OnStart(const Want &want) { HILOG_INFO("FormAbilityCommonB::onStart"); Ability::OnStart(want); } - void FormAbilityCommonB::OnActive() { HILOG_INFO("FormAbilityCommonB::OnActive"); @@ -149,21 +142,18 @@ void FormAbilityCommonB::OnStop() Ability::OnStop(); } - void FormAbilityCommonB::OnInactive() { HILOG_INFO("FormAbilityCommonB::OnInactive"); Ability::OnInactive(); } - void FormAbilityCommonB::OnBackground() { HILOG_INFO("FormAbilityCommonB::OnBackground"); Ability::OnBackground(); } - void FormAbilityCommonB::SubscribeEvent() { HILOG_INFO("FormAbilityCommonB::SubscribeEvent"); diff --git a/test/resource/formsystemtestability/fmsSystemTestHostNoPerm/src/form_ability_no_perm.cpp b/test/resource/formsystemtestability/fmsSystemTestHostNoPerm/src/form_ability_no_perm.cpp index 2cdc006a909..3ff4f626934 100644 --- a/test/resource/formsystemtestability/fmsSystemTestHostNoPerm/src/form_ability_no_perm.cpp +++ b/test/resource/formsystemtestability/fmsSystemTestHostNoPerm/src/form_ability_no_perm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -28,12 +28,10 @@ void FormAbilityNoPerm::AcquireFormCallback::OnAcquired(const int32_t result, co { HILOG_INFO("%{public}s called", __func__); } - void FormAbilityNoPerm::AcquireFormCallback::OnUpdate(const int32_t result, const FormJsInfo &formJsInfo) const { HILOG_INFO("%{public}s called", __func__); } - void FormAbilityNoPerm::AcquireFormCallback::OnFormUninstall(const int64_t formId) const { HILOG_INFO("%{public}s called", __func__); @@ -97,7 +95,6 @@ void FormAbilityNoPerm::OnStart(const Want &want) }; SubscribeEvent(eventList); } - void FormAbilityNoPerm::OnActive() { HILOG_INFO("FormAbilityNoPerm::OnActive"); @@ -112,21 +109,18 @@ void FormAbilityNoPerm::OnStop() Ability::OnStop(); } - void FormAbilityNoPerm::OnInactive() { HILOG_INFO("FormAbilityNoPerm::OnInactive"); Ability::OnInactive(); } - void FormAbilityNoPerm::OnBackground() { HILOG_INFO("FormAbilityNoPerm::OnBackground"); Ability::OnBackground(); } - void FormAbilityNoPerm::SubscribeEvent(const std::vector &eventList) { MatchingSkills matchingSkills; diff --git a/test/resource/formsystemtestability/fmsSystemTestHostNormal/src/form_ability_a.cpp b/test/resource/formsystemtestability/fmsSystemTestHostNormal/src/form_ability_a.cpp index ab5f9dc1e3e..dc5b9b0ce36 100644 --- a/test/resource/formsystemtestability/fmsSystemTestHostNormal/src/form_ability_a.cpp +++ b/test/resource/formsystemtestability/fmsSystemTestHostNormal/src/form_ability_a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -44,7 +44,6 @@ void FormAbilityA::AcquireFormCallback::OnAcquired(const int32_t result, const F HILOG_INFO("%{public}s called", __func__); FormTestUtils::PublishEvent(this->caseName_, this->code_, std::to_string(formJsInfo.formId)); } - void FormAbilityA::AcquireFormCallback::OnUpdate(const int32_t result, const FormJsInfo &formJsInfo) const { HILOG_INFO("%{public}s called", __func__); @@ -66,7 +65,6 @@ void FormAbilityA::AcquireFormCallback::OnFormUninstall(const int64_t formId) co { HILOG_INFO("%{public}s called", __func__); } - void FormAbilityA::FMS_deleteFormCommon(std::string strFormId) { HILOG_INFO("%{public}s called, formId: %{public}s", __func__, strFormId.c_str()); @@ -109,7 +107,6 @@ void FormAbilityA::FMS_acquireForm_0300(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_0300, EVENT_CODE_300, "false"); } } - void FormAbilityA::FMS_acquireForm_0400(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -131,7 +128,6 @@ void FormAbilityA::FMS_acquireForm_0400(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_0400, EVENT_CODE_400, "false"); } } - void FormAbilityA::FMS_acquireForm_0500(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -154,7 +150,6 @@ void FormAbilityA::FMS_acquireForm_0500(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_0500, EVENT_CODE_500, "false"); } } - void FormAbilityA::FMS_acquireForm_0600(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -177,7 +172,6 @@ void FormAbilityA::FMS_acquireForm_0600(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_0600, EVENT_CODE_600, "false"); } } - void FormAbilityA::FMS_acquireForm_0700(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -199,7 +193,6 @@ void FormAbilityA::FMS_acquireForm_0700(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_0700, EVENT_CODE_700, "false"); } } - void FormAbilityA::FMS_acquireForm_1000(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -221,7 +214,6 @@ void FormAbilityA::FMS_acquireForm_1000(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_1000, EVENT_CODE_1000, "false"); } } - void FormAbilityA::FMS_acquireForm_1100(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -244,7 +236,6 @@ void FormAbilityA::FMS_acquireForm_1100(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_1100, EVENT_CODE_1100, ""); } } - void FormAbilityA::FMS_acquireForm_1200(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -313,7 +304,6 @@ void FormAbilityA::FMS_acquireForm_1600(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_1600, EVENT_CODE_1600, ""); } } - void FormAbilityA::FMS_acquireForm_1600_1(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -336,7 +326,6 @@ void FormAbilityA::FMS_acquireForm_1600_1(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_1600_1, EVENT_CODE_1610, ""); } } - void FormAbilityA::FMS_acquireForm_1800(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -359,7 +348,6 @@ void FormAbilityA::FMS_acquireForm_1800(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_1800, EVENT_CODE_1800, ""); } } - void FormAbilityA::FMS_acquireForm_1800_1(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -382,7 +370,6 @@ void FormAbilityA::FMS_acquireForm_1800_1(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_1800_1, EVENT_CODE_1810, ""); } } - void FormAbilityA::FMS_acquireForm_1900(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -405,7 +392,6 @@ void FormAbilityA::FMS_acquireForm_1900(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_1900, EVENT_CODE_1900, ""); } } - void FormAbilityA::FMS_acquireForm_2100(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -429,7 +415,6 @@ void FormAbilityA::FMS_acquireForm_2100(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_2100, EVENT_CODE_2100, "false"); } } - void FormAbilityA::FMS_acquireForm_2200(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -445,7 +430,6 @@ void FormAbilityA::FMS_acquireForm_2200(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_2200, EVENT_CODE_2200, "false"); } } - void FormAbilityA::FMS_acquireForm_2300(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -461,7 +445,6 @@ void FormAbilityA::FMS_acquireForm_2300(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_2300, EVENT_CODE_2300, "false"); } } - void FormAbilityA::FMS_acquireForm_2400(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -500,7 +483,6 @@ void FormAbilityA::FMS_acquireForm_2500(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_2500, EVENT_CODE_2500, "false"); } } - void FormAbilityA::FMS_acquireForm_2600_1(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -562,7 +544,6 @@ void FormAbilityA::FMS_acquireForm_2700(std::string data) FMS_deleteFormCommon(data); } - void FormAbilityA::FMS_acquireForm_2800(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -581,7 +562,6 @@ void FormAbilityA::FMS_acquireForm_2800(std::string data) FMS_deleteFormCommon(data); } - void FormAbilityA::FMS_acquireForm_2900(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -627,7 +607,6 @@ void FormAbilityA::FMS_acquireForm_2900_1(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_2900_1, EVENT_CODE_2910, ""); } } - void FormAbilityA::FMS_acquireForm_3000(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -649,7 +628,6 @@ void FormAbilityA::FMS_acquireForm_3000(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_3000, EVENT_CODE_3000, "false"); } } - void FormAbilityA::FMS_acquireForm_3100(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -676,11 +654,9 @@ void FormAbilityA::FMS_acquireForm_3100(std::string data) void FormAbilityA::FMS_acquireForm_3300(std::string data) { } - void FormAbilityA::FMS_acquireForm_3400(std::string data) { } - void FormAbilityA::FMS_acquireForm_3500(std::string data) { } @@ -707,7 +683,6 @@ void FormAbilityA::FMS_acquireForm_tempForm(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_TEMP, EVENT_CODE_TEMP, ""); } } - void FormAbilityA::FMS_acquireFormBatch(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -757,7 +732,6 @@ void FormAbilityA::FMS_acquireFormBatchB(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_BATCH_B, EVENT_CODE_BATCH_B, "false"); } } - void FormAbilityA::FMS_acquireFormTempBatch(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -783,7 +757,6 @@ void FormAbilityA::FMS_acquireFormTempBatch(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_TEMP_FORM_BATCH, EVENT_CODE_TEMP_BATCH, "false"); } } - void FormAbilityA::FMS_deleteFormBatch(std::string strFormId) { HILOG_INFO("%{public}s called", __func__); @@ -796,18 +769,15 @@ void FormAbilityA::FMS_deleteFormBatch(std::string strFormId) FormTestUtils::PublishEvent(FORM_EVENT_RECV_CLEAR_FORM_BATCH, EVENT_CODE_CLEAR_BATCH, "false"); } } - FormAbilityA::~FormAbilityA() { CommonEventManager::UnSubscribeCommonEvent(subscriber_); } - void FormAbilityA::OnStart(const Want &want) { HILOG_INFO("FormAbilityA::onStart"); Ability::OnStart(want); } - void FormAbilityA::OnActive() { HILOG_INFO("FormAbilityA::OnActive"); @@ -822,21 +792,18 @@ void FormAbilityA::OnStop() Ability::OnStop(); } - void FormAbilityA::OnInactive() { HILOG_INFO("FormAbilityA::OnInactive"); Ability::OnInactive(); } - void FormAbilityA::OnBackground() { HILOG_INFO("FormAbilityA::OnBackground"); Ability::OnBackground(); } - void FormAbilityA::SubscribeEvent() { HILOG_INFO("FormAbilityA::SubscribeEvent"); diff --git a/test/resource/formsystemtestability/fmsSystemTestHostNormal/src/form_ability_deleteform.cpp b/test/resource/formsystemtestability/fmsSystemTestHostNormal/src/form_ability_deleteform.cpp index cfc5bb42ca0..1f8de799d4e 100644 --- a/test/resource/formsystemtestability/fmsSystemTestHostNormal/src/form_ability_deleteform.cpp +++ b/test/resource/formsystemtestability/fmsSystemTestHostNormal/src/form_ability_deleteform.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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,7 +33,6 @@ void FormAbilityDeleteForm::AcquireFormCallback::OnAcquired(const int32_t result ability_->FMS_deleteForm_common(formJsInfo.formId, this->caseName_); } } - void FormAbilityDeleteForm::AcquireFormCallback::OnUpdate(const int32_t result, const FormJsInfo &formJsInfo) const { HILOG_INFO("%{public}s called", __func__); @@ -117,7 +116,6 @@ void FormAbilityDeleteForm::FMS_deleteForm_0300(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_DELETE_FORM_0300, EVENT_CODE_300, ""); } } - void FormAbilityDeleteForm::FMS_deleteForm_0400(std::string data) { std::shared_ptr callback = @@ -219,7 +217,6 @@ void FormAbilityDeleteForm::FMS_deleteForm_0800(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_DELETE_FORM_0800, EVENT_CODE_800, ""); } } - void FormAbilityDeleteForm::FMS_deleteForm_0900(std::string data) { std::shared_ptr callback = @@ -350,7 +347,6 @@ void FormAbilityDeleteForm::FMS_deleteForm_1400(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_DELETE_FORM_1400, EVENT_CODE_1400, ""); } } - void FormAbilityDeleteForm::FMS_deleteForm_1401(std::string data) { HILOG_INFO("%{public}s formId: %{public}s", __func__, data.c_str()); @@ -415,7 +411,6 @@ void FormAbilityDeleteForm::FMS_deleteForm_1501(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_DELETE_FORM_1501, EVENT_CODE_1510, "deleteError"); } } - void FormAbilityDeleteForm::FMS_deleteForm_1502(std::string data) { HILOG_INFO("%{public}s formId: %{public}s", __func__, data.c_str()); @@ -428,7 +423,6 @@ void FormAbilityDeleteForm::FMS_deleteForm_1502(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_DELETE_FORM_1502, EVENT_CODE_1511, "false"); } } - void FormAbilityDeleteForm::FMS_deleteForm_1600(std::string data) { std::shared_ptr callback = @@ -450,7 +444,6 @@ void FormAbilityDeleteForm::FMS_deleteForm_1600(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_DELETE_FORM_1600, EVENT_CODE_1600, ""); } } - void FormAbilityDeleteForm::FMS_deleteForm_1601(std::string data) { HILOG_INFO("%{public}s formId: %{public}s", __func__, data.c_str()); @@ -480,7 +473,6 @@ void FormAbilityDeleteForm::FMS_deleteForm_1601(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_DELETE_FORM_1601, EVENT_CODE_1610, "deleteError"); } } - void FormAbilityDeleteForm::FMS_deleteForm_1602(std::string data) { HILOG_INFO("%{public}s formId: %{public}s", __func__, data.c_str()); @@ -545,7 +537,6 @@ void FormAbilityDeleteForm::FMS_deleteForm_1701(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_DELETE_FORM_1701, EVENT_CODE_1701, "deleteError"); } } - void FormAbilityDeleteForm::FMS_deleteForm_1702(std::string data) { HILOG_INFO("%{public}s formId: %{public}s", __func__, data.c_str()); @@ -558,7 +549,6 @@ void FormAbilityDeleteForm::FMS_deleteForm_1702(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_DELETE_FORM_1702, EVENT_CODE_1702, "false"); } } - void FormAbilityDeleteForm::FMS_acquire_tempForm_batch(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -583,7 +573,6 @@ void FormAbilityDeleteForm::FMS_acquire_tempForm_batch(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_TEMP_FORM_BATCH, EVENT_CODE_TEMP_BATCH, "false"); } } - void FormAbilityDeleteForm::FMS_acquireForm_batch(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -608,7 +597,6 @@ void FormAbilityDeleteForm::FMS_acquireForm_batch(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_BATCH, EVENT_CODE_BATCH, "false"); } } - void FormAbilityDeleteForm::FMS_deleteFormBatch(std::string strFormId) { HILOG_INFO("%{public}s called", __func__); @@ -724,7 +712,6 @@ void FormAbilityDeleteForm::DeleteForm_1000(int64_t form_id) FormTestUtils::PublishEvent(FORM_EVENT_RECV_DELETE_FORM_1000, EVENT_CODE_1000, ""); } } - void FormAbilityDeleteForm::DeleteForm_1100(int64_t form_id) { bool bResult = DeleteForm(form_id); @@ -736,47 +723,38 @@ void FormAbilityDeleteForm::DeleteForm_1100(int64_t form_id) FormTestUtils::PublishEvent(FORM_EVENT_RECV_DELETE_FORM_1100, EVENT_CODE_1100, "false"); } } - void FormAbilityDeleteForm::DeleteForm_1200(int64_t form_id) { FormTestUtils::PublishEvent(FORM_EVENT_RECV_DELETE_FORM_1200, EVENT_CODE_1200, std::to_string(form_id)); } - void FormAbilityDeleteForm::DeleteForm_1400(int64_t form_id) { FormTestUtils::PublishEvent(FORM_EVENT_RECV_DELETE_FORM_1400, EVENT_CODE_1400, std::to_string(form_id)); } - void FormAbilityDeleteForm::DeleteForm_1500(int64_t form_id) { FormTestUtils::PublishEvent(FORM_EVENT_RECV_DELETE_FORM_1500, EVENT_CODE_1500, std::to_string(form_id)); } - void FormAbilityDeleteForm::DeleteForm_1501(int64_t form_id) { FormTestUtils::PublishEvent(FORM_EVENT_RECV_DELETE_FORM_1501, EVENT_CODE_1510, std::to_string(form_id)); } - void FormAbilityDeleteForm::DeleteForm_1600(int64_t form_id) { FormTestUtils::PublishEvent(FORM_EVENT_RECV_DELETE_FORM_1600, EVENT_CODE_1600, std::to_string(form_id)); } - void FormAbilityDeleteForm::DeleteForm_1601(int64_t form_id) { FormTestUtils::PublishEvent(FORM_EVENT_RECV_DELETE_FORM_1601, EVENT_CODE_1610, std::to_string(form_id)); } - void FormAbilityDeleteForm::DeleteForm_1700(int64_t form_id) { FormTestUtils::PublishEvent(FORM_EVENT_RECV_DELETE_FORM_1700, EVENT_CODE_1700, std::to_string(form_id)); } - void FormAbilityDeleteForm::DeleteForm_1701(int64_t form_id) { FormTestUtils::PublishEvent(FORM_EVENT_RECV_DELETE_FORM_1701, EVENT_CODE_1701, std::to_string(form_id)); } - void FormAbilityDeleteForm::OnStart(const Want &want) { HILOG_INFO("FormAbilityDeleteForm::onStart"); @@ -811,7 +789,6 @@ void FormAbilityDeleteForm::OnStart(const Want &want) }; SubscribeEvent(eventList); } - void FormAbilityDeleteForm::OnActive() { HILOG_INFO("FormAbilityDeleteForm::OnActive"); @@ -826,21 +803,18 @@ void FormAbilityDeleteForm::OnStop() Ability::OnStop(); } - void FormAbilityDeleteForm::OnInactive() { HILOG_INFO("FormAbilityDeleteForm::OnInactive"); Ability::OnInactive(); } - void FormAbilityDeleteForm::OnBackground() { HILOG_INFO("FormAbilityDeleteForm::OnBackground"); Ability::OnBackground(); } - void FormAbilityDeleteForm::SubscribeEvent(const std::vector &eventList) { MatchingSkills matchingSkills; diff --git a/test/resource/formsystemtestability/fmsSystemTestHostNormal/src/form_ability_releaseform.cpp b/test/resource/formsystemtestability/fmsSystemTestHostNormal/src/form_ability_releaseform.cpp index c4ca6576424..5361faddace 100644 --- a/test/resource/formsystemtestability/fmsSystemTestHostNormal/src/form_ability_releaseform.cpp +++ b/test/resource/formsystemtestability/fmsSystemTestHostNormal/src/form_ability_releaseform.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -32,7 +32,6 @@ void FormAbilityReleaseForm::AcquireFormCallback::OnAcquired(const int32_t resul ability_->FMS_releaseForm_common(formJsInfo.formId, this->caseName_, this->lastformId_); } } - void FormAbilityReleaseForm::AcquireFormCallback::OnUpdate(const int32_t result, const FormJsInfo &formJsInfo) const { HILOG_INFO("%{public}s called", __func__); @@ -103,7 +102,6 @@ void FormAbilityReleaseForm::FMS_releaseForm_0300(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_RELEASE_FORM_0300, EVENT_CODE_300, ""); } } - void FormAbilityReleaseForm::FMS_releaseForm_0400(std::string data) { std::shared_ptr callback = @@ -204,7 +202,6 @@ void FormAbilityReleaseForm::FMS_releaseForm_0800(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_RELEASE_FORM_0800, EVENT_CODE_800, ""); } } - void FormAbilityReleaseForm::FMS_releaseForm_0900(std::string data) { std::shared_ptr callback = @@ -336,7 +333,6 @@ void FormAbilityReleaseForm::FMS_releaseForm_1400(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_RELEASE_FORM_1400, EVENT_CODE_1400, ""); } } - void FormAbilityReleaseForm::FMS_releaseForm_common_del(std::string data) { HILOG_INFO("%{public}s formId: %{public}s", __func__, data.c_str()); @@ -414,7 +410,6 @@ void FormAbilityReleaseForm::ReleaseForm_0700(int64_t form_id) FormTestUtils::PublishEvent(FORM_EVENT_RECV_RELEASE_FORM_0700, EVENT_CODE_700, "false"); } } - void FormAbilityReleaseForm::ReleaseForm_0800(int64_t form_id) { bool isReleaseCache = false; @@ -427,7 +422,6 @@ void FormAbilityReleaseForm::ReleaseForm_0800(int64_t form_id) FormTestUtils::PublishEvent(FORM_EVENT_RECV_RELEASE_FORM_0800, EVENT_CODE_800, "false"); } } - void FormAbilityReleaseForm::ReleaseForm_0900(int64_t form_id) { bool isReleaseCache = false; @@ -440,7 +434,6 @@ void FormAbilityReleaseForm::ReleaseForm_0900(int64_t form_id) FormTestUtils::PublishEvent(FORM_EVENT_RECV_RELEASE_FORM_0900, EVENT_CODE_900, "false"); } } - void FormAbilityReleaseForm::ReleaseForm_1000(int64_t form_id) { bool isReleaseCache = true; @@ -453,7 +446,6 @@ void FormAbilityReleaseForm::ReleaseForm_1000(int64_t form_id) FormTestUtils::PublishEvent(FORM_EVENT_RECV_RELEASE_FORM_1000, EVENT_CODE_1000, "false"); } } - void FormAbilityReleaseForm::ReleaseForm_1100(int64_t form_id) { bool isReleaseCache = true; @@ -466,7 +458,6 @@ void FormAbilityReleaseForm::ReleaseForm_1100(int64_t form_id) FormTestUtils::PublishEvent(FORM_EVENT_RECV_RELEASE_FORM_1100, EVENT_CODE_1100, "false"); } } - void FormAbilityReleaseForm::ReleaseForm_1200(int64_t form_id) { bool isReleaseCache = true; @@ -479,7 +470,6 @@ void FormAbilityReleaseForm::ReleaseForm_1200(int64_t form_id) FormTestUtils::PublishEvent(FORM_EVENT_RECV_RELEASE_FORM_1200, EVENT_CODE_1200, "false"); } } - void FormAbilityReleaseForm::ReleaseForm_1300(int64_t form_id, std::string lastFormId) { if (lastFormId == "") { @@ -499,7 +489,6 @@ void FormAbilityReleaseForm::ReleaseForm_1300(int64_t form_id, std::string lastF } } } - void FormAbilityReleaseForm::ReleaseForm_1400(int64_t form_id) { bool isReleaseCache = true; @@ -536,7 +525,6 @@ void FormAbilityReleaseForm::OnStart(const Want &want) }; SubscribeEvent(eventList); } - void FormAbilityReleaseForm::OnActive() { HILOG_INFO("FormAbilityReleaseForm::OnActive"); @@ -551,21 +539,18 @@ void FormAbilityReleaseForm::OnStop() Ability::OnStop(); } - void FormAbilityReleaseForm::OnInactive() { HILOG_INFO("FormAbilityReleaseForm::OnInactive"); Ability::OnInactive(); } - void FormAbilityReleaseForm::OnBackground() { HILOG_INFO("FormAbilityReleaseForm::OnBackground"); Ability::OnBackground(); } - void FormAbilityReleaseForm::SubscribeEvent(const std::vector &eventList) { MatchingSkills matchingSkills; diff --git a/test/resource/formsystemtestability/fmsSystemTestHostNormalB/src/form_ability_b.cpp b/test/resource/formsystemtestability/fmsSystemTestHostNormalB/src/form_ability_b.cpp index 8d88015a429..f903327b92b 100644 --- a/test/resource/formsystemtestability/fmsSystemTestHostNormalB/src/form_ability_b.cpp +++ b/test/resource/formsystemtestability/fmsSystemTestHostNormalB/src/form_ability_b.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -41,7 +41,6 @@ void FormAbilityB::AcquireFormCallback::OnAcquired(const int32_t result, const F ability_->FMS_deleteFormCommon(strFormId); } } - void FormAbilityB::AcquireFormCallback::OnUpdate(const int32_t result, const FormJsInfo &formJsInfo) const { HILOG_INFO("%{public}s called", __func__); @@ -58,7 +57,6 @@ void FormAbilityB::AcquireFormCallback::OnFormUninstall(const int64_t formId) co { HILOG_INFO("%{public}s called", __func__); } - void FormAbilityB::FMS_deleteFormCommon(std::string strFormId) { HILOG_INFO("%{public}s called, formId: %{public}s", __func__, strFormId.c_str()); @@ -103,7 +101,6 @@ void FormAbilityB::FMS_acquireForm_1400(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_1400, EVENT_CODE_1400, "false"); } } - void FormAbilityB::FMS_acquireForm_1500(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -150,7 +147,6 @@ void FormAbilityB::FMS_acquireForm_1800_2(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_1800_2, EVENT_CODE_1820, ""); } } - void FormAbilityB::FMS_acquireForm_1800_3(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -190,7 +186,6 @@ void FormAbilityB::FMS_acquireForm_2400_1(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_2400_1, EVENT_CODE_2410, "false"); } } - void FormAbilityB::FMS_acquireForm_3100(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -213,7 +208,6 @@ void FormAbilityB::FMS_acquireForm_3100(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_FORM_3100, EVENT_CODE_3100, ""); } } - void FormAbilityB::FMS_acquireForm_tempForm(std::string data) { HILOG_INFO("%{public}s called", __func__); @@ -287,18 +281,15 @@ void FormAbilityB::FMS_acquireFormTempBatch(std::string data) FormTestUtils::PublishEvent(FORM_EVENT_RECV_ACQUIRE_TEMP_FORM_BATCH, EVENT_CODE_TEMP_BATCH, "false"); } } - FormAbilityB::~FormAbilityB() { CommonEventManager::UnSubscribeCommonEvent(subscriber_); } - void FormAbilityB::OnStart(const Want &want) { HILOG_INFO("FormAbilityB::onStart"); Ability::OnStart(want); } - void FormAbilityB::OnActive() { HILOG_INFO("FormAbilityB::OnActive"); @@ -313,21 +304,18 @@ void FormAbilityB::OnStop() Ability::OnStop(); } - void FormAbilityB::OnInactive() { HILOG_INFO("FormAbilityB::OnInactive"); Ability::OnInactive(); } - void FormAbilityB::OnBackground() { HILOG_INFO("FormAbilityB::OnBackground"); Ability::OnBackground(); } - void FormAbilityB::SubscribeEvent() { HILOG_INFO("FormAbilityB::SubscribeEvent"); diff --git a/test/systemtest/common/ams/ams_service_ability_test/ams_service_ability_test.cpp b/test/systemtest/common/ams/ams_service_ability_test/ams_service_ability_test.cpp index 2317c98bd76..6b7f40d9da4 100644 --- a/test/systemtest/common/ams/ams_service_ability_test/ams_service_ability_test.cpp +++ b/test/systemtest/common/ams/ams_service_ability_test/ams_service_ability_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -123,7 +123,7 @@ public: result.clear(); char bufPs[BUFFER_SIZE]; FILE *ptr; - if (!cmd.empty() && (ptr = popen(cmd.c_str(), "r")) != nullptr) { + if (!cmd.empty() && (ptr = popen(cmd.c_str(), "r")) != NULL) { while (fgets(bufPs, BUFFER_SIZE, ptr) != nullptr) { result.append(bufPs); } diff --git a/tools/aa/src/ability_command.cpp b/tools/aa/src/ability_command.cpp index f55bd9a1fd7..a20c095ff83 100644 --- a/tools/aa/src/ability_command.cpp +++ b/tools/aa/src/ability_command.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021 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 @@ -353,7 +353,9 @@ ErrCode AbilityManagerShellCommand::CreateMessageMap() ErrCode AbilityManagerShellCommand::init() { - return AbilityManagerClient::GetInstance()->Connect(); + ErrCode result = AbilityManagerClient::GetInstance()->Connect(); + + return result; } ErrCode AbilityManagerShellCommand::RunAsHelpCommand() @@ -564,6 +566,7 @@ ErrCode AbilityManagerShellCommand::RunAsDumpsysCommand() int userID = DEFAULT_INVAL_VALUE; bool isfirstCommand = false; std::string args; + for (auto it = argList_.begin(); it != argList_.end(); it++) { if (*it == "-c" || *it == "--client") { if (isClient == false) { @@ -637,7 +640,7 @@ ErrCode AbilityManagerShellCommand::RunAsDumpsysCommand() break; } case 'l': { - if (isfirstCommand == false) { + if (isfirstCommand == false && optarg == nullptr) { isfirstCommand = true; } else { // 'aa dumpsys -i 10 -element -lastpage' diff --git a/tools/test/mock/mock_ability_manager_stub.h b/tools/test/mock/mock_ability_manager_stub.h index 38f9576b42b..6e99eac731d 100644 --- a/tools/test/mock/mock_ability_manager_stub.h +++ b/tools/test/mock/mock_ability_manager_stub.h @@ -85,7 +85,7 @@ public: MOCK_METHOD1(RemoveMission, int(int id)); MOCK_METHOD1(RemoveStack, int(int id)); MOCK_METHOD1(KillProcess, int(const std::string &bundleName)); - MOCK_METHOD2(UninstallApp, int(const std::string &bundleName, int32_t uid)); + MOCK_METHOD1(UninstallApp, int(const std::string &bundleName)); MOCK_METHOD2(MoveMissionToEnd, int(const sptr &token, const bool nonFirst)); MOCK_METHOD1(IsFirstInMission, bool(const sptr &token)); @@ -117,7 +117,6 @@ public: ChangeFocusAbility, int(const sptr &lostFocusToken, const sptr &getFocusToken)); MOCK_METHOD1(MinimizeMultiWindow, int(int missionId)); MOCK_METHOD1(MaximizeMultiWindow, int(int missionId)); - MOCK_METHOD1(GetMissionIdByToken, int32_t(const sptr &token)); MOCK_METHOD1(GetFloatingMissions, int(std::vector &list)); MOCK_METHOD1(CloseMultiWindow, int(int missionId)); MOCK_METHOD1(SetMissionStackSetting, int(const StackSetting &stackSetting)); diff --git a/tools/test/moduletest/aa/BUILD.gn b/tools/test/moduletest/aa/BUILD.gn index da4b3291b1f..5d9ed8f0f1b 100644 --- a/tools/test/moduletest/aa/BUILD.gn +++ b/tools/test/moduletest/aa/BUILD.gn @@ -136,8 +136,7 @@ group("moduletest") { deps = [ ":aa_command_dump_module_test", - - # ":aa_command_dumpsys_module_test", + ":aa_command_dumpsys_module_test", ":aa_command_start_module_test", ":aa_command_stop_service_module_test", ] diff --git a/zidl/test/native/src/test_client.cpp b/zidl/test/native/src/test_client.cpp index d2670709a25..b732b598ba2 100644 --- a/zidl/test/native/src/test_client.cpp +++ b/zidl/test/native/src/test_client.cpp @@ -31,6 +31,7 @@ int TestClient::ConnectService() } sptr object = saMgr->GetSystemAbility(IPC_TEST_SERVICE); + if (object != nullptr) { ZLOGE(LABEL, "Got test Service object"); testService_ = (new (std::nothrow) ZidlTestServiceProxy(object)); -- Gitee