mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-23 06:20:07 +00:00
卸载应用后通知接续图标消失
Signed-off-by: MisterE <smart_e@126.com>
This commit is contained in:
commit
96a76aa0d3
@ -84,6 +84,7 @@ public:
|
||||
int32_t RegisterOffListener(const std::string& type, const sptr<IRemoteObject>& obj);
|
||||
void NotifyDied(const sptr<IRemoteObject>& obj);
|
||||
void NotifyDeviceOffline(const std::string& networkId);
|
||||
void NotifyPackageRemove(const std::string& sinkBundleName);
|
||||
void OnDeviceScreenOff();
|
||||
void OnContinueSwitchOff();
|
||||
std::string GetContinueType(const std::string& bundleName);
|
||||
|
@ -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");
|
||||
|
@ -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<std::mutex> 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<std::mutex> registerOnListenerMapLock(eventMutex_);
|
||||
auto iterItem = registerOnListener_.find(onType_);
|
||||
if (iterItem == registerOnListener_.end()) {
|
||||
HILOGI("Get iterItem failed from registerOnListener_, nobody registed");
|
||||
return;
|
||||
}
|
||||
std::vector<sptr<IRemoteObject>> 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<std::mutex> currentIconLock(iconMutex_);
|
||||
|
Loading…
Reference in New Issue
Block a user