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

Merge pull request !1079 from MisterE/master
This commit is contained in:
openharmony_ci 2024-09-14 11:10:01 +00:00 committed by Gitee
commit ca58595f3b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
12 changed files with 138 additions and 144 deletions

View File

@ -41,9 +41,8 @@ public:
~DSchedContinueManager();
int32_t ContinueMission(const std::string &srcDeviceId, const std::string &dstDeviceId,
int32_t missionId, const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams &wantParams);
int32_t ContinueMission(const std::string &srcDeviceId, const std::string &dstDeviceId,
std::string bundleName, const std::string& continueType,
const sptr<IRemoteObject> &callback, const OHOS::AAFwk::WantParams &wantParams);
int32_t ContinueMission(const DSchedContinueInfo& continueInfo, const sptr<IRemoteObject> &callback,
const OHOS::AAFwk::WantParams &wantParams);
int32_t StartContinuation(const OHOS::AAFwk::Want& want, int32_t missionId, int32_t callerUid, int32_t status,
uint32_t accessToken);
int32_t NotifyCompleteContinuation(const std::u16string& devId, int32_t sessionId, bool isSuccess,
@ -65,12 +64,10 @@ private:
void StartEvent();
void HandleContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId, int32_t missionId,
const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams);
void HandleContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId,
std::string bundleName, const std::string& continueType,
void HandleContinueMission(const DSchedContinueInfo& continueInfo,
const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams);
bool GetFirstBundleName(DSchedContinueInfo &info, std::string &firstBundleNamme, std::string bundleName,
std::string deviceId);
void CompleteBundleName(DSchedContinueInfo &info, int32_t direction, int32_t &subType);
void HandleContinueMissionWithBundleName(DSchedContinueInfo &info, const sptr<IRemoteObject> &callback,
const OHOS::AAFwk::WantParams &wantParams);
void HandleStartContinuation(const OHOS::AAFwk::Want& want, int32_t missionId, int32_t callerUid,

View File

@ -48,6 +48,7 @@ const std::string TO_CALL_PKG = "TO_CALL_PKG";
const std::string HOST_PKG = "HOST_PKG";
const std::string ERROR_CODE = "ERROR_CODE";
const std::string PEER_UDID = "PEER_UDID";
const std::string APP_CALLEE = "APP_CALLEE";
const std::string APP_CALLER = "APP_CALLER";
constexpr char APP_CONTINUE_DOMAIN[] = "APP_CONTINUE";
constexpr int32_t ANONYM_MIN_LENGTH = 10;
@ -168,7 +169,7 @@ public:
bool UnfocusedGetBundleName(const std::string& func, int32_t errCode);
bool NotifyDockUnfocused(const std::string& func, int32_t errCode);
bool ClickIconDmsContinue(const std::string& func, int32_t errCode, std::string peerUdid,
const std::string& bundleName);
const std::string& srcBundleName, const std::string& dstBundleName);
bool ClickIconDmsStartAbility(const std::string& func, int32_t errCode);
bool ClickIconDmsRecvOver(const std::string& func, int32_t errCode);
bool SaveDataDmsContinue(const std::string& func, int32_t errCode);

View File

@ -48,9 +48,10 @@ 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),
continueType(continueType),
sourceBundleName(source_bundle_name) {
}
@ -94,16 +95,15 @@ private:
const int32_t state, const int32_t retry);
bool GetFinalBundleName(DmsBundleInfo& distributedBundleInfo, std::string &finalBundleName,
AppExecFwk::BundleInfo& localBundleInfo, std::string& continueType);
int32_t VerifyBroadcastSource(const std::string& senderNetworkId, const std::string& bundleName,
const std::string& continueType, const int32_t state);
int32_t VerifyBroadcastSource(const std::string& senderNetworkId, const std::string& srcBundleName,
const std::string& sinkBundleName, const std::string& continueType, const int32_t state);
void PostOnBroadcastBusiness(const std::string& senderNetworkId, uint16_t bundleNameId, uint8_t continueTypeId,
const int32_t state, const int32_t delay = 0, const int32_t retry = 0);
void FindContinueType(const DmsBundleInfo &distributedBundleInfo, uint8_t &continueTypeId,
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& bundleName, 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

@ -499,7 +499,8 @@ int32_t DSchedContinue::ExecuteContinueReq(std::shared_ptr<DistributedWantParams
continueInfo_.sinkDeviceId_ : continueInfo_.sourceDeviceId_;
std::string peerUdid = DtbschedmgrDeviceInfoStorage::GetInstance().GetUdidByNetworkId(peerDeviceId);
DmsRadar::GetInstance().ClickIconDmsContinue("ContinueMission", ERR_OK, peerUdid, continueInfo_.sinkBundleName_);
DmsRadar::GetInstance().ClickIconDmsContinue("ContinueMission", ERR_OK, peerUdid,
continueInfo_.sourceBundleName_, continueInfo_.sinkBundleName_);
DmsUE::GetInstance().TriggerDmsContinue(continueInfo_.sinkBundleName_, continueInfo_.sinkAbilityName_,
continueInfo_.sourceDeviceId_, ERR_OK);
@ -853,9 +854,9 @@ int32_t DSchedContinue::SetWantForContinuation(AAFwk::Want& newWant)
DmsContinueTime::GetInstance().WriteDurationInfo(DmsContinueTime::GetInstance().GetSaveDataDuration());
newWant.SetParam(DMSDURATION_SAVETIME, saveDataTime);
if (subServiceType_ == CONTINUE_PUSH) {
DmsContinueTime::GetInstance().SetSrcBundleName(newWant.GetElement().GetBundleName());
DmsContinueTime::GetInstance().SetSrcBundleName(continueInfo_.sourceBundleName_);
DmsContinueTime::GetInstance().SetSrcAbilityName(newWant.GetElement().GetAbilityName());
DmsContinueTime::GetInstance().SetDstBundleName(newWant.GetElement().GetBundleName());
DmsContinueTime::GetInstance().SetDstBundleName(continueInfo_.sinkBundleName_);
DmsContinueTime::GetInstance().SetDstAbilityName(newWant.GetElement().GetAbilityName());
}
return ERR_OK;
@ -980,9 +981,9 @@ void DSchedContinue::DurationDumperBeforeStartAbility(std::shared_ptr<DSchedCont
if (subServiceType_ == CONTINUE_PULL && cmd != nullptr) {
std::string timeInfo = cmd->want_.GetStringParam(DMSDURATION_SAVETIME);
DmsContinueTime::GetInstance().ReadDurationInfo(timeInfo.c_str());
DmsContinueTime::GetInstance().SetSrcBundleName(cmd->want_.GetElement().GetBundleName());
DmsContinueTime::GetInstance().SetSrcBundleName(continueInfo_.sourceBundleName_);
DmsContinueTime::GetInstance().SetSrcAbilityName(cmd->want_.GetElement().GetAbilityName());
DmsContinueTime::GetInstance().SetDstBundleName(cmd->want_.GetElement().GetBundleName());
DmsContinueTime::GetInstance().SetDstBundleName(continueInfo_.sinkBundleName_);
DmsContinueTime::GetInstance().SetDstAbilityName(cmd->want_.GetElement().GetAbilityName());
}
DmsContinueTime::GetInstance().SetDurationBegin(CONTINUE_START_ABILITY_TIME, GetTickCount());

View File

@ -177,10 +177,12 @@ void DSchedContinueManager::HandleContinueMission(const std::string& srcDeviceId
return;
}
int32_t DSchedContinueManager::ContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId,
std::string bundleName, const std::string& continueType,
int32_t DSchedContinueManager::ContinueMission(const DSchedContinueInfo& continueInfo,
const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams)
{
std::string srcDeviceId = continueInfo.sourceDeviceId_;
std::string dstDeviceId = continueInfo.sinkDeviceId_;
if (srcDeviceId.empty() || dstDeviceId.empty() || callback == nullptr) {
HILOGE("srcDeviceId or dstDeviceId or callback is null!");
return INVALID_PARAMETERS_ERR;
@ -206,7 +208,8 @@ int32_t DSchedContinueManager::ContinueMission(const std::string& srcDeviceId, c
#ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER
if (localDevId == srcDeviceId) {
int32_t missionId = -1;
int32_t ret = DMSContinueSendMgr::GetInstance().GetMissionIdByBundleName(bundleName, missionId);
int32_t ret = DMSContinueSendMgr::GetInstance().GetMissionIdByBundleName(
continueInfo.sinkBundleName_, missionId);
if (ret != ERR_OK) {
HILOGE("get missionId fail, ret %{public}d.", ret);
return ret;
@ -214,8 +217,8 @@ int32_t DSchedContinueManager::ContinueMission(const std::string& srcDeviceId, c
}
#endif
auto func = [this, srcDeviceId, dstDeviceId, bundleName, continueType, callback, wantParams]() {
HandleContinueMission(srcDeviceId, dstDeviceId, bundleName, continueType, callback, wantParams);
auto func = [this, continueInfo, callback, wantParams]() {
HandleContinueMission(continueInfo, callback, wantParams);
};
if (eventHandler_ == nullptr) {
HILOGE("eventHandler_ is nullptr");
@ -225,10 +228,14 @@ int32_t DSchedContinueManager::ContinueMission(const std::string& srcDeviceId, c
return ERR_OK;
}
void DSchedContinueManager::HandleContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId,
std::string bundleName, const std::string& continueType,
void DSchedContinueManager::HandleContinueMission(const DSchedContinueInfo& continueInfo,
const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams)
{
std::string srcDeviceId = continueInfo.sourceDeviceId_;
std::string dstDeviceId = continueInfo.sinkDeviceId_;
std::string srcBundleName = continueInfo.sourceBundleName_;
std::string bundleName = continueInfo.sinkBundleName_;
std::string continueType = continueInfo.continueType_;
HILOGI("start, srcDeviceId: %{public}s. dstDeviceId: %{public}s. bundleName: %{public}s."
" continueType: %{public}s.", GetAnonymStr(srcDeviceId).c_str(), GetAnonymStr(dstDeviceId).c_str(),
bundleName.c_str(), continueType.c_str());
@ -238,7 +245,7 @@ void DSchedContinueManager::HandleContinueMission(const std::string& srcDeviceId
return;
}
DSchedContinueInfo info = DSchedContinueInfo(srcDeviceId, bundleName, dstDeviceId, bundleName, continueType);
DSchedContinueInfo info = DSchedContinueInfo(srcDeviceId, srcBundleName, dstDeviceId, bundleName, continueType);
HandleContinueMissionWithBundleName(info, callback, wantParams);
return;
}
@ -270,43 +277,6 @@ bool DSchedContinueManager::GetFirstBundleName(DSchedContinueInfo &info, std::st
return false;
}
void DSchedContinueManager::CompleteBundleName(DSchedContinueInfo &info, int32_t direction, int32_t &subType)
{
if (direction == CONTINUE_SOURCE) {
cntSource_++;
std::string firstBundleName;
std::string bundleName = info.sourceBundleName_;
std::string deviceId = info.sourceDeviceId_;
if (GetFirstBundleName(info, firstBundleName, bundleName, deviceId)) {
info.sinkBundleName_ = firstBundleName;
}
} else {
cntSink_++;
subType = CONTINUE_PULL;
std::vector<currentIconInfo> lastRecvList = DMSContinueRecvMgr::GetInstance().lastRecvList_;
std::string sourceBundleName;
std::vector<currentIconInfo>::iterator recvInfoEndItr = lastRecvList.end();
while (recvInfoEndItr != lastRecvList.begin()) {
if (recvInfoEndItr->senderNetworkId == info.sourceDeviceId_
&& recvInfoEndItr->bundleName == info.sinkBundleName_) {
sourceBundleName = recvInfoEndItr->sourceBundleName;
break;
}
recvInfoEndItr--;
}
if (sourceBundleName.empty()) {
HILOGW("current sub type is continue pull; but can not get source bundle name from recv cache.");
std::string firstBundleNamme;
std::string bundleName = info.sinkBundleName_;
std::string deviceId = info.sinkDeviceId_;
if (GetFirstBundleName(info, firstBundleNamme, bundleName, deviceId)) {
sourceBundleName = firstBundleNamme;
}
}
info.sourceBundleName_ = sourceBundleName;
}
}
void DSchedContinueManager::HandleContinueMissionWithBundleName(DSchedContinueInfo &info,
const sptr<IRemoteObject> &callback, const OHOS::AAFwk::WantParams &wantParams)
{
@ -317,7 +287,21 @@ void DSchedContinueManager::HandleContinueMissionWithBundleName(DSchedContinueIn
return;
}
int32_t subType = CONTINUE_PUSH;
CompleteBundleName(info, direction, subType);
if (direction == CONTINUE_SOURCE) {
cntSource_++;
} else {
cntSink_++;
subType = CONTINUE_PULL;
if (info.sourceBundleName_.empty()) {
HILOGW("current sub type is continue pull; but can not get source bundle name from recv cache.");
std::string firstBundleNamme;
std::string bundleName = info.sinkBundleName_;
std::string deviceId = info.sinkDeviceId_;
if (GetFirstBundleName(info, firstBundleNamme, bundleName, deviceId)) {
info.sourceBundleName_ = firstBundleNamme;
}
}
}
{
std::lock_guard<std::mutex> continueLock(continueMutex_);
if (!continues_.empty() && continues_.find(info) != continues_.end()) {

View File

@ -729,7 +729,7 @@ bool DmsRadar::NotifyDockUnfocused(const std::string& func, int32_t errCode)
}
bool DmsRadar::ClickIconDmsContinue(const std::string& func, int32_t errCode, std::string peerUdid,
const std::string& bundleName)
const std::string& srcBundleName, const std::string& dstBundleName)
{
if (peerUdid.empty()) {
HILOGE("peerUdid is empty.");
@ -748,7 +748,8 @@ bool DmsRadar::ClickIconDmsContinue(const std::string& func, int32_t errCode, st
BIZ_STAGE, static_cast<int32_t>(ClickIcon::DMS_CONTINUE),
STAGE_RES, static_cast<int32_t>(StageRes::STAGE_SUCC),
PEER_UDID, GetAnonyUdid(peerUdid),
APP_CALLER, bundleName);
APP_CALLEE, srcBundleName,
APP_CALLER, dstBundleName);
} else {
res = HiSysEventWrite(
APP_CONTINUE_DOMAIN,
@ -760,7 +761,8 @@ bool DmsRadar::ClickIconDmsContinue(const std::string& func, int32_t errCode, st
BIZ_STAGE, static_cast<int32_t>(ClickIcon::DMS_CONTINUE),
STAGE_RES, static_cast<int32_t>(StageRes::STAGE_FAIL),
PEER_UDID, GetAnonyUdid(peerUdid),
APP_CALLER, bundleName,
APP_CALLEE, srcBundleName,
APP_CALLER, dstBundleName,
ERROR_CODE, errCode);
}
if (res != ERR_OK) {

View File

@ -916,7 +916,7 @@ int32_t DistributedSchedService::ContinueRemoteMission(const std::string& srcDev
DmsUE::GetInstance().TriggerDmsContinue(bundleName, abilityName, srcDeviceId, ERR_OK);
std::string peerUdid = DtbschedmgrDeviceInfoStorage::GetInstance().GetUdidByNetworkId(srcDeviceId);
DmsRadar::GetInstance().ClickIconDmsContinue("ContinueMission", ERR_OK, peerUdid, bundleName);
DmsRadar::GetInstance().ClickIconDmsContinue("ContinueMission", ERR_OK, peerUdid, bundleName, bundleName);
int32_t result = remoteDms->ContinueMission(srcDeviceId, dstDeviceId, missionId, callback, wantParams);
HILOGI("ContinueRemoteMission result: %{public}d!", result);

View File

@ -611,7 +611,8 @@ int32_t DistributedSchedStub::ContinueMissionOfBundleNameInner(MessageParcel& da
if ((!isFreeInstall && IsUsingQos(remoteDeviceId)) ||
(isFreeInstall && IsRemoteInstall(remoteDeviceId, bundleName))) {
DSchedTransportSoftbusAdapter::GetInstance().SetCallingTokenId(IPCSkeleton::GetCallingTokenID());
result = DSchedContinueManager::GetInstance().ContinueMission(srcDevId, dstDevId, bundleName, continueType,
result = DSchedContinueManager::GetInstance().ContinueMission(
DSchedContinueInfo(srcDevId, srcBundleName, dstDevId, bundleName, continueType),
callback, *wantParams);
HILOGI("result = %{public}d", result);
PARCEL_WRITE_REPLY_NOERROR(reply, Int32, result);

View File

@ -208,13 +208,14 @@ void DMSContinueRecvMgr::StartEvent()
HILOGI("StartEvent end");
}
int32_t DMSContinueRecvMgr::VerifyBroadcastSource(const std::string& senderNetworkId,
const std::string& bundleName, const std::string& continueType, const int32_t state)
int32_t DMSContinueRecvMgr::VerifyBroadcastSource(const std::string& senderNetworkId, const std::string& srcBundleName,
const std::string& sinkBundleName, const std::string& continueType, const int32_t state)
{
std::lock_guard<std::mutex> currentIconLock(iconMutex_);
if (state == ACTIVE) {
iconInfo_.senderNetworkId = senderNetworkId;
iconInfo_.bundleName = bundleName;
iconInfo_.bundleName = sinkBundleName;
iconInfo_.sourceBundleName = srcBundleName;
iconInfo_.continueType = continueType;
} else {
if (senderNetworkId != iconInfo_.senderNetworkId) {
@ -223,9 +224,9 @@ int32_t DMSContinueRecvMgr::VerifyBroadcastSource(const std::string& senderNetwo
return INVALID_PARAMETERS_ERR;
}
if (bundleName != iconInfo_.bundleName) {
if (sinkBundleName != iconInfo_.bundleName) {
HILOGW("BundleName not match, task abort. bundleName: %{public}s, saved bundleName: %{public}s",
bundleName.c_str(), iconInfo_.bundleName.c_str());
sinkBundleName.c_str(), iconInfo_.bundleName.c_str());
return INVALID_PARAMETERS_ERR;
}
@ -357,7 +358,7 @@ int32_t DMSContinueRecvMgr::DealOnBroadcastBusiness(const std::string& senderNet
return INVALID_PARAMETERS_ERR;
}
int32_t ret = VerifyBroadcastSource(senderNetworkId, finalBundleName, continueType, state);
int32_t ret = VerifyBroadcastSource(senderNetworkId, bundleName, finalBundleName, continueType, state);
if (ret != ERR_OK) {
return ret;
}
@ -369,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, finalBundleName, state, continueType);
NotifyRecvBroadcast(iter,
currentIconInfo(senderNetworkId, bundleName, finalBundleName, continueType),
state);
}
HILOGI("DealOnBroadcastBusiness end");
return ERR_OK;
@ -384,8 +387,13 @@ void DMSContinueRecvMgr::PushLatRecvCache(currentIconInfo &lastRecvInfo)
}
void DMSContinueRecvMgr::NotifyRecvBroadcast(const sptr<IRemoteObject>& obj,
const std::string& networkId, const std::string& bundleName, 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");
@ -400,16 +408,17 @@ void DMSContinueRecvMgr::NotifyRecvBroadcast(const sptr<IRemoteObject>& obj,
}
PARCEL_WRITE_HELPER_NORET(data, Int32, state);
PARCEL_WRITE_HELPER_NORET(data, String, networkId);
PARCEL_WRITE_HELPER_NORET(data, String, bundleName);
PARCEL_WRITE_HELPER_NORET(data, String, sinkBundleName);
PARCEL_WRITE_HELPER_NORET(data, String, continueType);
PARCEL_WRITE_HELPER_NORET(data, String, srcBundleName);
HILOGI("[PerformanceTest] NotifyRecvBroadcast called, IPC begin = %{public}" PRId64, GetTickCount());
int32_t error = obj->SendRequest(ON_CALLBACK, data, reply, option);
if (state != INACTIVE) {
std::string bName = bundleName;
std::string bName = sinkBundleName;
std::string cType = continueType;
std::string abilityName = BundleManagerInternal::GetInstance().GetAbilityName(networkId,
bName, cType);
DmsUE::GetInstance().NotifyDockShowIcon(bundleName, abilityName, networkId, error);
DmsUE::GetInstance().NotifyDockShowIcon(sinkBundleName, abilityName, networkId, error);
}
if (error != ERR_NONE) {
HILOGE("NotifyRecvBroadcast fail, error: %{public}d", error);
@ -476,7 +485,9 @@ void DMSContinueRecvMgr::OnDeviceScreenOff()
}
std::vector<sptr<IRemoteObject>> objs = iterItem->second;
for (auto iter : objs) {
NotifyRecvBroadcast(iter, senderNetworkId, bundleName, INACTIVE, continueType);
NotifyRecvBroadcast(iter,
currentIconInfo(senderNetworkId, iconInfo_.sourceBundleName, bundleName, continueType),
INACTIVE);
}
}
};
@ -518,7 +529,9 @@ void DMSContinueRecvMgr::OnContinueSwitchOff()
}
std::vector<sptr<IRemoteObject>> objs = iterItem->second;
for (auto iter : objs) {
NotifyRecvBroadcast(iter, senderNetworkId, bundleName, INACTIVE, continueType);
NotifyRecvBroadcast(iter,
currentIconInfo(senderNetworkId, iconInfo_.sourceBundleName, bundleName, continueType),
INACTIVE);
}
}
};
@ -568,7 +581,9 @@ void DMSContinueRecvMgr::NotifyDeviceOffline(const std::string& networkId)
}
std::vector<sptr<IRemoteObject>> objs = iterItem->second;
for (auto iter : objs) {
NotifyRecvBroadcast(iter, senderNetworkId, bundleName, INACTIVE, continueType);
NotifyRecvBroadcast(iter,
currentIconInfo(senderNetworkId, iconInfo_.sourceBundleName, bundleName, continueType),
INACTIVE);
}
}
HILOGI("NotifyDeviceOffline end");

View File

@ -150,31 +150,37 @@ HWTEST_F(DSchedContinueManagerTest, ContinueMission_003, TestSize.Level3)
DTEST_LOG << "DSchedContinueManagerTest ContinueMission_003 begin" << std::endl;
DistributedSchedUtil::MockPermission();
OHOS::AAFwk::WantParams wantParams;
int32_t ret = DSchedContinueManager::GetInstance().ContinueMission("", "", BUNDLE_NAME,
CONTINUETYPE, nullptr, wantParams);
int32_t ret = DSchedContinueManager::GetInstance().ContinueMission(
DSchedContinueInfo("", BUNDLE_NAME, "", BUNDLE_NAME, CONTINUETYPE),
nullptr, wantParams);
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
ret = DSchedContinueManager::GetInstance().ContinueMission(LOCAL_DEVICEID, "", BUNDLE_NAME,
CONTINUETYPE, nullptr, wantParams);
ret = DSchedContinueManager::GetInstance().ContinueMission(
DSchedContinueInfo(LOCAL_DEVICEID, BUNDLE_NAME, "", BUNDLE_NAME, CONTINUETYPE),
nullptr, wantParams);
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
ret = DSchedContinueManager::GetInstance().ContinueMission(LOCAL_DEVICEID, REMOTE_DEVICEID, BUNDLE_NAME,
CONTINUETYPE, nullptr, wantParams);
ret = DSchedContinueManager::GetInstance().ContinueMission(
DSchedContinueInfo(LOCAL_DEVICEID, BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE),
nullptr, wantParams);
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
auto callback = GetDSchedService();
ret = DSchedContinueManager::GetInstance().ContinueMission(LOCAL_DEVICEID, REMOTE_DEVICEID, BUNDLE_NAME,
CONTINUETYPE, callback, wantParams);
ret = DSchedContinueManager::GetInstance().ContinueMission(
DSchedContinueInfo(LOCAL_DEVICEID, BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE),
callback, wantParams);
EXPECT_EQ(ret, OPERATION_DEVICE_NOT_INITIATOR_OR_TARGET);
std::string locDevId;
EXPECT_EQ(true, DtbschedmgrDeviceInfoStorage::GetInstance().GetLocalDeviceId(locDevId));
ret = DSchedContinueManager::GetInstance().ContinueMission(LOCAL_DEVICEID, locDevId, BUNDLE_NAME,
CONTINUETYPE, callback, wantParams);
ret = DSchedContinueManager::GetInstance().ContinueMission(
DSchedContinueInfo(LOCAL_DEVICEID, BUNDLE_NAME, locDevId, BUNDLE_NAME, CONTINUETYPE),
callback, wantParams);
EXPECT_EQ(ret, INVALID_REMOTE_PARAMETERS_ERR);
ret = DSchedContinueManager::GetInstance().ContinueMission(locDevId, REMOTE_DEVICEID, BUNDLE_NAME,
CONTINUETYPE, callback, wantParams);
ret = DSchedContinueManager::GetInstance().ContinueMission(
DSchedContinueInfo(locDevId, BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE),
callback, wantParams);
EXPECT_EQ(ret, INVALID_REMOTE_PARAMETERS_ERR);
DTEST_LOG << "DSchedContinueManagerTest ContinueMission_003 end" << std::endl;
}
@ -189,15 +195,19 @@ HWTEST_F(DSchedContinueManagerTest, HandleContinueMission_001, TestSize.Level3)
DTEST_LOG << "DSchedContinueManagerTest HandleContinueMission_001 begin" << std::endl;
OHOS::AAFwk::WantParams wantParams;
auto callback = GetDSchedService();
DSchedContinueManager::GetInstance().HandleContinueMission("", REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE,
DSchedContinueManager::GetInstance().HandleContinueMission(
DSchedContinueInfo("", BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE),
callback, wantParams);
DSchedContinueManager::GetInstance().HandleContinueMission(LOCAL_DEVICEID, "", BUNDLE_NAME, CONTINUETYPE,
DSchedContinueManager::GetInstance().HandleContinueMission(
DSchedContinueInfo(LOCAL_DEVICEID, BUNDLE_NAME, "", BUNDLE_NAME, CONTINUETYPE),
callback, wantParams);
DSchedContinueManager::GetInstance().HandleContinueMission(LOCAL_DEVICEID, REMOTE_DEVICEID, BUNDLE_NAME,
CONTINUETYPE, nullptr, wantParams);
DSchedContinueManager::GetInstance().HandleContinueMission(
DSchedContinueInfo(LOCAL_DEVICEID, BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE),
nullptr, wantParams);
DSchedContinueManager::GetInstance().HandleContinueMission(LOCAL_DEVICEID, REMOTE_DEVICEID, BUNDLE_NAME,
CONTINUETYPE, callback, wantParams);
DSchedContinueManager::GetInstance().HandleContinueMission(
DSchedContinueInfo(LOCAL_DEVICEID, BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE),
callback, wantParams);
DTEST_LOG << "DSchedContinueManagerTest HandleContinueMission_001 end" << std::endl;
}
@ -379,32 +389,6 @@ HWTEST_F(DSchedContinueManagerTest, HandleContinueEnd_001, TestSize.Level3)
DTEST_LOG << "DSchedContinueManagerTest HandleContinueEnd_001 end" << std::endl;
}
/**
* @tc.name: GetFirstBundleName_001
* @tc.desc: test GetFirstBundleName func
* @tc.type: FUNC
*/
HWTEST_F(DSchedContinueManagerTest, GetFirstBundleName_001, TestSize.Level3)
{
DTEST_LOG << "DSchedContinueManagerTest GetFirstBundleName_001 begin" << std::endl;
DSchedContinueInfo info(LOCAL_DEVICEID, "sourceBundleName", REMOTE_DEVICEID, "sinkBundleName",
"continueType");
std::string firstBundleName;
std::string bundleName;
std::string deviceId;
int32_t direction = 1;
int32_t subType;
const sptr<IRemoteObject> callback = nullptr;
const OHOS::AAFwk::WantParams wantParams;
DSchedContinueManager::GetInstance().CompleteBundleName(info, direction, subType);
direction = 0;
DSchedContinueManager::GetInstance().CompleteBundleName(info, direction, subType);
DSchedContinueManager::GetInstance().HandleContinueMissionWithBundleName(info, callback, wantParams);
bool ret = DSchedContinueManager::GetInstance().GetFirstBundleName(info, firstBundleName, bundleName, deviceId);
EXPECT_EQ(ret, false);
DTEST_LOG << "DSchedContinueManagerTest GetFirstBundleName_001 end" << std::endl;
}
/**
* @tc.name: GetDSchedContinueByWant_001
* @tc.desc: test GetDSchedContinueByWant func

View File

@ -535,7 +535,7 @@ HWTEST_F(DistributedRadarTest, NotifyDockUnfocused_002, TestSize.Level3)
HWTEST_F(DistributedRadarTest, ClickIconDmsContinue_001, TestSize.Level3)
{
DTEST_LOG << "DistributedRadarTest ClickIconDmsContinue_001 begin" << std::endl;
bool ret = DmsRadar::GetInstance().ClickIconDmsContinue(FUNC, ERR_OK, DEVICE_ID, BUNDLE_NAME);
bool ret = DmsRadar::GetInstance().ClickIconDmsContinue(FUNC, ERR_OK, DEVICE_ID, BUNDLE_NAME, BUNDLE_NAME);
EXPECT_EQ(ret, true);
DTEST_LOG << "DistributedRadarTest ClickIconDmsContinue_001 end" << std::endl;
}
@ -548,7 +548,7 @@ HWTEST_F(DistributedRadarTest, ClickIconDmsContinue_001, TestSize.Level3)
HWTEST_F(DistributedRadarTest, ClickIconDmsContinue_002, TestSize.Level3)
{
DTEST_LOG << "DistributedRadarTest ClickIconDmsContinue_002 begin" << std::endl;
bool ret = DmsRadar::GetInstance().ClickIconDmsContinue(FUNC, ERR_NO, DEVICE_ID, BUNDLE_NAME);
bool ret = DmsRadar::GetInstance().ClickIconDmsContinue(FUNC, ERR_NO, DEVICE_ID, BUNDLE_NAME, BUNDLE_NAME);
EXPECT_EQ(ret, true);
DTEST_LOG << "DistributedRadarTest ClickIconDmsContinue_002 end" << std::endl;
}

View File

@ -357,14 +357,16 @@ HWTEST_F(DMSContinueManagerTest, testVerifyBroadcastSource001, TestSize.Level3)
int32_t state = ACTIVE;
std::string networkId = "test networkId";
std::string bundleName = "test bundleName";
std::string sourceBundleName = "test sourceBundleName";
std::string sinkBundleName = "test sinkBundleName";
std::string continueType = "test continueType";
int32_t ret = DMSContinueRecvMgr::GetInstance().VerifyBroadcastSource(networkId,
bundleName, continueType, state);
sourceBundleName, sinkBundleName, continueType, state);
EXPECT_EQ(ret, ERR_OK);
state = INACTIVE;
ret = DMSContinueRecvMgr::GetInstance().VerifyBroadcastSource(networkId, bundleName, continueType, state);
ret = DMSContinueRecvMgr::GetInstance().VerifyBroadcastSource(
networkId, sourceBundleName, sinkBundleName, continueType, state);
EXPECT_EQ(ret, ERR_OK);
}
@ -379,16 +381,17 @@ HWTEST_F(DMSContinueManagerTest, testVerifyBroadcastSource002, TestSize.Level3)
int32_t state = ACTIVE;
std::string networkId = "test networkId";
std::string bundleName = "test bundleName";
std::string sourceBundleName = "test sourceBundleName";
std::string sinkBundleName = "test sinkBundleName";
std::string continueType = "test continueType";
int32_t ret = DMSContinueRecvMgr::GetInstance().VerifyBroadcastSource(networkId,
bundleName, continueType, state);
sourceBundleName, sinkBundleName, continueType, state);
EXPECT_EQ(ret, ERR_OK);
state = INACTIVE;
networkId = "invalid networkId";
ret = DMSContinueRecvMgr::GetInstance().VerifyBroadcastSource(networkId,
bundleName, continueType, state);
sourceBundleName, sinkBundleName, continueType, state);
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
}
@ -403,16 +406,18 @@ HWTEST_F(DMSContinueManagerTest, testVerifyBroadcastSource003, TestSize.Level3)
int32_t state = ACTIVE;
std::string networkId = "test networkId";
std::string bundleName = "test bundleName";
std::string sourceBundleName = "test sourceBundleName";
std::string sinkBundleName = "test sinkBundleName";
std::string continueType = "test continueType";
int32_t ret = DMSContinueRecvMgr::GetInstance().VerifyBroadcastSource(networkId,
bundleName, continueType, state);
sourceBundleName, sinkBundleName, continueType, state);
EXPECT_EQ(ret, ERR_OK);
state = INACTIVE;
bundleName = "invalid bundleName";
sourceBundleName = "invalid sourceBundleName";
sinkBundleName = "invalid sinkBundleName";
ret = DMSContinueRecvMgr::GetInstance().VerifyBroadcastSource(networkId,
bundleName, continueType, state);
sourceBundleName, sinkBundleName, continueType, state);
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
}
@ -449,15 +454,18 @@ HWTEST_F(DMSContinueManagerTest, testDealOnBroadcastBusiness001, TestSize.Level3
*/
sptr<IRemoteObject> obj = nullptr;
std::string networkId = "invalid networkId";
std::string bundleName = "invalid bundleName";
std::string sourceBundleName = "invalid sourceBundleName";
std::string sinkBundleName = "invalid sinkBundleName";
std::string continueType = "invalid continueType";
DMSContinueRecvMgr::GetInstance().NotifyRecvBroadcast(obj, networkId, bundleName, state, continueType);
DMSContinueRecvMgr::GetInstance().NotifyRecvBroadcast(obj,
currentIconInfo(networkId, sourceBundleName, sinkBundleName, continueType), state);
/**
* @tc.steps: step3. test NotifyRecvBroadcast when missionId is invalid;
*/
obj = new RemoteOnListenerStubTest();
DMSContinueRecvMgr::GetInstance().NotifyRecvBroadcast(obj, networkId, bundleName, state, continueType);
DMSContinueRecvMgr::GetInstance().NotifyRecvBroadcast(obj,
currentIconInfo(networkId, sourceBundleName, sinkBundleName, continueType), state);
DTEST_LOG << "DMSContinueManagerTest testDealOnBroadcastBusiness001 end" << std::endl;
}
@ -786,13 +794,14 @@ HWTEST_F(DMSContinueManagerTest, testGetContinueType_001, TestSize.Level1)
DTEST_LOG << "DMSContinueManagerTest testGetContinueType_001 start" << std::endl;
int32_t state = ACTIVE;
std::string networkId = "test networkId";
std::string bundleName = "test bundleName";
std::string sourceBundleName = "test sourceBundleName";
std::string sinkBundleName = "test sinkBundleName";
std::string continueType = "test continueType";
int32_t ret = DMSContinueRecvMgr::GetInstance().VerifyBroadcastSource(networkId,
bundleName, continueType, state);
sourceBundleName, sinkBundleName, continueType, state);
EXPECT_EQ(ret, ERR_OK);
EXPECT_FALSE(DMSContinueRecvMgr::GetInstance().GetContinueType(bundleName).empty());
EXPECT_FALSE(DMSContinueRecvMgr::GetInstance().GetContinueType(sinkBundleName).empty());
DTEST_LOG << "DMSContinueManagerTest testGetContinueType_001 end" << std::endl;
}