异包名接续广播缓存优化及添加打点

Signed-off-by: MisterE <smart_e@126.com>
This commit is contained in:
MisterE 2024-09-12 17:49:47 +08:00
commit 271468c447
2 changed files with 22 additions and 9 deletions

View File

@ -48,10 +48,11 @@ struct currentIconInfo {
}
currentIconInfo(const std::string &source_device_id, const std::string &source_bundle_name,
const std::string &sink_bundle_name)
const std::string &sink_bundle_name, const std::string &continueType = "")
: senderNetworkId(source_device_id),
bundleName(sink_bundle_name),
sourceBundleName(source_bundle_name) {
sourceBundleName(source_bundle_name),
continueType(continueType) {
}
currentIconInfo() = default;
@ -102,8 +103,7 @@ private:
std::string &continueType);
int32_t DealOnBroadcastBusiness(const std::string& senderNetworkId, uint16_t bundleNameId, uint8_t continueTypeId,
const int32_t state, const int32_t retry = 0);
void NotifyRecvBroadcast(const sptr<IRemoteObject>& obj, const std::string& networkId, const std::string& srcBundleName,
const std::string& sinkBundleName, const int32_t state, const std::string& continueType = "");
void NotifyRecvBroadcast(const sptr<IRemoteObject>& obj, const currentIconInfo& continueInfo, const int32_t state);
bool ContinueTypeCheck(const AppExecFwk::BundleInfo& bundleInfo, const std::string& continueType);
void PushLatRecvCache(currentIconInfo &lastRecvInfo);
private:

View File

@ -370,7 +370,9 @@ int32_t DMSContinueRecvMgr::DealOnBroadcastBusiness(const std::string& senderNet
}
std::vector<sptr<IRemoteObject>> objs = iterItem->second;
for (auto iter : objs) {
NotifyRecvBroadcast(iter, senderNetworkId, bundleName, finalBundleName, state, continueType);
NotifyRecvBroadcast(iter,
currentIconInfo(senderNetworkId, bundleName, finalBundleName, continueType),
state);
}
HILOGI("DealOnBroadcastBusiness end");
return ERR_OK;
@ -385,8 +387,13 @@ void DMSContinueRecvMgr::PushLatRecvCache(currentIconInfo &lastRecvInfo)
}
void DMSContinueRecvMgr::NotifyRecvBroadcast(const sptr<IRemoteObject>& obj,
const std::string& networkId, const std::string& srcBundleName, const std::string& sinkBundleName, const int32_t state, const std::string& continueType)
const currentIconInfo& continueInfo, const int32_t state)
{
std::string networkId = continueInfo.senderNetworkId;
std::string srcBundleName = continueInfo.sourceBundleName;
std::string sinkBundleName = continueInfo.bundleName;
std::string continueType = continueInfo.continueType.empty() ? "" : continueInfo.continueType;
HILOGI("NotifyRecvBroadcast start");
if (obj == nullptr) {
HILOGE("obj is null");
@ -478,7 +485,9 @@ void DMSContinueRecvMgr::OnDeviceScreenOff()
}
std::vector<sptr<IRemoteObject>> objs = iterItem->second;
for (auto iter : objs) {
NotifyRecvBroadcast(iter, senderNetworkId, iconInfo_.sourceBundleName, bundleName, INACTIVE, continueType);
NotifyRecvBroadcast(iter,
currentIconInfo(senderNetworkId, iconInfo_.sourceBundleName, bundleName, continueType),
INACTIVE);
}
}
};
@ -520,7 +529,9 @@ void DMSContinueRecvMgr::OnContinueSwitchOff()
}
std::vector<sptr<IRemoteObject>> objs = iterItem->second;
for (auto iter : objs) {
NotifyRecvBroadcast(iter, senderNetworkId, iconInfo_.sourceBundleName, bundleName, INACTIVE, continueType);
NotifyRecvBroadcast(iter,
currentIconInfo(senderNetworkId, iconInfo_.sourceBundleName, bundleName, continueType),
INACTIVE);
}
}
};
@ -570,7 +581,9 @@ void DMSContinueRecvMgr::NotifyDeviceOffline(const std::string& networkId)
}
std::vector<sptr<IRemoteObject>> objs = iterItem->second;
for (auto iter : objs) {
NotifyRecvBroadcast(iter, senderNetworkId, iconInfo_.sourceBundleName, bundleName, INACTIVE, continueType);
NotifyRecvBroadcast(iter,
currentIconInfo(senderNetworkId, iconInfo_.sourceBundleName, bundleName, continueType),
INACTIVE);
}
}
HILOGI("NotifyDeviceOffline end");