mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-23 06:20:07 +00:00
!892 BugFix: 通过版本校验保留RPC链路兼容+修复雷达打点点位
Merge pull request !892 from zhx/master
This commit is contained in:
commit
304f2d4c59
@ -20,7 +20,7 @@ namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
namespace Constants {
|
||||
constexpr const char* DMS_NAME = "dmsfwk";
|
||||
constexpr const char* DMS_VERSION = "4.1.0";
|
||||
constexpr const char* DMS_VERSION = "5.0.0";
|
||||
constexpr const char* DMS_SERVICE_ID = "dmsfwk_svr_id";
|
||||
constexpr const char* DMS_CHAR_ID = "dmsInfo";
|
||||
constexpr const char* PACKAGE_NAMES = "packageNames";
|
||||
|
@ -85,6 +85,7 @@ private:
|
||||
bool CheckCallingUid();
|
||||
bool EnforceInterfaceToken(MessageParcel& data);
|
||||
bool CallerInfoUnmarshalling(CallerInfo& callerInfo, MessageParcel& data);
|
||||
bool IsUsingQos(const std::string& remoteDeviceId);
|
||||
void SaveExtraInfo(const nlohmann::json& extraInfoJson, CallerInfo& callerInfo);
|
||||
void InitExtendedLocalFuncsInner();
|
||||
void InitLocalFuncsInner();
|
||||
|
@ -404,9 +404,9 @@ int32_t DSchedContinue::ExecuteContinueReq(std::shared_ptr<DistributedWantParams
|
||||
{
|
||||
HILOGI("ExecuteContinueReq start, continueInfo: %s", continueInfo_.toString().c_str());
|
||||
DurationDumperStart();
|
||||
DmsRadar::GetInstance().ClickIconDmsContinue("ContinueMission", ERR_OK);
|
||||
|
||||
if (subServiceType_ == CONTINUE_PULL) {
|
||||
DmsRadar::GetInstance().ClickIconDmsContinue("ContinueMission", ERR_OK);
|
||||
QuickStartAbility();
|
||||
}
|
||||
|
||||
@ -486,30 +486,6 @@ std::string DSchedContinue::QuerySinkAbilityName()
|
||||
return localBundleInfo.abilityInfos.front().name;
|
||||
}
|
||||
|
||||
int32_t DSchedContinue::StartAbility(const OHOS::AAFwk::Want& want, int32_t requestCode)
|
||||
{
|
||||
int32_t ret = AAFwk::AbilityManagerClient::GetInstance()->Connect();
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("ExecuteContinueData connect ability server failed %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t activeAccountId = 0;
|
||||
ret = DistributedSchedService::GetInstance().QueryOsAccount(activeAccountId);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("ExecuteContinueData QueryOsAccount failed %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
HILOGI("ExecuteContinueData StartAbility start");
|
||||
ret = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, DEFAULT_REQUEST_CODE, activeAccountId);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("StartAbility failed %d", ret);
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DSchedContinue::DurationDumperStart()
|
||||
{
|
||||
DmsContinueTime::GetInstance().Init();
|
||||
@ -556,6 +532,7 @@ int32_t DSchedContinue::PackStartCmd(std::shared_ptr<DSchedContinueStartCmd>& cm
|
||||
int32_t DSchedContinue::ExecuteContinueAbility(int32_t appVersion)
|
||||
{
|
||||
HILOGI("ExecuteContinueAbility start");
|
||||
DmsRadar::GetInstance().SaveDataDmsContinue("ContinueAbility", ERR_OK);
|
||||
|
||||
int32_t result = GetMissionIdByBundleName();
|
||||
if (result != ERR_OK) {
|
||||
@ -577,7 +554,6 @@ int32_t DSchedContinue::ExecuteContinueAbility(int32_t appVersion)
|
||||
result = AbilityManagerClient::GetInstance()->ContinueAbility(continueInfo_.sinkDeviceId_,
|
||||
continueInfo_.missionId_, appVersion);
|
||||
HILOGI("ExecuteContinueAbility call continueAbility end, result: %d.", result);
|
||||
DmsRadar::GetInstance().SaveDataDmsContinue("ContinueAbility", result);
|
||||
|
||||
if (result != ERR_OK) {
|
||||
return CONTINUE_CALL_CONTINUE_ABILITY_FAILED;
|
||||
@ -648,7 +624,6 @@ int32_t DSchedContinue::ExecuteContinueReply()
|
||||
int32_t DSchedContinue::ExecuteContinueSend(std::shared_ptr<ContinueAbilityData> data)
|
||||
{
|
||||
HILOGI("ExecuteContinueSend start, continueInfo: %s", continueInfo_.toString().c_str());
|
||||
DmsRadar::GetInstance().SaveDataDmsRemoteWant("StartRemoteAbility", ERR_OK);
|
||||
DurationDumperBeforeStartRemoteAbility();
|
||||
|
||||
SetCleanMissionFlag(data->want);
|
||||
@ -691,6 +666,7 @@ int32_t DSchedContinue::ExecuteContinueSend(std::shared_ptr<ContinueAbilityData>
|
||||
auto cmd = std::make_shared<DSchedContinueDataCmd>();
|
||||
PackDataCmd(cmd, newWant, abilityInfo, callerInfo, accountInfo);
|
||||
ret = SendCommand(cmd);
|
||||
DmsRadar::GetInstance().SaveDataDmsRemoteWant("SendContinueData", ret);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("ExecuteContinueSend send data cmd failed, ret %d", ret);
|
||||
return ret;
|
||||
@ -828,6 +804,22 @@ int32_t DSchedContinue::ExecuteContinueData(std::shared_ptr<DSchedContinueDataCm
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DSchedContinue::DurationDumperBeforeStartAbility(std::shared_ptr<DSchedContinueDataCmd> cmd)
|
||||
{
|
||||
if (subServiceType_ == CONTINUE_PULL) {
|
||||
std::string timeInfo = cmd->want_.GetStringParam(DMSDURATION_SAVETIME);
|
||||
DmsContinueTime::GetInstance().ReadDurationInfo(timeInfo.c_str());
|
||||
DmsContinueTime::GetInstance().SetSrcBundleName(cmd->want_.GetElement().GetBundleName());
|
||||
DmsContinueTime::GetInstance().SetSrcAbilityName(cmd->want_.GetElement().GetAbilityName());
|
||||
DmsContinueTime::GetInstance().SetDstBundleName(cmd->want_.GetElement().GetBundleName());
|
||||
DmsContinueTime::GetInstance().SetDstAbilityName(cmd->want_.GetElement().GetAbilityName());
|
||||
}
|
||||
DmsContinueTime::GetInstance().SetDurationBegin(CONTINUE_START_ABILITY_TIME, GetTickCount());
|
||||
|
||||
eventData_.moduleName = cmd->want_.GetElement().GetModuleName();
|
||||
eventData_.abilityName = cmd->want_.GetElement().GetAbilityName();
|
||||
}
|
||||
|
||||
bool DSchedContinue::WaitAbilityStateInitial(int32_t persistentId)
|
||||
{
|
||||
int32_t retryTimeout = GET_ABILITY_STATE_RETRY_TIMES;
|
||||
@ -848,20 +840,29 @@ bool DSchedContinue::WaitAbilityStateInitial(int32_t persistentId)
|
||||
return false;
|
||||
}
|
||||
|
||||
void DSchedContinue::DurationDumperBeforeStartAbility(std::shared_ptr<DSchedContinueDataCmd> cmd)
|
||||
int32_t DSchedContinue::StartAbility(const OHOS::AAFwk::Want& want, int32_t requestCode)
|
||||
{
|
||||
if (subServiceType_ == CONTINUE_PULL) {
|
||||
std::string timeInfo = cmd->want_.GetStringParam(DMSDURATION_SAVETIME);
|
||||
DmsContinueTime::GetInstance().ReadDurationInfo(timeInfo.c_str());
|
||||
DmsContinueTime::GetInstance().SetSrcBundleName(cmd->want_.GetElement().GetBundleName());
|
||||
DmsContinueTime::GetInstance().SetSrcAbilityName(cmd->want_.GetElement().GetAbilityName());
|
||||
DmsContinueTime::GetInstance().SetDstBundleName(cmd->want_.GetElement().GetBundleName());
|
||||
DmsContinueTime::GetInstance().SetDstAbilityName(cmd->want_.GetElement().GetAbilityName());
|
||||
int32_t ret = AAFwk::AbilityManagerClient::GetInstance()->Connect();
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("ExecuteContinueData connect ability server failed %d", ret);
|
||||
return ret;
|
||||
}
|
||||
DmsContinueTime::GetInstance().SetDurationBegin(CONTINUE_START_ABILITY_TIME, GetTickCount());
|
||||
|
||||
eventData_.moduleName = cmd->want_.GetElement().GetModuleName();
|
||||
eventData_.abilityName = cmd->want_.GetElement().GetAbilityName();
|
||||
int32_t activeAccountId = 0;
|
||||
ret = DistributedSchedService::GetInstance().QueryOsAccount(activeAccountId);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("ExecuteContinueData QueryOsAccount failed %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
HILOGI("ExecuteContinueData StartAbility start");
|
||||
DmsRadar::GetInstance().ClickIconDmsStartAbility("StartAbility", ret);
|
||||
ret = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, DEFAULT_REQUEST_CODE, activeAccountId);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("StartAbility failed %d", ret);
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t DSchedContinue::ExecuteNotifyComplete(int32_t result)
|
||||
@ -942,7 +943,7 @@ int32_t DSchedContinue::ExecuteContinueEnd(int32_t result)
|
||||
HILOGD("ExecuteContinueEnd clean mission result: %d", ret);
|
||||
}
|
||||
|
||||
if (direction_ == CONTINUE_SOURCE) {
|
||||
if (direction_ == CONTINUE_SINK) {
|
||||
DmsRadar::GetInstance().ClickIconDmsRecvOver("NotifyContinuationResultFromRemote", result);
|
||||
}
|
||||
|
||||
|
@ -404,13 +404,16 @@ void DSchedContinueManager::NotifyContinueDataRecv(int32_t sessionId, int32_t co
|
||||
{
|
||||
HILOGI("start, parsed cmd %d, sessionId: %d.", command, sessionId);
|
||||
std::lock_guard<std::mutex> continueLock(continueMutex_);
|
||||
for (auto iter = continues_.begin(); iter != continues_.end(); iter++) {
|
||||
if (iter->second != nullptr && sessionId == iter->second->GetSessionId()) {
|
||||
HILOGI("sessionId %d exist.", sessionId);
|
||||
iter->second->OnDataRecv(command, dataBuffer);
|
||||
return;
|
||||
if (!continues_.empty()) {
|
||||
for (auto iter = continues_.begin(); iter != continues_.end(); iter++) {
|
||||
if (iter->second != nullptr && sessionId == iter->second->GetSessionId()) {
|
||||
HILOGI("sessionId %d exist.", sessionId);
|
||||
iter->second->OnDataRecv(command, dataBuffer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (command == DSCHED_CONTINUE_CMD_START) {
|
||||
HILOGI("recv start cmd, sessionId: %d.", sessionId);
|
||||
auto startCmd = std::make_shared<DSchedContinueStartCmd>();
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "distributed_sched_permission.h"
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "dms_callback_task.h"
|
||||
#include "dms_constant.h"
|
||||
#include "dms_free_install_callback.h"
|
||||
#include "dms_token_callback.h"
|
||||
#include "dms_version_manager.h"
|
||||
@ -81,6 +82,7 @@ namespace DistributedSchedule {
|
||||
using namespace AAFwk;
|
||||
using namespace AccountSA;
|
||||
using namespace AppExecFwk;
|
||||
using namespace Constants;
|
||||
|
||||
namespace {
|
||||
const std::string TAG = "DistributedSchedService";
|
||||
@ -100,7 +102,6 @@ const std::string CHANGE_TYPE_KEY = "changeType";
|
||||
const std::string DMS_HIPLAY_ACTION = "ohos.ability.action.deviceSelect";
|
||||
const std::string DMS_VERSION_ID = "dmsVersion";
|
||||
const std::string DMS_CONNECT_TOKEN = "connectToken";
|
||||
const std::string DMS_VERSION = "4.0.0";
|
||||
const std::string DMS_MISSION_ID = "dmsMissionId";
|
||||
const std::string SUPPORT_CONTINUE_PAGE_STACK_KEY = "ohos.extra.param.key.supportContinuePageStack";
|
||||
const std::string SUPPORT_CONTINUE_SOURCE_EXIT_KEY = "ohos.extra.param.key.supportContinueSourceExit";
|
||||
@ -542,7 +543,6 @@ int32_t DistributedSchedService::ContinueAbilityWithTimeout(const std::string& d
|
||||
int64_t saveDataBegin = GetTickCount();
|
||||
DmsContinueTime::GetInstance().SetSaveDataDurationBegin(saveDataBegin);
|
||||
int32_t result = AbilityManagerClient::GetInstance()->ContinueAbility(dstDeviceId, missionId, remoteBundleVersion);
|
||||
DmsRadar::GetInstance().SaveDataDmsContinue("ContinueAbility", result);
|
||||
HILOGI("result: %{public}d!", result);
|
||||
if (result == ERR_INVALID_VALUE) {
|
||||
return MISSION_FOR_CONTINUING_IS_NOT_ALIVE;
|
||||
@ -599,7 +599,6 @@ int32_t DistributedSchedService::ContinueRemoteMission(const std::string& srcDev
|
||||
return INVALID_REMOTE_PARAMETERS_ERR;
|
||||
}
|
||||
int32_t result = remoteDms->ContinueMission(srcDeviceId, dstDeviceId, bundleName, callback, wantParams);
|
||||
DmsRadar::GetInstance().ClickIconDmsContinue("ContinueMission", result);
|
||||
HILOGI("ContinueRemoteMission result: %{public}d!", result);
|
||||
if (DmsContinueTime::GetInstance().GetPull()) {
|
||||
int64_t end = GetTickCount();
|
||||
@ -866,7 +865,6 @@ int32_t DistributedSchedService::StartContinuation(const OHOS::AAFwk::Want& want
|
||||
}
|
||||
} else {
|
||||
result = StartRemoteAbility(newWant, callerUid, DEFAULT_REQUEST_CODE, accessToken);
|
||||
DmsRadar::GetInstance().SaveDataDmsRemoteWant("StartRemoteAbility", result);
|
||||
if (result != ERR_OK) {
|
||||
HILOGE("continue ability failed, errorCode = %{public}d", result);
|
||||
return result;
|
||||
@ -914,7 +912,6 @@ void DistributedSchedService::NotifyCompleteContinuation(const std::u16string& d
|
||||
remoteDms->NotifyContinuationResultFromRemote(sessionId, isSuccess, dstInfo);
|
||||
dschedContinuation_->continueInfo_.srcNetworkId = "";
|
||||
dschedContinuation_->continueInfo_.dstNetworkId = "";
|
||||
DmsRadar::GetInstance().ClickIconDmsRecvOver("NotifyContinuationResultFromRemote", ERR_OK);
|
||||
}
|
||||
|
||||
int32_t DistributedSchedService::NotifyContinuationResultFromRemote(int32_t sessionId, bool isSuccess,
|
||||
@ -2594,7 +2591,6 @@ int32_t DistributedSchedService::StartAbility(const OHOS::AAFwk::Want& want, int
|
||||
DmsContinueTime::GetInstance().SetDstBundleName(want.GetElement().GetBundleName());
|
||||
err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, requestCode, activeAccountId);
|
||||
}
|
||||
DmsRadar::GetInstance().ClickIconDmsStartAbility("StartAbility", err);
|
||||
if (err != ERR_OK) {
|
||||
HILOGE("StartAbility failed %{public}d", err);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "dfx/dms_hitrace_constants.h"
|
||||
#include "distributed_want.h"
|
||||
#include "distributed_sched_permission.h"
|
||||
#include "dms_version_manager.h"
|
||||
#include "dsched_continue_manager.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
@ -58,9 +59,8 @@ const std::string PARAM_FREEINSTALL_APPID = "ohos.freeinstall.params.callingAppI
|
||||
const std::string PARAM_FREEINSTALL_BUNDLENAMES = "ohos.freeinstall.params.callingBundleNames";
|
||||
const std::string CMPT_PARAM_FREEINSTALL_BUNDLENAMES = "ohos.extra.param.key.allowedBundles";
|
||||
const std::string DMS_VERSION_ID = "dmsVersion";
|
||||
constexpr int32_t QOS_THRESHOLD_VERSION = 5;
|
||||
const int DEFAULT_REQUEST_CODE = -1;
|
||||
|
||||
constexpr bool IS_USING_QOS = true;
|
||||
}
|
||||
|
||||
DistributedSchedStub::DistributedSchedStub()
|
||||
@ -416,9 +416,17 @@ int32_t DistributedSchedStub::ContinueMissionInner(MessageParcel& data, MessageP
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
|
||||
int32_t result = (IS_USING_QOS) ?
|
||||
DSchedContinueManager::GetInstance().ContinueMission(srcDevId, dstDevId, missionId, callback, *wantParams) :
|
||||
ContinueMission(srcDevId, dstDevId, missionId, callback, *wantParams);
|
||||
int32_t result = ERR_OK;
|
||||
if (isLocalCalling) {
|
||||
std::string remoteDeviceId = (IPCSkeleton::GetCallingDeviceID() == srcDevId) ? dstDevId : srcDevId;
|
||||
if (IsUsingQos(remoteDeviceId)) {
|
||||
result = DSchedContinueManager::GetInstance().ContinueMission(srcDevId, dstDevId, missionId, callback,
|
||||
*wantParams);
|
||||
HILOGI("result = %{public}d", result);
|
||||
PARCEL_WRITE_REPLY_NOERROR(reply, Int32, result);
|
||||
}
|
||||
}
|
||||
result = ContinueMission(srcDevId, dstDevId, missionId, callback, *wantParams);
|
||||
HILOGI("result = %{public}d", result);
|
||||
PARCEL_WRITE_REPLY_NOERROR(reply, Int32, result);
|
||||
}
|
||||
@ -456,10 +464,18 @@ int32_t DistributedSchedStub::ContinueMissionOfBundleNameInner(MessageParcel& da
|
||||
if (continueType == "") {
|
||||
continueType = DMSContinueRecvMgr::GetInstance().GetContinueType(bundleName);
|
||||
}
|
||||
int32_t result = (IS_USING_QOS)
|
||||
? DSchedContinueManager::GetInstance().ContinueMission(srcDevId, dstDevId, bundleName, continueType,
|
||||
callback, *wantParams)
|
||||
: ContinueMission(srcDevId, dstDevId, bundleName, callback, *wantParams);
|
||||
|
||||
int32_t result = ERR_OK;
|
||||
if (isLocalCalling) {
|
||||
std::string remoteDeviceId = (IPCSkeleton::GetCallingDeviceID() == srcDevId) ? dstDevId : srcDevId;
|
||||
if (IsUsingQos(remoteDeviceId)) {
|
||||
result = DSchedContinueManager::GetInstance().ContinueMission(srcDevId, dstDevId, bundleName, continueType,
|
||||
callback, *wantParams);
|
||||
HILOGI("result = %{public}d", result);
|
||||
PARCEL_WRITE_REPLY_NOERROR(reply, Int32, result);
|
||||
}
|
||||
}
|
||||
result = ContinueMission(srcDevId, dstDevId, bundleName, callback, *wantParams);
|
||||
HILOGI("result = %{public}d", result);
|
||||
PARCEL_WRITE_REPLY_NOERROR(reply, Int32, result);
|
||||
}
|
||||
@ -487,7 +503,8 @@ int32_t DistributedSchedStub::StartContinuationInner(MessageParcel& data, Messag
|
||||
HILOGI("get AccessTokenID = %{public}u", accessToken);
|
||||
DistributedSchedPermission::GetInstance().MarkUriPermission(*want, accessToken);
|
||||
|
||||
int32_t result = (IS_USING_QOS) ?
|
||||
std::string deviceId = want->GetElement().GetDeviceID();
|
||||
int32_t result = (IsUsingQos(deviceId)) ?
|
||||
DSchedContinueManager::GetInstance().StartContinuation(*want, missionId, callerUid, status, accessToken) :
|
||||
StartContinuation(*want, missionId, callerUid, status, accessToken);
|
||||
ReportEvent(*want, BehaviorEvent::START_CONTINUATION, result, callerUid);
|
||||
@ -512,7 +529,7 @@ int32_t DistributedSchedStub::NotifyCompleteContinuationInner(MessageParcel& dat
|
||||
PARCEL_READ_HELPER(data, Int32, sessionId);
|
||||
bool continuationResult = false;
|
||||
PARCEL_READ_HELPER(data, Bool, continuationResult);
|
||||
if (IS_USING_QOS) {
|
||||
if (IsUsingQos(Str16ToStr8(devId))) {
|
||||
DSchedContinueManager::GetInstance().NotifyCompleteContinuation(devId, sessionId, continuationResult);
|
||||
} else {
|
||||
NotifyCompleteContinuation(devId, sessionId, continuationResult);
|
||||
@ -520,6 +537,21 @@ int32_t DistributedSchedStub::NotifyCompleteContinuationInner(MessageParcel& dat
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
bool DistributedSchedStub::IsUsingQos(const std::string& remoteDeviceId)
|
||||
{
|
||||
if (remoteDeviceId.empty()) {
|
||||
HILOGW("remote deviceId empty, using rpc");
|
||||
return false;
|
||||
}
|
||||
|
||||
DmsVersion thresholdDmsVersion = {QOS_THRESHOLD_VERSION, 0, 0};
|
||||
if (DmsVersionManager::IsRemoteDmsVersionLower(remoteDeviceId, thresholdDmsVersion)) {
|
||||
HILOGW("remote dms not support qos, using rpc");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t DistributedSchedStub::NotifyDSchedEventResultFromRemoteInner(MessageParcel& data,
|
||||
[[maybe_unused]] MessageParcel& reply)
|
||||
{
|
||||
@ -847,9 +879,7 @@ int32_t DistributedSchedStub::GetContinueInfoInner(MessageParcel& data, MessageP
|
||||
}
|
||||
std::string dstNetworkId;
|
||||
std::string srcNetworkId;
|
||||
int32_t result = (IS_USING_QOS) ?
|
||||
DSchedContinueManager::GetInstance().GetContinueInfo(dstNetworkId, srcNetworkId) :
|
||||
GetContinueInfo(dstNetworkId, srcNetworkId);
|
||||
int32_t result = DSchedContinueManager::GetInstance().GetContinueInfo(dstNetworkId, srcNetworkId);
|
||||
PARCEL_WRITE_HELPER(reply, String, dstNetworkId);
|
||||
PARCEL_WRITE_HELPER(reply, String, srcNetworkId);
|
||||
return result;
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "dfx/dms_continue_time_dumper.h"
|
||||
#include "distributed_sched_continuation_test.h"
|
||||
#include "distributed_sched_util.h"
|
||||
#include "dms_constant.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "ipc_skeleton.h"
|
||||
#include "mock_distributed_sched.h"
|
||||
@ -30,13 +31,13 @@ using namespace OHOS::DistributedHardware;
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
using namespace Constants;
|
||||
namespace {
|
||||
const std::u16string MOCK_DEVICE_ID = u"MOCK_DEVICE_ID";
|
||||
constexpr int32_t MOCK_SESSION_ID = 123;
|
||||
constexpr int32_t MOCK_TASK_ID = 456;
|
||||
const std::string LOCAL_DEVICE_ID = "192.168.43.100";
|
||||
const string DMS_VERSION_ID = "dmsVersion";
|
||||
const string DMS_VERSION = "4.0.0";
|
||||
constexpr int32_t SLEEP_TIME = 1000;
|
||||
constexpr int64_t FREE_INSTALL_TIMEOUT = 50000;
|
||||
constexpr int32_t REQUEST_CODE_ERR = 305;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#undef private
|
||||
#include "distributed_sched_util.h"
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "dms_constant.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "nativetoken_kit.h"
|
||||
@ -38,6 +39,7 @@ using namespace OHOS::Security::AccessToken;
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
using namespace Constants;
|
||||
namespace {
|
||||
constexpr uint32_t ACCESS_TOKEN = 100000000;
|
||||
constexpr uint32_t INVALID_ACCESS_TOKEN = 0;
|
||||
@ -56,7 +58,6 @@ const string DMS_IS_CALLER_BACKGROUND = "dmsIsCallerBackGround";
|
||||
const string DMS_API_VERSION = "dmsApiVersion";
|
||||
const string DMS_MISSION_ID = "dmsMissionId";
|
||||
const string DMS_VERSION_ID = "dmsVersion";
|
||||
const string DMS_VERSION = "4.0.0";
|
||||
const int API_VERSION = 9;
|
||||
const int FA_MODULE_ALLOW_MIN_API_VERSION = 8;
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "distributed_sched_proxy.h"
|
||||
#include "distributed_sched_service.h"
|
||||
#include "distributed_sched_util.h"
|
||||
#include "dms_constant.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "form_mgr_errors.h"
|
||||
@ -49,6 +50,7 @@ namespace DistributedSchedule {
|
||||
using namespace AAFwk;
|
||||
using namespace AppExecFwk;
|
||||
using namespace DistributedHardware;
|
||||
using namespace Constants;
|
||||
namespace {
|
||||
const string LOCAL_DEVICEID = "192.168.43.100";
|
||||
const string REMOTE_DEVICEID = "255.255.255.255";
|
||||
@ -62,7 +64,6 @@ namespace {
|
||||
const string BUNDLE_NAME = "com.ohos.permissionmanager";
|
||||
const string DMS_IS_CALLER_BACKGROUND = "dmsIsCallerBackGround";
|
||||
const string DMS_VERSION_ID = "dmsVersion";
|
||||
const string DMS_VERSION = "4.0.0";
|
||||
constexpr int32_t SLEEP_TIME = 1000;
|
||||
}
|
||||
|
||||
@ -466,7 +467,7 @@ HWTEST_F(DistributedSchedServiceFirstTest, StartAbilityFromRemote_001, TestSize.
|
||||
HWTEST_F(DistributedSchedServiceFirstTest, StartRemoteShareForm_002, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceFirstTest StartRemoteShareForm_002 start" << std::endl;
|
||||
|
||||
|
||||
sptr<IDistributedSched> proxy = GetDms();
|
||||
if (proxy == nullptr) {
|
||||
return;
|
||||
@ -492,7 +493,7 @@ HWTEST_F(DistributedSchedServiceFirstTest, StartRemoteShareForm_002, TestSize.Le
|
||||
want.SetParam(DMS_MISSION_ID, missionId);
|
||||
int result2 = proxy->SendResultFromRemote(want, 0, callerInfo, accountInfo, 0);
|
||||
DTEST_LOG << "result2:" << result2 << std::endl;
|
||||
|
||||
|
||||
/**
|
||||
* @tc.steps: step1. call StartAbilityFromRemote when remoteDeviceId is valid.
|
||||
*/
|
||||
@ -584,14 +585,14 @@ HWTEST_F(DistributedSchedServiceFirstTest, StartAbilityFromRemote_004, TestSize.
|
||||
HWTEST_F(DistributedSchedServiceFirstTest, StartAbilityFromRemote_005, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceFirstTest StartAbilityFromRemote_005 start" << std::endl;
|
||||
|
||||
|
||||
if (DistributedSchedService::GetInstance().dschedContinuation_ == nullptr) {
|
||||
DistributedSchedService::GetInstance().dschedContinuation_ = std::make_shared<DSchedContinuation>();
|
||||
}
|
||||
int32_t missionId = MISSION_ID;
|
||||
bool isSuccess = false;
|
||||
DistributedSchedService::GetInstance().NotifyContinuationCallbackResult(missionId, isSuccess);
|
||||
|
||||
|
||||
AAFwk::Want want;
|
||||
std::string localDeviceId;
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().GetLocalDeviceId(localDeviceId);
|
||||
@ -733,14 +734,14 @@ HWTEST_F(DistributedSchedServiceFirstTest, SendResultFromRemote_003, TestSize.Le
|
||||
HWTEST_F(DistributedSchedServiceFirstTest, SendResultFromRemote_004, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceFirstTest SendResultFromRemote_004 start" << std::endl;
|
||||
|
||||
|
||||
if (DistributedSchedService::GetInstance().dschedContinuation_ == nullptr) {
|
||||
DistributedSchedService::GetInstance().dschedContinuation_ = std::make_shared<DSchedContinuation>();
|
||||
}
|
||||
int32_t missionId = MISSION_ID;
|
||||
bool resultCode = ERR_OK;
|
||||
DistributedSchedService::GetInstance().NotifyContinuationCallbackResult(missionId, resultCode);
|
||||
|
||||
|
||||
AAFwk::Want want;
|
||||
std::string localDeviceId;
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().GetLocalDeviceId(localDeviceId);
|
||||
@ -920,7 +921,7 @@ HWTEST_F(DistributedSchedServiceFirstTest, ContinueMission_003, TestSize.Level1)
|
||||
int32_t result = DistributedSchedService::GetInstance().ContinueMission(
|
||||
"", "string", BUNDLE_NAME, callback, wantParams);
|
||||
EXPECT_EQ(result, INVALID_PARAMETERS_ERR);
|
||||
|
||||
|
||||
/**
|
||||
* @tc.steps: step2. test ContinueMission when dstDeviceId is empty;
|
||||
*/
|
||||
@ -1166,7 +1167,7 @@ HWTEST_F(DistributedSchedServiceFirstTest, StartContinuation_007, TestSize.Level
|
||||
DistributedSchedService::GetInstance().GetFormMgrProxy();
|
||||
DTEST_LOG << "DSchedContinuationTest GetFormMgrProxy_001 end" << std::endl;
|
||||
#endif
|
||||
|
||||
|
||||
int32_t ret = DistributedSchedService::GetInstance().StartContinuation(
|
||||
want, missionId, callerUid, status, accessToken);
|
||||
DistributedSchedService::GetInstance().NotifyCompleteContinuation(DEVICE_ID_NULL, SESSION_ID, isSuccess);
|
||||
@ -1205,7 +1206,7 @@ HWTEST_F(DistributedSchedServiceFirstTest, StartContinuation_008, TestSize.Level
|
||||
DistributedSchedService::GetInstance().GetFormMgrProxy();
|
||||
DTEST_LOG << "DSchedContinuationTest GetFormMgrProxy_001 end" << std::endl;
|
||||
#endif
|
||||
|
||||
|
||||
int32_t ret = DistributedSchedService::GetInstance().StartContinuation(
|
||||
want, missionId, callerUid, status, accessToken);
|
||||
DistributedSchedService::GetInstance().NotifyCompleteContinuation(DEVICE_ID_NULL, SESSION_ID, isSuccess);
|
||||
@ -1330,7 +1331,7 @@ HWTEST_F(DistributedSchedServiceFirstTest, ConnectAbilityFromRemote_003, TestSiz
|
||||
HWTEST_F(DistributedSchedServiceFirstTest, NotifyProcessDiedFromRemote_001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedServiceFirstTest NotifyProcessDiedFromRemote_001 start" << std::endl;
|
||||
|
||||
|
||||
sptr<IDistributedSched> proxy = GetDms();
|
||||
|
||||
AAFwk::Want want;
|
||||
@ -1358,7 +1359,7 @@ HWTEST_F(DistributedSchedServiceFirstTest, NotifyProcessDiedFromRemote_001, Test
|
||||
"com.ohos.distributedmusicplayer", "192.168.43.100", abilityInfo);
|
||||
int result2 = DistributedSchedService::GetInstance().StartAbilityFromRemote(want,
|
||||
abilityInfo, 0, callerInfo1, accountInfo);
|
||||
|
||||
|
||||
/**
|
||||
* @tc.steps: step1. call NotifyProcessDiedFromRemote when sourceDeviceId == sourceDeviceId.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user