!1233 bms扫描完成后,发送扫描完成广播

Merge pull request !1233 from wanghang/master
This commit is contained in:
openharmony_ci
2022-04-16 11:55:10 +00:00
committed by Gitee
4 changed files with 23 additions and 0 deletions
@@ -94,6 +94,10 @@ public:
* @brief register bms sa to samgr
*/
void RegisterService();
/**
* @brief send bundle scan finished common event
*/
void NotifyBundleScanStatus();
/**
* @brief Process hidump.
* @param args Indicates the args.
@@ -15,6 +15,8 @@
#include "bundle_mgr_service.h"
#include "ohos/aafwk/content/want.h"
#include "account_helper.h"
#include "app_log_wrapper.h"
#include "bundle_constants.h"
@@ -317,6 +319,19 @@ void BundleMgrService::RegisterService()
AfterRegisterToService();
}
void BundleMgrService::NotifyBundleScanStatus()
{
APP_LOGD("PublishCommonEvent for bundle scan finished");
AAFwk::Want want;
want.SetAction(EventFwk::CommonEventSupport::COMMON_EVENT_BUNDLE_SCAN_FINISHED);
EventFwk::CommonEventData commonEventData { want };
if (!EventFwk::CommonEventManager::PublishCommonEvent(commonEventData)) {
APP_LOGE("PublishCommonEvent for bundle scan finished failed.");
} else {
APP_LOGD("PublishCommonEvent for bundle scan finished succeed.");
}
}
#ifdef DEVICE_MANAGER_ENABLE
void BundleMgrService::OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId)
{
@@ -71,6 +71,7 @@ void BMSEventHandler::ProcessEvent(const InnerEvent::Pointer &event)
OnRebootStartScanning();
SetAllInstallFlag();
DelayedSingleton<BundleMgrService>::GetInstance()->RegisterService();
DelayedSingleton<BundleMgrService>::GetInstance()->NotifyBundleScanStatus();
break;
}
default:
@@ -100,6 +100,9 @@ void BundleUserMgrHostImpl::CreateNewUser(int32_t userId)
if (static_cast<int32_t>(g_installedHapNum) < totalHapNum) {
bundlePromise->WaitForAllTasksExecute();
}
if (userId == Constants::START_USERID) {
DelayedSingleton<BundleMgrService>::GetInstance()->NotifyBundleScanStatus();
}
APP_LOGD("CreateNewUser end userId: (%{public}d)", userId);
}