broker整改

Signed-off-by: @ran-zhao-yu <ranzhaoyu1@huawei.com>
This commit is contained in:
@ran-zhao-yu 2024-08-08 11:35:07 +08:00
parent 7620f5e3cb
commit 8978174b65
8 changed files with 5 additions and 966 deletions

View File

@ -52,8 +52,6 @@
"components": [
"ability_base",
"ability_runtime",
"access_token",
"ipc",
"hilog",
"hisysevent",
"hitrace",
@ -65,8 +63,7 @@
"zlib",
"bounds_checking_function",
"icu",
"cJSON",
"container_hmos_service_broker"
"cJSON"
]
},
"build": {

View File

@ -13,7 +13,7 @@
import("//build/ohos.gni")
import("../../resmgr.gni")
# source code for win.
is_win = "${current_os}_${current_cpu}" == "mingw_x86_64"

View File

@ -0,0 +1 @@

View File

@ -1,460 +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 RESOURCE_MANAGER_IMPL_EXT_H
#define RESOURCE_MANAGER_IMPL_EXT_H
#include "resource_manager.h"
#if defined(RESMGR_BROKER_ENABLE)
#include "resource_manager_broker_client.h"
#endif
namespace OHOS {
namespace Global {
namespace Resource {
class ResourceManagerImplExt : public ResourceManager {
public:
ResourceManagerImplExt();
~ResourceManagerImplExt();
#if defined(RESMGR_BROKER_ENABLE)
bool Init(int32_t appType, std::string bundleName);
#endif
/* *
* Null function
*/
virtual bool AddResource(const char *path, const uint32_t &selectedTypes = SELECT_ALL);
/* *
* Null function
*/
virtual bool AddResource(const std::string &path, const std::vector<std::string> &overlayPaths);
/* *
* Null function
*/
virtual bool RemoveResource(const std::string &path, const std::vector<std::string> &overlayPaths);
/* *
* Null function
*/
virtual bool AddAppOverlay(const std::string &path);
/* *
* Null function
*/
virtual bool RemoveAppOverlay(const std::string &path);
/* *
* Null function
*/
virtual RState UpdateResConfig(ResConfig &resConfig, bool isUpdateTheme = false);
/* *
* Null function
*/
virtual void GetResConfig(ResConfig &resConfig);
/* *
* Get string resource by Id
* @param id the resource Id
* @param outValue the string resource write to
* @return SUCCESS if resource exist, else NOT_FOUND
*/
#if defined(RESMGR_BROKER_ENABLE)
virtual RState GetStringById(uint32_t id, std::string &outValue);
#endif
/* *
* Null function
*/
virtual RState GetStringByName(const char *name, std::string &outValue);
/* *
* Null function
*/
virtual RState GetStringFormatById(std::string &outValue, uint32_t id, ...);
/* *
* Null function
*/
virtual RState GetStringFormatByName(std::string &outValue, const char *name, ...);
/* *
* Null function
*/
virtual RState GetStringArrayById(uint32_t id, std::vector<std::string> &outValue);
/* *
* Null function
*/
virtual RState GetStringArrayByName(const char *name, std::vector<std::string> &outValue);
/* *
* Null function
*/
virtual RState GetPatternById(uint32_t id, std::map<std::string, std::string> &outValue);
/* *
* Null function
*/
virtual RState GetPatternByName(const char *name, std::map<std::string, std::string> &outValue);
/* *
* Null function
*/
virtual RState GetPluralStringById(uint32_t id, int quantity, std::string &outValue);
/* *
* Null function
*/
virtual RState GetPluralStringByName(const char *name, int quantity, std::string &outValue);
/* *
* Null function
*/
virtual RState GetPluralStringByIdFormat(std::string &outValue, uint32_t id, int quantity, ...);
/* *
* Null function
*/
virtual RState GetPluralStringByNameFormat(std::string &outValue, const char *name, int quantity, ...);
/* *
* Null function
*/
virtual RState GetThemeById(uint32_t id, std::map<std::string, std::string> &outValue);
/* *
* Null function
*/
virtual RState GetThemeByName(const char *name, std::map<std::string, std::string> &outValue);
/* *
* Null function
*/
virtual RState GetBooleanById(uint32_t id, bool &outValue);
/* *
* Null function
*
*/
virtual RState GetBooleanByName(const char *name, bool &outValue);
/* *
* Null function
*/
virtual RState GetIntegerById(uint32_t id, int &outValue);
/* *
* Null function
*/
virtual RState GetIntegerByName(const char *name, int &outValue);
/* *
* Null function
*/
virtual RState GetFloatById(uint32_t id, float &outValue);
/* *
* Null function
*/
virtual RState GetFloatById(uint32_t id, float &outValue, std::string &unit);
/* *
* Null function
*/
virtual RState GetFloatByName(const char *name, float &outValue);
/* *
* Null function
*/
virtual RState GetFloatByName(const char *name, float &outValue, std::string &unit);
/* *
* Null function
*/
virtual RState GetIntArrayById(uint32_t id, std::vector<int> &outValue);
/* *
* Null function
*/
virtual RState GetIntArrayByName(const char *name, std::vector<int> &outValue);
/* *
* Null function
*/
virtual RState GetColorById(uint32_t id, uint32_t &outValue);
/* *
* Null function
*/
virtual RState GetColorByName(const char *name, uint32_t &outValue);
/* *
* Null function
*/
virtual RState GetProfileById(uint32_t id, std::string &outValue);
/* *
* Null function
*/
virtual RState GetProfileByName(const char *name, std::string &outValue);
/* *
* Null function
*/
virtual RState GetMediaById(uint32_t id, std::string &outValue, uint32_t density = 0);
/* *
* Null function
*/
virtual RState GetMediaByName(const char *name, std::string &outValue, uint32_t density = 0);
/* *
* Null function
*/
virtual RState GetRawFilePathByName(const std::string &name, std::string &outValue);
/* *
* Null function
*/
virtual RState GetRawFileDescriptor(const std::string &name, RawFileDescriptor &descriptor);
/* *
* Null function
*/
virtual RState CloseRawFileDescriptor(const std::string &name);
/* *
* Get the MEDIA data by resource id
* @param id the resource id
* @param len the data len write to
* @param outValue the obtain resource path write to
* @param density the screen density, within the area of OHOS::Global::Resource::ScreenDensity
* @return SUCCESS if resource exist, else NOT_FOUND
*/
#if defined(RESMGR_BROKER_ENABLE)
virtual RState GetMediaDataById(
uint32_t id, size_t &len, std::unique_ptr<uint8_t[]> &outValue, uint32_t density = 0);
#endif
/* *
* Null function
*/
virtual RState GetMediaDataByName(
const char *name, size_t &len, std::unique_ptr<uint8_t[]> &outValue, uint32_t density = 0);
/* *
* Get the MEDIA base64 data resource by resource id
* @param id the resource id
* @param outValue the media base64 data
* @param density the screen density, within the area of OHOS::Global::Resource::ScreenDensity
* @return SUCCESS if resource exist, else NOT_FOUND
*/
virtual RState GetMediaBase64DataById(uint32_t id, std::string &outValue, uint32_t density = 0);
/* *
* Null function
*/
virtual RState GetMediaBase64DataByName(const char *name, std::string &outValue, uint32_t density = 0);
/* *
* Null function
*/
virtual RState GetProfileDataById(uint32_t id, size_t &len, std::unique_ptr<uint8_t[]> &outValue);
/* *
* Null function
*/
virtual RState GetProfileDataByName(const char *name, size_t &len, std::unique_ptr<uint8_t[]> &outValue);
/* *
* Null function
*/
virtual RState GetRawFileFromHap(const std::string &rawFileName, size_t &len, std::unique_ptr<uint8_t[]> &outValue);
/* *
* Null function
*/
virtual RState GetRawFileDescriptorFromHap(const std::string &rawFileName, RawFileDescriptor &descriptor);
/* *
* Null function
*/
virtual RState IsLoadHap(std::string &hapPath);
/* *
* Null function
*/
virtual RState GetRawFileList(const std::string &rawDirPath, std::vector<std::string> &rawfileList);
/* *
* Get the drawable information for given resId, mainly about type, len, buffer
* @param id the resource id
* @param type the drawable type
* @param len the drawable buffer length
* @param outValue the drawable buffer write to
* @param density the drawable density
* @return SUCCESS if resource exist, else not found
*/
virtual RState GetDrawableInfoById(
uint32_t id, std::string &type, size_t &len, std::unique_ptr<uint8_t[]> &outValue, uint32_t density = 0);
/* *
* Null function
*/
virtual RState GetDrawableInfoByName(
const char *name, std::string &type, size_t &len, std::unique_ptr<uint8_t[]> &outValue, uint32_t density = 0);
/* *
* Get string format by resource id
* @param id the resource id
* @param outValue the resource write to
* @param jsParams the formatting string resource js parameters, the tuple first parameter represents the type,
* napi_number is denoted by NAPI_NUMBER, napi_string is denoted by NAPI_STRING,
* the tuple second parameter represents the value
* @return SUCCESS if resource exists and was formatted successfully, else ERROR
*/
virtual RState GetStringFormatById(uint32_t id, std::string &outValue,
std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> &jsParams);
/* *
* Null function
*/
virtual RState GetStringFormatByName(const char *name, std::string &outValue,
std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> &jsParams);
/* *
* Null function
*/
virtual uint32_t GetResourceLimitKeys();
/* *
* Null function
*/
virtual RState GetRawFdNdkFromHap(const std::string &name, RawFileDescriptor &descriptor);
/* *
* Null function
*/
virtual RState GetResId(const std::string &resTypeName, uint32_t &resId);
/* *
* Null function
*/
virtual void GetLocales(std::vector<std::string> &outValue, bool includeSystem = false);
/**
* Get the drawable information for given resId, mainly about type, len, buffer
* @param id the resource id
* @param drawableInfo the drawable info
* @param outValue the drawable buffer write to
* @param iconType the drawable type
* @param density the drawable density
* @return SUCCESS if resource exist, else not found
*/
virtual RState GetDrawableInfoById(uint32_t id,
std::tuple<std::string, size_t, std::string> &drawableInfo,
std::unique_ptr<uint8_t[]> &outValue, uint32_t iconType, uint32_t density = 0);
/* *
* Null function
*/
virtual RState GetDrawableInfoByName(const char *name,
std::tuple<std::string, size_t, std::string> &drawableInfo,
std::unique_ptr<uint8_t[]> &outValue, uint32_t iconType, uint32_t density = 0);
/* *
* Null function
*/
virtual RState GetSymbolById(uint32_t id, uint32_t &outValue);
/* *
* Null function
*/
virtual RState GetSymbolByName(const char *name, uint32_t &outValue);
/* *
* Null function
*/
virtual RState GetThemeIcons(uint32_t resId, std::pair<std::unique_ptr<uint8_t[]>, size_t> &foregroundInfo,
std::pair<std::unique_ptr<uint8_t[]>, size_t> &backgroundInfo, uint32_t density = 0);
/* *
* Null function
*/
virtual std::string GetThemeMask();
/* *
* Null function
*/
virtual RState IsRawDirFromHap(const std::string &pathName, bool &outValue);
/* *
* Null function
*/
virtual std::shared_ptr<ResourceManager> GetOverrideResourceManager(std::shared_ptr<ResConfig> overrideResConfig);
/* *
* Null function
*/
virtual RState UpdateOverrideResConfig(ResConfig &resConfig);
/* *
* Null function
*/
virtual void GetOverrideResConfig(ResConfig &resConfig);
virtual RState GetDynamicIcon(const std::string &resName, std::pair<std::unique_ptr<uint8_t[]>, size_t> &iconInfo,
uint32_t density = 0);
/* *
* Null function
*/
virtual RState GetStringFormatById(std::string &outValue, uint32_t id, va_list args);
/* *
* Null function
*/
virtual RState GetStringFormatByName(std::string &outValue, const char *name, va_list args);
/* *
* Null function
*/
virtual RState GetFormatPluralStringById(std::string &outValue, uint32_t id, int quantity,
std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> &jsParams);
/* *
* Null function
*/
virtual RState GetFormatPluralStringByName(std::string &outValue, const char *name, int quantity,
std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> &jsParams);
/* *
* Null function
*/
virtual bool AddPatchResource(const char *path, const char *patchPath);
private:
#if defined(RESMGR_BROKER_ENABLE)
std::shared_ptr<ANCO::ResourceManagerBrokerClient> client_;
#endif
};
} // namespace Resource
} // namespace Global
} // namespace OHOS
#endif

View File

@ -14,7 +14,7 @@
*/
#include "resource_manager.h"
#include "hilog_wrapper.h"
#include "resource_manager_impl.h"
#include "system_resource_manager.h"

View File

@ -0,0 +1 @@

View File

@ -1,492 +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 "resource_manager_impl_ext.h"
#if defined(RESMGR_BROKER_ENABLE)
#include "accesstoken_kit.h"
#include "ipc_skeleton.h"
#include "tokenid_kit.h"
#include "securec.h"
#endif
#include "hilog_wrapper.h"
#include "utils/utils.h"
#include "res_config.h"
#include "utils/common.h"
#include "utils/string_utils.h"
namespace OHOS {
namespace Global {
namespace Resource {
constexpr uint32_t DEFAULT_RETURN_VALUE = 0;
#if defined(RESMGR_SUPPORT_LINUX)
constexpr int LINUX_TYPE = 2;
#endif
#if defined(RESMGR_BROKER_ENABLE)
bool VerifyCallingPermission(const std::string &permissionName)
{
Security::AccessToken::AccessTokenID callerToken = IPCSkeleton::GetCallingTokenID();
RESMGR_HILOGI(RESMGR_TAG, "VerifyCallingPermission permission %{public}s, callerToken : %{public}u",
permissionName.c_str(), callerToken);
if (Security::AccessToken::AccessTokenKit::VerifyAccessToken(callerToken, permissionName) ==
Security::AccessToken::PermissionState::PERMISSION_DENIED) {
RESMGR_HILOGE(RESMGR_TAG, "permission %{public}s denied, callerToken : %{public}u",
permissionName.c_str(), callerToken);
return false;
}
return true;
}
#endif
ResourceManagerImplExt::ResourceManagerImplExt()
{}
ResourceManagerImplExt::~ResourceManagerImplExt()
{}
#if defined(RESMGR_BROKER_ENABLE)
bool ResourceManagerImplExt::Init(int32_t appType, std::string bundleName)
{
if (!VerifyCallingPermission("ohos.permission.GET_BUNDLE_INFO_PRIVILEGED")) {
RESMGR_HILOGE(RESMGR_TAG, "check ohos.permission.GET_BUNDLE_INFO_PRIVILEGED permission fail");
return false;
}
client_ = std::make_shared<ANCO::ResourceManagerBrokerClient>();
if (client_ == nullptr) {
RESMGR_HILOGE(RESMGR_TAG, "get broker client failed in ResourceManagerImplExt::Init");
return false;
}
client_->init(appType, bundleName);
return true;
}
#endif
#if defined(RESMGR_BROKER_ENABLE)
RState ResourceManagerImplExt::GetStringById(uint32_t id, std::string &outValue)
{
if (client_ != nullptr) {
return static_cast<RState>(client_->GetString(id, outValue));
}
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
#endif
RState ResourceManagerImplExt::GetStringFormatById(uint32_t id, std::string &outValue,
std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> &jsParams)
{
RState state = GetStringById(id, outValue);
if (state != SUCCESS) {
return state;
}
ResConfigImpl resConfig;
GetResConfig(resConfig);
if (!ReplacePlaceholderWithParams(outValue, resConfig, jsParams)) {
return ERROR_CODE_RES_NAME_FORMAT_ERROR;
}
return SUCCESS;
}
#if defined(RESMGR_BROKER_ENABLE)
RState ResourceManagerImplExt::GetMediaDataById(uint32_t id, size_t &len,
std::unique_ptr<uint8_t[]> &outValue, uint32_t density)
{
if (client_ != nullptr) {
return static_cast<RState>(client_->GetMedia(id, len, outValue, density));
}
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
#endif
RState ResourceManagerImplExt::GetMediaBase64DataById(uint32_t id, std::string &outValue, uint32_t density)
{
size_t len;
std::unique_ptr<uint8_t[]> tempData;
RState state = GetMediaDataById(id, len, tempData, density);
if (state != SUCCESS) {
return state;
}
std::string type = "png";
return Utils::EncodeBase64(tempData, len, type, outValue);
}
RState ResourceManagerImplExt::GetDrawableInfoById(uint32_t id, std::string &type, size_t &len,
std::unique_ptr<uint8_t[]> &outValue, uint32_t density)
{
type = "png";
return GetMediaDataById(id, len, outValue, density);
}
bool ResourceManagerImplExt::AddResource(const char *path, const uint32_t &selectedTypes)
{
return false;
}
bool ResourceManagerImplExt::AddResource(const std::string &path, const std::vector<std::string> &overlayPaths)
{
return false;
}
bool ResourceManagerImplExt::RemoveResource(const std::string &path, const std::vector<std::string> &overlayPaths)
{
return false;
}
bool ResourceManagerImplExt::AddAppOverlay(const std::string &path)
{
return false;
}
bool ResourceManagerImplExt::RemoveAppOverlay(const std::string &path)
{
return false;
}
RState ResourceManagerImplExt::UpdateResConfig(ResConfig &resConfig, bool isUpdateTheme)
{
return ERROR;
}
void ResourceManagerImplExt::GetResConfig(ResConfig &resConfig)
{}
RState ResourceManagerImplExt::GetStringByName(const char *name, std::string &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetStringFormatById(std::string &outValue, uint32_t id, ...)
{
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
RState ResourceManagerImplExt::GetStringFormatByName(std::string &outValue, const char *name, ...)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetStringArrayById(uint32_t id, std::vector<std::string> &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
RState ResourceManagerImplExt::GetStringArrayByName(const char *name, std::vector<std::string> &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetPatternById(uint32_t id, std::map<std::string, std::string> &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
RState ResourceManagerImplExt::GetPatternByName(const char *name, std::map<std::string, std::string> &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetPluralStringById(uint32_t id, int quantity, std::string &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
RState ResourceManagerImplExt::GetPluralStringByName(const char *name, int quantity, std::string &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetPluralStringByIdFormat(std::string &outValue, uint32_t id, int quantity, ...)
{
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
RState ResourceManagerImplExt::GetPluralStringByNameFormat(std::string &outValue, const char *name, int quantity, ...)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetThemeById(uint32_t id, std::map<std::string, std::string> &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
RState ResourceManagerImplExt::GetThemeByName(const char *name, std::map<std::string, std::string> &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetBooleanById(uint32_t id, bool &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
RState ResourceManagerImplExt::GetBooleanByName(const char *name, bool &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetIntegerById(uint32_t id, int &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
RState ResourceManagerImplExt::GetIntegerByName(const char *name, int &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetFloatById(uint32_t id, float &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
RState ResourceManagerImplExt::GetFloatById(uint32_t id, float &outValue, std::string &unit)
{
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
RState ResourceManagerImplExt::GetFloatByName(const char *name, float &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetFloatByName(const char *name, float &outValue, std::string &unit)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetIntArrayById(uint32_t id, std::vector<int> &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
RState ResourceManagerImplExt::GetIntArrayByName(const char *name, std::vector<int> &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetColorById(uint32_t id, uint32_t &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
RState ResourceManagerImplExt::GetColorByName(const char *name, uint32_t &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetProfileById(uint32_t id, std::string &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
RState ResourceManagerImplExt::GetProfileByName(const char *name, std::string &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetMediaById(uint32_t id, std::string &outValue, uint32_t density)
{
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
RState ResourceManagerImplExt::GetMediaByName(const char *name, std::string &outValue, uint32_t density)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetRawFilePathByName(const std::string &name, std::string &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetRawFileDescriptor(const std::string &name, RawFileDescriptor &descriptor)
{
return ERROR_CODE_RES_PATH_INVALID;
}
RState ResourceManagerImplExt::CloseRawFileDescriptor(const std::string &name)
{
return ERROR_CODE_RES_PATH_INVALID;
}
RState ResourceManagerImplExt::GetMediaDataByName(
const char *name, size_t &len, std::unique_ptr<uint8_t[]> &outValue, uint32_t density)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetMediaBase64DataByName(const char *name, std::string &outValue, uint32_t density)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetProfileDataById(uint32_t id, size_t &len, std::unique_ptr<uint8_t[]> &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
RState ResourceManagerImplExt::GetProfileDataByName(
const char *name, size_t &len, std::unique_ptr<uint8_t[]> &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetRawFileFromHap(
const std::string &rawFileName, size_t &len, std::unique_ptr<uint8_t[]> &outValue)
{
return ERROR_CODE_RES_PATH_INVALID;
}
RState ResourceManagerImplExt::GetRawFileDescriptorFromHap(
const std::string &rawFileName, RawFileDescriptor &descriptor)
{
return ERROR_CODE_RES_PATH_INVALID;
}
RState ResourceManagerImplExt::IsLoadHap(std::string &hapPath)
{
return ERROR_CODE_RES_PATH_INVALID;
}
RState ResourceManagerImplExt::GetRawFileList(const std::string &rawDirPath, std::vector<std::string> &rawfileList)
{
return ERROR_CODE_RES_PATH_INVALID;
}
RState ResourceManagerImplExt::GetDrawableInfoByName(
const char *name, std::string &type, size_t &len, std::unique_ptr<uint8_t[]> &outValue, uint32_t density)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetStringFormatByName(const char *name, std::string &outValue,
std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> &jsParams)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
uint32_t ResourceManagerImplExt::GetResourceLimitKeys()
{
return DEFAULT_RETURN_VALUE;
}
RState ResourceManagerImplExt::GetRawFdNdkFromHap(const std::string &name, RawFileDescriptor &descriptor)
{
return ERROR_CODE_RES_PATH_INVALID;
}
RState ResourceManagerImplExt::GetResId(const std::string &resTypeName, uint32_t &resId)
{
return NOT_FOUND;
}
void ResourceManagerImplExt::GetLocales(std::vector<std::string> &outValue, bool includeSystem) {}
RState ResourceManagerImplExt::GetDrawableInfoById(uint32_t id,
std::tuple<std::string, size_t, std::string> &drawableInfo,
std::unique_ptr<uint8_t[]> &outValue, uint32_t iconType, uint32_t density)
{
size_t len = 0;
RState state = GetMediaDataById(id, len, outValue, density);
std::string type = "png";
std::string themeMask = "";
drawableInfo = std::make_tuple(type, len, themeMask);
return state;
}
RState ResourceManagerImplExt::GetDrawableInfoByName(const char *name,
std::tuple<std::string, size_t, std::string> &drawableInfo,
std::unique_ptr<uint8_t[]> &outValue, uint32_t iconType, uint32_t density)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetSymbolById(uint32_t id, uint32_t &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
RState ResourceManagerImplExt::GetSymbolByName(const char *name, uint32_t &outValue)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetThemeIcons(uint32_t resId,
std::pair<std::unique_ptr<uint8_t[]>, size_t> &foregroundInfo,
std::pair<std::unique_ptr<uint8_t[]>, size_t> &backgroundInfo, uint32_t density)
{
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
std::string ResourceManagerImplExt::GetThemeMask()
{
return "";
}
RState ResourceManagerImplExt::IsRawDirFromHap(const std::string &pathName, bool &outValue)
{
return ERROR_CODE_RES_PATH_INVALID;
}
std::shared_ptr<ResourceManager> ResourceManagerImplExt::GetOverrideResourceManager(
std::shared_ptr<ResConfig> overrideResConfig)
{
return nullptr;
}
RState ResourceManagerImplExt::UpdateOverrideResConfig(ResConfig &resConfig)
{
return ERROR;
}
void ResourceManagerImplExt::GetOverrideResConfig(ResConfig &resConfig) {}
RState ResourceManagerImplExt::GetDynamicIcon(const std::string &resName,
std::pair<std::unique_ptr<uint8_t[]>, size_t> &iconInfo, uint32_t density)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetStringFormatById(std::string &outValue, uint32_t id, va_list args)
{
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
RState ResourceManagerImplExt::GetStringFormatByName(std::string &outValue, const char *name, va_list args)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
RState ResourceManagerImplExt::GetFormatPluralStringById(std::string &outValue, uint32_t id, int quantity,
std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> &jsParams)
{
return ERROR_CODE_RES_NOT_FOUND_BY_ID;
}
RState ResourceManagerImplExt::GetFormatPluralStringByName(std::string &outValue, const char *name, int quantity,
std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> &jsParams)
{
return ERROR_CODE_RES_NOT_FOUND_BY_NAME;
}
bool ResourceManagerImplExt::AddPatchResource(const char *path, const char *patchPath)
{
return false;
}
} // namespace Resource
} // namespace Global
} // namespace OHOS

View File

@ -11,14 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/ohos.gni")
declare_args() {
resource_management_support_icu = true
resmgr_broker_enable = true
if (defined(global_parts_info) &&
!defined(global_parts_info.virt_service_container_hmos_service_broker)) {
resmgr_broker_enable = false
}
}