!828 增加时区云推系统参数

Merge pull request !828 from sunyaozu/OpenHarmony-5.0-Release
This commit is contained in:
openharmony_ci 2024-09-19 11:00:24 +00:00 committed by Gitee
commit 8d598b5b01
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 11 additions and 0 deletions

View File

@ -14,6 +14,7 @@ persist.global.language=zh-Hans
persist.global.locale=zh-Hans-CN
persist.global.is24Hour=
persist.global.preferredLanguages=
persist.global.tz_override=false
const.global.language=zh-Hans
const.global.locale=zh-Hans-CN
const.global.region=CN

View File

@ -15,6 +15,7 @@ persist.global.language = i18n:i18n:0775
persist.global.locale = i18n:i18n:0775
persist.global.is24Hour = i18n:i18n:0775
persist.global.preferredLanguages = i18n:i18n:0775
persist.global.tz_override = i18n:i18n:0775
const.global.locale = i18n:i18n:0444
const.global.language = i18n:i18n:0444
const.global.region = i18n:i18n:0444

View File

@ -104,6 +104,7 @@ ohos_executable("hmos_cust_timezone_mount") {
deps = [ "../frameworks/intl:intl_util" ]
external_deps = [
"hilog:libhilog",
"init:libbegetutil",
"openssl:libcrypto_shared",
"openssl:libssl_shared",
]

View File

@ -18,6 +18,7 @@
#include <string>
#include <sys/mount.h>
#include "i18n_hilog.h"
#include "parameter.h"
#include "signature_verifier.h"
#include "utils.h"
@ -38,6 +39,7 @@ const std::string LOCALE_PATH = "/system/etc/TIMEZONE/generic/current/";
const std::string SAFE_PATH = "/data/service/el1/public/i18n/timezone/";
const std::string PUBKEY_PATH = "/system/etc/LIBPHONENUMBER/generic/";
const std::string PUBKEY_NAME = "hota_i18n_upgrade_v1.pem";
const std::string COTA_PARAM_TIMEZONE_KEY = "persist.global.tz_override";
const int FILE_NAME_INDEX = 6;
std::vector<std::string> g_dataFiles = {};
@ -213,26 +215,32 @@ bool CheckFileIntegrity()
void UpdateTimeZone()
{
if (!Init()) {
SetParameter(COTA_PARAM_TIMEZONE_KEY.c_str(), "false");
HILOG_INFO_I18N("UpdateTimeZone: init error");
return;
}
if (!Mount()) {
SetParameter(COTA_PARAM_TIMEZONE_KEY.c_str(), "false");
HILOG_INFO_I18N("UpdateTimeZone: mount error");
return;
}
if (!CheckIfUpdateNecessary()) {
SetParameter(COTA_PARAM_TIMEZONE_KEY.c_str(), "false");
HILOG_INFO_I18N("UpdateTimeZone: CheckIfUpdateNecessary error, no need to update");
return;
}
if (!CheckFileIntegrity()) {
SetParameter(COTA_PARAM_TIMEZONE_KEY.c_str(), "false");
HILOG_INFO_I18N("UpdateTimeZone: CheckFileIntegrity error, no need to update");
return;
}
if (!CopyDataFile()) {
SetParameter(COTA_PARAM_TIMEZONE_KEY.c_str(), "false");
HILOG_INFO_I18N("UpdateTimeZone: CopyDataFile error");
return;
}
SetParameter(COTA_PARAM_TIMEZONE_KEY.c_str(), "true");
HILOG_INFO_I18N("UpdateTimeZone: UpdateTimeZone");
}