fix aafwk bugs.

Signed-off-by: zhongjianfei <zhongjianfei@huawei.com>
Change-Id: I8815cd8a89e29add0a335484a17bb6e79da94f57
This commit is contained in:
zhongjianfei
2022-03-10 20:40:23 +08:00
parent 1288bd4e14
commit 8f61b77aee
252 changed files with 1354 additions and 490 deletions
+8
View File
@@ -24,3 +24,11 @@ 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
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -30,7 +30,6 @@ namespace AppExecFwk {
/**
* Base implementation for interface of TaskDispatcher.
*/
class BaseTaskDispatcher : public TaskDispatcher {
public:
BaseTaskDispatcher(const std::string &dispatcherName, const TaskPriority priority);
@@ -90,7 +89,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.
*
@@ -110,7 +109,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.
*
*/
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -55,6 +55,7 @@ struct PriorityTaskWrapper {
static constexpr int DEFAULT_PRIORITY_WEIGHT = 1;
static constexpr int LOW_PRIORITY_WEIGHT = 0;
};
struct CompareTaskPriority {
bool operator()(const std::shared_ptr<PriorityTaskWrapper> &wrapper1,
const std::shared_ptr<PriorityTaskWrapper> &wrapper2) const
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -12,7 +12,6 @@
* 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
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -95,7 +95,7 @@ bool GroupImpl::AddNotification(const std::shared_ptr<Runnable> &notification)
if (count_.load() != 0) {
std::unique_lock<std::mutex> lock(dataMutex_);
if (notifications_.size() == MAX_TASK) {
HILOG_WARN("GroupImpl::AddNotification called maximun number of tasks exceeded");
HILOG_WARN("GroupImpl::AddNotification called maximum number of tasks exceeded");
return false;
}
if (count_.load() != 0) {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
+5 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -208,9 +208,10 @@ void Task::ConcurrentQueueStatusUpdate(const TaskStage::TASKSTAGE taskstage)
bool Task::operator==(std::shared_ptr<Task> &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
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -49,7 +49,7 @@ WorkerPool::~WorkerPool()
bool WorkerPool::Init(const std::shared_ptr<WorkerPoolConfig> &config)
{
if (CheckConfigParams(config) == false) {
if (!CheckConfigParams(config)) {
HILOG_ERROR("WorkerPool::checkConfigParams parameters are illegal");
return false;
}
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -64,7 +64,7 @@ std::shared_ptr<ParallelTaskDispatcher> 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<ParallelTaskDispatcher> ptr = CreateMtParallelTaskDispatcher(name, TaskPriority::DEFAULT);
std::atomic<int> count(0);
std::shared_ptr<Runnable> runnable = std::make_shared<Runnable>([&]() {
@@ -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<ParallelTaskDispatcher> ptr = CreateMtParallelTaskDispatcher(name, TaskPriority::DEFAULT);
std::atomic<int> 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<ParallelTaskDispatcher> ptr = CreateMtParallelTaskDispatcher(name, TaskPriority::DEFAULT);
std::shared_ptr<Group> group = ptr->CreateDispatchGroup();
ptr->AsyncGroupDispatch(group, std::make_shared<Runnable>([&]() {
@@ -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);
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -34,6 +34,7 @@ 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);
@@ -47,6 +48,7 @@ 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) {
@@ -344,7 +344,7 @@ ErrCode AbilityContextImpl::RestoreWindowStage(NativeEngine& engine, NativeValue
ErrCode AbilityContextImpl::StartAbility(
const AAFwk::Want& want, const std::shared_ptr<CallerCallBack> &callback)
{
if (!localCallContainer_) {
if (localCallContainer_ == nullptr) {
localCallContainer_ = new (std::nothrow)LocalCallContainer();
}
@@ -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_METHOD1(UninstallApp, int(const std::string &bundleName));
MOCK_METHOD2(UninstallApp, int(const std::string &bundleName, int32_t uid));
MOCK_METHOD2(
GetWantSender, sptr<IWantSender>(const WantSenderInfo &wantSenderInfo, const sptr<IRemoteObject> &callerToken));
MOCK_METHOD2(SendWantSender, int(const sptr<IWantSender> &target, const SenderInfo &senderInfo));
@@ -140,6 +140,7 @@ 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<IRemoteObject> &token));
MOCK_METHOD2(GetWantSenderInfo, int(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info));
@@ -55,7 +55,7 @@ void AbilityCallerTest::SetUpTestCase(void)
OHOS::sptr<OHOS::IRemoteObject> abilityObject = new (std::nothrow) MockServiceAbilityManagerService();
auto sysMgr = OHOS::DelayedSingleton<SysMrgClient>::GetInstance();
if (sysMgr == NULL) {
if (sysMgr == nullptr) {
GTEST_LOG_(ERROR) << "fail to get ISystemAbilityManager";
return;
}
+7 -1
View File
@@ -12,6 +12,7 @@
# 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"
@@ -253,7 +254,6 @@ 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,6 +270,12 @@ 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",
@@ -49,17 +49,17 @@ public:
std::shared_ptr<ContextDeal> &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();
/**
+15 -1
View File
@@ -23,7 +23,9 @@
#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"
@@ -31,7 +33,9 @@
#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"
@@ -2116,10 +2120,14 @@ 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<AbilityRuntime::WantAgent::WantAgent>(wantAgent), abilityInfo_->name, GetToken());
return BackgroundTaskMgr::BackgroundTaskMgrHelper::RequestStartBackgroundRunning(taskParam);
#else
return ERR_INVALID_OPERATION;
#endif
}
/**
@@ -2129,7 +2137,11 @@ 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
@@ -3235,7 +3247,9 @@ std::shared_ptr<NativeRdb::DataAbilityPredicates> Ability::ParsePredictionArgsRe
HILOG_INFO("Ability::ParsePredictionArgsReference push_back done");
}
predicates->SetWhereArgs(strPredicatesList);
if (predicates) {
predicates->SetWhereArgs(strPredicatesList);
}
return predicates;
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -195,7 +195,7 @@ void AbilityWindow::OnPostAbilityStop()
if (windowScene_) {
windowScene_ = nullptr;
HILOG_INFO("AbilityWindow::widow windowScene_ release end.");
HILOG_INFO("AbilityWindow::window windowScene_ release end.");
}
isWindowAttached = false;
@@ -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}d, flags= %{public}d.", __func__, code, option.GetFlags());
HILOG_INFO("%{public}s called begin, code = %{public}u, flags= %{public}d.", __func__, code, option.GetFlags());
std::u16string remoteDescriptor = data.ReadInterfaceToken();
if (remoteDescriptor != ReverseContinuationSchedulerReplicaStub::GetDescriptor()) {
HILOG_ERROR("ReverseContinuationSchedulerReplicaStub::OnRemoteRequest token is invalid");
@@ -250,8 +250,7 @@ std::shared_ptr<DataAbilityHelper> 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;
}
@@ -855,25 +854,31 @@ bool DataAbilityHelper::CheckUriParam(const Uri &uri)
return false;
}
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");
// do not directly use uri_ here, otherwise, it will probably crash.
std::vector<std::string> segments;
{
std::lock_guard<std::mutex> 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");
return false;
}
std::vector<std::string> checkSegments;
checkUri.GetPathSegments(checkSegments);
std::vector<std::string> segments;
uriSp->GetPathSegments(segments);
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;
}
uri_->GetPathSegments(segments);
}
std::vector<std::string> checkSegments;
checkUri.GetPathSegments(checkSegments);
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;
}
HILOG_INFO("DataAbilityHelper::CheckUriParam end.");
return true;
}
@@ -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(%p) error", dataAbilityOperation);
HILOG_ERROR("DataAbilityOperation::Unmarshalling dataAbilityOperation error");
delete dataAbilityOperation;
dataAbilityOperation = nullptr;
}
@@ -116,7 +116,7 @@ private:
};
NativeValue* lastParam =
(info.argc == UPDATE_FORM_PARAMS_SIZE) ? nullptr : info.argv[UPDATE_FORM_PARAMS_SIZE];
(info.argc == UPDATE_FORM_PARAMS_SIZE) ? nullptr : info.argv[UPDATE_FORM_PARAMS_SIZE - 1];
NativeValue* result = nullptr;
AsyncTask::Schedule(
engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result));
@@ -452,6 +452,7 @@ std::shared_ptr<NativeRdb::AbsSharedResultSet> JsDataShareExtAbility::Query(cons
HILOG_INFO("%{public}s begin.", __func__);
std::shared_ptr<NativeRdb::AbsSharedResultSet> ret;
if (!CheckCallingPermission(abilityInfo_->readPermission)) {
HILOG_ERROR("%{public}s Check calling permission failed.", __func__);
return ret;
}
@@ -46,7 +46,7 @@ void NewAbilityImpl::HandleAbilityTransaction(const Want &want, const AAFwk::Lif
#endif
SetLifeCycleStateInfo(targetState);
if (lifecycleState_ == AAFwk::ABILITY_STATE_INITIAL) {
if (ability_ && lifecycleState_ == AAFwk::ABILITY_STATE_INITIAL) {
ability_->SetStartAbilitySetting(targetState.setting);
ability_->SetLaunchParam(targetState.launchParam);
Start(want);
@@ -45,7 +45,7 @@ void PageAbilityImpl::HandleAbilityTransaction(const Want &want, const AAFwk::Li
SetLifeCycleStateInfo(targetState);
if (lifecycleState_ == AAFwk::ABILITY_STATE_INITIAL) {
if (ability_ && lifecycleState_ == AAFwk::ABILITY_STATE_INITIAL) {
ability_->SetStartAbilitySetting(targetState.setting);
Start(want);
CheckAndRestore();
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -26,9 +26,7 @@ using OHOS::AppExecFwk::ElementName;
namespace OHOS {
namespace AAFwk {
MockAbilityManagerService::MockAbilityManagerService() : abilityScheduler_(nullptr)
{
abilityScheduler_ = nullptr;
}
{}
MockAbilityManagerService::~MockAbilityManagerService()
{}
@@ -173,7 +171,7 @@ int MockAbilityManagerService::KillProcess(const std::string &bundleName)
return 0;
}
int MockAbilityManagerService::UninstallApp(const std::string &bundleName)
int MockAbilityManagerService::UninstallApp(const std::string &bundleName, int32_t uid)
{
return 0;
}
@@ -160,6 +160,7 @@ public:
MOCK_METHOD2(SetMissionLabel, int(const sptr<IRemoteObject> &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<IRemoteObject> &token));
MOCK_METHOD1(GetAbilityRunningInfos, int(std::vector<AbilityRunningInfo> &info));
MOCK_METHOD2(GetExtensionRunningInfos, int(int upperLimit, std::vector<ExtensionRunningInfo> &info));
@@ -198,7 +199,7 @@ public:
int KillProcess(const std::string &bundleName) override;
int UninstallApp(const std::string &bundleName) override;
int UninstallApp(const std::string &bundleName, int32_t uid) override;
int TerminateAbilityByCaller(const sptr<IRemoteObject> &callerToken, int requestCode) override
{
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -287,7 +287,7 @@ public:
{
return "";
};
// obtains information about an application bundle contained in a ohos Ability Package (HAP).
// obtains information about an application bundle contained in an ohos Ability Package (HAP).
virtual bool GetBundleArchiveInfo(
const std::string &hapFilePath, const BundleFlag flag, BundleInfo &bundleInfo) override
{
@@ -59,7 +59,7 @@ void AbilityContextTest::SetUpTestCase(void)
GTEST_LOG_(INFO) << "AppExecFwk_AbilityContext_SetUpTestCase abilityObject->" << abilityObject.GetRefPtr();
auto sysMgr = OHOS::DelayedSingleton<SysMrgClient>::GetInstance();
if (sysMgr == NULL) {
if (sysMgr == nullptr) {
GTEST_LOG_(ERROR) << "fail to get ISystemAbilityManager";
return;
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -51,7 +51,7 @@ void AbilityPermissionTest::SetUpTestCase(void)
auto sysMgr = OHOS::DelayedSingleton<SysMrgClient>::GetInstance();
if (sysMgr == NULL) {
if (sysMgr == nullptr) {
GTEST_LOG_(ERROR) << "fail to get ISystemAbilityManager";
return;
}
@@ -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 = CONTEXT_DATA_STORAGE + CONTEXT_ELS[0] + CONTEXT_BUNDLE;
dir = LOCAL_CODE_PATH;
}
CreateDirIfNotExist(dir);
HILOG_DEBUG("ContextImpl::GetBundleCodeDir:%{public}s", dir.c_str());

Some files were not shown because too many files have changed in this diff Show More