!102 添加蓝牙断连后安装进度接口能够返回正在更新的应用进度的功能

Merge pull request !102 from wangdengjia/1209beta2
This commit is contained in:
openharmony_ci
2021-12-10 07:07:09 +00:00
committed by Gitee
2 changed files with 19 additions and 3 deletions
@@ -109,6 +109,8 @@ private:
uint32_t installedThirdBundleNum_;
List<ToBeInstalledApp *> systemPathList_;
PreAppList *preAppList_;
bool updateFlag_;
int32_t oldVersionCode_;
};
}
@@ -51,6 +51,8 @@ GtManagerService::GtManagerService()
jsEngineVer_ = nullptr;
installedThirdBundleNum_ = 0;
preAppList_ = nullptr;
updateFlag_ = false;
oldVersionCode_ = -1;
}
GtManagerService::~GtManagerService()
@@ -109,6 +111,15 @@ bool GtManagerService::Install(const char *hapPath, const InstallParam *installP
return false;
}
updateFlag_ = false;
oldVersionCode_ = -1;
BundleInfo *installedInfo = bundleMap_->Get(bundleInstallMsg_->bundleName);
if (installedInfo != nullptr) {
updateFlag_ = true;
oldVersionCode_ = installedInfo->versionCode;
HILOG_INFO(HILOG_MODULE_AAFWK, "[BMS] App is in the updated state");
}
SetCurrentBundle(bundleInstallMsg_->bundleName);
(void) ReportInstallCallback(OPERATION_DOING, 0, BMS_INSTALLATION_START, installerCallback);
DisableServiceWdg();
@@ -174,9 +185,12 @@ bool GtManagerService::GetInstallState(const char *bundleName, InstallState *ins
}
BundleInfo *installedInfo = bundleMap_->Get(bundleName);
if (installedInfo != nullptr) {
*installState = BUNDLE_INSTALL_OK;
*installProcess = BMS_INSTALLATION_COMPLETED;
return true;
bool isUpdateSuccess = updateFlag_ && oldVersionCode_ < installedInfo->versionCode;
if (!updateFlag_ || isUpdateSuccess) {
*installState = BUNDLE_INSTALL_OK;
*installProcess = BMS_INSTALLATION_COMPLETED;
return true;
}
}
if (bundleInstallMsg_ == nullptr || bundleInstallMsg_->bundleName == nullptr) {
*installState = BUNDLE_INSTALL_FAIL;