mirror of
https://gitee.com/openharmony/bundlemanager_bundle_framework
synced 2024-11-27 01:11:15 +00:00
!7478 在安装应用市场或OTA时,创建/data/local/shader_cache/cloud/common
Merge pull request !7478 from small_leek/addcommon
This commit is contained in:
commit
b2253e4c25
@ -523,6 +523,7 @@ private:
|
||||
void InnerProcessCheckShaderCacheDir();
|
||||
void ProcessCheckCloudShaderDir();
|
||||
void InnerProcessCheckCloudShaderDir();
|
||||
void InnerProcessCheckCloudShaderCommonDir(const int32_t uid, const int32_t gid);
|
||||
void ProcessNewBackupDir();
|
||||
void ProcessCheckRecoverableApplicationInfo();
|
||||
void InnerProcessCheckRecoverableApplicationInfo();
|
||||
|
@ -171,6 +171,7 @@ constexpr int32_t CLONE_APP_INDEX_MAX = 5;
|
||||
// shader
|
||||
constexpr const char* SHADER_CACHE_PATH = "/data/local/shader_cache/local/";
|
||||
constexpr const char* CLOUD_SHADER_PATH = "/data/local/shader_cache/cloud/";
|
||||
constexpr const char* CLOUD_SHADER_COMMON_PATH = "/data/local/shader_cache/cloud/common";
|
||||
constexpr const char* CLOUD_SHADER_OWNER = "const.appgallery.shaderowner.bundlename";
|
||||
// apiReleaseType
|
||||
constexpr const char* API_RELEASE_TYPE_RELEASE = "Release";
|
||||
|
@ -6089,6 +6089,19 @@ void BaseBundleInstaller::CreateCloudShader(const std::string &bundleName, int32
|
||||
|
||||
constexpr int32_t mode = (S_IRWXU | S_IXGRP | S_IXOTH);
|
||||
ErrCode result = InstalldClient::GetInstance()->Mkdir(ServiceConstants::CLOUD_SHADER_PATH, mode, uid, gid);
|
||||
if (result != ERR_OK) {
|
||||
LOG_W(BMS_TAG_DEFAULT, "Mkdir %{public}s failed, error is %{public}d",
|
||||
ServiceConstants::CLOUD_SHADER_PATH, result);
|
||||
return;
|
||||
}
|
||||
|
||||
constexpr int32_t commonMode = (S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
||||
result = InstalldClient::GetInstance()->Mkdir(ServiceConstants::CLOUD_SHADER_COMMON_PATH, commonMode, uid, gid);
|
||||
if (result != ERR_OK) {
|
||||
LOG_W(BMS_TAG_DEFAULT, "Mkdir %{public}s failed, error is %{public}d",
|
||||
ServiceConstants::CLOUD_SHADER_COMMON_PATH, result);
|
||||
return;
|
||||
}
|
||||
LOG_I(BMS_TAG_INSTALLER, "Create cloud shader cache result: %{public}d", result);
|
||||
}
|
||||
|
||||
|
@ -1441,16 +1441,21 @@ void BMSEventHandler::ProcessNewBackupDir()
|
||||
void BMSEventHandler::InnerProcessCheckCloudShaderDir()
|
||||
{
|
||||
bool cloudExist = true;
|
||||
bool commonExist = true;
|
||||
ErrCode result = InstalldClient::GetInstance()->IsExistDir(ServiceConstants::CLOUD_SHADER_PATH, cloudExist);
|
||||
if (result != ERR_OK) {
|
||||
LOG_W(BMS_TAG_DEFAULT, "IsExistDir failed, error is %{public}d", result);
|
||||
return;
|
||||
}
|
||||
if (cloudExist) {
|
||||
LOG_D(BMS_TAG_DEFAULT, "CLOUD_SHADER_PATH is exist");
|
||||
result = InstalldClient::GetInstance()->IsExistDir(ServiceConstants::CLOUD_SHADER_COMMON_PATH, commonExist);
|
||||
if (result != ERR_OK) {
|
||||
LOG_W(BMS_TAG_DEFAULT, "IsExistDir failed, error is %{public}d", result);
|
||||
commonExist = false;
|
||||
}
|
||||
if (cloudExist && commonExist) {
|
||||
LOG_D(BMS_TAG_DEFAULT, "CLOUD_SHADER_PATH and CLOUD_SHADER_COMMON_PATH existed");
|
||||
return;
|
||||
}
|
||||
|
||||
const std::string bundleName = OHOS::system::GetParameter(ServiceConstants::CLOUD_SHADER_OWNER, "");
|
||||
if (bundleName.empty()) {
|
||||
return;
|
||||
@ -1469,9 +1474,29 @@ void BMSEventHandler::InnerProcessCheckCloudShaderDir()
|
||||
LOG_D(BMS_TAG_DEFAULT, "Obtain bundleInfo failed, bundleName: %{public}s not exist", bundleName.c_str());
|
||||
return;
|
||||
}
|
||||
if (!cloudExist) {
|
||||
constexpr int32_t mode = (S_IRWXU | S_IXGRP | S_IXOTH);
|
||||
result = InstalldClient::GetInstance()->Mkdir(ServiceConstants::CLOUD_SHADER_PATH, mode, info.uid, info.gid);
|
||||
if (result != ERR_OK) {
|
||||
LOG_W(BMS_TAG_DEFAULT, "Mkdir CLOUD_SHADER_PATH failed, error is %{public}d", result);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!commonExist) {
|
||||
InnerProcessCheckCloudShaderCommonDir(info.uid, info.gid);
|
||||
}
|
||||
LOG_I(BMS_TAG_DEFAULT, "Create cloud shader cache result: %{public}d", result);
|
||||
}
|
||||
|
||||
constexpr int32_t mode = (S_IRWXU | S_IXGRP | S_IXOTH);
|
||||
result = InstalldClient::GetInstance()->Mkdir(ServiceConstants::CLOUD_SHADER_PATH, mode, info.uid, info.gid);
|
||||
void BMSEventHandler::InnerProcessCheckCloudShaderCommonDir(const int32_t uid, const int32_t gid)
|
||||
{
|
||||
constexpr int32_t commonMode = (S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
||||
ErrCode result = InstalldClient::GetInstance()->Mkdir(ServiceConstants::CLOUD_SHADER_COMMON_PATH,
|
||||
commonMode, uid, gid);
|
||||
if (result != ERR_OK) {
|
||||
LOG_W(BMS_TAG_DEFAULT, "Mkdir CLOUD_SHADER_COMMON_PATH failed, error is %{public}d", result);
|
||||
return;
|
||||
}
|
||||
LOG_I(BMS_TAG_DEFAULT, "Create cloud shader cache result: %{public}d", result);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user