mirror of
https://gitee.com/openharmony/bundlemanager_bundle_framework
synced 2024-11-23 07:09:53 +00:00
IssueNo:#IB3U0Q
Description:fix singleton bug Sig:SIG_ApplicaitonFramework Feature or Bugfix:Bugfix Binary Source:No Signed-off-by: wangtiantian <wangtiantian19@huawei.com>
This commit is contained in:
parent
607d14a403
commit
b57d7091ab
@ -631,6 +631,7 @@ private:
|
||||
void UpdatePreinstallDBForNotUpdatedBundle(const std::string &bundleName,
|
||||
const std::unordered_map<std::string, InnerBundleInfo> &innerBundleInfos);
|
||||
void InnerProcessRebootUninstallWrongBundle();
|
||||
bool InnerCheckSingletonBundleUserInfo(const InnerBundleInfo &bundleInfo);
|
||||
void ProcessCheckAppEl1Dir();
|
||||
void static ProcessCheckAppEl1DirTask();
|
||||
void CleanAllBundleShaderCache() const;
|
||||
|
@ -181,6 +181,14 @@ const std::set<std::string> ALLOW_MULTI_ICON_BUNDLE = {
|
||||
"com.ohos.contacts"
|
||||
};
|
||||
constexpr const char* CALLER_NAME_BMS = "bms";
|
||||
// allow singleton change
|
||||
const std::set<std::string> SINGLETON_WHITE_LIST = {
|
||||
"com.ohos.formrenderservice",
|
||||
"com.ohos.sceneboard",
|
||||
"com.ohos.callui",
|
||||
"com.ohos.mms",
|
||||
"com.ohos.FusionSearch"
|
||||
};
|
||||
} // namespace ServiceConstants
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
|
@ -104,14 +104,6 @@ constexpr const char* BMS_ACTIVATION_LOCK = "persist.bms.activation-lock";
|
||||
constexpr const char* BMS_TRUE = "true";
|
||||
constexpr const char* BMS_FALSE = "false";
|
||||
constexpr int8_t BMS_ACTIVATION_LOCK_VAL_LEN = 20;
|
||||
|
||||
const std::set<std::string> SINGLETON_WHITE_LIST = {
|
||||
"com.ohos.formrenderservice",
|
||||
"com.ohos.sceneboard",
|
||||
"com.ohos.callui",
|
||||
"com.ohos.mms",
|
||||
"com.ohos.FusionSearch"
|
||||
};
|
||||
constexpr const char* DATA_EXTENSION_PATH = "/extension/";
|
||||
const char* INSTALL_SOURCE_PREINSTALL = "pre-installed";
|
||||
const char* INSTALL_SOURCE_UNKNOWN = "unknown";
|
||||
@ -2156,7 +2148,7 @@ ErrCode BaseBundleInstaller::ProcessBundleInstallStatus(InnerBundleInfo &info, i
|
||||
|
||||
bool BaseBundleInstaller::AllowSingletonChange(const std::string &bundleName)
|
||||
{
|
||||
return SINGLETON_WHITE_LIST.find(bundleName) != SINGLETON_WHITE_LIST.end();
|
||||
return ServiceConstants::SINGLETON_WHITE_LIST.find(bundleName) != ServiceConstants::SINGLETON_WHITE_LIST.end();
|
||||
}
|
||||
|
||||
ErrCode BaseBundleInstaller::ProcessBundleUpdateStatus(
|
||||
|
@ -3924,20 +3924,64 @@ void BMSEventHandler::ProcessRebootQuickFixUnInstallAndRecover(const std::string
|
||||
|
||||
void BMSEventHandler::InnerProcessRebootUninstallWrongBundle()
|
||||
{
|
||||
auto dataMgr = DelayedSingleton<BundleMgrService>::GetInstance()->GetDataMgr();
|
||||
if (dataMgr == nullptr) {
|
||||
LOG_E(BMS_TAG_DEFAULT, "dataMgr is null");
|
||||
return;
|
||||
}
|
||||
for (const auto &bundleName : ServiceConstants::SINGLETON_WHITE_LIST) {
|
||||
InnerBundleInfo bundleInfo;
|
||||
if (!dataMgr->FetchInnerBundleInfo(bundleName, bundleInfo)) {
|
||||
LOG_W(BMS_TAG_DEFAULT, "-n %{public}s is not exist", bundleName.c_str());
|
||||
continue;
|
||||
}
|
||||
InnerCheckSingletonBundleUserInfo(bundleInfo);
|
||||
}
|
||||
}
|
||||
|
||||
bool BMSEventHandler::InnerCheckSingletonBundleUserInfo(const InnerBundleInfo &bundleInfo)
|
||||
{
|
||||
const auto bundleUserInfos = bundleInfo.GetInnerBundleUserInfos();
|
||||
if (bundleUserInfos.size() <= 1) {
|
||||
return true;
|
||||
}
|
||||
std::set<int32_t> userIds;
|
||||
for (const auto &item : bundleUserInfos) {
|
||||
userIds.insert(item.second.bundleUserInfo.userId);
|
||||
}
|
||||
if (userIds.find(Constants::DEFAULT_USERID) == userIds.end()) {
|
||||
return true;
|
||||
}
|
||||
const std::string bundleName = bundleInfo.GetBundleName();
|
||||
LOG_I(BMS_TAG_DEFAULT, "-n %{public}s is exist different user info", bundleName.c_str());
|
||||
InstallParam installParam;
|
||||
installParam.userId = Constants::DEFAULT_USERID;
|
||||
installParam.SetKillProcess(false);
|
||||
installParam.needSendEvent = false;
|
||||
std::vector<std::string> wrongBundleNameList;
|
||||
wrongBundleNameList.emplace_back(Constants::SCENE_BOARD_BUNDLE_NAME);
|
||||
|
||||
for (const auto &bundle : wrongBundleNameList) {
|
||||
if (!bundleInfo.IsSingleton()) {
|
||||
LOG_I(BMS_TAG_DEFAULT, "-n %{public}s delete 0 userInfo", bundleName.c_str());
|
||||
SystemBundleInstaller installer;
|
||||
if (!installer.UninstallSystemBundle(bundle, installParam)) {
|
||||
LOG_W(BMS_TAG_DEFAULT, "OTA uninstall bundle %{public}s userId %{public}d error", bundle.c_str(),
|
||||
if (!installer.UninstallSystemBundle(bundleName, installParam)) {
|
||||
LOG_W(BMS_TAG_DEFAULT, "OTA uninstall bundle %{public}s userId %{public}d error", bundleName.c_str(),
|
||||
installParam.userId);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
for (const auto &userId : userIds) {
|
||||
if (userId == Constants::DEFAULT_USERID) {
|
||||
continue;
|
||||
}
|
||||
LOG_I(BMS_TAG_DEFAULT, "-n %{public}s delete %{public}d userInfo", bundleName.c_str(), userId);
|
||||
installParam.userId = userId;
|
||||
SystemBundleInstaller installer;
|
||||
if (!installer.UninstallSystemBundle(bundleName, installParam)) {
|
||||
LOG_W(BMS_TAG_DEFAULT, "OTA uninstall bundle %{public}s userId %{public}d error", bundleName.c_str(),
|
||||
installParam.userId);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void BMSEventHandler::ProcessCheckAppEl1Dir()
|
||||
|
Loading…
Reference in New Issue
Block a user