mirror of
https://github.com/openharmony/bundlemanager_bundle_framework_lite.git
synced 2026-07-19 20:23:33 -04:00
IssueNo:#I4DK34
Description:add transform language Sig:appexecfwk Feature or Bugfix:Bugfix Binary Source:No Signed-off-by: wangdengjia <wangdengjia@huawei.com> Change-Id: I16322a2b3914e9263cfa84e0e7f730a5ea3316da Signed-off-by: wangdengjia <wangdengjia@huawei.com>
This commit is contained in:
@@ -51,6 +51,8 @@ public:
|
||||
|
||||
bool RegisterInstallerCallback(InstallerCallback installerCallback) const;
|
||||
|
||||
void UpdateBundleInfoList() const;
|
||||
|
||||
private:
|
||||
BundleMsClient() = default;
|
||||
|
||||
|
||||
@@ -33,4 +33,9 @@ bool RegisterInstallerCallback(InstallerCallback installerCallback)
|
||||
{
|
||||
return OHOS::BundleMsClient::GetInstance().RegisterInstallerCallback(installerCallback);
|
||||
}
|
||||
|
||||
void UpdateBundleInfoList(void)
|
||||
{
|
||||
OHOS::BundleMsClient::GetInstance().UpdateBundleInfoList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,4 +188,12 @@ uint32_t BundleMsClient::GetBundleSize (const char *bundleName) const
|
||||
}
|
||||
return bmsProxy_->GetBundleSize(bundleName);
|
||||
}
|
||||
|
||||
void BundleMsClient::UpdateBundleInfoList () const
|
||||
{
|
||||
if (!Initialize()) {
|
||||
return;
|
||||
}
|
||||
bmsProxy_->UpdateBundleInfoList();
|
||||
}
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -52,6 +52,7 @@ struct BmsSliteInterface {
|
||||
bool (*GetInstallState)(const char *bundleName, InstallState *installState, uint8_t *installProcess);
|
||||
uint32_t (*GetBundleSize)(const char *bundleName);
|
||||
bool (*RegisterInstallerCallback)(InstallerCallback installerCallback);
|
||||
void (*UpdateBundleInfoList)();
|
||||
};
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
@@ -75,6 +75,12 @@ uint32_t GetBundleSize(const char *bundleName);
|
||||
*/
|
||||
bool RegisterInstallerCallback(InstallerCallback installerCallback);
|
||||
|
||||
/**
|
||||
* @brief Update bundleInfo when system language has been changed.
|
||||
*
|
||||
*/
|
||||
void UpdateBundleInfoList(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ const uint8_t LONG_LENGTH = 8;
|
||||
const uint16_t MAX_INT = 256;
|
||||
const uint8_t MAX_VERSION_NAME_LEN = 20;
|
||||
const uint8_t MAX_LABLE_LEN = 30;
|
||||
const uint8_t MAX_THIRD_BUNDLE_NUMBER = 30;
|
||||
const uint8_t MAX_THIRD_BUNDLE_NUMBER = 50;
|
||||
|
||||
struct SignatureInfo {
|
||||
char *bundleName;
|
||||
|
||||
@@ -38,6 +38,7 @@ public:
|
||||
static bool GetInstallState(const char *bundleName, InstallState *installState, uint8_t *installProcess);
|
||||
static uint32_t GetBundleSize (const char *bundleName);
|
||||
static bool RegisterInstallerCallback(InstallerCallback installerCallback);
|
||||
static void UpdateBundleInfoList();
|
||||
|
||||
static BundleMgrSliteFeature *GetInstance()
|
||||
{
|
||||
|
||||
@@ -69,6 +69,7 @@ public:
|
||||
uint32_t GetNumOfThirdBundles();
|
||||
void RemoveBundleResList(const char *bundleName);
|
||||
void AddBundleResList(const BundleRes *bundleRes);
|
||||
void UpdateBundleInfoList();
|
||||
void ReportInstallProcess(const char *bundleName, uint8_t bundleStyle, uint8_t process);
|
||||
void AddNumOfThirdBundles();
|
||||
void ReduceNumOfThirdBundles();
|
||||
|
||||
@@ -35,6 +35,7 @@ BundleMgrSliteFeatureImpl g_bmsSliteImpl = {
|
||||
.GetInstallState = BundleMgrSliteFeature::GetInstallState,
|
||||
.GetBundleSize = BundleMgrSliteFeature::GetBundleSize,
|
||||
.RegisterInstallerCallback = BundleMgrSliteFeature::RegisterInstallerCallback,
|
||||
.UpdateBundleInfoList = BundleMgrSliteFeature::UpdateBundleInfoList,
|
||||
DEFAULT_IUNKNOWN_ENTRY_END
|
||||
};
|
||||
|
||||
@@ -138,4 +139,9 @@ bool BundleMgrSliteFeature::RegisterInstallerCallback(InstallerCallback installe
|
||||
{
|
||||
return OHOS::GtManagerService::GetInstance().RegisterInstallerCallback(installerCallback);
|
||||
}
|
||||
|
||||
void BundleMgrSliteFeature::UpdateBundleInfoList()
|
||||
{
|
||||
OHOS::GtManagerService::GetInstance().UpdateBundleInfoList();
|
||||
}
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -659,6 +659,46 @@ void GtManagerService::RemoveBundleResList(const char *bundleName)
|
||||
}
|
||||
}
|
||||
|
||||
void GtManagerService::UpdateBundleInfoList()
|
||||
{
|
||||
if (bundleResList_ == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto node = bundleResList_->Begin(); node != bundleResList_->End(); node = node->next_) {
|
||||
BundleRes *res = node->value_;
|
||||
if (res == nullptr || res->bundleName == nullptr || res->abilityRes == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
BundleInfo *bundleInfo = bundleMap_->Get(res->bundleName);
|
||||
if (bundleInfo == nullptr) {
|
||||
HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] get no bundleInfo when change bundle res!");
|
||||
continue;
|
||||
}
|
||||
|
||||
int32_t len = strlen(INSTALL_PATH) + 1 + strlen(res->bundleName);
|
||||
char *path = reinterpret_cast<char *>(UI_Malloc(len + 1));
|
||||
if (path == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sprintf_s(path, len + 1, "%s/%s", INSTALL_PATH, res->bundleName) < 0) {
|
||||
HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] change bundle res failed! because sprintf_s fail");
|
||||
UI_Free(path);
|
||||
continue;
|
||||
}
|
||||
|
||||
uint8_t errorCode = GtBundleParser::ConvertResInfoToBundleInfo(path, res->abilityRes->labelId,
|
||||
res->abilityRes->iconId, bundleInfo);
|
||||
UI_Free(path);
|
||||
if (errorCode != ERR_OK) {
|
||||
HILOG_ERROR(HILOG_MODULE_AAFWK, "[BMS] change bundle res failed! errorCode is %d", errorCode);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GtManagerService::TransformJsToBcWhenRestart(const char *codePath, const char *bundleName)
|
||||
{
|
||||
if (codePath == nullptr) {
|
||||
@@ -872,7 +912,7 @@ int32_t GtManagerService::ReportUninstallCallback(uint8_t errCode, uint8_t insta
|
||||
return -1;
|
||||
}
|
||||
bundleInstallMsg->installState = static_cast<InstallState>(installState);
|
||||
bundleInstallMsg->bundleName = Utils::Strdup(bundleName);
|
||||
bundleInstallMsg->bundleName = bundleName;
|
||||
bundleInstallMsg->installProcess = process;
|
||||
(*installerCallback)(errCode, bundleInstallMsg);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user