mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-22 22:09:58 +00:00
!1168 相同应用使用不同moduleName适配不同设备场景下,接续失败
Merge pull request !1168 from 皇甫毅/master
This commit is contained in:
commit
c1b57a6a38
@ -529,6 +529,10 @@ enum {
|
|||||||
* Result(29360238) for get window failed from scb.
|
* Result(29360238) for get window failed from scb.
|
||||||
*/
|
*/
|
||||||
DMS_GET_WINDOW_FAILED_FROM_SCB = 29360238,
|
DMS_GET_WINDOW_FAILED_FROM_SCB = 29360238,
|
||||||
|
/**
|
||||||
|
* Result(29360238) for BMS can not find the specified module.
|
||||||
|
*/
|
||||||
|
CAN_NOT_FOUND_MODULE_ERR = 29360239,
|
||||||
};
|
};
|
||||||
} // namespace DistributedSchedule
|
} // namespace DistributedSchedule
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
|
@ -154,6 +154,10 @@ private:
|
|||||||
int32_t ExecuteContinueReply();
|
int32_t ExecuteContinueReply();
|
||||||
int32_t ExecuteContinueSend(std::shared_ptr<ContinueAbilityData> data);
|
int32_t ExecuteContinueSend(std::shared_ptr<ContinueAbilityData> data);
|
||||||
int32_t ExecuteContinueData(std::shared_ptr<DSchedContinueDataCmd> cmd);
|
int32_t ExecuteContinueData(std::shared_ptr<DSchedContinueDataCmd> cmd);
|
||||||
|
int32_t UpdateElementInfo(std::shared_ptr<DSchedContinueDataCmd> cmd);
|
||||||
|
void FindSinkContinueAbilityInfo(const std::string &srcModuleName, const std::string &srcContinueType,
|
||||||
|
std::vector<DmsAbilityInfo> &dmsAbilityInfos, std::vector<DmsAbilityInfo> &result);
|
||||||
|
void ContinueTypeFormat(std::string &continueType);
|
||||||
int32_t ExecuteNotifyComplete(int32_t result);
|
int32_t ExecuteNotifyComplete(int32_t result);
|
||||||
int32_t ExecuteContinueEnd(int32_t result);
|
int32_t ExecuteContinueEnd(int32_t result);
|
||||||
int32_t ExecuteContinueError(int32_t result);
|
int32_t ExecuteContinueError(int32_t result);
|
||||||
|
@ -63,6 +63,8 @@ public:
|
|||||||
std::string& bundleName);
|
std::string& bundleName);
|
||||||
bool GetDistributedBundleInfo(const std::string &networkId, const uint16_t &bundleNameId,
|
bool GetDistributedBundleInfo(const std::string &networkId, const uint16_t &bundleNameId,
|
||||||
DmsBundleInfo &distributeBundleInfo);
|
DmsBundleInfo &distributeBundleInfo);
|
||||||
|
bool GetDistributedBundleInfo(const std::string &networkId, const std::string &bundleName,
|
||||||
|
DmsBundleInfo &distributeBundleInfo);
|
||||||
bool GetBundleNameId(const std::string& bundleName, uint16_t &bundleNameId);
|
bool GetBundleNameId(const std::string& bundleName, uint16_t &bundleNameId);
|
||||||
std::string GetContinueType(const std::string &networkId, std::string &bundleName, uint8_t continueTypeId);
|
std::string GetContinueType(const std::string &networkId, std::string &bundleName, uint8_t continueTypeId);
|
||||||
std::string GetAbilityName(const std::string &networkId, std::string &bundleName, std::string &continueType);
|
std::string GetAbilityName(const std::string &networkId, std::string &bundleName, std::string &continueType);
|
||||||
|
@ -104,7 +104,7 @@ private:
|
|||||||
const int32_t state, const int32_t retry = 0);
|
const int32_t state, const int32_t retry = 0);
|
||||||
void NotifyRecvBroadcast(const sptr<IRemoteObject>& obj, const currentIconInfo& continueInfo, const int32_t state);
|
void NotifyRecvBroadcast(const sptr<IRemoteObject>& obj, const currentIconInfo& continueInfo, const int32_t state);
|
||||||
bool IsBundleContinuable(const AppExecFwk::BundleInfo& bundleInfo, const std::string &srcAbilityName,
|
bool IsBundleContinuable(const AppExecFwk::BundleInfo& bundleInfo, const std::string &srcAbilityName,
|
||||||
const std::string &srcContinueType, bool isSameBundle);
|
const std::string &srcContinueType);
|
||||||
std::string ContinueTypeFormat(const std::string &continueType);
|
std::string ContinueTypeFormat(const std::string &continueType);
|
||||||
void FindToNotifyRecvBroadcast(const std::string& senderNetworkId, const std::string& bundleName,
|
void FindToNotifyRecvBroadcast(const std::string& senderNetworkId, const std::string& bundleName,
|
||||||
const std::string& continueType);
|
const std::string& continueType);
|
||||||
|
@ -932,6 +932,10 @@ int32_t DSchedContinue::ExecuteContinueData(std::shared_ptr<DSchedContinueDataCm
|
|||||||
HILOGE("check deviceId failed");
|
HILOGE("check deviceId failed");
|
||||||
return INVALID_REMOTE_PARAMETERS_ERR;
|
return INVALID_REMOTE_PARAMETERS_ERR;
|
||||||
}
|
}
|
||||||
|
if (UpdateElementInfo(cmd) != ERR_OK) {
|
||||||
|
HILOGE("ExecuteContinueData UpdateElementInfo failed.");
|
||||||
|
return CAN_NOT_FOUND_MODULE_ERR;
|
||||||
|
}
|
||||||
int32_t ret = CheckStartPermission(cmd);
|
int32_t ret = CheckStartPermission(cmd);
|
||||||
if (ret != ERR_OK) {
|
if (ret != ERR_OK) {
|
||||||
HILOGE("ExecuteContinueData CheckTargetPermission failed!");
|
HILOGE("ExecuteContinueData CheckTargetPermission failed!");
|
||||||
@ -965,6 +969,84 @@ int32_t DSchedContinue::ExecuteContinueData(std::shared_ptr<DSchedContinueDataCm
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t DSchedContinue::UpdateElementInfo(std::shared_ptr<DSchedContinueDataCmd> cmd)
|
||||||
|
{
|
||||||
|
std::string srcModuleName = cmd->want_.GetModuleName();
|
||||||
|
if (srcModuleName.empty()) {
|
||||||
|
HILOGD("UpdateElementInfo srcModuleName from element is empty");
|
||||||
|
srcModuleName = cmd->want_.GetStringParam(OHOS::AAFwk::Want::PARAM_MODULE_NAME);
|
||||||
|
}
|
||||||
|
std::string srcContinueType = cmd->continueType_;
|
||||||
|
ContinueTypeFormat(srcContinueType);
|
||||||
|
HILOGD("UpdateElementInfo srcModuleName: %{public}s; srcContinueType:%{public}s", srcModuleName.c_str(),
|
||||||
|
srcContinueType.c_str());
|
||||||
|
DmsBundleInfo distributedBundleInfo;
|
||||||
|
std::string localDeviceId;
|
||||||
|
if (!GetLocalDeviceId(localDeviceId) || !DmsBmStorage::GetInstance()->GetDistributedBundleInfo(
|
||||||
|
localDeviceId, cmd->dstBundleName_, distributedBundleInfo)) {
|
||||||
|
HILOGE("UpdateElementInfo can not found bundle info for bundle name: %{public}s",
|
||||||
|
cmd->dstBundleName_.c_str());
|
||||||
|
return CAN_NOT_FOUND_MODULE_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<DmsAbilityInfo> dmsAbilityInfos = distributedBundleInfo.dmsAbilityInfos;
|
||||||
|
std::vector<DmsAbilityInfo> result;
|
||||||
|
FindSinkContinueAbilityInfo(srcModuleName, srcContinueType, dmsAbilityInfos, result);
|
||||||
|
if (result.empty()) {
|
||||||
|
HILOGE("UpdateElementInfo can not found bundle info for bundle name: %{public}s",
|
||||||
|
cmd->dstBundleName_.c_str());
|
||||||
|
return CAN_NOT_FOUND_MODULE_ERR;
|
||||||
|
}
|
||||||
|
auto element = cmd->want_.GetElement();
|
||||||
|
DmsAbilityInfo finalAbility = result[0];
|
||||||
|
HILOGD("UpdateElementInfo final sink ability detail info: "
|
||||||
|
"bundleName: %{public}s; abilityName: %{public}s; moduleName: %{public}s",
|
||||||
|
cmd->dstBundleName_.c_str(), finalAbility.abilityName.c_str(), finalAbility.moduleName.c_str());
|
||||||
|
cmd->want_.SetElementName(element.GetDeviceID(), cmd->dstBundleName_, finalAbility.abilityName,
|
||||||
|
finalAbility.moduleName);
|
||||||
|
return ERR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DSchedContinue::FindSinkContinueAbilityInfo(const std::string &srcModuleName, const std::string &srcContinueType,
|
||||||
|
std::vector<DmsAbilityInfo> &dmsAbilityInfos, std::vector<DmsAbilityInfo> &result)
|
||||||
|
{
|
||||||
|
bool sameModuleGot = false;
|
||||||
|
for (const auto &abilityInfoElement: dmsAbilityInfos) {
|
||||||
|
std::vector<std::string> continueTypes = abilityInfoElement.continueType;
|
||||||
|
for (std::string &continueTypeElement: continueTypes) {
|
||||||
|
ContinueTypeFormat(continueTypeElement);
|
||||||
|
HILOGD("UpdateElementInfo check sink continue ability, current: "
|
||||||
|
"continueType: %{public}s; abilityName: %{public}s; moduleName: %{public}s",
|
||||||
|
continueTypeElement.c_str(), abilityInfoElement.abilityName.c_str(),
|
||||||
|
abilityInfoElement.moduleName.c_str());
|
||||||
|
if (continueTypeElement != srcContinueType) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (srcModuleName == abilityInfoElement.moduleName) {
|
||||||
|
sameModuleGot = true;
|
||||||
|
result.clear();
|
||||||
|
result.push_back(abilityInfoElement);
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
result.push_back(abilityInfoElement);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sameModuleGot) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DSchedContinue::ContinueTypeFormat(std::string &continueType)
|
||||||
|
{
|
||||||
|
std::string suffix = QUICK_START_CONFIGURATION;
|
||||||
|
if (suffix.length() <= continueType.length() &&
|
||||||
|
continueType.rfind(suffix) == (continueType.length() - suffix.length())) {
|
||||||
|
continueType = continueType.substr(0, continueType.rfind(QUICK_START_CONFIGURATION));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int32_t DSchedContinue::UpdateWantForContinueType(OHOS::AAFwk::Want& want)
|
int32_t DSchedContinue::UpdateWantForContinueType(OHOS::AAFwk::Want& want)
|
||||||
{
|
{
|
||||||
std::string srcAbilityName = want.GetElement().GetAbilityName();
|
std::string srcAbilityName = want.GetElement().GetAbilityName();
|
||||||
|
@ -453,6 +453,57 @@ bool DmsBmStorage::GetDistributedBundleInfo(const std::string &networkId,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DmsBmStorage::GetDistributedBundleInfo(const std::string &networkId, const std::string &bundleName,
|
||||||
|
DmsBundleInfo &distributeBundleInfo)
|
||||||
|
{
|
||||||
|
HILOGD("networkId: %{public}s bundleNameId: %{public}s", GetAnonymStr(networkId).c_str(), bundleName.c_str());
|
||||||
|
if (!CheckKvStore()) {
|
||||||
|
HILOGE("kvStore is nullptr");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::string udid = DtbschedmgrDeviceInfoStorage::GetInstance().GetUdidByNetworkId(networkId);
|
||||||
|
std::string uuid = DtbschedmgrDeviceInfoStorage::GetInstance().GetUuidByNetworkId(networkId);
|
||||||
|
if (udid == "" || uuid == "") {
|
||||||
|
HILOGE("can not get udid or uuid");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
HILOGI("uuid: %{public}s", GetAnonymStr(uuid).c_str());
|
||||||
|
std::vector<Entry> remoteEntries;
|
||||||
|
Status status = kvStorePtr_->GetDeviceEntries(uuid, remoteEntries);
|
||||||
|
if (remoteEntries.empty() || status != Status::SUCCESS) {
|
||||||
|
HILOGE("GetDeviceEntries error: %{public}d or remoteEntries is empty", status);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<Entry> reduRiskEntries;
|
||||||
|
std::string keyOfPublic = udid + AppExecFwk::Constants::FILE_UNDERLINE + PUBLIC_RECORDS;
|
||||||
|
for (auto entry: remoteEntries) {
|
||||||
|
std::string key = entry.key.ToString();
|
||||||
|
std::string value = entry.value.ToString();
|
||||||
|
if (key.find(keyOfPublic) != std::string::npos) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
DmsBundleInfo distributedBundleInfoTmp;
|
||||||
|
if (distributedBundleInfoTmp.FromJsonString(value)
|
||||||
|
&& distributedBundleInfoTmp.bundleName == bundleName) {
|
||||||
|
distributeBundleInfo = distributedBundleInfoTmp;
|
||||||
|
reduRiskEntries.push_back(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (reduRiskEntries.size() > 1) {
|
||||||
|
HILOGE("Redundant data needs to be deleted.");
|
||||||
|
DelReduData(networkId, reduRiskEntries);
|
||||||
|
distributeBundleInfo = DmsBundleInfo();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (reduRiskEntries.empty()) {
|
||||||
|
HILOGE("get distributedBundleInfo failed.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
HILOGD("end.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Status DmsBmStorage::GetResultSatus(std::promise<OHOS::DistributedKv::Status> &resultStatusSignal)
|
Status DmsBmStorage::GetResultSatus(std::promise<OHOS::DistributedKv::Status> &resultStatusSignal)
|
||||||
{
|
{
|
||||||
auto future = resultStatusSignal.get_future();
|
auto future = resultStatusSignal.get_future();
|
||||||
|
@ -332,9 +332,8 @@ int32_t DMSContinueRecvMgr::DealOnBroadcastBusiness(const std::string& senderNet
|
|||||||
HILOGE("The bundleType must be app, but it is %{public}d", localBundleInfo.applicationInfo.bundleType);
|
HILOGE("The bundleType must be app, but it is %{public}d", localBundleInfo.applicationInfo.bundleType);
|
||||||
return INVALID_PARAMETERS_ERR;
|
return INVALID_PARAMETERS_ERR;
|
||||||
}
|
}
|
||||||
bool isSameBundle = (bundleName == finalBundleName);
|
|
||||||
if (state == ACTIVE
|
if (state == ACTIVE
|
||||||
&& !IsBundleContinuable(localBundleInfo, abilityInfo.abilityName, continueType, isSameBundle)) {
|
&& !IsBundleContinuable(localBundleInfo, abilityInfo.abilityName, continueType)) {
|
||||||
HILOGE("Bundle %{public}s is not continuable", finalBundleName.c_str());
|
HILOGE("Bundle %{public}s is not continuable", finalBundleName.c_str());
|
||||||
return BUNDLE_NOT_CONTINUABLE;
|
return BUNDLE_NOT_CONTINUABLE;
|
||||||
}
|
}
|
||||||
@ -359,7 +358,7 @@ int32_t DMSContinueRecvMgr::DealOnBroadcastBusiness(const std::string& senderNet
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DMSContinueRecvMgr::IsBundleContinuable(const AppExecFwk::BundleInfo& bundleInfo,
|
bool DMSContinueRecvMgr::IsBundleContinuable(const AppExecFwk::BundleInfo& bundleInfo,
|
||||||
const std::string &srcAbilityName, const std::string &srcContinueType, bool isSameBundle)
|
const std::string &srcAbilityName, const std::string &srcContinueType)
|
||||||
{
|
{
|
||||||
std::string formatSrcContinueType = ContinueTypeFormat(srcContinueType);
|
std::string formatSrcContinueType = ContinueTypeFormat(srcContinueType);
|
||||||
for (auto &abilityInfo: bundleInfo.abilityInfos) {
|
for (auto &abilityInfo: bundleInfo.abilityInfos) {
|
||||||
@ -368,16 +367,12 @@ bool DMSContinueRecvMgr::IsBundleContinuable(const AppExecFwk::BundleInfo& bundl
|
|||||||
}
|
}
|
||||||
for (const auto &continueTypeItem: abilityInfo.continueType) {
|
for (const auto &continueTypeItem: abilityInfo.continueType) {
|
||||||
HILOGI("IsBundleContinuable check: srcAbilityName:%{public}s; srcContinueType:%{public}s;"
|
HILOGI("IsBundleContinuable check: srcAbilityName:%{public}s; srcContinueType:%{public}s;"
|
||||||
" sinkAbilityName:%{public}s; sinkContinueType:%{public}s; isSameBundle: %{public}d",
|
" sinkAbilityName:%{public}s; sinkContinueType:%{public}s; ",
|
||||||
srcAbilityName.c_str(), srcContinueType.c_str(), abilityInfo.name.c_str(),
|
srcAbilityName.c_str(), srcContinueType.c_str(), abilityInfo.name.c_str(),
|
||||||
continueTypeItem.c_str(), isSameBundle);
|
continueTypeItem.c_str());
|
||||||
if (continueTypeItem == srcContinueType || continueTypeItem == formatSrcContinueType) {
|
if (continueTypeItem == srcContinueType || continueTypeItem == formatSrcContinueType) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ((srcContinueType == srcAbilityName || abilityInfo.name == continueTypeItem)
|
|
||||||
&& isSameBundle && abilityInfo.name == srcAbilityName) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "dtbschedmgr_log.h"
|
#include "dtbschedmgr_log.h"
|
||||||
#include "softbus_error_code.h"
|
#include "softbus_error_code.h"
|
||||||
#include "test_log.h"
|
#include "test_log.h"
|
||||||
|
#include "mission/distributed_bm_storage.h"
|
||||||
|
|
||||||
using namespace testing;
|
using namespace testing;
|
||||||
using namespace testing::ext;
|
using namespace testing::ext;
|
||||||
@ -30,6 +31,15 @@ namespace DistributedSchedule {
|
|||||||
namespace {
|
namespace {
|
||||||
const std::string BASEDIR = "/data/service/el1/public/database/DistributedSchedule";
|
const std::string BASEDIR = "/data/service/el1/public/database/DistributedSchedule";
|
||||||
const std::string BUNDLEMAME_1 = "bundleName";
|
const std::string BUNDLEMAME_1 = "bundleName";
|
||||||
|
const std::string CONTINUE_TYPE1 = "continueType1";
|
||||||
|
const std::string CONTINUE_TYPE2 = "continueType2";
|
||||||
|
const std::string CONTINUE_TYPE3 = "continueType3";
|
||||||
|
const std::string CONTINUE_TYPE1_QUICK = "continueType1_ContinueQuickStart";
|
||||||
|
const std::string MODULE_NAME1 = "moduleName1";
|
||||||
|
const std::string MODULE_NAME2 = "moduleName2";
|
||||||
|
const std::string MODULE_NAME3 = "moduleName3";
|
||||||
|
const std::string ABILITY_NAME_SAME_AS_CONTINUE_TYPE = CONTINUE_TYPE1;
|
||||||
|
const std::string ABILITY_NAME_DIFF_AS_CONTINUE_TYPE = "ability";
|
||||||
const int32_t WAITTIME = 2000;
|
const int32_t WAITTIME = 2000;
|
||||||
const uint32_t DSCHED_BUFFER_SIZE = 1024;
|
const uint32_t DSCHED_BUFFER_SIZE = 1024;
|
||||||
}
|
}
|
||||||
@ -619,6 +629,80 @@ HWTEST_F(DSchedContinueTest, DSchedContinueTest_0017_1, TestSize.Level0)
|
|||||||
usleep(WAITTIME);
|
usleep(WAITTIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @tc.name: DSchedContinueTest_0017_2
|
||||||
|
* @tc.desc: UpdateElementInfo
|
||||||
|
* @tc.type: FUNC
|
||||||
|
*/
|
||||||
|
HWTEST_F(DSchedContinueTest, DSchedContinueTest_0017_2, TestSize.Level0)
|
||||||
|
{
|
||||||
|
DTEST_LOG << "DSchedContinueTest DSchedContinueTest_0017_2 begin" << std::endl;
|
||||||
|
std::string deviceId = "123";
|
||||||
|
std::string bundleName = "test";
|
||||||
|
int32_t subType = CONTINUE_PULL;
|
||||||
|
int32_t direction = CONTINUE_SINK;
|
||||||
|
sptr<IRemoteObject> callback = nullptr;
|
||||||
|
auto info = DSchedContinueInfo(deviceId, bundleName, deviceId, bundleName, "");
|
||||||
|
auto conti = std::make_shared<DSchedContinue>(subType, direction, callback, info);
|
||||||
|
conti->Init();
|
||||||
|
auto cmd = std::make_shared<DSchedContinueDataCmd>();
|
||||||
|
// no same continueType, diff module
|
||||||
|
EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(true));
|
||||||
|
cmd->continueType_ = CONTINUE_TYPE3;
|
||||||
|
cmd->want_.SetElementName("", BUNDLEMAME_1, ABILITY_NAME_SAME_AS_CONTINUE_TYPE, MODULE_NAME2);
|
||||||
|
int32_t ret = conti->UpdateElementInfo(cmd);
|
||||||
|
EXPECT_EQ(ret, CAN_NOT_FOUND_MODULE_ERR);
|
||||||
|
// no continueType, same module
|
||||||
|
EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(true));
|
||||||
|
cmd->continueType_ = CONTINUE_TYPE1;
|
||||||
|
cmd->want_.SetElementName("", BUNDLEMAME_1, ABILITY_NAME_SAME_AS_CONTINUE_TYPE, MODULE_NAME1);
|
||||||
|
ret = conti->UpdateElementInfo(cmd);
|
||||||
|
EXPECT_EQ(ret, ERR_OK);
|
||||||
|
// no continueType with quick start, same module
|
||||||
|
EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(true));
|
||||||
|
cmd->continueType_ = CONTINUE_TYPE1_QUICK;
|
||||||
|
cmd->want_.SetElementName("", BUNDLEMAME_1, ABILITY_NAME_SAME_AS_CONTINUE_TYPE, MODULE_NAME1);
|
||||||
|
ret = conti->UpdateElementInfo(cmd);
|
||||||
|
EXPECT_EQ(ret, ERR_OK);
|
||||||
|
// has continueType, same module
|
||||||
|
EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(true));
|
||||||
|
cmd->continueType_ = CONTINUE_TYPE2;
|
||||||
|
cmd->want_.SetElementName("", BUNDLEMAME_1, ABILITY_NAME_DIFF_AS_CONTINUE_TYPE, MODULE_NAME2);
|
||||||
|
ret = conti->UpdateElementInfo(cmd);
|
||||||
|
EXPECT_EQ(ret, ERR_OK);
|
||||||
|
// has continueType, diff module
|
||||||
|
EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(true));
|
||||||
|
cmd->continueType_ = CONTINUE_TYPE2;
|
||||||
|
cmd->want_.SetElementName("", BUNDLEMAME_1, ABILITY_NAME_DIFF_AS_CONTINUE_TYPE, MODULE_NAME1);
|
||||||
|
ret = conti->UpdateElementInfo(cmd);
|
||||||
|
EXPECT_EQ(ret, ERR_OK);
|
||||||
|
// has continueType, no module
|
||||||
|
EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(true));
|
||||||
|
cmd->continueType_ = CONTINUE_TYPE2;
|
||||||
|
cmd->want_.SetElementName("", BUNDLEMAME_1, ABILITY_NAME_DIFF_AS_CONTINUE_TYPE, MODULE_NAME3);
|
||||||
|
ret = conti->UpdateElementInfo(cmd);
|
||||||
|
EXPECT_EQ(ret, ERR_OK);
|
||||||
|
DTEST_LOG << "DSchedContinueTest DSchedContinueTest_0017_2 end ret:" << ret << std::endl;
|
||||||
|
usleep(WAITTIME);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DmsBmStorage::GetDistributedBundleInfo(const std::string &networkId, const std::string &bundleName,
|
||||||
|
DmsBundleInfo &distributeBundleInfo)
|
||||||
|
{
|
||||||
|
DmsAbilityInfo info2;
|
||||||
|
info2.continueType = {CONTINUE_TYPE2};
|
||||||
|
info2.moduleName = MODULE_NAME2;
|
||||||
|
info2.abilityName = ABILITY_NAME_DIFF_AS_CONTINUE_TYPE;
|
||||||
|
distributeBundleInfo.dmsAbilityInfos.push_back(info2);
|
||||||
|
|
||||||
|
DmsAbilityInfo info1;
|
||||||
|
info1.continueType = {CONTINUE_TYPE1};
|
||||||
|
info1.moduleName = MODULE_NAME1;
|
||||||
|
info1.abilityName = ABILITY_NAME_SAME_AS_CONTINUE_TYPE;
|
||||||
|
distributeBundleInfo.dmsAbilityInfos.push_back(info1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @tc.name: DSchedContinueTest_0018_1
|
* @tc.name: DSchedContinueTest_0018_1
|
||||||
* @tc.desc: ExecuteNotifyComplete
|
* @tc.desc: ExecuteNotifyComplete
|
||||||
|
@ -1059,7 +1059,6 @@ HWTEST_F(DMSContinueManagerTest, testIsBundleContinuable_001, TestSize.Level1)
|
|||||||
DTEST_LOG << "DMSContinueManagerTest testIsBundleContinuable_001 start" << std::endl;
|
DTEST_LOG << "DMSContinueManagerTest testIsBundleContinuable_001 start" << std::endl;
|
||||||
std::string srcAbilityName = "abilityName";
|
std::string srcAbilityName = "abilityName";
|
||||||
std::string srcContinueType = "continueType";
|
std::string srcContinueType = "continueType";
|
||||||
bool isSameBundle = true;
|
|
||||||
|
|
||||||
AppExecFwk::BundleInfo localBundleInfo;
|
AppExecFwk::BundleInfo localBundleInfo;
|
||||||
std::vector<AppExecFwk::AbilityInfo> abilityInfos;
|
std::vector<AppExecFwk::AbilityInfo> abilityInfos;
|
||||||
@ -1074,14 +1073,9 @@ HWTEST_F(DMSContinueManagerTest, testIsBundleContinuable_001, TestSize.Level1)
|
|||||||
localBundleInfo.abilityInfos = abilityInfos;
|
localBundleInfo.abilityInfos = abilityInfos;
|
||||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||||
ASSERT_NE(nullptr, recvMgr);
|
ASSERT_NE(nullptr, recvMgr);
|
||||||
bool ret = recvMgr->IsBundleContinuable(localBundleInfo, srcAbilityName,
|
bool ret = recvMgr->IsBundleContinuable(localBundleInfo, srcAbilityName, srcContinueType);
|
||||||
srcContinueType, isSameBundle);
|
|
||||||
EXPECT_EQ(ret, false);
|
EXPECT_EQ(ret, false);
|
||||||
|
|
||||||
isSameBundle = false;
|
|
||||||
ret = recvMgr->IsBundleContinuable(localBundleInfo, srcAbilityName,
|
|
||||||
srcContinueType, isSameBundle);
|
|
||||||
EXPECT_EQ(ret, false);
|
|
||||||
DTEST_LOG << "DMSContinueManagerTest testIsBundleContinuable_001 end" << std::endl;
|
DTEST_LOG << "DMSContinueManagerTest testIsBundleContinuable_001 end" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1095,7 +1089,6 @@ HWTEST_F(DMSContinueManagerTest, testIsBundleContinuable_002, TestSize.Level1)
|
|||||||
DTEST_LOG << "DMSContinueManagerTest testIsBundleContinuable_002 start" << std::endl;
|
DTEST_LOG << "DMSContinueManagerTest testIsBundleContinuable_002 start" << std::endl;
|
||||||
std::string srcAbilityName = "abilityName";
|
std::string srcAbilityName = "abilityName";
|
||||||
std::string srcContinueType = "continueType";
|
std::string srcContinueType = "continueType";
|
||||||
bool isSameBundle = true;
|
|
||||||
|
|
||||||
AppExecFwk::BundleInfo localBundleInfo;
|
AppExecFwk::BundleInfo localBundleInfo;
|
||||||
std::vector<AppExecFwk::AbilityInfo> abilityInfos;
|
std::vector<AppExecFwk::AbilityInfo> abilityInfos;
|
||||||
@ -1110,13 +1103,7 @@ HWTEST_F(DMSContinueManagerTest, testIsBundleContinuable_002, TestSize.Level1)
|
|||||||
localBundleInfo.abilityInfos = abilityInfos;
|
localBundleInfo.abilityInfos = abilityInfos;
|
||||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||||
ASSERT_NE(nullptr, recvMgr);
|
ASSERT_NE(nullptr, recvMgr);
|
||||||
bool ret = recvMgr->IsBundleContinuable(localBundleInfo, srcAbilityName,
|
bool ret = recvMgr->IsBundleContinuable(localBundleInfo, srcAbilityName, srcContinueType);
|
||||||
srcContinueType, isSameBundle);
|
|
||||||
EXPECT_EQ(ret, true);
|
|
||||||
|
|
||||||
isSameBundle = false;
|
|
||||||
ret = recvMgr->IsBundleContinuable(localBundleInfo, srcAbilityName,
|
|
||||||
srcContinueType, isSameBundle);
|
|
||||||
EXPECT_EQ(ret, true);
|
EXPECT_EQ(ret, true);
|
||||||
DTEST_LOG << "DMSContinueManagerTest testIsBundleContinuable_002 end" << std::endl;
|
DTEST_LOG << "DMSContinueManagerTest testIsBundleContinuable_002 end" << std::endl;
|
||||||
}
|
}
|
||||||
@ -1133,7 +1120,6 @@ HWTEST_F(DMSContinueManagerTest, testIsBundleContinuable_003, TestSize.Level1)
|
|||||||
std::string sinkAbilityName = "sinkAbilityName";
|
std::string sinkAbilityName = "sinkAbilityName";
|
||||||
std::string srcContinueType = "srcContinueType";
|
std::string srcContinueType = "srcContinueType";
|
||||||
std::string sinkContinueType = "sinkContinueType";
|
std::string sinkContinueType = "sinkContinueType";
|
||||||
bool isSameBundle = false;
|
|
||||||
|
|
||||||
AppExecFwk::BundleInfo localBundleInfo;
|
AppExecFwk::BundleInfo localBundleInfo;
|
||||||
std::vector<AppExecFwk::AbilityInfo> abilityInfos;
|
std::vector<AppExecFwk::AbilityInfo> abilityInfos;
|
||||||
@ -1148,10 +1134,9 @@ HWTEST_F(DMSContinueManagerTest, testIsBundleContinuable_003, TestSize.Level1)
|
|||||||
localBundleInfo.abilityInfos = abilityInfos;
|
localBundleInfo.abilityInfos = abilityInfos;
|
||||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||||
ASSERT_NE(nullptr, recvMgr);
|
ASSERT_NE(nullptr, recvMgr);
|
||||||
bool ret = recvMgr->IsBundleContinuable(localBundleInfo, srcAbilityName,
|
bool ret = recvMgr->IsBundleContinuable(localBundleInfo, srcAbilityName, srcContinueType);
|
||||||
srcContinueType, isSameBundle);
|
|
||||||
EXPECT_EQ(ret, false);
|
EXPECT_EQ(ret, false);
|
||||||
DTEST_LOG << "DMSContinueManagerTest testIsBundleContinuable_002 end" << std::endl;
|
DTEST_LOG << "DMSContinueManagerTest testIsBundleContinuable_003 end" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1166,7 +1151,6 @@ HWTEST_F(DMSContinueManagerTest, testIsBundleContinuable_004, TestSize.Level1)
|
|||||||
std::string sinkAbilityName = "sinkAbilityName";
|
std::string sinkAbilityName = "sinkAbilityName";
|
||||||
std::string srcContinueType = srcAbilityName;
|
std::string srcContinueType = srcAbilityName;
|
||||||
std::string sinkContinueType = "sinkContinueType";
|
std::string sinkContinueType = "sinkContinueType";
|
||||||
bool isSameBundle = true;
|
|
||||||
|
|
||||||
AppExecFwk::BundleInfo localBundleInfo;
|
AppExecFwk::BundleInfo localBundleInfo;
|
||||||
std::vector<AppExecFwk::AbilityInfo> abilityInfos;
|
std::vector<AppExecFwk::AbilityInfo> abilityInfos;
|
||||||
@ -1181,8 +1165,7 @@ HWTEST_F(DMSContinueManagerTest, testIsBundleContinuable_004, TestSize.Level1)
|
|||||||
localBundleInfo.abilityInfos = abilityInfos;
|
localBundleInfo.abilityInfos = abilityInfos;
|
||||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||||
ASSERT_NE(nullptr, recvMgr);
|
ASSERT_NE(nullptr, recvMgr);
|
||||||
bool ret = recvMgr->IsBundleContinuable(localBundleInfo, srcAbilityName,
|
bool ret = recvMgr->IsBundleContinuable(localBundleInfo, srcAbilityName, srcContinueType);
|
||||||
srcContinueType, isSameBundle);
|
|
||||||
EXPECT_EQ(ret, false);
|
EXPECT_EQ(ret, false);
|
||||||
DTEST_LOG << "DMSContinueManagerTest testIsBundleContinuable_004 end" << std::endl;
|
DTEST_LOG << "DMSContinueManagerTest testIsBundleContinuable_004 end" << std::endl;
|
||||||
}
|
}
|
||||||
@ -1194,12 +1177,11 @@ HWTEST_F(DMSContinueManagerTest, testIsBundleContinuable_004, TestSize.Level1)
|
|||||||
*/
|
*/
|
||||||
HWTEST_F(DMSContinueManagerTest, testIsBundleContinuable_005, TestSize.Level1)
|
HWTEST_F(DMSContinueManagerTest, testIsBundleContinuable_005, TestSize.Level1)
|
||||||
{
|
{
|
||||||
DTEST_LOG << "DMSContinueManagerTest testIsBundleContinuable_004 start" << std::endl;
|
DTEST_LOG << "DMSContinueManagerTest testIsBundleContinuable_005 start" << std::endl;
|
||||||
std::string srcAbilityName = "srcAbilityName";
|
std::string srcAbilityName = "srcAbilityName";
|
||||||
std::string sinkAbilityName = "sinkAbilityName";
|
std::string sinkAbilityName = "sinkAbilityName";
|
||||||
std::string srcContinueType = srcAbilityName;
|
std::string srcContinueType = srcAbilityName;
|
||||||
std::string sinkContinueType = "sinkContinueType";
|
std::string sinkContinueType = "sinkContinueType";
|
||||||
bool isSameBundle = true;
|
|
||||||
|
|
||||||
AppExecFwk::BundleInfo localBundleInfo;
|
AppExecFwk::BundleInfo localBundleInfo;
|
||||||
std::vector<AppExecFwk::AbilityInfo> abilityInfos;
|
std::vector<AppExecFwk::AbilityInfo> abilityInfos;
|
||||||
@ -1214,9 +1196,8 @@ HWTEST_F(DMSContinueManagerTest, testIsBundleContinuable_005, TestSize.Level1)
|
|||||||
localBundleInfo.abilityInfos = abilityInfos;
|
localBundleInfo.abilityInfos = abilityInfos;
|
||||||
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
auto recvMgr = MultiUserManager::GetInstance().GetCurrentRecvMgr();
|
||||||
ASSERT_NE(nullptr, recvMgr);
|
ASSERT_NE(nullptr, recvMgr);
|
||||||
bool ret = recvMgr->IsBundleContinuable(localBundleInfo, srcAbilityName,
|
bool ret = recvMgr->IsBundleContinuable(localBundleInfo, srcAbilityName, srcContinueType);
|
||||||
srcContinueType, isSameBundle);
|
EXPECT_EQ(ret, false);
|
||||||
EXPECT_EQ(ret, true);
|
|
||||||
DTEST_LOG << "DMSContinueManagerTest testIsBundleContinuable_005 end" << std::endl;
|
DTEST_LOG << "DMSContinueManagerTest testIsBundleContinuable_005 end" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user