diff --git a/frameworks/intl/include/multi_users.h b/frameworks/intl/include/multi_users.h index 2dbf4377d78df20c86ec407ef908a4e0f99f00da..37a043fc474140100eddafdb021b8b039310570e 100644 --- a/frameworks/intl/include/multi_users.h +++ b/frameworks/intl/include/multi_users.h @@ -55,9 +55,6 @@ private: static const std::string MULTI_USERS_LOCALE_KEY; static const std::string MULTI_USERS_HOUR_KEY; static const std::string INIT_KEY; - static const std::string UPDATED_USERS_KEY; - static const std::string DEFAULT_UPDATED_USERS; - static const std::string TRUE_VALUE; static const std::string PREFERENCE_PATH; static const int32_t DEFAULT_LOCAL_ID; static const int CONFIG_LEN; diff --git a/frameworks/intl/parameter_upgrade/etc/libphonenumber/version.txt b/frameworks/intl/parameter_upgrade/etc/libphonenumber/version.txt index 4dbb09ff3284e8e85a3ccb313077e43282ca5988..a2f650c965263977bed6b355fcf679b4b54dc8c8 100644 --- a/frameworks/intl/parameter_upgrade/etc/libphonenumber/version.txt +++ b/frameworks/intl/parameter_upgrade/etc/libphonenumber/version.txt @@ -1,6 +1,6 @@ -version=1.10.24.100 +version=11.10.24.100 type=LIBPHONENUMBER subtype=generic compatibleVersion=1 classify=1 -displayVersion=PN.GENC.1.10.24.100 \ No newline at end of file +displayVersion=PN.GENC.11.10.24.100 \ No newline at end of file diff --git a/frameworks/intl/parameter_upgrade/etc/taboo/version.txt b/frameworks/intl/parameter_upgrade/etc/taboo/version.txt index 280063541f1cdaacb044a6f022acb3b139c52e54..7a34c72eda646b0df407e1d46c0cdc8243878667 100644 --- a/frameworks/intl/parameter_upgrade/etc/taboo/version.txt +++ b/frameworks/intl/parameter_upgrade/etc/taboo/version.txt @@ -1,6 +1,6 @@ -version=1.10.24.100 +version=11.10.24.100 type=TABOO subtype=generic compatibleVersion=1 classify=1 -displayVersion=TB.GENC.1.10.24.100 \ No newline at end of file +displayVersion=TB.GENC.11.10.24.100 \ No newline at end of file diff --git a/frameworks/intl/src/multi_users.cpp b/frameworks/intl/src/multi_users.cpp index 854cd3c8f03d3f170b32702e428ab6683d8368ac..5b94dd62e0395f15d855ba3bca6fed195ee01b9c 100644 --- a/frameworks/intl/src/multi_users.cpp +++ b/frameworks/intl/src/multi_users.cpp @@ -35,9 +35,6 @@ const std::string MultiUsers::MULTI_USERS_LANGUAGE_KEY = "languageData"; const std::string MultiUsers::MULTI_USERS_LOCALE_KEY = "localeData"; const std::string MultiUsers::MULTI_USERS_HOUR_KEY = "is24HourData"; const std::string MultiUsers::INIT_KEY = "init"; -const std::string MultiUsers::UPDATED_USERS_KEY = "updateUsers"; -const std::string MultiUsers::DEFAULT_UPDATED_USERS = "100:true"; -const std::string MultiUsers::TRUE_VALUE = "true"; const std::string MultiUsers::PREFERENCE_PATH = "/data/service/el1/public/i18n/global/GlobalParamData"; const int32_t MultiUsers::DEFAULT_LOCAL_ID = 100; const int MultiUsers::CONFIG_LEN = 128; @@ -60,7 +57,6 @@ void MultiUsers::InitMultiUser() if (!init) { AddUser(localId); preferences->PutBool(INIT_KEY, true); - preferences->PutString(UPDATED_USERS_KEY, DEFAULT_UPDATED_USERS); preferences->Flush(); HILOG_INFO_I18N("InitMultiUser: init multi user data success"); } @@ -178,8 +174,8 @@ I18nErrorCode MultiUsers::SaveIs24Hour(const std::string& localId, const std::st I18nErrorCode MultiUsers::SaveGlobalParam(const std::string& localId) { - std::string language = ReadSystemParameter(LocaleConfig::LANGUAGE_KEY.c_str(), CONFIG_LEN); - std::string locale = ReadSystemParameter(LocaleConfig::LOCALE_KEY.c_str(), CONFIG_LEN); + std::string language = LocaleConfig::GetSystemLanguage(); + std::string locale = LocaleConfig::GetSystemLocale(); std::string is24Hour = ReadSystemParameter(LocaleConfig::HOUR_KEY.c_str(), CONFIG_LEN); I18nErrorCode errCode = SaveLanguage(localId, language); if (errCode != I18nErrorCode::SUCCESS) { @@ -251,11 +247,6 @@ I18nErrorCode MultiUsers::RemoveGlobalParam(const std::string& localId) return I18nErrorCode::FAILED; } - errCode = WriteMultiUsersParameter(UPDATED_USERS_KEY, "", localId, true); - if (errCode != I18nErrorCode::SUCCESS) { - HILOG_ERROR_I18N("RemoveGlobalParam: Remove %{public}s failed.", localId.c_str()); - return I18nErrorCode::FAILED; - } return I18nErrorCode::SUCCESS; } @@ -377,21 +368,12 @@ void MultiUsers::UpdateConfiguration(const std::string& locale, const std::strin configuration.AddItem(AAFwk::GlobalConfigurationKey::SYSTEM_HOUR, is24Hour); auto appMgrClient = std::make_unique(); - std::string userIdStr = std::to_string(userId); - bool isUpdated = TRUE_VALUE.compare(ReadMultiUsersParameter(UPDATED_USERS_KEY, userIdStr)) == 0; - userId = isUpdated ? 0 : userId; - AppExecFwk::AppMgrResultCode status = appMgrClient->UpdateConfiguration(configuration, userId); if (status != AppExecFwk::AppMgrResultCode::RESULT_OK) { HILOG_ERROR_I18N("MultiUsers::UpdateConfiguration: Update configuration userId %{public}d failed.", userId); return; } HILOG_INFO_I18N("MultiUsers::UpdateConfiguration: Update configuration userId %{public}d success.", userId); - - if (!isUpdated && WriteMultiUsersParameter(UPDATED_USERS_KEY, TRUE_VALUE, userIdStr, false) != - I18nErrorCode::SUCCESS) { - HILOG_ERROR_I18N("MultiUsers::UpdateConfiguration: Write UPDATED_USERS_KEY failed."); - } } I18nErrorCode MultiUsers::PublishCommonEvent(int32_t userId) diff --git a/frameworks/intl/test/unittest/i18n_test.cpp b/frameworks/intl/test/unittest/i18n_test.cpp index 813fc25d095491f196441403044a593ce123690e..4a9f511abae46fbd13c8ab92668f665ece812de9 100644 --- a/frameworks/intl/test/unittest/i18n_test.cpp +++ b/frameworks/intl/test/unittest/i18n_test.cpp @@ -1501,6 +1501,7 @@ HWTEST_F(I18nTest, I18nFuncTest062, TestSize.Level1) HWTEST_F(I18nTest, I18nFuncTest063, TestSize.Level1) { std::unique_ptr ptr = std::make_unique(); + ASSERT_TRUE(ptr != nullptr); ptr->SetGregorianDate(1900, 1, 31); int32_t year = ptr->GetLunarYear(); @@ -1551,6 +1552,8 @@ HWTEST_F(I18nTest, I18nFuncTest063, TestSize.Level1) HWTEST_F(I18nTest, I18nFuncTest064, TestSize.Level1) { std::unique_ptr ptr = std::make_unique(); + ASSERT_TRUE(ptr != nullptr); + ptr->SetGregorianDate(2087, 1, 11); int32_t year = ptr->GetLunarYear(); int32_t month = ptr->GetLunarMonth(); @@ -1600,6 +1603,8 @@ HWTEST_F(I18nTest, I18nFuncTest064, TestSize.Level1) HWTEST_F(I18nTest, I18nFuncTest065, TestSize.Level1) { std::unique_ptr ptr = std::make_unique(); + ASSERT_TRUE(ptr != nullptr); + ptr->SetGregorianDate(2024, 8, 51); int32_t year = ptr->GetLunarYear(); int32_t month = ptr->GetLunarMonth(); diff --git a/services/include/i18n_service_ability.h b/services/include/i18n_service_ability.h index ed9066b80bed5ebb004e4e15b8fa7bf5d3ddf31c..db3bccf17b631c12845c1c52c6cfc483e0ac4701 100644 --- a/services/include/i18n_service_ability.h +++ b/services/include/i18n_service_ability.h @@ -69,7 +69,7 @@ private: * until there no request in 10s. */ void DelayUnloadI18nServiceAbility(); - int32_t GetTaskNumber(ModifyTaskNumber action); + int32_t UpdateTaskNumber(ModifyTaskNumber action); void StartTask(int32_t pid); void FinishTask(int32_t pid); int32_t GetCallingUserId(); diff --git a/services/src/hmos_libphonenumber_mount.cpp b/services/src/hmos_libphonenumber_mount.cpp deleted file mode 100644 index f7d402fd555fee951f837891a219ee25f8a8d198..0000000000000000000000000000000000000000 --- a/services/src/hmos_libphonenumber_mount.cpp +++ /dev/null @@ -1,152 +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 -#include -#include -#include "i18n_hilog.h" -#include "signature_verifier.h" -#include "utils.h" - - -namespace OHOS { -namespace Global { -namespace I18n { -namespace { -const std::string CUST_GLOBAL_CARRIER_DIR = "/system/etc/LIBPHONENUMBER/mount_dir/"; -const std::string VERSION_FILE = "version.txt"; -const std::string CERT_FILE = "CERT.ENC"; -const std::string VERIFY_FILE = "CERT.SF"; -const std::string MANIFEST_FILE = "MANIFEST.MF"; -const std::string SUB_TYPE = "generic"; -const std::string CFG_PATH = - "/data/service/el1/public/update/param_service/install/system/etc/LIBPHONENUMBER/generic/"; -const std::string LOCALE_PATH = "/system/etc/LIBPHONENUMBER/generic/"; -const std::string SAFE_PATH = "/data/service/el1/public/i18n/libphonenumber/"; -const std::string PUBKEY_NAME = "hota_i18n_upgrade_v1.pem"; -const std::vector DATA_FILES = {"GeocodingInfo", "MetadataInfo"}; -} - -bool Mount() -{ - if (!IsDirExist(CUST_GLOBAL_CARRIER_DIR.c_str()) || - !IsDirExist(SAFE_PATH.c_str())) { - HILOG_ERROR_I18N("Mount: CUST_GLOBAL_CARRIER_DIR or CFG_PATH not exist"); - return false; - } - - std::string cotaOpkeyVersionDir = SAFE_PATH; - std::string custOpkeyVersionDir = CUST_GLOBAL_CARRIER_DIR; - - if (mount(cotaOpkeyVersionDir.c_str(), custOpkeyVersionDir.c_str(), nullptr, MS_BIND, nullptr) != 0) { - HILOG_ERROR_I18N("Mount: fail to mount: opkey(%{public}s) errno(%{public}s)", - cotaOpkeyVersionDir.c_str(), strerror(errno)); - return false; - } else { - HILOG_INFO_I18N("Mount: success to mount cotaDir to custDir: opkey(%{public}s)", cotaOpkeyVersionDir.c_str()); - } - return true; -} - -void CopyDataFile() -{ - if (!IsDirExist(SAFE_PATH.c_str())) { - HILOG_INFO_I18N("CopyDataFile: SAFE_PATH not exist"); - return; - } - - for (size_t i = 0; i < DATA_FILES.size(); i++) { - std::string srcPath = CFG_PATH + DATA_FILES[i]; - std::string dstPath = SAFE_PATH + DATA_FILES[i]; - if (!FileExist(srcPath)) { - HILOG_INFO_I18N("CopyDataFile: %{public}s not exist", DATA_FILES[i].c_str()); - continue; - } - if (!FileCopy(srcPath, dstPath)) { - HILOG_INFO_I18N("CopyDataFile: copy %{public}s failed", DATA_FILES[i].c_str()); - } - } -} - -bool CheckIfUpdateNecessary() -{ - std::string versionUpdate = SignatureVerifier::LoadFileVersion(CFG_PATH + VERSION_FILE); - std::string versionLocale = SignatureVerifier::LoadFileVersion(LOCALE_PATH + VERSION_FILE); - HILOG_INFO_I18N("CheckIfUpdateNecessary: Verify: versionUpdate(%{public}s) versionLocale(%{public}s)", - versionUpdate.c_str(), versionLocale.c_str()); - - if (versionLocale.length() == 0 || versionUpdate.length() == 0) { - return false; - } - if (SignatureVerifier::CompareVersion(versionLocale, versionUpdate) <= 0) { - return false; - } - return true; -} - -bool CheckFileIntegrity() -{ - std::string certPath = CFG_PATH + CERT_FILE; - std::string verifyPath = CFG_PATH + VERIFY_FILE; - std::string pubkeyPath = LOCALE_PATH + PUBKEY_NAME; - std::string manifestPath = CFG_PATH + MANIFEST_FILE; - if (!SignatureVerifier::VerifyCertFile(certPath, verifyPath, pubkeyPath, manifestPath)) { - HILOG_ERROR_I18N("CheckFileIntegrity: VerifyCertFile error"); - return false; - } - - for (size_t i = 0; i < DATA_FILES.size(); i++) { - HILOG_ERROR_I18N("CheckFileIntegrity: file to verify (%{public}s)", DATA_FILES[i].c_str()); - std::string filePath = CFG_PATH + DATA_FILES[i]; - if (FileExist(filePath.c_str()) && - !SignatureVerifier::VerifyParamFile(DATA_FILES[i], CFG_PATH, manifestPath)) { - HILOG_ERROR_I18N("CheckFileIntegrity: VerifyParamFile error"); - return false; - } - } - - return true; -} - -void UpdateLibphonenumber() -{ - if (!CheckIfUpdateNecessary()) { - HILOG_INFO_I18N("UpdateLibphonenumber: CheckIfUpdateNecessary error, no need to update"); - return; - } - if (!CheckFileIntegrity()) { - HILOG_INFO_I18N("UpdateLibphonenumber: CheckFileIntegrity error, no need to update"); - return; - } - - CopyDataFile(); - - if (!Mount()) { - HILOG_INFO_I18N("UpdateLibphonenumber: mount error"); - return; - } - - HILOG_INFO_I18N("UpdateLibphonenumber: UpdateLibphonenumber"); -} - -} -} -} - -int main(int argc, char *argv[]) -{ - HILOG_INFO_I18N("hmos_libphonenumber_mount: UpdateLibphonenumber start"); - OHOS::Global::I18n::UpdateLibphonenumber(); - return 0; -} \ No newline at end of file diff --git a/services/src/hmos_timezone_mount.cpp b/services/src/hmos_timezone_mount.cpp deleted file mode 100644 index 4b0356551b12f599ca3cf1f4cb7941f24cf0c32a..0000000000000000000000000000000000000000 --- a/services/src/hmos_timezone_mount.cpp +++ /dev/null @@ -1,256 +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 -#include -#include -#include -#include -#include "i18n_hilog.h" -#include "parameter.h" -#include "signature_verifier.h" -#include "utils.h" - - -namespace OHOS { -namespace Global { -namespace I18n { - -const std::string CUST_GLOBAL_CARRIER_DIR = "/system/etc/tzdata_distro/"; -const std::string VERSION_FILE = "version.txt"; -const std::string CERT_FILE = "CERT.ENC"; -const std::string VERIFY_FILE = "CERT.SF"; -const std::string MANIFEST_FILE = "MANIFEST.MF"; -const std::string SUB_TYPE = "generic"; -const std::string CFG_PATH = - "/data/service/el1/public/update/param_service/install/system/etc/TIMEZONE/generic/current/"; -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 g_dataFiles = {}; - -bool Init() -{ - std::string manifestPath = CFG_PATH + MANIFEST_FILE; - std::unique_ptr resolvedPath = std::make_unique(PATH_MAX); - if (realpath(manifestPath.c_str(), resolvedPath.get()) == nullptr) { - HILOG_ERROR_I18N("MANIFEST_FILE file path isn't exists."); - return false; - } - std::ifstream file(resolvedPath.get()); - if (file.is_open()) { - std::string line; - while (std::getline(file, line)) { - if (line.find("Name: ") == 0) { - g_dataFiles.push_back(line.substr(FILE_NAME_INDEX)); - } - } - file.close(); - return true; - } else { - return false; - } -} - -bool Mount() -{ - if (!IsDirExist(CUST_GLOBAL_CARRIER_DIR.c_str()) || - !IsDirExist(SAFE_PATH.c_str())) { - HILOG_ERROR_I18N("Mount: CUST_GLOBAL_CARRIER_DIR or CFG_PATH not exist"); - return false; - } - - std::string cotaOpkeyVersionDir = SAFE_PATH; - std::string custOpkeyVersionDir = CUST_GLOBAL_CARRIER_DIR; - - if (mount(cotaOpkeyVersionDir.c_str(), custOpkeyVersionDir.c_str(), nullptr, MS_BIND, nullptr) != 0) { - HILOG_ERROR_I18N("Mount: fail to mount: opkey(%{public}s) errno(%{public}s)", - cotaOpkeyVersionDir.c_str(), strerror(errno)); - return false; - } - - if (mount(nullptr, custOpkeyVersionDir.c_str(), nullptr, MS_REMOUNT | MS_BIND | MS_RDONLY, nullptr) != 0) { - HILOG_ERROR_I18N("Mount: fail to mount read only: opkey(%{public}s) errno(%{public}s)", - cotaOpkeyVersionDir.c_str(), strerror(errno)); - if (umount(custOpkeyVersionDir.c_str()) != 0) { - HILOG_ERROR_I18N("Error during unmount: %{public}s\n", strerror(errno)); - } - return false; - } - - HILOG_INFO_I18N("Mount: success ro bind cotaDir to custDir: opkey(%{public}s)", cotaOpkeyVersionDir.c_str()); - return true; -} - -void ensureDirectoryExists(const std::filesystem::path& dir_path) -{ - std::error_code ec; - if (!std::filesystem::exists(dir_path)) { - HILOG_ERROR_I18N("Directory does not exist: %{public}s", dir_path.c_str()); - std::filesystem::create_directories(dir_path, ec); - if (ec) { - HILOG_ERROR_I18N("Failed to create directory: %{public}s, Error: %{public}s", dir_path.c_str(), - ec.message().c_str()); - } - } -} - -void clearPath(const std::filesystem::path& dir_path) -{ - std::error_code ec; - for (const auto& entry : std::filesystem::directory_iterator(dir_path)) { - std::filesystem::remove_all(entry.path(), ec); - if (ec) { - HILOG_ERROR_I18N("clearPath: Error removing file: %{public}s, Error: %{public}s", entry.path().c_str(), - ec.message().c_str()); - } - } -} - -bool copySingleFile(const std::filesystem::path& src_path, const std::filesystem::path& dst_path) -{ - if (!FileExist(src_path.string())) { - HILOG_ERROR_I18N("copySingleFile: Source file does not exist: %{public}s", src_path.c_str()); - return false; - } - - ensureDirectoryExists(dst_path.parent_path()); - HILOG_INFO_I18N("copySingleFile: copy file: %{public}s, %{public}s", src_path.c_str(), dst_path.c_str()); - if (!FileCopy(src_path.string(), dst_path.string())) { - HILOG_ERROR_I18N("copySingleFile: Failed to copy file: %{public}s", src_path.c_str()); - return false; - } - - return true; -} - -bool CopyDataFile() -{ - HILOG_INFO_I18N("TimeZone CopyDataFile start"); - if (!IsDirExist(SAFE_PATH.c_str())) { - HILOG_ERROR_I18N("TimeZone CopyDataFile: SAFE_PATH does not exist"); - return false; - } - - std::filesystem::path safe_dir(SAFE_PATH); - clearPath(safe_dir); - - bool copySuccess = true; - for (const auto& file : g_dataFiles) { - std::filesystem::path src_path = std::filesystem::path(CFG_PATH) / file; - std::filesystem::path dst_path = std::filesystem::path(SAFE_PATH) / file; - if (!copySingleFile(src_path, dst_path)) { - HILOG_ERROR_I18N("CopyDataFile: Copy failed for %{public}s", file.c_str()); - copySuccess = false; - break; - } - } - - if (!copySuccess) { - HILOG_ERROR_I18N("CopyDataFile error, clearing the safe directory..."); - clearPath(safe_dir); - } - - return copySuccess; -} - -bool CheckIfUpdateNecessary() -{ - std::string versionUpdate = SignatureVerifier::LoadFileVersion(CFG_PATH + VERSION_FILE); - std::string versionLocale = SignatureVerifier::LoadFileVersion(LOCALE_PATH + VERSION_FILE); - HILOG_INFO_I18N("CheckIfUpdateNecessary: Verify: versionUpdate(%{public}s) versionLocale(%{public}s)", - versionUpdate.c_str(), versionLocale.c_str()); - - if (versionLocale.length() == 0 || versionUpdate.length() == 0) { - return false; - } - if (SignatureVerifier::CompareVersion(versionLocale, versionUpdate) <= 0) { - return false; - } - return true; -} - -bool CheckFileIntegrity() -{ - std::string certPath = CFG_PATH + CERT_FILE; - std::string verifyPath = CFG_PATH + VERIFY_FILE; - std::string pubkeyPath = PUBKEY_PATH + PUBKEY_NAME; - std::string manifestPath = CFG_PATH + MANIFEST_FILE; - if (!SignatureVerifier::VerifyCertFile(certPath, verifyPath, pubkeyPath, manifestPath)) { - HILOG_ERROR_I18N("CheckFileIntegrity: VerifyCertFile error"); - return false; - } - - for (unsigned long i = 0; i < g_dataFiles.size(); i++) { - HILOG_ERROR_I18N("CheckFileIntegrity: file to verify (%{public}s)", g_dataFiles[i].c_str()); - std::string filePath = CFG_PATH + g_dataFiles[i]; - if (!FileExist(filePath.c_str())) { - HILOG_ERROR_I18N("CheckFileIntegrity: file not exist (%{public}s)", g_dataFiles[i].c_str()); - return false; - } - if (!SignatureVerifier::VerifyParamFile(g_dataFiles[i], CFG_PATH, manifestPath)) { - HILOG_ERROR_I18N("CheckFileIntegrity: VerifyParamFile error"); - return false; - } - } - - return true; -} - -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"); -} - -} -} -} - -int main(int argc, char *argv[]) -{ - HILOG_INFO_I18N("hmos_timezone_mount: UpdateTimeZone start"); - OHOS::Global::I18n::UpdateTimeZone(); - return 0; -} \ No newline at end of file diff --git a/services/src/i18n_service_ability.cpp b/services/src/i18n_service_ability.cpp index 8e84c30f9f80bf381c58157362a74ab66e2756f3..f917afc1f56b83c8a917f91c7ebc91177c77e72b 100644 --- a/services/src/i18n_service_ability.cpp +++ b/services/src/i18n_service_ability.cpp @@ -287,7 +287,7 @@ void I18nServiceAbility::OnStop() int32_t I18nServiceAbility::OnIdle(const SystemAbilityOnDemandReason& idleReason) { - if (GetTaskNumber(ModifyTaskNumber::QUERY) == 0) { + if (UpdateTaskNumber(ModifyTaskNumber::QUERY) == 0) { HILOG_INFO_I18N("I18nServiceAbility::OnIdle: Immediately unload."); return 0; } @@ -295,7 +295,7 @@ int32_t I18nServiceAbility::OnIdle(const SystemAbilityOnDemandReason& idleReason return DELAY_MILLISECONDS_FOR_UNLOAD_SA; } -int32_t I18nServiceAbility::GetTaskNumber(ModifyTaskNumber action) +int32_t I18nServiceAbility::UpdateTaskNumber(ModifyTaskNumber action) { std::lock_guard taskLock(taskNumberMutex); taskNumber += static_cast(action); @@ -307,7 +307,7 @@ void I18nServiceAbility::StartTask(int32_t pid) if (Memory::MemMgrClient::GetInstance().SetCritical(pid, true, I18N_SA_ID) != 0) { HILOG_ERROR_I18N("I18nServiceAbility::StartTask: Set critical true failed."); } - GetTaskNumber(ModifyTaskNumber::INCREASE); + UpdateTaskNumber(ModifyTaskNumber::INCREASE); DelayUnloadI18nServiceAbility(); } @@ -316,7 +316,7 @@ void I18nServiceAbility::FinishTask(int32_t pid) if (Memory::MemMgrClient::GetInstance().SetCritical(pid, false, I18N_SA_ID) != 0) { HILOG_ERROR_I18N("I18nServiceAbility::StartTask: Set critical true failed."); } - GetTaskNumber(ModifyTaskNumber::DECREASE); + UpdateTaskNumber(ModifyTaskNumber::DECREASE); } int32_t I18nServiceAbility::GetCallingUserId()