mirror of
https://gitee.com/openharmony/distributeddatamgr_datamgr_service
synced 2025-02-20 14:52:40 +00:00
update
Signed-off-by: zph <zhaopenghui5@huawei.com>
This commit is contained in:
parent
36f6feadcf
commit
f516ecff43
@ -20,7 +20,6 @@ group("fuzztest") {
|
||||
|
||||
deps = [
|
||||
"cloudservicestub_fuzzer:fuzztest",
|
||||
"customutdinstaller_fuzzer:fuzztest",
|
||||
"datashareservicestub_fuzzer:fuzztest",
|
||||
"dumphelper_fuzzer:fuzztest",
|
||||
"kvdbservicestub_fuzzer:fuzztest",
|
||||
|
@ -1,112 +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.
|
||||
##############################hydra-fuzz########################################
|
||||
import("//build/config/features.gni")
|
||||
import("//build/test.gni")
|
||||
import("//foundation/distributeddatamgr/datamgr_service/datamgr_service.gni")
|
||||
|
||||
##############################fuzztest##########################################
|
||||
ohos_fuzztest("CustomUtdInstallerFuzzTest") {
|
||||
module_out_path = "datamgr_service/datamgr_service"
|
||||
|
||||
include_dirs = [
|
||||
"${data_service_path}/service/udmf/utd",
|
||||
"${udmf_path}/framework/common",
|
||||
"${udmf_path}/interfaces/innerkits/common",
|
||||
"${udmf_path}/interfaces/innerkits/data",
|
||||
"${data_service_path}/framework/include",
|
||||
"${data_service_path}/service/udmf/lifecycle",
|
||||
"${data_service_path}/service/udmf/permission",
|
||||
"${data_service_path}/service/udmf/preprocess",
|
||||
"${data_service_path}/service/udmf/store",
|
||||
"${data_service_path}/service/udmf",
|
||||
"${kv_store_path}/frameworks/common",
|
||||
"${kv_store_common_path}",
|
||||
"${kv_store_path}/frameworks/innerkitsimpl/distributeddatafwk/include",
|
||||
"${kv_store_path}/frameworks/innerkitsimpl/distributeddatasvc/include",
|
||||
"${kv_store_path}/frameworks/innerkitsimpl/kvdb/include",
|
||||
"${kv_store_distributeddb_path}",
|
||||
"${kv_store_distributeddb_path}/include/",
|
||||
"${kv_store_distributeddb_path}/interfaces/include/",
|
||||
"${kv_store_distributeddb_path}/interfaces/include/relational",
|
||||
"${dataobject_path}/frameworks/innerkitsimpl/include",
|
||||
"${relational_store_path}/interfaces/inner_api/cloud_data/include",
|
||||
"${relational_store_path}/interfaces/inner_api/rdb/include",
|
||||
"${relational_store_path}/interfaces/inner_api/common_type/include",
|
||||
"//third_party/json/single_include",
|
||||
"${data_service_path}/framework/include",
|
||||
"${data_service_path}/adapter/include/communicator",
|
||||
"${data_service_path}/adapter/include/dfx",
|
||||
"${data_service_path}/service/bootstrap/include",
|
||||
"${device_manager_path}/interfaces/inner_kits/native_cpp/include",
|
||||
"${file_service_path}/interfaces/innerkits/native/remote_file_share/include",
|
||||
"${kv_store_path}/interfaces/innerkits/distributeddata/include",
|
||||
"${kv_store_path}/framework/libs/distributeddb/interfaces/include",
|
||||
"${kv_store_common_path}",
|
||||
"${udmf_path}/framework/common",
|
||||
"${udmf_path}/interfaces/innerkits/common",
|
||||
"${udmf_path}/interfaces/innerkits/data",
|
||||
]
|
||||
|
||||
fuzz_config_file =
|
||||
"${data_service_path}/service/test/fuzztest/customutdinstaller_fuzzer"
|
||||
|
||||
cflags = [
|
||||
"-g",
|
||||
"-O0",
|
||||
"-Wno-unused-variable",
|
||||
"-fno-omit-frame-pointer",
|
||||
]
|
||||
|
||||
sources = [
|
||||
"${data_service_path}/service/udmf/utd/custom_utd_installer.cpp",
|
||||
"customutdinstaller_fuzzer.cpp",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"${data_service_path}/adapter:distributeddata_adapter",
|
||||
"${data_service_path}/adapter/utils:distributeddata_utils_static",
|
||||
"${data_service_path}/framework:distributeddatasvcfwk",
|
||||
"${data_service_path}/service:distributeddatasvc",
|
||||
"${data_service_path}/service/udmf:udmf_server",
|
||||
"${kv_store_distributeddb_path}:distributeddb",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"ability_base:zuri",
|
||||
"ability_runtime:uri_permission_mgr",
|
||||
"access_token:libaccesstoken_sdk",
|
||||
"app_file_service:remote_file_share_native",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"bundle_framework:appexecfwk_core",
|
||||
"c_utils:utils",
|
||||
"hilog:libhilog",
|
||||
"image_framework:image",
|
||||
"ipc:ipc_core",
|
||||
"kv_store:distributeddata_inner",
|
||||
"kv_store:distributeddata_mgr",
|
||||
"kv_store:distributeddb",
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr:samgr_proxy",
|
||||
"udmf:udmf_client",
|
||||
"udmf:utd_client",
|
||||
]
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
group("fuzztest") {
|
||||
testonly = true
|
||||
|
||||
deps = [ ":CustomUtdInstallerFuzzTest" ]
|
||||
}
|
||||
###############################################################################
|
@ -1,16 +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.
|
||||
*/
|
||||
|
||||
FUZZ
|
@ -1,57 +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 "customutdinstaller_fuzzer.h"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#include "ipc_skeleton.h"
|
||||
#include "custom_utd_installer.h"
|
||||
#include "message_parcel.h"
|
||||
#include "securec.h"
|
||||
|
||||
using namespace OHOS::UDMF;
|
||||
|
||||
namespace OHOS {
|
||||
|
||||
bool InstallUtdFuzz(const uint8_t* data, size_t size)
|
||||
{
|
||||
int32_t user = static_cast<int32_t>(*data);
|
||||
std::string bundleName(reinterpret_cast<const char *>(data), size);
|
||||
CustomUtdInstaller::GetInstance().InstallUtd(bundleName, user);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UninstallUtdFuzz(const uint8_t* data, size_t size)
|
||||
{
|
||||
int32_t user = static_cast<int32_t>(*data);
|
||||
std::string bundleName(reinterpret_cast<const char *>(data), size);
|
||||
CustomUtdInstaller::GetInstance().UninstallUtd(bundleName, user);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fuzzer entry point */
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
{
|
||||
if (data == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
OHOS::InstallUtdFuzz(data, size);
|
||||
OHOS::UninstallUtdFuzz(data, size);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,21 +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 CUSTOM_UTD_INSTALLER_FUZZER_H
|
||||
#define CUSTOM_UTD_INSTALLER_FUZZER_H
|
||||
|
||||
#define FUZZ_PROJECT_NAME "customutdinstaller_fuzzer"
|
||||
|
||||
#endif // CUSTOM_UTD_INSTALLER_FUZZER_H
|
@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<fuzz_config>
|
||||
<fuzztest>
|
||||
<!-- maximum length of a test input -->
|
||||
<max_len>1000</max_len>
|
||||
<!-- maximum total time in seconds to run the fuzzer -->
|
||||
<max_total_time>300</max_total_time>
|
||||
<!-- memory usage limit in Mb -->
|
||||
<rss_limit_mb>4096</rss_limit_mb>
|
||||
</fuzztest>
|
||||
</fuzz_config>
|
@ -60,7 +60,6 @@ ohos_shared_library("udmf_server") {
|
||||
"store/store_cache.cpp",
|
||||
"udmf_service_impl.cpp",
|
||||
"udmf_service_stub.cpp",
|
||||
"utd/custom_utd_installer.cpp",
|
||||
]
|
||||
|
||||
configs = [ ":module_public_config" ]
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "reporter.h"
|
||||
#include "uri_permission_manager.h"
|
||||
#include "uri.h"
|
||||
#include "utd/custom_utd_installer.h"
|
||||
#include "udmf_conversion.h"
|
||||
#include "udmf_radar_reporter.h"
|
||||
#include "securec.h"
|
||||
|
@ -1,223 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#define LOG_TAG "CustomUtdInstaller"
|
||||
|
||||
#include <regex>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
#include "error_code.h"
|
||||
#include "log_print.h"
|
||||
#include "if_system_ability_manager.h"
|
||||
#include "iservice_registry.h"
|
||||
#include "system_ability_definition.h"
|
||||
#include "utd_graph.h"
|
||||
#include "custom_utd_json_parser.h"
|
||||
#include "custom_utd_store.h"
|
||||
#include "preset_type_descriptors.h"
|
||||
#include "custom_utd_installer.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace UDMF {
|
||||
constexpr const char *CUSTOM_UTD_PATH = "/data/service/el1/";
|
||||
constexpr const char *CUSTOM_UTD_FILE = "/distributeddata/utd/utd-adt.json";
|
||||
CustomUtdInstaller::CustomUtdInstaller()
|
||||
{
|
||||
}
|
||||
|
||||
CustomUtdInstaller::~CustomUtdInstaller()
|
||||
{
|
||||
}
|
||||
|
||||
CustomUtdInstaller &CustomUtdInstaller::GetInstance()
|
||||
{
|
||||
static CustomUtdInstaller instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
sptr<AppExecFwk::IBundleMgr> CustomUtdInstaller::GetBundleManager()
|
||||
{
|
||||
auto samgrProxy = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (samgrProxy == nullptr) {
|
||||
ZLOGE("samgrProxy is null.");
|
||||
return nullptr;
|
||||
}
|
||||
auto bmsProxy = samgrProxy->GetSystemAbility(BUNDLE_MGR_SERVICE_SYS_ABILITY_ID);
|
||||
if (bmsProxy == nullptr) {
|
||||
ZLOGE("failed to get bms from samgrProxy.");
|
||||
return nullptr;
|
||||
}
|
||||
return iface_cast<AppExecFwk::IBundleMgr>(bmsProxy);
|
||||
}
|
||||
|
||||
int32_t CustomUtdInstaller::InstallUtd(const std::string &bundleName, int32_t user)
|
||||
{
|
||||
std::string path = CUSTOM_UTD_PATH + std::to_string(user) + CUSTOM_UTD_FILE;
|
||||
std::vector<TypeDescriptorCfg> customTyepCfgs = CustomUtdStore::GetInstance().GetTypeCfgs(path);
|
||||
std::vector <TypeDescriptorCfg> presetTypes = PresetTypeDescriptors::GetInstance().GetPresetTypes();
|
||||
std::vector <std::string> modules = GetHapModules(bundleName, user);
|
||||
bool isSucc = true;
|
||||
for (std::string module : modules) {
|
||||
auto utdTypes = GetModuleCustomUtdTypes(bundleName, module, user);
|
||||
if (utdTypes.first.empty() && utdTypes.second.empty()) {
|
||||
ZLOGD("Module custom utd types is empty.");
|
||||
continue;
|
||||
}
|
||||
if (!UtdCfgsChecker::GetInstance().CheckTypeDescriptors(utdTypes, presetTypes, customTyepCfgs, bundleName)) {
|
||||
ZLOGE("Parse json failed, moduleName: %{public}s, bundleName: %{public}s.", module.c_str(),
|
||||
bundleName.c_str());
|
||||
isSucc = false;
|
||||
continue;
|
||||
}
|
||||
if (SaveCustomUtds(utdTypes, customTyepCfgs, bundleName, path) != E_OK) {
|
||||
ZLOGE("Install save custom utds failed, moduleName: %{public}s, bundleName: %{public}s.", module.c_str(),
|
||||
bundleName.c_str());
|
||||
isSucc = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!isSucc) {
|
||||
return E_ERROR;
|
||||
}
|
||||
return E_OK;
|
||||
}
|
||||
|
||||
int32_t CustomUtdInstaller::UninstallUtd(const std::string &bundleName, int32_t user)
|
||||
{
|
||||
std::string path = CUSTOM_UTD_PATH + std::to_string(user) + CUSTOM_UTD_FILE;
|
||||
std::vector<TypeDescriptorCfg> customTyepCfgs = CustomUtdStore::GetInstance().GetTypeCfgs(path);
|
||||
std::vector<TypeDescriptorCfg> deletionMock;
|
||||
if (!customTyepCfgs.empty()) {
|
||||
deletionMock.insert(deletionMock.end(), customTyepCfgs.begin(), customTyepCfgs.end());
|
||||
}
|
||||
for (auto iter = deletionMock.begin(); iter != deletionMock.end();) {
|
||||
auto it = find (iter->installerBundles.begin(), iter->installerBundles.end(), bundleName);
|
||||
if (it != iter->installerBundles.end()) {
|
||||
iter->installerBundles.erase(it);
|
||||
}
|
||||
if (iter->installerBundles.empty()) {
|
||||
iter = deletionMock.erase(iter);
|
||||
} else {
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
std::vector <TypeDescriptorCfg> presetTypes = PresetTypeDescriptors::GetInstance().GetPresetTypes();
|
||||
if (!UtdCfgsChecker::GetInstance().CheckBelongingToTypes(deletionMock, presetTypes)) {
|
||||
ZLOGW("Uninstall error, because of belongingToTypes check failed.");
|
||||
return E_ERROR;
|
||||
}
|
||||
for (auto customIter = customTyepCfgs.begin(); customIter != customTyepCfgs.end();) {
|
||||
auto InstallerIter = find (customIter->installerBundles.begin(), customIter->installerBundles.end(),
|
||||
bundleName);
|
||||
if (InstallerIter != customIter->installerBundles.end()) {
|
||||
customIter->installerBundles.erase(InstallerIter);
|
||||
}
|
||||
if (customIter->installerBundles.empty()) {
|
||||
customIter = customTyepCfgs.erase(customIter);
|
||||
} else {
|
||||
customIter++;
|
||||
}
|
||||
}
|
||||
if (CustomUtdStore::GetInstance().SaveTypeCfgs(customTyepCfgs, path) != E_OK) {
|
||||
ZLOGE("Save type cfgs failed, bundleName: %{public}s.", bundleName.c_str());
|
||||
return E_ERROR;
|
||||
}
|
||||
return E_OK;
|
||||
}
|
||||
|
||||
std::vector<std::string> CustomUtdInstaller::GetHapModules(const std::string &bundleName, int32_t user)
|
||||
{
|
||||
auto bundlemgr = GetBundleManager();
|
||||
if (bundlemgr == nullptr) {
|
||||
ZLOGE("Get bms service failed, bundleName: %{public}s.", bundleName.c_str());
|
||||
return {};
|
||||
}
|
||||
AppExecFwk::BundleInfo bundleInfo;
|
||||
if (!bundlemgr->GetBundleInfo(bundleName, AppExecFwk::BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo, user)) {
|
||||
ZLOGE("Get local bundle info failed, bundleName: %{public}s.", bundleName.c_str());
|
||||
}
|
||||
return bundleInfo.hapModuleNames;
|
||||
}
|
||||
|
||||
CustomUtdCfgs CustomUtdInstaller::GetModuleCustomUtdTypes(const std::string &bundleName,
|
||||
const std::string &moduleName, int32_t user)
|
||||
{
|
||||
auto bundlemgr = GetBundleManager();
|
||||
std::string jsonStr;
|
||||
CustomUtdCfgs typeCfgs;
|
||||
if (bundlemgr == nullptr) {
|
||||
ZLOGE("Get bms service failed, bundleName: %{public}s.", bundleName.c_str());
|
||||
return typeCfgs;
|
||||
}
|
||||
auto status = bundlemgr->GetJsonProfile(AppExecFwk::ProfileType::UTD_SDT_PROFILE, bundleName, moduleName, jsonStr,
|
||||
user);
|
||||
if (status != NO_ERROR) {
|
||||
ZLOGD("get json profile failed, bundleName: %{public}s.", bundleName.c_str());
|
||||
return typeCfgs;
|
||||
}
|
||||
if (jsonStr.empty()) {
|
||||
ZLOGE("JsonStr is empty, bundleName: %{public}s.", bundleName.c_str());
|
||||
return typeCfgs;
|
||||
}
|
||||
std::vector<TypeDescriptorCfg> declarationType;
|
||||
std::vector<TypeDescriptorCfg> referenceType;
|
||||
|
||||
CustomUtdJsonParser customUtdJsonParser_;
|
||||
bool res = customUtdJsonParser_.ParseUserCustomUtdJson(jsonStr, declarationType, referenceType);
|
||||
if (!jsonStr.empty() && res) {
|
||||
typeCfgs.first = declarationType;
|
||||
typeCfgs.second = referenceType;
|
||||
}
|
||||
return typeCfgs;
|
||||
}
|
||||
|
||||
int32_t CustomUtdInstaller::SaveCustomUtds(const CustomUtdCfgs &utdTypes, std::vector<TypeDescriptorCfg> customTyepCfgs,
|
||||
const std::string &bundleName, const std::string &path)
|
||||
{
|
||||
for (TypeDescriptorCfg declarationType : utdTypes.first) {
|
||||
for (auto iter = customTyepCfgs.begin(); iter != customTyepCfgs.end();) {
|
||||
if (iter->typeId == declarationType.typeId) {
|
||||
declarationType.installerBundles = iter->installerBundles;
|
||||
iter = customTyepCfgs.erase(iter);
|
||||
} else {
|
||||
iter ++;
|
||||
}
|
||||
}
|
||||
declarationType.installerBundles.emplace(bundleName);
|
||||
declarationType.ownerBundle = bundleName;
|
||||
customTyepCfgs.push_back(declarationType);
|
||||
}
|
||||
for (TypeDescriptorCfg referenceType : utdTypes.second) {
|
||||
bool found = false;
|
||||
for (auto &typeCfg : customTyepCfgs) {
|
||||
if (typeCfg.typeId == referenceType.typeId) {
|
||||
typeCfg.installerBundles.emplace(bundleName);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
referenceType.installerBundles.emplace(bundleName);
|
||||
customTyepCfgs.push_back(referenceType);
|
||||
}
|
||||
}
|
||||
if (CustomUtdStore::GetInstance().SaveTypeCfgs(customTyepCfgs, path) != E_OK) {
|
||||
ZLOGE("Save type cfgs failed, bundleName: %{public}s.", bundleName.c_str());
|
||||
return E_ERROR;
|
||||
}
|
||||
return E_OK;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef DATAMGR_SERVICE_UTD_MANAGER_H
|
||||
#define DATAMGR_SERVICE_UTD_MANAGER_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "bundlemgr/bundle_mgr_proxy.h"
|
||||
#include "utd_common.h"
|
||||
#include "utd_cfgs_checker.h"
|
||||
#include "system_ability.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace UDMF {
|
||||
class CustomUtdInstaller {
|
||||
public:
|
||||
static CustomUtdInstaller &GetInstance();
|
||||
int32_t InstallUtd(const std::string &bundleName, int32_t user);
|
||||
int32_t UninstallUtd(const std::string &bundleName, int32_t user);
|
||||
|
||||
private:
|
||||
CustomUtdInstaller();
|
||||
~CustomUtdInstaller();
|
||||
CustomUtdInstaller(const CustomUtdInstaller &obj) = delete;
|
||||
CustomUtdInstaller &operator=(const CustomUtdInstaller &obj) = delete;
|
||||
sptr<AppExecFwk::IBundleMgr> GetBundleManager();
|
||||
std::vector<std::string> GetHapModules(const std::string &bundleName, int32_t user);
|
||||
CustomUtdCfgs GetModuleCustomUtdTypes(const std::string &bundleName, const std::string &moduleName, int32_t user);
|
||||
int32_t SaveCustomUtds(const CustomUtdCfgs &utdTypes, std::vector<TypeDescriptorCfg> customTyepCfgs,
|
||||
const std::string &bundleName, const std::string &path);
|
||||
};
|
||||
} // namespace UDMF
|
||||
} // namespace OHOS
|
||||
#endif // DATAMGR_SERVICE_UTD_MANAGER_H
|
Loading…
x
Reference in New Issue
Block a user