mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2025-02-17 04:49:02 +00:00
commit
db65e9e206
@ -104,8 +104,6 @@ private:
|
||||
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 currentIconInfo& continueInfo, const int32_t state);
|
||||
bool ContinueTypeCheck(const AppExecFwk::BundleInfo& bundleInfo, const std::string& continueType);
|
||||
void PushLatRecvCache(currentIconInfo &lastRecvInfo);
|
||||
private:
|
||||
currentIconInfo iconInfo_;
|
||||
sptr<DistributedMissionDiedListener> missionDiedListener_;
|
||||
@ -117,8 +115,6 @@ private:
|
||||
std::mutex iconMutex_;
|
||||
std::shared_ptr<OHOS::AppExecFwk::EventHandler> eventHandler_;
|
||||
bool hasRegSoftbusEventListener_ = false;
|
||||
public:
|
||||
std::vector<currentIconInfo> lastRecvList_;
|
||||
};
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
|
@ -43,7 +43,6 @@ constexpr int32_t INDEX_2 = 2;
|
||||
constexpr int32_t INDEX_3 = 3;
|
||||
constexpr int32_t DBMS_RETRY_MAX_TIME = 5;
|
||||
constexpr int32_t DBMS_RETRY_DELAY = 2000;
|
||||
constexpr int32_t LAST_RECV_INFO_QUEUE_SIZE = 5;
|
||||
const std::string TAG = "DMSContinueRecvMgr";
|
||||
const std::string DBMS_RETRY_TASK = "retry_on_boradcast_task";
|
||||
const std::u16string DESCRIPTOR = u"ohos.aafwk.RemoteOnListener";
|
||||
@ -267,8 +266,7 @@ bool DMSContinueRecvMgr::GetFinalBundleName(DmsBundleInfo &distributedBundleInfo
|
||||
AppExecFwk::BundleInfo &localBundleInfo, std::string &continueType)
|
||||
{
|
||||
std::string bundleName = distributedBundleInfo.bundleName;
|
||||
if (BundleManagerInternal::GetLocalBundleInfo(bundleName, localBundleInfo) == ERR_OK
|
||||
&& ContinueTypeCheck(localBundleInfo, continueType)) {
|
||||
if (BundleManagerInternal::GetLocalBundleInfo(bundleName, localBundleInfo) == ERR_OK) {
|
||||
finalBundleName = bundleName;
|
||||
return true;
|
||||
}
|
||||
@ -285,31 +283,16 @@ bool DMSContinueRecvMgr::GetFinalBundleName(DmsBundleInfo &distributedBundleInfo
|
||||
AppExecFwk::AppProvisionInfo appProvisionInfo;
|
||||
if (BundleManagerInternal::GetAppProvisionInfo4CurrentUser(bundleNameItem, appProvisionInfo)
|
||||
&& appProvisionInfo.developerId == distributedBundleInfo.developerId
|
||||
&& BundleManagerInternal::GetLocalBundleInfo(bundleNameItem, localBundleInfo) == ERR_OK
|
||||
&& ContinueTypeCheck(localBundleInfo, continueType)) {
|
||||
&& BundleManagerInternal::GetLocalBundleInfo(bundleNameItem, localBundleInfo) == ERR_OK) {
|
||||
finalBundleName = bundleNameItem;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
HILOGE("continue type is not empty and can not get local bundle info and continue nundle for "
|
||||
HILOGE("can not get local bundle info and continue nundle for "
|
||||
"bundle name: %{public}s", bundleName.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DMSContinueRecvMgr::ContinueTypeCheck(const AppExecFwk::BundleInfo &bundleInfo, const std::string &continueType)
|
||||
{
|
||||
for (const auto &abilityInfo: bundleInfo.abilityInfos) {
|
||||
for (const auto &continueTypeItem: abilityInfo.continueType) {
|
||||
if (continueTypeItem == continueType) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
HILOGE("can not mate continue type: %{public}s in buninfo for bundleName: %{public}s", continueType.c_str(),
|
||||
bundleInfo.name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
void DMSContinueRecvMgr::FindContinueType(const DmsBundleInfo &distributedBundleInfo,
|
||||
uint8_t &continueTypeId, std::string &continueType)
|
||||
{
|
||||
@ -350,8 +333,6 @@ int32_t DMSContinueRecvMgr::DealOnBroadcastBusiness(const std::string& senderNet
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
HILOGI("got finalBundleName: %{public}s", finalBundleName.c_str());
|
||||
currentIconInfo lastRecvInfo = currentIconInfo(senderNetworkId, bundleName, finalBundleName);
|
||||
PushLatRecvCache(lastRecvInfo);
|
||||
|
||||
if (localBundleInfo.applicationInfo.bundleType != AppExecFwk::BundleType::APP) {
|
||||
HILOGE("The bundleType must be app, but it is %{public}d", localBundleInfo.applicationInfo.bundleType);
|
||||
@ -378,14 +359,6 @@ int32_t DMSContinueRecvMgr::DealOnBroadcastBusiness(const std::string& senderNet
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void DMSContinueRecvMgr::PushLatRecvCache(currentIconInfo &lastRecvInfo)
|
||||
{
|
||||
if (lastRecvList_.size() >= LAST_RECV_INFO_QUEUE_SIZE) {
|
||||
lastRecvList_.erase(lastRecvList_.begin());
|
||||
}
|
||||
lastRecvList_.push_back(lastRecvInfo);
|
||||
}
|
||||
|
||||
void DMSContinueRecvMgr::NotifyRecvBroadcast(const sptr<IRemoteObject>& obj,
|
||||
const currentIconInfo& continueInfo, const int32_t state)
|
||||
{
|
||||
|
@ -905,20 +905,5 @@ HWTEST_F(DMSContinueManagerTest, testGetFinalBundleName_001, TestSize.Level1)
|
||||
EXPECT_EQ(ret, false);
|
||||
DTEST_LOG << "DMSContinueManagerTest testGetFinalBundleName_001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testContinueTypeCheck_001
|
||||
* @tc.desc: test ContinueTypeCheck
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSContinueManagerTest, testContinueTypeCheck_001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest testContinueTypeCheck_001 start" << std::endl;
|
||||
AppExecFwk::BundleInfo localBundleInfo;
|
||||
std::string continueType;
|
||||
bool ret = DMSContinueRecvMgr::GetInstance().ContinueTypeCheck(localBundleInfo, continueType);
|
||||
EXPECT_EQ(ret, false);
|
||||
DTEST_LOG << "DMSContinueManagerTest testContinueTypeCheck_001 end" << std::endl;
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
|
Loading…
x
Reference in New Issue
Block a user