diff --git a/services/dtbschedmgr/include/mission/dms_continue_recv_manager.h b/services/dtbschedmgr/include/mission/dms_continue_recv_manager.h index 2906b6ed..185883ea 100644 --- a/services/dtbschedmgr/include/mission/dms_continue_recv_manager.h +++ b/services/dtbschedmgr/include/mission/dms_continue_recv_manager.h @@ -84,6 +84,7 @@ public: int32_t RegisterOffListener(const std::string& type, const sptr& obj); void NotifyDied(const sptr& obj); void NotifyDeviceOffline(const std::string& networkId); + void NotifyPackageRemove(const std::string& sinkBundleName); void OnDeviceScreenOff(); void OnContinueSwitchOff(); std::string GetContinueType(const std::string& bundleName); diff --git a/services/dtbschedmgr/src/common_event_listener.cpp b/services/dtbschedmgr/src/common_event_listener.cpp index b69150b6..749e3223 100644 --- a/services/dtbschedmgr/src/common_event_listener.cpp +++ b/services/dtbschedmgr/src/common_event_listener.cpp @@ -81,8 +81,9 @@ void CommonEventListener::OnReceiveEvent(const EventFwk::CommonEventData &eventD DmsBmStorage::GetInstance()->SaveStorageDistributeInfo(want.GetElement().GetBundleName(), true); break; case PACKAGE_REMOVED : - HILOGI("PACKAGE_REMOVED"); + HILOGI("PACKAGE_REMOVED: %{public}s", want.GetElement().GetBundleName().c_str()); DmsBmStorage::GetInstance()->DeleteStorageDistributeInfo(want.GetElement().GetBundleName()); + DMSContinueRecvMgr::GetInstance().NotifyPackageRemove(want.GetElement().GetBundleName()); break; default: HILOGW("OnReceiveEvent undefined action"); diff --git a/services/dtbschedmgr/src/mission/dms_continue_recv_manager.cpp b/services/dtbschedmgr/src/mission/dms_continue_recv_manager.cpp index 1561298c..52d4ea66 100644 --- a/services/dtbschedmgr/src/mission/dms_continue_recv_manager.cpp +++ b/services/dtbschedmgr/src/mission/dms_continue_recv_manager.cpp @@ -561,6 +561,46 @@ void DMSContinueRecvMgr::NotifyDeviceOffline(const std::string& networkId) HILOGI("NotifyDeviceOffline end"); } +void DMSContinueRecvMgr::NotifyPackageRemove(const std::string& sinkBundleName) +{ + if (sinkBundleName.empty()) { + HILOGE("NotifyPackageRemove sinkBundleName empty"); + return; + } + if(iconInfo_.bundleName != sinkBundleName) { + return; + } + HILOGI("NotifyPackageRemove begin. sinkBundleName: %{public}s.", sinkBundleName.c_str()); + std::string senderNetworkId; + std::string bundleName; + std::string continueType; + { + std::lock_guard currentIconLock(iconMutex_); + senderNetworkId = iconInfo_.senderNetworkId; + bundleName = iconInfo_.bundleName; + continueType = iconInfo_.continueType; + iconInfo_.senderNetworkId = ""; + iconInfo_.bundleName = ""; + iconInfo_.continueType = ""; + } + HILOGI("Saved iconInfo cleared, sinkBundleName: %{public}s.", bundleName.c_str()); + { + std::lock_guard registerOnListenerMapLock(eventMutex_); + auto iterItem = registerOnListener_.find(onType_); + if (iterItem == registerOnListener_.end()) { + HILOGI("Get iterItem failed from registerOnListener_, nobody registed"); + return; + } + std::vector> objs = iterItem->second; + for (auto iter : objs) { + NotifyRecvBroadcast(iter, + currentIconInfo(senderNetworkId, iconInfo_.sourceBundleName, bundleName, continueType), + INACTIVE); + } + } + HILOGI("NotifyPackageRemove end"); +} + std::string DMSContinueRecvMgr::GetContinueType(const std::string& bundleName) { std::lock_guard currentIconLock(iconMutex_);