diff --git a/aafwk.gni b/aafwk.gni index 9e1a559076ffe4636b823a269b21fc10d385863f..0e00cbd507b9624e88f2cf225ebb52c8760d1d9e 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 39040c9b8c00941165fe0e1be3061f0ae328ddb0..b58b035353d6828f8f7b2adf91f6a7800e0b44d8 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 8fa9150d0fe9dd2966d00509c05ca126fb442f4d..ceba1aafa69a6060ab899763779cf4d38a2ed9b0 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 f1cce7186b252936d5f0e52eddd639fe480d2811..f55a2b6f081ada770d864b37bd864790dfa206f1 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 05d2fd2e1b43aee1d09730c5019bc8efc395924a..305c861422741df49d1dfa17abb3ce2e9d34c639 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 f0416a1824ee1d73447617abd193aec5dd9e312d..3af52cc747fc28f763c746079aec6f29bde66169 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 388942ad7ff12b19ac839dc0119bca824eece399..4075ee5f59ed84456fa254f6bf83b5ad6caed312 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 8f85c544b0e9dbb93f0ee12d77dd598293914258..8c429313a59c4be1bd2051a149a6d73e489af262 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 39a5fcf4ab1d512138de86cb4522c399e5a2d08e..87381bd557bf8d0d0b5108d4f2638902a91e55db 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 3348ad1a0bbc616523d54991464a428f37d46e75..0777833e7aed6cc3e01bfc5bdbb781cb3bfedb48 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 8a5ecab5dfae094b5329a0ed4ca41a5bb8760d6a..64ecdb2e320afa6bcdb322e2a78fc6e800b2c5de 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 377ccd5e4139288cd64b6be98cf5599971f4c498..138f78aa7680721f5dfbd357cba8a816258d1cf1 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 ffb0cc90dcd819efc69983162423328aae3ab7bd..f289bec7e596cb29a3b766f57234f85b56faaece 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 7bf29df1d27ff65634fe0cc3be3d15f76928ad1d..c2c52234bec1cc9429b52ded4550d2f843e321b8 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 4c5c57a38a0dae50d924a0cbb677084a509854b8..5901e6bbc27f90225d93645c4abe2d982c769b76 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 e43309c5ba8f3e020aa7aced7a59ace8427c0d17..b73c09578cf9ad2b11e5642c787672324814251d 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 df1c5cd4ceb0b461726ce4b91edaab29038dfe2f..84d9973e046b5836842c3f9b913534a8c9189482 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 f0b6e46494bd98565138100312c3b98c0b1ddf09..b1891899515af939f9bac91e872a42700427f559 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 8c2da3aebeba2c93c12ce759b4ca2067a0b0c1d2..e0244d0fbeefaee18300eeb2774b8ee4e3822f52 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 9c6c53d085b2dd52dc9c2dfa3f9b847933b87647..7e9286e0fbeacbf11000b9ef76724753ffd935d8 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 1c457d94a62319332f696a66678b3194791a7996..6ee8ef91d818fea1fac410c435aee43adcdcf353 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 45e19983389e72e70c8965b117ea21f2d8e14e3d..8ec371262e2716c89c01906aaed9699360363309 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 5f218ddfcc35e4017b4419c84a776590730bdc9e..4b62e2cd3cfa52a780241af73c096b2f5bbafc8a 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 5938064c5a2beeb19242dc3e6599e5c70e2222e7..d010f661a2984400dfade760eb1ccbb63c20d7dc 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 fd84ab2a566094cd45a4a347d5e3541baeaac565..af541d17cae10e168dc11811a41711a337397213 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 4c3e6acd8468feeb45acad53d01de67044de9b9e..51794fc34956cdcd03cfc6b1da46400344fca342 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 5e4509a6162202bfe7922f6bddd441bdd8377cd2..7c6294c036ad5d360559a9c34d41e7ff502c4d16 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 3e1c25baee9d4a8cede72d3e3b17e7b20f179ab4..f1d685ed0f2680de2410170493ae8a1ccecfff79 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 02b278341740ab3eef5c150f33c8294e88f21f73..6aca9c78c3d939563c825f4f57a74a95cbcdeea7 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 6ce8fdda977c89dc5fd8ba66aaa9190325c3a0c9..5b5b3cc5ce625feae3a9bd19617a42cc8f1144bf 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 0e5066bb9c93473a0790634379b6038405dd0a91..83f1fd9d94355121e03034a4bc153f7c93984f95 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 e816dc455d840256b4a7dc59e49edc5760221ee3..6a794d8eafdd4a0d8756968d367bbe12b21daead 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 4be1ec7b1cf63099f16ecea600d3c59d6b3c66c0..ff4ceee648f32af5b7fac25bae4ee86fa3f97d5b 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 f7d96a688bbde52956c0c9907d1d656333f07f10..676fd491749463bc3ccf4109052be7876db6fe63 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 41f3dce63cbcdd6753491f01883af6c39d6d585b..63fe1a334d912f4561712fe385c058aef68f8e2a 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 a760c32b9e0d6229e988c22834532bf632f8ce97..528180e67ccdb89c919f7181edd993bfb5999335 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 0e18d9cc8fb9435b43a83cd209958345a2518238..971b042e40729769ef29221eb057b13d63097c4e 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 065df40d3f0efd3682f81cec48e377fe95ad0f23..e2c12b62e4062beac43587c6c3cb1b23c7d04f1c 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 8fd7976ed71fb47420b34a6f5a47e3815323f9e3..d14616124dfb677bead28dffb298b92a8316a0a2 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 5dbf3147e33dff555a856e359046439e51d35951..0e8eedaa47d8c9ab90b541148547f070252b63e4 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 404567290f85da44e10e489b2d7c0119222a6bfa..a42d13a2d5bb558d17675343652aef58028d151c 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 9f840d7badfa2e76e3510253f7813885bac8d85e..dc049bd9463a56e94bfac49ed3ab73d69c175677 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 117fc41bb8d5cedfc4a4e5c2483966fe6e83771f..7a9672fc29ed89666f9af4b8d5f7085dff9be05c 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 c27637c77d84dffefc26cb7100a4777373ca8ab1..1c43d56c4b1d8992a14da8006358f9dd39e4eca1 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 e9fd2c2940fcf662c739524dff906dd524778c44..f4d1aeae48baa320867a26e17490f640001c55c3 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 9c705156c44678ee557b9d44eb4c698e76a81b34..57eedb0cf9657977627c8e13fc5f1893f1f6e89a 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 58c6730325a8219b8cdb63cc4c218263a6870801..125246d8aefb68438bcc6984f9db6a2056244867 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 10eb4715a950450c4aae344c02303b2a3be23ca8..b86f345d621ddbbe902b6dfac0f6f5116c0d1fa1 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 7ab2580ed9844769531c600451bbd4d1a1458932..fb64f1340f3978ebdff7630268ebddf6ef754b52 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 58c204fbd6eba86d606f55f99fb96b68abb8e79b..636b8e1059e5a303d612faef7b3e18f698a3d7a0 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 fd04fe6fd7cf6ea6c843160d01ca90858a036384..3ce7d0beb41366ae443683d853380cde5efbd08a 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 72f3a9228c23281f3acf199412b8b1c4583254c6..344cfbc9267b59027074726f859114dc7fb5d6b7 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 72f51bd87ebba8d47a73c5250207d86bf0a52b6d..034e2735ffe4a1e606d29ecedac43e342ab954f2 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 38c25387f13b1b654defb1a88a8ba11c437d6252..a7e924cf0234769f389676492b8b6b03d87e4b14 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 e32d1db4542b315d9c0846fac66f01124be1911e..2d806681b24fb5e7391d621b5182d7a40f04d270 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 c861e62bbbd744f085e63b0c53ded6fb64ff51dd..0fa744cf871a81d49a2ca88f1c12933c3d90cb52 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 70660016a4ff156a4f1224903f711398b77ff06e..0c5f1598c3eb5df89f69e892c5da40de3fe8122b 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 383b08f4977869e0b8facd839e16c1cbc70c1f2e..44da57920080b6c72297ad21531b30d4bb4573c6 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 c008fcccd145109d09eb58221f6aff13eacbcd53..0292695e797e092dd96a3aafdcf64ebaff7589b9 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 57009126a2b227202b1c5ee362aea72d11273136..c72beab2a9ee1fb7dc9d32fdabc397bc44399686 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 0c96d0037f560628bd15c63e85528a386ab15c04..9118bf33c6433e11f75d27810a9f7b18a921662f 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 dfca77d5fa3344fb6ece81c65b6aa9cd85bd32c9..ae5fd1d92be8fd4bfb13152584e2349d5d432130 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 13c94fb8a77ce102cb95f6d8b83083a777370c3d..273b89ce87938e4de336ea787f662c84f1880d20 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 5069a2279cac0d5abd075900b299d3285a5fd7c5..47f70eb1da15cb8ee64e902efe525b2270147d5a 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 ae5d9ec39d67dcc1c029433ee4ee65e937554f53..87822b593595622e395bd249aef824191a0ddf15 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 bedbc6e2b6f6218ca44f9192033ec66b6164340f..5146ec09942eb1856e8231af5ecca4b6e3e5e922 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 91a6ee6eac2ff91cf397c2600371bc352156399f..3cc8ee274b335b1aba9ee801c728ac725331e9fb 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 1fdc4299941e66d86bfffb37a783fe3e6a393a54..0fa06c0642c2614a5f29d6594d726a39f8c05474 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 e5899e7892def4f683d95ed9f85963bdadbb8b28..e6b418d78012cccb4ede624d434d9df5c7fac9c5 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 6784b7f6ded9c6cbba64dafd595dfe6efeec0194..0bd65420cf03611f251e3f95657b67b5e9761529 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 dc460e18a43e39eb1251e6d0b2a2dde54c03fb8b..594fcb73c9407ba2bb515ff26f4ef686b3cdc0fc 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 a837c31baae3e61584829923f6fd19c0fbe64618..c2f769c0c60c3033a983ca019b8af09141455fc2 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 86300bfbf18fdb26e3837abf1373bbdab482a1c5..fd7cc87971dbba1e80904e40ee176eea7e737fd9 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 8d0afe32e4701a6bd1ec0d3f3d26d980c5c4a4b6..9796fb4748b96fe529762713a2cdb8771311c4ec 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 7dbcd3070aecb23b1083138ee1a9eb842de2a6a2..63a2cac60afcf6a88bd6d0b01c45fdc8c2b3e4ff 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 0be1fa9d00b57e05140dd9fcba436fe68681d898..cb7313d728cc18da84e3cd3d4b405a7fd8fa8c98 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 1fd76d728ad92d1f41356bcdfacc0f44ad984195..603077fff5e02b381ec2aa7a94a42f3811284daa 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 1d5740c34163c3519806f2c84859ae91c9f79358..551b443ff04c0675b28c42de1ef50037bc474656 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 9de8ea3536101b3ffca31dadaf511bca19909072..528c9af9cffd31e357769f91d102ec75b09e1bc0 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 81d87f96fd31205820186de25624f8ad2099fada..d9ca5ee0f40495b9e69e83d8ce5fdb7b75ea5748 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 27e44039eb6f70508aa5df39a1884f976c53ab19..e8591266b9c3aaef38f9d476a3e50f8fbfa2f4a0 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 c829801f5b635d49f184c8d4e465570aebfb9eb8..a5ad2966ef49f1a9991d9da530ddb0a9c96fa228 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 ebd9437fcea936985671c6c32c6ec27c7be2141c..79bf37ab2f6628148820e5685695e516ca99b3f8 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 7522047b1696a17e65b1495a5bb4bdde568ca34a..8954716504988d7f6a9dfa275377d0b0a54164e3 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 c870115cf2489fe998cd204534c02a0cf81c8557..c994331a2a9783e69caed1d8dfc4e0d0e369dfdf 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 862ce08984f5c32bf30833be991dd8450e7df729..62cd57c035e0cce4eedda0f8030bee5ffaeb2790 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 6040330a5f0e83bcf3438e8e385e59132f6df1b7..722ecce9d0db47e863495f01965a401a9be97245 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 db6e9504bc27698ced2e649d5b9b66e2a0bcd4cc..63a3a10f0e6693af027780c7136a9523ad55fb1e 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 571894a5a7db728a7c55b4d50f5d03def1f4665b..4a516be3cea412994a2a5991029e419b6b4a9ef7 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 8f67c0c7dd512ffb8f9890d5cf138d2a928d855b..13d8f44d518a05b0f5034f9575647df47dd26e86 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 1b14d3818cbf320d796c78baa56554d040fd2b9c..28cd18d18b99fec86e7391b21a756ebc132a04e5 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 abca98562d5dadf3e48dbf78f137f71d50e85638..cd75d0252066c3ab23a365766997ad585e09a041 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 b7fa9fd453d9a671c7ce2b8bb9819619e19f5588..a890ba24e62fffb46ce9b58f36279f4d9407c51f 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 c2622d6689d1a8e4b3d662a7b2480578da6eeeaf..594c105c2385cdd9e24511f991857993d8a8c0ee 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 b314bce0a31832f4d9d0964bc91754eb1bd5a7dd..afac3de2feb90e046efe6ee7b2dca1100bb4d7c0 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 69b72785fcca81161487afa7d976a891351575d1..21f571f8d064376f97f0511099b88251d24347a8 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 73ad44e12869b2c5d8daf2c9a32b7170f0146e23..340a7b37c2440be2a4d3984e522c6fbafe15ae0f 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 6eba768327b22360afe7b0b318b29b236ddaeef3..c705e2aa06c220649113ca9b4ce9c0fe8e972458 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 39ec8600af92fb21c0243750255e20a0cbbbefc9..06f9bd1c321c10323e09474b7d9e90cf80d955e8 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 029c9df2244f034037ae5dffcd7d9754b69cad2c..be24cd79b68514cd6002cd875ec67aa3b0dd00cc 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 983ffe9ac6809feab6bcf1a201e5ccfa0c453b62..627c34d3a9526107dd186acfe3f380f2858703e8 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 973a616961666e4f633ec835c67811b27693703a..4d8427212f18fffe97d6ef91b935eaae2dfc649f 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 a65ead41952b71af7edf9944188bdb04422c384f..10a61b102a1aa4c34eada8e14955fa890dd4d0b0 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 e1bcd3c2eeb17f85e16756a38ef474a34f0b4ee4..a57281033d96b5871e2bb44b62eb71f6e4e04fda 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 d6588ed87ac47fc900799a17418beb8ffb788c7c..936f084101c137f184d185d552fab104e8aca6c0 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 f435817668161eb5faff5155eb5cf1b64a938bd5..9433ead0d14379d63de1f959d7394e97cc15f638 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 ce30c18c1fbe16780b7945575e20e47b1cf19d2d..2641b5e684db619d9ee37fa14ccc4113ec820a7f 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 8a2a1ec8cd9766f7ad83aa0504e4639aa68c368b..ecb520513057dbb2cbd374b2d25bd830b301a691 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 806413668057c6187d3a830c0be858258955f3b4..161a6454c21c5fd142149bb1ed870bdddef3d929 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 0a7d8f3bc6bef96463698036fec9c8b5cffb31c9..baef798a1f1561bb88299f89c6e574c74966e1b3 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 f64569134fa027326b0040c6e31514dc18db62b3..5f7106cf5b4cfe9482bb9b727df924b33c18ce96 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 35cc923d83200e7827ebbbf495154d74d89f4b25..5101d21735aca93319c6169c8df8313df76ccfae 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 8db35922a30120469702ad6021dce2b98f4fdeae..8a3e95caa1632b3afc4b0ea1141b376aaaea578c 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 e86f616a2cd2f510b73e02870ed50c9cf0f77963..c198d37047c0fdb64389acf7f233ea2bc2b13d42 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 b18bd56d754598dcc72799d376755c1df10b8687..262e56d0a7cb89adbf2e8c1e3a24dbb4c073051c 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 00a98755f58b98da73163063b2f262b2b6d6bfd0..14e9c459a208afef9a2c7064e08282d86f7d81c8 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 ab61c4eeac2eecdc13f6ec7b76ec1e57f91ea025..e8bd70cb0b1cacd43291090dbeb5437c4821b8c9 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 123e08e5cef7284021b70d96a7c94aa06802cf14..c1e73ed03a69e5624b3cf01de97150430a714424 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 14bbfb31f6e23b28b9c3f0f636aaaa4e0d12b6ed..7696ce30911f5e819ddbbda84b36ed47e10c472b 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 e8d43c6ec3bf071ccaed2da71b7771952a9bf02d..9626b64b112e2a1008f644d8f7ffbcdcb07e9d66 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 5fb8ffff4bfd1f40ea914f43697adb6b29b8064b..c05c45c6544d607c38f817126791133548b2df0d 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 845f139539cad91ad3103f96cf89cc2d4ce847dd..cb1bb6f8bfba3cb9b845e18cae6c0795c019d4bc 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 e9513f2fb14b0cd062ff5fdf9e50882a9b48b7aa..36c330d19d60317e273c98d53740ef7145cf50e5 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 6c07b1963df3156b0e59ce8b74a5b91cc03a1a44..5d5c9e4bc5d6ce09efafde77041e50a740fcc857 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 334ec2bc93b346a8b525017284fb89ec35ce7407..d80f7d2166e4f86ef8a852fd159b22d04ab98bec 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 f72e8b35708251ae381cc1b24ddce7f522c1c405..74462aaadee20fd3d57525101fae0c4b9bc4ec7e 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 58d345f4867c45dccc10d5daf95ce98bea2d4f23..e9b3a04d80be4c140d48cd8b18be8178fe6eaa79 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 1666833ee729f8efae41013c3a2e6f5fb7fa1aef..71d298be2e6cf29b32b7f8dd1da49bc76e3bee67 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 b21bed8c4e1d0e28156d5389ae105cad859abf33..ce9ece8a858af52441c2fac65f8333fe0174256e 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 5a00a9768f8c22654e70852a003edae35de6e874..b5726463380f71bba1543740b23bcb34d138d596 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 68361bcd0025603df10cb2f988cbf71eb243e63d..bad33a92ec4628902d0a4876a0a23b3c8f58152e 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 4a9a096ed95d3a1224a02f65dd2389e385b00c30..a2aa882fcec1d1fe4717f8c1db57fdee8d063c98 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 005c8f4e45c22f0a65b6ed25ef479b9aa4847b91..1305571339da28ab52d04d284158c5c51d440b1e 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 5318715054343e4536b79cd84f155dd5caeb653a..9636dbaf4a2df8db8b100863852fc2a38f4a3233 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 f2a5ede04726a25f18480a55a93edb5447839145..3bf6e6e6bc63dacd45bc7c3f27ca732e226c72d7 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 018c0291acd36a49b916d1cbfd70a6ff581283bf..d2118654f74965e76239f263d4de34a1fb677578 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 a39e549889008d629469404a6367383c8806d6b0..94ce53749bd993b6577d934e2a16f79cbf24f3ee 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 fe474794aa6341d023b00fa752b2114baeec6e99..f0e2178af28f13e6eb4cb9452ac1d2b67a5344a1 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 e7ddc4da67fba442cbb500a87b759a6540f07e91..fcbcfa72e5295fd8eca570136e90c12453be6625 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 b39e597b63b6e97f0fd634c1d8fb396ee77f47d1..9c02fe52f6f625e087f4fd479559bd5251b155b9 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 20898728ca0d22c27ced9a3787f6df8ec098aab8..aae547f49c4fa21e6cd6a8320f384f2930dac375 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 97c7e828e918372d927ed49e445002843fe53ce1..fbebe28689ee9b5176d6ed1d68f444beca9dcc48 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 7ce18829cb95b078be385d3c7753d3a4e1409cb2..8cbea1e7b33b4506804c444f2e95bdd931ec9bca 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 91055a5981b55ea15844169adc287434a85351cd..7a198f290fb4c0f3efb07420505153feb6f5de99 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 059c975da36c9e591a238dda7eac4d2fbad4a2fd..55b5667da003f76be062936600b6366118c859c3 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 8cc2d2267d3ce74c2a410e52ad7b686df7bdf6b3..abcd15a5d77518fc899cbae83916ef540fa98bb9 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 989457105528330a18fad7ac8b3c4ba518047f08..8174f23870ff353166f5d8b1d26881ae7b379f25 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 972cbdf0abd62a95dc6aa64b3d9969a9deebd370..5a4d4d0e0e448cc9eb2da042e45ea5e980a3c891 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 225d8d6c61b0afd701a1f7a6c91aabd101906785..bffb159ba84cac0d96029b399650de4228a030a2 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 e8c3775025100cc8bb347a99dfda8670c3f1fa04..ba2c69a9e0665763ea4e10aa09a9b6752c8df622 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 4d724479b32636f77a869f5dfba61d0d77525b5d..903cd9e6a953081d669ccb570d2460d2d60975a0 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 bbbb31acd165ba8550c76703dc47f05546c3fe0c..6e2cf8ce3f287cea62982474f326bf3395c472ee 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 5facb27a223a34b1175f3741b45f650906e98aee..554f9c249ea0d993c6390b307948580b60a9c235 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 12b1324ec3c333d72acad96589746adbbb4e03e9..166c225ae19b7a61dceb8ec22c19bd508f163fd4 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 9170e39f30de1ac69d84ae43026b626119893d16..737b3f193dc43bcfa014cf78b0d96d4ae293236f 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 57a1963cf851ab839742964cd2cbd5552bc96d59..7bbd81602578ba9583b7e6016be404262dc6f7a5 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 0504dd36b0036c6d14ced575ce55a856dc68f81f..402f451790dd0ab4adf967da7136eb828f9dee82 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 929a29c040e0e24769f87e445199e98e9720764a..dbf3c483d02b34f93458a99ce2b406820358a605 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 0b811ec6bd39e6ea54bada75dab1c0dce0038cda..af13a48e3507e0f7dc6aa8e64eb9e79781889cf6 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 5289421796e14142f44c83cb789b0c4adeb1afa9..f3757a4e4622659ad75aa189e92960b150ecafab 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 34de25fd73d0374a371ce4e4c5d5cb2aa957bcee..93c74aad320894bce7feff73a97c45990d206b9b 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 b6e3b5b2c65a53c9a093ae636d12d36703bdd618..5f25a7487038e1d856f355ec05e76e8ece53ab24 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 ee003f2b3781315b4b6cd4cb43e120a6206d9d43..7a20272afc12ae984fb3a6edbcdd305fe9ac9afe 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 7c5d2c38beddd88b45fc84cdcab13bb1fd53a3dc..55852046f41d0d826e3ed4d9318a7afcf3a8b0e4 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 17c55e4eb5a654c98bbbab6858214b8a1bd97fb5..de5adfbcd73416d49b7d6c9568c72da77e93c056 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 49c2e203eabf201b033bbddccb03c6304d1030d7..783df6ab6e98b4a15ad19860678af28b58161bb1 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 b4e8cf3202c05ea62c7c20157e6971ac4f61c81a..b8836846642c4781c9a27be0b28d643aebfe3c3f 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 71356161bddc259e173931390a31184bfd72aa78..486f96063e71b11643d96d1d04c13be92b18a516 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 b3cae91f4e8d27d1cabd62465231143decd784c6..f713cac88f2de216ddfbeca688b0772b8b746a7e 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 3e43d70a15c3b6635828e104b3fda659a00ada9b..a17f04b500a38acfb19bc5e46a30c298cc1c48ca 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 8fd323709e5e007c97b38fdda98a7a00a75c1455..54580c6b32b5b81bec2aabc98c74e917b373c5a9 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 1eee7ad008dbd0fe281575c2cc20044317e0d089..889dbc03af8d478d1d441c5a5505e75777346234 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 2d97db18838421cdd3d3281a0353cf61ecf96c0c..6cd186b67c9d1c4f7d43ce7a2a9a21ea70cd7b3f 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 221497a6492c04ecfa52bd2c76370ea524abf04a..c930a6d0de376bc1118a70204efda8b25c80d870 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 9902f6d3c4f28df039289baf1c2a7244524537f0..2198f0df7ed3b311e87ef5494c2b2e88ea14512e 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 aeaa0e3207a9cdfbca04c8b06530d3c0600af1fc..224364b1b2cf0976000d8ff0b896816fdc12c328 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 742dfa0b07008c5175fdbfaece87c02356f3ee67..b127d033804c1659c4217c6e9bff8a6f07adb23a 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 17f1166cd8a13c7b5fe34814f49375fdac7eea62..c1fb9290a48738f459091ada0f724773969c7c84 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 c53591d8e05f79d0d4d098b1629a8ebc85358562..fc3b6753b82af214f5ab684b9f3c3dfa5c3f6509 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 665e4dcafc07ab5e82152bbcc888ba35f067e186..0f4c522e1bfb23e1d520a61eb71585d99f17ac3d 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 d73188b7a85ef5dc1cab9863e12ee51d65ddc336..621209f63bd603400f0eca0e54b84c5e462c80c9 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 e7a725cadbbbb439d333c2aebc20874826a26455..0be423eb8749cf5a531c4491c422aebc38bec816 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 1a82cb08819810a6ba25ad5066c76f188950ad44..a22b1865f3150236f7b6f531f6f9f2bd2d90556c 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 9eefea72f5b7b5d056414d237dfe722af29f170b..2d4167321eee6daa818f23e6f5a054a5621d1373 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 e2825bd7839d7e313579c82a5c36d6ac6adf1cfa..3c2a6b1714f262652b0640f5cc03cb1c4960f82f 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 bb85e1dfd8aa18106f09246b492421676419a4bd..c75b01ef44cf47bf91c6ec133d60c2564f1c5fcb 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 e73a6da9c49685fd2916b3815e9a49a8b059990a..9a128f97072c611cf37e6cdb7f647dd6864c19c8 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 0d9c5591c096db087f34cabdef2a54b429f2d218..86e8505154fc367c2106b4b06fdcdc5da46e7504 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 05d94121bd23b89f6f5e5299e19ed9c0da7dce60..b16d19871eda3c5804fbbaf1a8949ef2dd528960 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 3bf6449c2e36e71d3ca42c0596fb6ae546e7dd1f..f88bd33be438c4b530c928962dad79d91c3618b6 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 38d97defaae86c1ff58ae4569af9a686c0dabc05..3007f1aed7179bcbd5228ada1f00a6608aa76005 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 c53f4049b630b9bc7a944a73d5cb15868cc9e45d..7c9d8f8cfda90465335e6d30fb4700b12ad3b6d2 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 a82e44c903729390f11ab449b99591a3bf155d28..7782b001111e92a42f2c1611d8900b43726542e7 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 a877f3d63a006d368b788970487f3e38874b32c4..8d45bb39837fbdd1058799b41c75af1f9ffac58a 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 9dde4a875d8aacd28fbd3b3121f0e7b494341123..64112141172d76ff0154dfd1fe157c24021a8172 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 2c191af31fb5e3d9a506e5518c1227ae333e6f0a..72426c43a660de9028ab9cb62696a205b2c00811 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 62c8d239b212e6681f74524e526537e419ec3bcd..c5f8a27088d481fd9de42dbb5ba6f83707206140 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 51b73361f80c4f1571bfb194495487fa3cb43378..01822e7c72f0f4793322f3534845b48d20b533b4 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 5f316aeec9506b4d9da1e49f9589233340b1c608..38a1ef322cdadc2cb3cfa0e462b9b0c8b627beb5 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 aa60310a252045a42c4990995ab3e224d53b46ef..d90d4bcea8de8d663b4ab08e398e4679d31b5549 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 f17c4be3a439f2b1048020de10eb14e59042dbd8..1b45cb5e14108ad9c3c51fd58684a4ddebb1ccef 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 b8a99828852e8709239b3ae615d3b90d3e758a70..b537cb26e262e83e83d2a983c260b41a6a5dc800 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 7ce5889de8c55a7b0dc233a58e295bb7466eb2a9..9432cf07206b1dd987a405e1d106e8fa623e9906 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 157fb562f4ba2c1a04503ce0aecee1d8a2fe596b..2d4b0cc6491db508f4e0c2833da944641c7ebc0a 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 07d51498d9992ec8ecbafb4d4457d1d07f0a7f66..8d0b9dfd45e099efc8b8fcc3d67594253a62af71 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 97fccd2e1addf5cdb1d0503149993790fce90b16..cffaeb9bdb0ce0f483150f03f7d2f32c612354cb 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 c6541e1f459cd09676822380a7bb5952767664ed..14f4d14a1918fd470b687541af8ec39fc1ac1186 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 541502ab31f11934db007e34d7160696ea069563..b751267e6a137d1c633928052b3596098c9df53a 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 15d377d2f54768e5491e86ebf7a3ab1a86d11990..1f8ee784e80b8cedc67062d8cffdb95de0b1d6cd 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 b01f66ef6c8614df22bec6e5f569435f75f86c7e..b833123f9a4b78e6f411569c1652e57871bb78a6 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 1c4c4fce1a7ffa6aa2c4209b06faa660e868dd2c..b242c4080ac12d1d2dc01a9772d0c2dfcf34dc94 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 bbfedfdb46ff2f9bbf0f10d26d199d44e2f4150e..e582ddb0ce175faf8b1e75d454349b514b2c7abd 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 46cdf6ed86834c5135215a19113378a2bd81860d..7ad8fc83d9819dbc67634ac6a370259799ae95cb 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 4f656ee0a777b138455b8912fd40826ef5ba025d..e82ef5566e813e45b0d7d2514e8410b8b3322109 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 0fb84ce4175570d538138c2439d268c98c10b995..f3cde572b1d27dee1d7df9a150de3857839de20b 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 1d01331d618614348548194998693b94e36a4cb7..7a480b2f0a7f8a7ebae37ae19a40a930f33e3b9b 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 f1efa22d431bdc0c732e65d1f511f4f610b0e8a1..9c20fdb068f0c51269d91ebe63c843db1bdbb24f 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 8cfefb75165c6639024517980b6a38657e26d945..f0f005064d2d148f51636d0537ede2c6f144e7a7 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 fb9b4583ec82712029c50db9d1c00bac42b38d5a..c65309aabf5e174346441176c85d0325cadf299a 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 414c563ada38093e1a00612bc24370bfe51f92f5..ad54fb74ae0e45ebf71f79e748e930cf3edc3a70 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 e1960e809e0bf13f5b27b5b6af75c7f9cb4596aa..df33e11b7a97692839d60f704c59abae761e4ea8 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 9d030f31fcf52abb7d1fde4d5b6656475a551681..12e14d6aecf4c8fe4c7f72c1abf18cf7f653b95b 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 268565fdf0a829b865f737f98a03b9c812a9df7c..92a14dbb7a89f1dc8a70c2a738779094404ac16e 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 39d2bf5df2fad53f72c778af174d6a45985501a2..70ef4d43d1aa5abed0c73a68bdc6cff3d9715c53 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 394f93d1368032bce46a06c00b6245b4f821d409..c590912c2899fc580a3052155bfa0f874ed433db 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 ea863f61668028ae5b76710a70c39e9c6d3a0204..174ccbfebcaa53822b43f476380909f0f1f2fd57 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 01cab016ef38fe4076632e034a25117d474dd326..a7ddbf433ee481540cc44d37bf1a0ab4377af9ee 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 423c213955df775c1ca0780414ad1ffc805cdf34..9d27752489fffdef10601ee25aa634fd427d627e 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 bda339be0fe65fb1aeffdefb15a38d9245183712..cba78198677b01f6843b94c625a3a0a41bbee85b 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 a4348b7d5e5e82484842bb0bc3a02ed8d5ffa830..2616d1b899261f58d3151f7fcb9fb3e97081741b 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 b051dfe4482284ac30f04fd5b7de0bd7c9e9c15e..f5e3129610aa70f3e137b38fd5e2f1a1fba2fff3 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 8dbbc988f3f409d3a89ce7e66921791a8e09c479..8c9308a6265154dfe13a276e96e693135b23de84 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 9d7f87929e3588d3902b7e76d81ba104d2b5ab8c..28580675bfa24111261a014a52f56210001959b0 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 88917ef087d7695d7d13d9792ca4ee0c940d909e..b77b18761751c12949c7f5e017448a07dd333a46 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 a9c7577fe6adb74098540c9ad9229a17a611183f..5ad88c511e96a1960bc600d928f43ce6603964e0 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 4c0039dbc09648fdd7caec2d5b7b008e77dfaab0..44b5651ab18743dc11fdc5aaf3e2a3be4aab6a74 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 7293ba61811795fd7bf2951fdf5723e43d6d5a39..80d609c5e0ad735e9ab21e87e8721f3c9eaa4f94 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 df7d2410864866803496d34f6b2581a25987e935..123e907fadab2c25e5f5467e0a4b932413c0d256 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 e4ec061d522fbb0ac78b15ce063c44262165833f..f47ad90b8ade2bc08baf7c6f86b685005e4022f8 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 faba4c317db11855b5de28a9ab360a8c2698f900..4557c046ecf0d4961e4c068b6fc5afce14d0529d 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 f17b9f9ff9bdc2309d74f55031ca76049e83c22b..10b06b931237b25e1a21f6f8ca8420e518125159 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 7ee493ced51b0e4a52ccc567efbeb312a3cee679..fb5e9f5641c01d3182826fe943d96939ba4171fd 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 2cdc006a90961862bc09348c2989f3c7540b4b93..3ff4f626934d67219004cf2c5e8b604b572456b3 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 ab5f9dc1e3e411a8b3051236c2892adc4cbbf0cd..dc5b9b0ce36db0228efcc63db3eba996a12225b9 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 cfc5bb42ca01b6f245ac01e9093a51b53ae38b5b..1f8de799d4efb89e90e98f960d7c108248f666c4 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 c4ca6576424275a0adfe22354117a20df071029e..5361faddace91de4d08df3b46577622c7d5bbaa0 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 8d88015a429ff20daa56d16b5d714660cc5f2551..f903327b92bda2ae913b737fe55f9be099702cfa 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 2317c98bd76aaf98889b57db89a9ed14bfc30798..6b7f40d9da40573ff12d23f4bdd989b818006482 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 f55bd9a1fd7d3e319d752ff0b65d708cd5f38efd..a20c095ff83fb01d8466d852167f48dafcc2d00e 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 38f9576b42b7cc5e09ba9860768ed20df509dafb..6e99eac731d00630d5123ffd66322f0469a0726f 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 da4b3291b1f04f0f3c5d9fb848e37426700f3b53..5d9ed8f0f1b1eb6655e484d01ebe837f7fc62fb9 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 d2670709a2572e9308bbb507cac5d07dd767a626..b732b598ba22306afa0c560d2ccc7e36ed08201c 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));