mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-27 01:10:52 +00:00
remove unused info.
Signed-off-by: zhangyafei-echo <zhangyafei12@huawei.com> Change-Id: I60b95f7adcb39d5bd62201106a718bd84dbbdf48
This commit is contained in:
parent
4bcfbc929d
commit
e9bc4c3e38
@ -1197,18 +1197,12 @@ bool UIAbility::CheckRecoveryEnabled()
|
||||
|
||||
bool UIAbility::CheckDefaultRecoveryEnabled()
|
||||
{
|
||||
if (setting_ == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::UIABILITY, "null setting_");
|
||||
if (abilityContext_ == nullptr) {
|
||||
TAG_LOGW(AAFwkTag::UIABILITY, "context invalid");
|
||||
return false;
|
||||
}
|
||||
|
||||
auto value = setting_->GetProperty(AppExecFwk::AbilityStartSetting::DEFAULT_RECOVERY_KEY);
|
||||
if ((!useAppSettedRecoveryValue_.load()) && (value == "true")) {
|
||||
TAG_LOGD(AAFwkTag::UIABILITY, "default recovery enabled");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return abilityContext_->GetRestoreEnabled();
|
||||
}
|
||||
|
||||
bool UIAbility::IsStartByScb()
|
||||
|
@ -309,7 +309,7 @@ private:
|
||||
wptr<IRemoteObject> sessionToken_;
|
||||
std::mutex uiExtensionMutex_;
|
||||
std::map<int32_t, Want> uiExtensionMap_;
|
||||
std::atomic<bool> restoreEnabled_ = true;
|
||||
std::atomic<bool> restoreEnabled_ = false;
|
||||
|
||||
static void RequestDialogResultJSThreadWorker(uv_work_t* work, int status);
|
||||
void OnAbilityResultInner(int requestCode, int resultCode, const AAFwk::Want &resultData);
|
||||
|
@ -305,12 +305,6 @@ ohos_prebuilt_etc("ams_extension_config.json") {
|
||||
part_name = "ability_runtime"
|
||||
}
|
||||
|
||||
ohos_prebuilt_etc("default_recovery_config.json") {
|
||||
source = "resource/default_recovery_config.json"
|
||||
subsystem_name = "ability"
|
||||
part_name = "ability_runtime"
|
||||
}
|
||||
|
||||
ohos_prebuilt_etc("start_ability_without_caller_token.json") {
|
||||
source = "resource/start_ability_without_caller_token.json"
|
||||
subsystem_name = "ability"
|
||||
@ -462,7 +456,6 @@ group("ams_service_config") {
|
||||
deps = [
|
||||
":ams_service_config.json",
|
||||
":deeplink_reserve_config.json",
|
||||
":default_recovery_config.json",
|
||||
":start_ability_without_caller_token.json",
|
||||
":uiextension_picker_config.json",
|
||||
]
|
||||
|
@ -95,7 +95,6 @@ abilityms_files = [
|
||||
"src/scene_board/status_bar_delegate_manager.cpp",
|
||||
"src/scene_board/ui_ability_lifecycle_manager.cpp",
|
||||
"src/deeplink_reserve/deeplink_reserve_config.cpp",
|
||||
"src/app_recovery/default_recovery_config.cpp",
|
||||
|
||||
#connection observer
|
||||
"src/connection_observer_controller.cpp",
|
||||
|
@ -2232,7 +2232,6 @@ private:
|
||||
void InitInterceptorForScreenUnlock();
|
||||
void InitPushTask();
|
||||
void InitDeepLinkReserve();
|
||||
void InitDefaultRecoveryList();
|
||||
|
||||
bool CheckSenderWantInfo(int32_t callerUid, const WantSenderInfo &wantSenderInfo);
|
||||
|
||||
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_ABILITY_RUNTIME_DEFAULT_RECOVERY_CONFIG_H
|
||||
#define OHOS_ABILITY_RUNTIME_DEFAULT_RECOVERY_CONFIG_H
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "singleton.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
namespace DefaultRecoveryConstants {
|
||||
constexpr int32_t RESERVE_NUMBER_INVALID = 0;
|
||||
constexpr int32_t TIMEOUT_DELETE_TIME_INVALID = 0;
|
||||
} // namespace DefaultRecoveryConstants
|
||||
|
||||
class DefaultRecoveryConfig {
|
||||
public:
|
||||
static DefaultRecoveryConfig &GetInstance()
|
||||
{
|
||||
static DefaultRecoveryConfig instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
~DefaultRecoveryConfig() = default;
|
||||
bool LoadConfiguration();
|
||||
bool IsBundleDefaultRecoveryEnabled(const std::string &bundleName);
|
||||
int32_t GetReserveNumber();
|
||||
int32_t GetTimeoutDeleteTime();
|
||||
|
||||
private:
|
||||
std::string GetConfigPath();
|
||||
bool ReadFileInfoJson(const std::string &filePath, nlohmann::json &jsonBuf);
|
||||
bool LoadDefaultRecovery(const nlohmann::json &object);
|
||||
DefaultRecoveryConfig() = default;
|
||||
DISALLOW_COPY_AND_MOVE(DefaultRecoveryConfig);
|
||||
|
||||
private:
|
||||
// It was set in Init() of abilityms.
|
||||
std::unordered_set<std::string> bundleNameList_;
|
||||
int32_t reserveNumber_ = DefaultRecoveryConstants::RESERVE_NUMBER_INVALID;
|
||||
int32_t timeoutDeleteTime_ = DefaultRecoveryConstants::TIMEOUT_DELETE_TIME_INVALID;
|
||||
};
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_ABILITY_RUNTIME_DEFAULT_RECOVERY_CONFIG_H
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"default_recovery": {
|
||||
"support_bundle_name_list": [],
|
||||
"reserve_number_when_timeout": 5,
|
||||
"recovery_data_timeout_delete_time": 168
|
||||
}
|
||||
}
|
@ -27,7 +27,6 @@
|
||||
#endif
|
||||
#include "app_utils.h"
|
||||
#include "app_exit_reason_data_manager.h"
|
||||
#include "app_recovery/default_recovery_config.h"
|
||||
#include "application_util.h"
|
||||
#include "recovery_info_timer.h"
|
||||
#include "assert_fault_callback_death_mgr.h"
|
||||
@ -329,7 +328,6 @@ bool AbilityManagerService::Init()
|
||||
InitInterceptor();
|
||||
InitStartAbilityChain();
|
||||
InitDeepLinkReserve();
|
||||
InitDefaultRecoveryList();
|
||||
|
||||
abilityAutoStartupService_ = std::make_shared<AbilityRuntime::AbilityAutoStartupService>();
|
||||
InitPushTask();
|
||||
@ -349,13 +347,6 @@ void AbilityManagerService::InitDeepLinkReserve()
|
||||
}
|
||||
}
|
||||
|
||||
void AbilityManagerService::InitDefaultRecoveryList()
|
||||
{
|
||||
if (!DefaultRecoveryConfig::GetInstance().LoadConfiguration()) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Load default recovery list failed.");
|
||||
}
|
||||
}
|
||||
|
||||
void AbilityManagerService::InitInterceptor()
|
||||
{
|
||||
interceptorExecuter_ = std::make_shared<AbilityInterceptorExecuter>();
|
||||
@ -5995,11 +5986,6 @@ int AbilityManagerService::GenerateAbilityRequest(const Want &want, int requestC
|
||||
request.callerToken = callerToken;
|
||||
auto setting = AbilityStartSetting::GetEmptySetting();
|
||||
if (setting != nullptr) {
|
||||
auto bundleName = want.GetElement().GetBundleName();
|
||||
auto defaultRecovery = DefaultRecoveryConfig::GetInstance().IsBundleDefaultRecoveryEnabled(bundleName);
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "bundleName: %{public}s, defaultRecovery: %{public}d.", bundleName.c_str(),
|
||||
defaultRecovery);
|
||||
setting->AddProperty(AbilityStartSetting::DEFAULT_RECOVERY_KEY, defaultRecovery ? "true" : "false");
|
||||
setting->AddProperty(AbilityStartSetting::IS_START_BY_SCB_KEY, "false"); // default is false
|
||||
request.startSetting = std::make_shared<AbilityStartSetting>(*(setting.get()));
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ namespace AAFwk {
|
||||
const std::string AbilityStartSetting::BOUNDS_KEY = "bounds";
|
||||
const std::string AbilityStartSetting::WINDOW_DISPLAY_ID_KEY = "windowId";
|
||||
const std::string AbilityStartSetting::WINDOW_MODE_KEY = "windowMode";
|
||||
const std::string AbilityStartSetting::DEFAULT_RECOVERY_KEY = "defaultRecovery";
|
||||
const std::string AbilityStartSetting::IS_START_BY_SCB_KEY = "isStartByScb";
|
||||
constexpr uint32_t CYCLE_LIMIT = 1000;
|
||||
|
||||
|
@ -1,149 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "app_recovery/default_recovery_config.h"
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <unistd.h>
|
||||
#include <regex>
|
||||
|
||||
#include "config_policy_utils.h"
|
||||
#include "hilog_tag_wrapper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
namespace {
|
||||
constexpr const char* CONFIG_PATH = "/etc/default_recovery_config.json";
|
||||
constexpr const char* DEFAULT_RESERVE_CONFIG_PATH = "/system/etc/default_recovery_config.json";
|
||||
constexpr const char* ITEM_DEFAULT_RECOVERY_NAME = "default_recovery";
|
||||
constexpr const char* SUPPORT_BUNDLE_NAME_LIST = "support_bundle_name_list";
|
||||
constexpr const char* RESERVE_NUMBER_WHEN_TIMEOUT = "reserve_number_when_timeout";
|
||||
constexpr const char* RECOVERY_DATA_TIMEOUT_DELETE_TIME = "recovery_data_timeout_delete_time";
|
||||
}
|
||||
|
||||
std::string DefaultRecoveryConfig::GetConfigPath()
|
||||
{
|
||||
char buf[MAX_PATH_LEN] = { 0 };
|
||||
char *configPath = GetOneCfgFile(CONFIG_PATH, buf, MAX_PATH_LEN);
|
||||
if (configPath == nullptr || configPath[0] == '\0' || strlen(configPath) > MAX_PATH_LEN) {
|
||||
return DEFAULT_RESERVE_CONFIG_PATH;
|
||||
}
|
||||
return configPath;
|
||||
}
|
||||
|
||||
bool DefaultRecoveryConfig::LoadConfiguration()
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "Load configuration.");
|
||||
std::string configPath = GetConfigPath();
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "Default recovery config path is: %{public}s.", configPath.c_str());
|
||||
nlohmann::json jsonBuf;
|
||||
if (ReadFileInfoJson(configPath, jsonBuf)) {
|
||||
if (!LoadDefaultRecovery(jsonBuf)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Load configuration failed.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DefaultRecoveryConfig::IsBundleDefaultRecoveryEnabled(const std::string &bundleName)
|
||||
{
|
||||
if (bundleNameList_.find(bundleName) != bundleNameList_.end()) {
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "Find bundleName %{public}s.", bundleName.c_str());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t DefaultRecoveryConfig::GetReserveNumber()
|
||||
{
|
||||
return reserveNumber_;
|
||||
}
|
||||
|
||||
int32_t DefaultRecoveryConfig::GetTimeoutDeleteTime()
|
||||
{
|
||||
return timeoutDeleteTime_;
|
||||
}
|
||||
|
||||
bool DefaultRecoveryConfig::LoadDefaultRecovery(const nlohmann::json &object)
|
||||
{
|
||||
if (!object.contains(ITEM_DEFAULT_RECOVERY_NAME)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Default recovery config not existed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
const nlohmann::json &jsonObject = object.at(ITEM_DEFAULT_RECOVERY_NAME);
|
||||
if (jsonObject.contains(SUPPORT_BUNDLE_NAME_LIST) && jsonObject[SUPPORT_BUNDLE_NAME_LIST].is_array()) {
|
||||
for (const auto &value : jsonObject.at(SUPPORT_BUNDLE_NAME_LIST)) {
|
||||
if (value.is_string()) {
|
||||
auto bundleName = value.get<std::string>();
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "Bundle name is %{public}s.", bundleName.c_str());
|
||||
bundleNameList_.emplace(bundleName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (jsonObject.contains(RESERVE_NUMBER_WHEN_TIMEOUT) && jsonObject[RESERVE_NUMBER_WHEN_TIMEOUT].is_number()) {
|
||||
reserveNumber_ = jsonObject.at(RESERVE_NUMBER_WHEN_TIMEOUT).get<int32_t>();
|
||||
}
|
||||
|
||||
if (jsonObject.contains(RECOVERY_DATA_TIMEOUT_DELETE_TIME) &&
|
||||
jsonObject[RECOVERY_DATA_TIMEOUT_DELETE_TIME].is_number()) {
|
||||
timeoutDeleteTime_ = jsonObject.at(RECOVERY_DATA_TIMEOUT_DELETE_TIME).get<int32_t>();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DefaultRecoveryConfig::ReadFileInfoJson(const std::string &filePath, nlohmann::json &jsonBuf)
|
||||
{
|
||||
if (access(filePath.c_str(), F_OK) != 0) {
|
||||
TAG_LOGW(AAFwkTag::ABILITYMGR, "%{public}s, not existed.", filePath.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (filePath.empty()) {
|
||||
TAG_LOGW(AAFwkTag::ABILITYMGR, "File path is empty.");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::fstream in;
|
||||
in.open(filePath, std::ios_base::in);
|
||||
if (!in.is_open()) {
|
||||
TAG_LOGW(AAFwkTag::ABILITYMGR, "Open file failed with %{public}d.", errno);
|
||||
return false;
|
||||
}
|
||||
|
||||
in.seekg(0, std::ios::end);
|
||||
int64_t size = in.tellg();
|
||||
if (size <= 0) {
|
||||
TAG_LOGW(AAFwkTag::ABILITYMGR, "The file is empty.");
|
||||
in.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
in.seekg(0, std::ios::beg);
|
||||
jsonBuf = nlohmann::json::parse(in, nullptr, false);
|
||||
in.close();
|
||||
if (jsonBuf.is_discarded()) {
|
||||
TAG_LOGW(AAFwkTag::ABILITYMGR, "bad profile file.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
@ -15,11 +15,12 @@
|
||||
|
||||
#include "recovery_info_timer.h"
|
||||
#include "app_exit_reason_data_manager.h"
|
||||
#include "app_recovery/default_recovery_config.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
constexpr int32_t HOURS_TO_SECOND = 60 * 60;
|
||||
constexpr int32_t TIMEOUT_DELETE_TIME = 168;
|
||||
constexpr int32_t RESERVE_NUM = 5;
|
||||
|
||||
RecoveryInfoTimer& RecoveryInfoTimer::GetInstance()
|
||||
{
|
||||
@ -40,9 +41,8 @@ void RecoveryInfoTimer::SubmitSaveRecoveryInfo(RecoveryInfo recoveryInfo)
|
||||
recoveryInfoQueue_.push_back(recoveryInfo);
|
||||
|
||||
int64_t now = recoveryInfo.time;
|
||||
auto timeoutDeleteTime = AbilityRuntime::DefaultRecoveryConfig::GetInstance().
|
||||
GetTimeoutDeleteTime() * HOURS_TO_SECOND;
|
||||
auto reserveNumber = AbilityRuntime::DefaultRecoveryConfig::GetInstance().GetReserveNumber();
|
||||
auto timeoutDeleteTime = TIMEOUT_DELETE_TIME * HOURS_TO_SECOND;
|
||||
auto reserveNumber = RESERVE_NUM;
|
||||
int timeoutCount = 0;
|
||||
for (auto p = recoveryInfoQueue_.begin(); p != recoveryInfoQueue_.end(); p++) {
|
||||
if (now - p->time >= timeoutDeleteTime) {
|
||||
|
@ -471,7 +471,6 @@ group("unittest") {
|
||||
"dataobs_mgr_service_test:unittest",
|
||||
"dataobs_mgr_stub_test:unittest",
|
||||
"deeplink_reserve_config_test:unittest",
|
||||
"default_recovery_config_test:unittest",
|
||||
"dfr_test:unittest",
|
||||
"dlp_state_item_test:unittest",
|
||||
"dlp_utils_test:unittest",
|
||||
|
@ -196,18 +196,6 @@ HWTEST_F(AbilityManagerServiceFourthTest, NotifySaveAsResult_001, TestSize.Level
|
||||
TAG_LOGI(AAFwkTag::TEST, "AbilityManagerServiceFourthTest NotifySaveAsResult_001 end");
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: AbilityManagerService
|
||||
* Function: InitDefaultRecoveryList
|
||||
* FunctionPoints: AbilityManagerService InitDefaultRecoveryList
|
||||
*/
|
||||
HWTEST_F(AbilityManagerServiceFourthTest, InitDefaultRecoveryList_001, TestSize.Level1)
|
||||
{
|
||||
auto abilityMs = std::make_shared<AbilityManagerService>();
|
||||
abilityMs->InitDefaultRecoveryList();
|
||||
EXPECT_NE(abilityMs, nullptr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: AbilityManagerService
|
||||
* Function: OnStop
|
||||
|
@ -1,47 +0,0 @@
|
||||
# Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/test.gni")
|
||||
import("//foundation/ability/ability_runtime/ability_runtime.gni")
|
||||
|
||||
module_output_path = "ability_runtime/abilityms"
|
||||
|
||||
ohos_unittest("default_recovery_config_test") {
|
||||
module_out_path = module_output_path
|
||||
|
||||
include_dirs =
|
||||
[ "${ability_runtime_services_path}/abilitymgr/include/app_recovery" ]
|
||||
|
||||
sources = [
|
||||
"${ability_runtime_services_path}/abilitymgr/src/app_recovery/default_recovery_config.cpp",
|
||||
"default_recovery_config_test.cpp",
|
||||
]
|
||||
|
||||
configs = [ "${ability_runtime_services_path}/abilitymgr:abilityms_config" ]
|
||||
|
||||
deps = [
|
||||
"${ability_runtime_services_path}/abilitymgr:abilityms",
|
||||
"//third_party/googletest:gmock_main",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
"config_policy:configpolicy_util",
|
||||
"hilog:libhilog",
|
||||
]
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
testonly = true
|
||||
deps = [ ":default_recovery_config_test" ]
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include <memory>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "hilog_tag_wrapper.h"
|
||||
#define private public
|
||||
#define protected public
|
||||
#include "default_recovery_config.h"
|
||||
#undef private
|
||||
#undef protected
|
||||
|
||||
using namespace testing::ext;
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
class DefaultRecoveryConfigTest : public testing::Test {
|
||||
public:
|
||||
DefaultRecoveryConfigTest() = default;
|
||||
virtual ~DefaultRecoveryConfigTest() = default;
|
||||
|
||||
static void SetUpTestCase(void);
|
||||
static void TearDownTestCase(void);
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
};
|
||||
|
||||
void DefaultRecoveryConfigTest::SetUpTestCase(void)
|
||||
{}
|
||||
|
||||
void DefaultRecoveryConfigTest::TearDownTestCase(void)
|
||||
{}
|
||||
|
||||
void DefaultRecoveryConfigTest::SetUp()
|
||||
{}
|
||||
|
||||
void DefaultRecoveryConfigTest::TearDown()
|
||||
{}
|
||||
|
||||
/**
|
||||
* @tc.name: LoadConfiguration_0100
|
||||
* @tc.desc: basic function test of load configuration.
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issue
|
||||
*/
|
||||
HWTEST_F(DefaultRecoveryConfigTest, LoadConfiguration_0100, TestSize.Level1)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::TEST, "begin.");
|
||||
DefaultRecoveryConfig config;
|
||||
EXPECT_EQ(config.LoadConfiguration(), true);
|
||||
EXPECT_EQ(config.IsBundleDefaultRecoveryEnabled("com.acts.test"), false);
|
||||
EXPECT_EQ(config.GetReserveNumber(), 5);
|
||||
EXPECT_EQ(config.GetTimeoutDeleteTime(), 168);
|
||||
TAG_LOGI(AAFwkTag::TEST, "end.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: LoadConfiguration_0200
|
||||
* @tc.desc: basic function test of load configuration.
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issue
|
||||
*/
|
||||
HWTEST_F(DefaultRecoveryConfigTest, LoadConfiguration_0200, TestSize.Level1)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::TEST, "begin.");
|
||||
DefaultRecoveryConfig config;
|
||||
const nlohmann::json DEFAULT_CONFIG = R"(
|
||||
{
|
||||
"default_recovery": {
|
||||
"support_bundle_name_list": [
|
||||
"com.acts.example1",
|
||||
"com.acts.example2"
|
||||
],
|
||||
"reserve_number_when_timeout": 10,
|
||||
"recovery_data_timeout_delete_time": 7
|
||||
}
|
||||
}
|
||||
)"_json;
|
||||
config.LoadDefaultRecovery(DEFAULT_CONFIG);
|
||||
EXPECT_EQ(config.IsBundleDefaultRecoveryEnabled("com.acts.example1"), true);
|
||||
EXPECT_EQ(config.IsBundleDefaultRecoveryEnabled("com.acts.example2"), true);
|
||||
EXPECT_EQ(config.GetReserveNumber(), 10);
|
||||
EXPECT_EQ(config.GetTimeoutDeleteTime(), 7);
|
||||
TAG_LOGI(AAFwkTag::TEST, "end.");
|
||||
}
|
||||
} // namespace AbilityRuntime
|
||||
} // namespace OHOS
|
Loading…
Reference in New Issue
Block a user