mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-27 00:20:44 +00:00
Adjust anonymous string func to utils
Signed-off-by: t00605578 <tongyuejiao@huawei.com>
This commit is contained in:
parent
8640003895
commit
0f11866930
@ -35,6 +35,7 @@ int32_t Base64StrToParcel(const std::string& rawStr, Parcel& parcel);
|
||||
std::string Base64Encode(const unsigned char *toEncode, unsigned int len);
|
||||
std::string Base64Decode(const std::string& basicString);
|
||||
bool IsBase64(unsigned char c);
|
||||
std::string GetAnonymStr(const std::string &value);
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_DISTRIBUTED_SCHED_SERVICE_H
|
||||
|
@ -34,20 +34,23 @@ const std::string TAG = "DistributedSchedUtils";
|
||||
const std::string CONTINUE_CONFIG_RELATIVE_PATH = "etc/distributedhardware/dms/continue_config.json";
|
||||
const std::string ALLOW_APP_LIST_KEY = "allow_applist";
|
||||
constexpr int32_t MAX_CONFIG_PATH_LEN = 1024;
|
||||
constexpr size_t INT32_SHORT_ID_LEN = 20;
|
||||
constexpr size_t INT32_MIN_ID_LEN = 6;
|
||||
constexpr size_t INT32_PLAINTEXT_LEN = 4;
|
||||
|
||||
const uint32_t OFFSET2 = 2;
|
||||
const uint32_t OFFSET4 = 4;
|
||||
const uint32_t OFFSET6 = 6;
|
||||
const uint8_t PARAM_FC = 0xfc;
|
||||
const uint8_t PARAM_03 = 0x03;
|
||||
const uint8_t PARAM_F0 = 0xf0;
|
||||
const uint8_t PARAM_0F = 0x0f;
|
||||
const uint8_t PARAM_C0 = 0xc0;
|
||||
const uint8_t PARAM_3F = 0x3f;
|
||||
const int INDEX_FIRST = 0;
|
||||
const int INDEX_SECOND = 1;
|
||||
const int INDEX_THIRD = 2;
|
||||
const int INDEX_FORTH = 3;
|
||||
constexpr uint32_t OFFSET2 = 2;
|
||||
constexpr uint32_t OFFSET4 = 4;
|
||||
constexpr uint32_t OFFSET6 = 6;
|
||||
constexpr uint8_t PARAM_FC = 0xfc;
|
||||
constexpr uint8_t PARAM_03 = 0x03;
|
||||
constexpr uint8_t PARAM_F0 = 0xf0;
|
||||
constexpr uint8_t PARAM_0F = 0x0f;
|
||||
constexpr uint8_t PARAM_C0 = 0xc0;
|
||||
constexpr uint8_t PARAM_3F = 0x3f;
|
||||
constexpr uint32_t INDEX_FIRST = 0;
|
||||
constexpr uint32_t INDEX_SECOND = 1;
|
||||
constexpr uint32_t INDEX_THIRD = 2;
|
||||
constexpr uint32_t INDEX_FORTH = 3;
|
||||
|
||||
static std::atomic<bool> g_isMissContinueCfg = false;
|
||||
static std::string g_continueCfgFullPath = "";
|
||||
@ -326,5 +329,26 @@ bool IsBase64(unsigned char c)
|
||||
return (isalnum(c) || (c == '+') || (c == '/'));
|
||||
}
|
||||
|
||||
std::string GetAnonymStr(const std::string &value)
|
||||
{
|
||||
std::string res;
|
||||
std::string tmpStr("******");
|
||||
size_t strLen = value.length();
|
||||
if (strLen < INT32_MIN_ID_LEN) {
|
||||
return tmpStr;
|
||||
}
|
||||
|
||||
if (strLen <= INT32_SHORT_ID_LEN) {
|
||||
res += value[0];
|
||||
res += tmpStr;
|
||||
res += value[strLen - 1];
|
||||
} else {
|
||||
res.append(value, 0, INT32_PLAINTEXT_LEN);
|
||||
res += tmpStr;
|
||||
res.append(value, strLen - INT32_PLAINTEXT_LEN, INT32_PLAINTEXT_LEN);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
|
@ -82,7 +82,7 @@ void DSchedEventListenerStub::DSchedEventNotifyInner(MessageParcel &data, Messag
|
||||
DSchedEventNotify(eventNotify);
|
||||
} while (0);
|
||||
if (!reply.WriteInt32(ret)) {
|
||||
HILOGE("DSchedEventNotifyInner write ret failed, ret = %d", ret);
|
||||
HILOGE("DSchedEventNotifyInner write ret failed, ret = %{public}d", ret);
|
||||
}
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
|
@ -119,7 +119,7 @@ void DmsSystemAbilityStatusChange::OnAddSystemAbility(int32_t systemAbilityId, c
|
||||
{
|
||||
HILOGI("OnAddSystemAbility called, the systemAbilityId is %d", systemAbilityId);
|
||||
if (systemAbilityId != DISTRIBUTED_SCHED_SA_ID) {
|
||||
HILOGE("SystemAbilityId must be DISTRIBUTED_SCHED_SA_ID,but it is %d", systemAbilityId);
|
||||
HILOGE("SystemAbilityId must be DISTRIBUTED_SCHED_SA_ID, but it is %{public}d", systemAbilityId);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ void DmsSystemAbilityStatusChange::OnRemoveSystemAbility(int32_t systemAbilityId
|
||||
{
|
||||
HILOGI("OnRemoveSystemAbility called, the systemAbilityId is %d", systemAbilityId);
|
||||
if (systemAbilityId != DISTRIBUTED_SCHED_SA_ID) {
|
||||
HILOGE("SystemAbilityId must be DISTRIBUTED_SCHED_SA_ID,but it is %d", systemAbilityId);
|
||||
HILOGE("SystemAbilityId must be DISTRIBUTED_SCHED_SA_ID, but it is %{public}d", systemAbilityId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -484,14 +484,14 @@ int32_t DistributedAbilityManagerService::OnDeviceCancel()
|
||||
bool DistributedAbilityManagerService::HandleDisconnectAbility()
|
||||
{
|
||||
if (continuationHandler_ == nullptr) {
|
||||
HILOGE("continuationHandler_ is nullptr");
|
||||
HILOGE("continuationHandler is null.");
|
||||
return false;
|
||||
}
|
||||
auto func = [this]() {
|
||||
HILOGD("HandleDisconnectAbility called.");
|
||||
int32_t errCode = DisconnectAbility();
|
||||
if (errCode != ERR_OK) {
|
||||
HILOGE("DisconnectAbility errCode:%d", errCode);
|
||||
HILOGE("DisconnectAbility errCode: %{public}d.", errCode);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
@ -91,7 +91,7 @@ dtbabilitymgr_sources = [
|
||||
ohos_unittest("continuationmanagertest") {
|
||||
module_out_path = module_output_path
|
||||
sources = [
|
||||
"${distributed_service}/dtbschedmgr/test/unittest/distributed_sched_util.cpp",
|
||||
"${distributed_service}/dtbschedmgr/test/unittest/distributed_sched_test_util.cpp",
|
||||
"unittest/continuation_manager/app_connection_stub_test.cpp",
|
||||
"unittest/continuation_manager/continuation_manager_test.cpp",
|
||||
]
|
||||
@ -114,7 +114,7 @@ ohos_unittest("distributedabilitymanagerservicetest") {
|
||||
cflags = [ "-Dprivate=public" ]
|
||||
module_out_path = module_output_path
|
||||
sources = [
|
||||
"${distributed_service}/dtbschedmgr/test/unittest/distributed_sched_util.cpp",
|
||||
"${distributed_service}/dtbschedmgr/test/unittest/distributed_sched_test_util.cpp",
|
||||
"unittest/distributed_ability_manager_dumper_test.cpp",
|
||||
"unittest/distributed_ability_manager_service_test.cpp",
|
||||
"unittest/distributed_ability_manager_stub_test.cpp",
|
||||
@ -142,7 +142,7 @@ ohos_unittest("distributedeventtest") {
|
||||
cflags = [ "-Dprivate=public" ]
|
||||
module_out_path = module_output_path
|
||||
sources = [
|
||||
"${distributed_service}/dtbschedmgr/test/unittest/distributed_sched_util.cpp",
|
||||
"${distributed_service}/dtbschedmgr/test/unittest/distributed_sched_test_util.cpp",
|
||||
"unittest/dms_client_test.cpp",
|
||||
"unittest/dms_handler_test.cpp",
|
||||
"unittest/dms_listener_stub_test.cpp",
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "continuation_manager_test.h"
|
||||
|
||||
#include "distributed_ability_manager_client.h"
|
||||
#include "distributed_sched_util.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "mock_remote_stub.h"
|
||||
#include "test_log.h"
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "distributed_ability_manager_service_test.h"
|
||||
|
||||
#include <thread>
|
||||
#include "distributed_sched_util.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#define private public
|
||||
#include "continuation_extra_params.h"
|
||||
|
@ -62,7 +62,6 @@ public:
|
||||
std::string GetUuidByNetworkId(const std::string& networkId);
|
||||
bool GetLocalBasicInfo(DistributedHardware::DmDeviceInfo& dmDeviceInfo);
|
||||
|
||||
static std::string AnonymizeNetworkId(const std::string& deviceId);
|
||||
static std::shared_ptr<DnetworkAdapter> GetInstance();
|
||||
bool UpdateDeviceInfoStorage();
|
||||
|
||||
|
@ -22,10 +22,10 @@
|
||||
#include <string>
|
||||
|
||||
#include "ability_manager_client.h"
|
||||
#include "adapter/dnetwork_adapter.h"
|
||||
#include "distributedWant/distributed_want.h"
|
||||
#include "distributedWant/distributed_want_params.h"
|
||||
#include "distributed_sched_interface.h"
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "dsched_data_buffer.h"
|
||||
#include "dsched_continue_event.h"
|
||||
#include "dsched_continue_event_handler.h"
|
||||
@ -69,18 +69,18 @@ public:
|
||||
|
||||
std::string ToStringIgnoreMissionId() const
|
||||
{
|
||||
return "SrcDevId: " + DnetworkAdapter::AnonymizeNetworkId(this->sourceDeviceId_) + " " +
|
||||
return "SrcDevId: " + GetAnonymStr(this->sourceDeviceId_) + " " +
|
||||
"SrcBundle: " + this->sourceBundleName_ + " " +
|
||||
"DstDevId: "+ DnetworkAdapter::AnonymizeNetworkId(this->sinkDeviceId_) + " " +
|
||||
"DstDevId: "+ GetAnonymStr(this->sinkDeviceId_) + " " +
|
||||
"DstBundle: " + this->sinkBundleName_ + " " +
|
||||
"ContiType: " + this->continueType_;
|
||||
}
|
||||
|
||||
std::string toString() const
|
||||
{
|
||||
return "SrcDevId: " + DnetworkAdapter::AnonymizeNetworkId(this->sourceDeviceId_) + " " +
|
||||
return "SrcDevId: " + GetAnonymStr(this->sourceDeviceId_) + " " +
|
||||
"SrcBundle: " + this->sourceBundleName_ + " " +
|
||||
"DstDevId: "+ DnetworkAdapter::AnonymizeNetworkId(this->sinkDeviceId_) + " " +
|
||||
"DstDevId: "+ GetAnonymStr(this->sinkDeviceId_) + " " +
|
||||
"DstBundle: " + this->sinkBundleName_ + " " +
|
||||
"ContiType: " + this->continueType_ + " " +
|
||||
"MissionId: " + std::to_string(this->missionId_);
|
||||
|
@ -105,6 +105,7 @@ public:
|
||||
void NotifyMissionSnapshotChanged(int32_t missionId);
|
||||
void NotifyMissionSnapshotDestroyed(int32_t missionId);
|
||||
void NotifyRemoteDied(const wptr<IRemoteObject>& remote);
|
||||
|
||||
private:
|
||||
std::map<std::string, std::shared_ptr<AppExecFwk::EventHandler>> deviceHandle_;
|
||||
mutable std::mutex remoteMissionInfosLock_;
|
||||
|
@ -21,9 +21,11 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "errors.h"
|
||||
#include "event_runner.h"
|
||||
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "event_runner.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
@ -35,7 +37,6 @@ constexpr int32_t RETRY_REGISTER_CALLBACK_TIMES = 5;
|
||||
constexpr int32_t RETRY_REGISTER_CALLBACK_DELAY_TIME = 1000; // 1s
|
||||
const std::string PKG_NAME = "DBinderBus_Dms_" + std::to_string(getprocpid());
|
||||
|
||||
constexpr int32_t NON_ANONYMIZED_LENGTH = 6;
|
||||
const std::string EMPTY_DEVICE_ID = "";
|
||||
const std::string TAG = "DnetworkAdapter";
|
||||
}
|
||||
@ -67,7 +68,7 @@ void DnetworkAdapter::DeviceInitCallBack::OnRemoteDied()
|
||||
void DnetworkAdapter::DmsDeviceStateCallback::OnDeviceOnline(const DmDeviceInfo& deviceInfo)
|
||||
{
|
||||
std::string networkId = deviceInfo.networkId;
|
||||
HILOGI("OnNodeOnline netwokId = %{public}s", AnonymizeNetworkId(networkId).c_str());
|
||||
HILOGI("OnNodeOnline netwokId: %{public}s.", GetAnonymStr(networkId).c_str());
|
||||
auto onlineNotifyTask = [deviceInfo]() {
|
||||
std::lock_guard<std::mutex> autoLock(listenerSetMutex_);
|
||||
for (auto& listener : listenerSet_) {
|
||||
@ -82,7 +83,7 @@ void DnetworkAdapter::DmsDeviceStateCallback::OnDeviceOnline(const DmDeviceInfo&
|
||||
|
||||
void DnetworkAdapter::DmsDeviceStateCallback::OnDeviceOffline(const DmDeviceInfo& deviceInfo)
|
||||
{
|
||||
HILOGI("OnNodeOffline networkId = %{public}s", AnonymizeNetworkId(deviceInfo.networkId).c_str());
|
||||
HILOGI("OnNodeOffline networkId: %{public}s.", GetAnonymStr(deviceInfo.networkId).c_str());
|
||||
auto offlineNotifyTask = [deviceInfo]() {
|
||||
std::lock_guard<std::mutex> autoLock(listenerSetMutex_);
|
||||
for (auto& listener : listenerSet_) {
|
||||
@ -98,7 +99,7 @@ void DnetworkAdapter::DmsDeviceStateCallback::OnDeviceOffline(const DmDeviceInfo
|
||||
void DnetworkAdapter::DmsDeviceStateCallback::OnDeviceChanged(const DmDeviceInfo& deviceInfo)
|
||||
{
|
||||
std::string networkId = deviceInfo.networkId;
|
||||
HILOGI("OnDeviceChanged netwokId = %{public}s", AnonymizeNetworkId(networkId).c_str());
|
||||
HILOGI("OnDeviceChanged netwokId: %{public}s.", GetAnonymStr(networkId).c_str());
|
||||
}
|
||||
|
||||
void DnetworkAdapter::DmsDeviceStateCallback::OnDeviceReady(const DmDeviceInfo& deviceInfo)
|
||||
@ -217,15 +218,5 @@ std::string DnetworkAdapter::GetUuidByNetworkId(const std::string& networkId)
|
||||
}
|
||||
return uuid;
|
||||
}
|
||||
|
||||
std::string DnetworkAdapter::AnonymizeNetworkId(const std::string& networkId)
|
||||
{
|
||||
if (networkId.length() < NON_ANONYMIZED_LENGTH) {
|
||||
return EMPTY_DEVICE_ID;
|
||||
}
|
||||
std::string anonNetworkId = networkId.substr(0, NON_ANONYMIZED_LENGTH);
|
||||
anonNetworkId.append("******");
|
||||
return anonNetworkId;
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
|
@ -417,11 +417,11 @@ int32_t DSchedContinue::ExecuteContinueReq(std::shared_ptr<DistributedWantParams
|
||||
softbusSessionId_ = DSchedTransportSoftbusAdapter::GetInstance().ConnectDevice(peerDeviceId);
|
||||
if (softbusSessionId_ <= 0) {
|
||||
HILOGE("ExecuteContinueReq connect peer device %s failed, ret %d",
|
||||
DnetworkAdapter::AnonymizeNetworkId(peerDeviceId).c_str(), softbusSessionId_);
|
||||
GetAnonymStr(peerDeviceId).c_str(), softbusSessionId_);
|
||||
return softbusSessionId_;
|
||||
}
|
||||
HILOGI("ExecuteContinueReq peer %s connected, sessionId %d",
|
||||
DnetworkAdapter::AnonymizeNetworkId(peerDeviceId).c_str(), softbusSessionId_);
|
||||
GetAnonymStr(peerDeviceId).c_str(), softbusSessionId_);
|
||||
|
||||
auto startCmd = std::make_shared<DSchedContinueStartCmd>();
|
||||
int32_t ret = PackStartCmd(startCmd, wantParams);
|
||||
@ -949,8 +949,7 @@ int32_t DSchedContinue::ExecuteContinueEnd(int32_t result)
|
||||
if (result != ERR_OK ||
|
||||
(subServiceType_ == CONTINUE_PULL && direction_ == CONTINUE_SINK) ||
|
||||
(subServiceType_ == CONTINUE_PUSH && direction_ == CONTINUE_SOURCE)) {
|
||||
HILOGI("ExecuteContinueEnd disconnect peer device %s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(peerDeviceId).c_str());
|
||||
HILOGI("ExecuteContinueEnd disconnect peer device %s", GetAnonymStr(peerDeviceId).c_str());
|
||||
DSchedTransportSoftbusAdapter::GetInstance().DisconnectDevice(peerDeviceId);
|
||||
}
|
||||
|
||||
|
@ -18,8 +18,9 @@
|
||||
#include <sys/prctl.h>
|
||||
#include <map>
|
||||
|
||||
#include "adapter/dnetwork_adapter.h"
|
||||
#include "cJSON.h"
|
||||
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "dsched_transport_softbus_adapter.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
@ -113,9 +114,8 @@ int32_t DSchedContinueManager::ContinueMission(const std::string& srcDeviceId, c
|
||||
void DSchedContinueManager::HandleContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId,
|
||||
int32_t missionId, const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams)
|
||||
{
|
||||
HILOGI("start, srcDeviceId: %s. dstDeviceId: %s. missionId: %d.",
|
||||
DnetworkAdapter::AnonymizeNetworkId(srcDeviceId).c_str(),
|
||||
DnetworkAdapter::AnonymizeNetworkId(dstDeviceId).c_str(), missionId);
|
||||
HILOGI("start, srcDeviceId: %s. dstDeviceId: %s. missionId: %d.", GetAnonymStr(srcDeviceId).c_str(),
|
||||
GetAnonymStr(dstDeviceId).c_str(), missionId);
|
||||
|
||||
if (srcDeviceId.empty() || dstDeviceId.empty() || callback == nullptr) {
|
||||
HILOGE("srcDeviceId or dstDeviceId or callback is null!");
|
||||
@ -160,8 +160,8 @@ void DSchedContinueManager::HandleContinueMission(const std::string& srcDeviceId
|
||||
const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams)
|
||||
{
|
||||
HILOGI("start, srcDeviceId: %s. dstDeviceId: %s. bundleName: %s. continueType: %s.",
|
||||
DnetworkAdapter::AnonymizeNetworkId(srcDeviceId).c_str(),
|
||||
DnetworkAdapter::AnonymizeNetworkId(dstDeviceId).c_str(), bundleName.c_str(), continueType.c_str());
|
||||
GetAnonymStr(srcDeviceId).c_str(), GetAnonymStr(dstDeviceId).c_str(),
|
||||
bundleName.c_str(), continueType.c_str());
|
||||
|
||||
if (srcDeviceId.empty() || dstDeviceId.empty() || callback == nullptr) {
|
||||
HILOGE("srcDeviceId or dstDeviceId or callback is null!");
|
||||
@ -284,8 +284,7 @@ void DSchedContinueManager::HandleNotifyCompleteContinuation(const std::u16strin
|
||||
bool isSuccess)
|
||||
{
|
||||
std::string deviceId = Str16ToStr8(devId);
|
||||
HILOGI("begin, deviceId %s, missionId %d, isSuccess %d", DnetworkAdapter::AnonymizeNetworkId(deviceId).c_str(),
|
||||
missionId, isSuccess);
|
||||
HILOGI("begin, deviceId %s, missionId %d, isSuccess %d", GetAnonymStr(deviceId).c_str(), missionId, isSuccess);
|
||||
{
|
||||
std::lock_guard<std::mutex> continueLock(continueMutex_);
|
||||
if (continues_.empty()) {
|
||||
|
@ -18,9 +18,11 @@
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
#include "adapter/dnetwork_adapter.h"
|
||||
#include "cJSON.h"
|
||||
#include "datetime_ex.h"
|
||||
|
||||
#include "adapter/dnetwork_adapter.h"
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "deviceManager/dms_device_info.h"
|
||||
@ -373,14 +375,14 @@ void DmsContinueTime::AppendInfo()
|
||||
std::stringstream str;
|
||||
str << "== SOURCE ==\n"
|
||||
<< "Network Id : " << std::setw(DMSDURATION_SPACE) << std::left
|
||||
<< DnetworkAdapter::AnonymizeNetworkId(srcInfo_.netWorkId.c_str())
|
||||
<< GetAnonymStr(srcInfo_.netWorkId.c_str())
|
||||
<< "Device Name : " << srcInfo_.deviceName << "\n"
|
||||
<< "Bundle Name : " << std::setw(DMSDURATION_SPACE) << std::left
|
||||
<< srcInfo_.bundleName
|
||||
<< "Ability Name : " << srcInfo_.abilityName << "\n"
|
||||
<< "== SINK ==\n"
|
||||
<< "Network Id : " << std::setw(DMSDURATION_SPACE) << std::left
|
||||
<< DnetworkAdapter::AnonymizeNetworkId(dstInfo_.netWorkId.c_str())
|
||||
<< GetAnonymStr(dstInfo_.netWorkId.c_str())
|
||||
<< "Device Name : " << dstInfo_.deviceName << "\n"
|
||||
<< "Bundle Name : " << std::setw(DMSDURATION_SPACE) << std::left
|
||||
<< dstInfo_.bundleName
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "device_manager.h"
|
||||
#include "dfx/dms_hisysevent_report.h"
|
||||
#include "distributed_sched_service.h"
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "ipc_skeleton.h"
|
||||
@ -116,8 +117,7 @@ void DistributedSchedAdapter::DeviceOnline(const std::string& networkId)
|
||||
return;
|
||||
}
|
||||
|
||||
HILOGD("process DeviceOnline networkId is %{public}s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(networkId).c_str());
|
||||
HILOGD("process DeviceOnline networkId is %{public}s", GetAnonymStr(networkId).c_str());
|
||||
dmsAdapterHandler_->RemoveTask(networkId);
|
||||
}
|
||||
|
||||
@ -132,8 +132,7 @@ void DistributedSchedAdapter::DeviceOffline(const std::string& networkId)
|
||||
HILOGW("DeviceOffline networkId is empty");
|
||||
return;
|
||||
}
|
||||
HILOGD("process DeviceOffline networkId is %{public}s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(networkId).c_str());
|
||||
HILOGD("process DeviceOffline networkId is %{public}s", GetAnonymStr(networkId).c_str());
|
||||
auto callback = [networkId, this] () {
|
||||
ProcessDeviceOffline(networkId);
|
||||
};
|
||||
|
@ -61,8 +61,6 @@
|
||||
#include "parcel_helper.h"
|
||||
#include "scene_board_judgement.h"
|
||||
#include "switch_status_dependency.h"
|
||||
#include "dsched_continue_manager.h"
|
||||
#include "mission/dms_continue_recv_manager.h"
|
||||
#ifdef SUPPORT_COMMON_EVENT_SERVICE
|
||||
#include "common_event_listener.h"
|
||||
#endif
|
||||
@ -570,9 +568,8 @@ int32_t DistributedSchedService::ContinueRemoteMission(const std::string& srcDev
|
||||
int32_t DistributedSchedService::ContinueRemoteMission(const std::string& srcDeviceId, const std::string& dstDeviceId,
|
||||
const std::string& bundleName, const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams)
|
||||
{
|
||||
HILOGI("%{public}s. srcDeviceId: %{public}s. dstDeviceId: %{public}s. bundleName: %{public}s.", __func__,
|
||||
DnetworkAdapter::AnonymizeNetworkId(srcDeviceId).c_str(),
|
||||
DnetworkAdapter::AnonymizeNetworkId(dstDeviceId).c_str(), bundleName.c_str());
|
||||
HILOGI("ContinueRemoteMission srcDeviceId: %{public}s. dstDeviceId: %{public}s. bundleName: %{public}s.",
|
||||
GetAnonymStr(srcDeviceId).c_str(), GetAnonymStr(dstDeviceId).c_str(), bundleName.c_str());
|
||||
if (!CheckBundleContinueConfig(bundleName)) {
|
||||
HILOGI("App does not allow continue in config file, bundle name %{public}s", bundleName.c_str());
|
||||
return REMOTE_DEVICE_BIND_ABILITY_ERR;
|
||||
@ -618,7 +615,7 @@ int32_t DistributedSchedService::ContinueRemoteMission(const std::string& srcDev
|
||||
|
||||
int32_t DistributedSchedService::QuickStartAbility(const std::string& bundleName)
|
||||
{
|
||||
HILOGI("%{public}s called", __func__);
|
||||
HILOGI("QuickStartAbility called");
|
||||
if (!Rosen::SceneBoardJudgement::IsSceneBoardEnabled()) {
|
||||
HILOGE("sceneBoard not available.");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
@ -663,16 +660,14 @@ int32_t DistributedSchedService::ContinueMission(const std::string& srcDeviceId,
|
||||
|
||||
if (srcDeviceId == localDevId) {
|
||||
if (DtbschedmgrDeviceInfoStorage::GetInstance().GetDeviceInfoById(dstDeviceId) == nullptr) {
|
||||
HILOGE("GetDeviceInfoById failed, dstDeviceId: %{public}s.",
|
||||
DnetworkAdapter::AnonymizeNetworkId(dstDeviceId).c_str());
|
||||
HILOGE("GetDeviceInfoById failed, dstDeviceId: %{public}s.", GetAnonymStr(dstDeviceId).c_str());
|
||||
return INVALID_REMOTE_PARAMETERS_ERR;
|
||||
}
|
||||
return ContinueLocalMission(dstDeviceId, missionId, callback, wantParams);
|
||||
} else if (dstDeviceId == localDevId) {
|
||||
DmsContinueTime::GetInstance().SetPull(true);
|
||||
if (DtbschedmgrDeviceInfoStorage::GetInstance().GetDeviceInfoById(srcDeviceId) == nullptr) {
|
||||
HILOGE("GetDeviceInfoById failed, srcDeviceId: %{public}s.",
|
||||
DnetworkAdapter::AnonymizeNetworkId(srcDeviceId).c_str());
|
||||
HILOGE("GetDeviceInfoById failed, srcDeviceId: %{public}s.", GetAnonymStr(srcDeviceId).c_str());
|
||||
return INVALID_REMOTE_PARAMETERS_ERR;
|
||||
}
|
||||
return ContinueRemoteMission(srcDeviceId, dstDeviceId, missionId, callback, wantParams);
|
||||
@ -688,8 +683,7 @@ int32_t DistributedSchedService::ProcessContinueLocalMission(const std::string&
|
||||
{
|
||||
HILOGI("ProcessContinueLocalMission called.");
|
||||
if (DtbschedmgrDeviceInfoStorage::GetInstance().GetDeviceInfoById(dstDeviceId) == nullptr) {
|
||||
HILOGE("GetDeviceInfoById failed, dstDeviceId: %{public}s.",
|
||||
DnetworkAdapter::AnonymizeNetworkId(dstDeviceId).c_str());
|
||||
HILOGE("GetDeviceInfoById failed, dstDeviceId: %{public}s.", GetAnonymStr(dstDeviceId).c_str());
|
||||
return INVALID_REMOTE_PARAMETERS_ERR;
|
||||
}
|
||||
|
||||
@ -720,8 +714,7 @@ int32_t DistributedSchedService::ProcessContinueRemoteMission(const std::string&
|
||||
{
|
||||
HILOGI("ProcessContinueRemoteMission start.");
|
||||
if (DtbschedmgrDeviceInfoStorage::GetInstance().GetDeviceInfoById(srcDeviceId) == nullptr) {
|
||||
HILOGE("GetDeviceInfoById failed, srcDeviceId: %{public}s.",
|
||||
DnetworkAdapter::AnonymizeNetworkId(srcDeviceId).c_str());
|
||||
HILOGE("GetDeviceInfoById failed, srcDeviceId: %{public}s.", GetAnonymStr(srcDeviceId).c_str());
|
||||
return INVALID_REMOTE_PARAMETERS_ERR;
|
||||
}
|
||||
if (dschedContinuation_ == nullptr) {
|
||||
@ -740,9 +733,8 @@ int32_t DistributedSchedService::ProcessContinueRemoteMission(const std::string&
|
||||
int32_t DistributedSchedService::ContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId,
|
||||
const std::string& bundleName, const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams)
|
||||
{
|
||||
HILOGI("%{public}s. srcDeviceId: %{public}s. dstDeviceId: %{public}s. bundleName: %{public}s.", __func__,
|
||||
DnetworkAdapter::AnonymizeNetworkId(srcDeviceId).c_str(),
|
||||
DnetworkAdapter::AnonymizeNetworkId(dstDeviceId).c_str(), bundleName.c_str());
|
||||
HILOGI("ContinueMission srcDeviceId: %{public}s. dstDeviceId: %{public}s. bundleName: %{public}s.",
|
||||
GetAnonymStr(srcDeviceId).c_str(), GetAnonymStr(dstDeviceId).c_str(), bundleName.c_str());
|
||||
if (srcDeviceId.empty() || dstDeviceId.empty() || callback == nullptr) {
|
||||
HILOGE("srcDeviceId or dstDeviceId or callback is null!");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
@ -946,7 +938,7 @@ int32_t DistributedSchedService::NotifyDSchedEventResultFromRemote(const std::st
|
||||
#ifdef SUPPORT_DISTRIBUTED_FORM_SHARE
|
||||
sptr<IFormMgr> DistributedSchedService::GetFormMgrProxy()
|
||||
{
|
||||
HILOGD("%{public}s begin.", __func__);
|
||||
HILOGD("GetFormMgrProxy begin.");
|
||||
std::lock_guard<std::mutex> lock(formMgrLock_);
|
||||
if (formMgrProxy_ != nullptr) {
|
||||
HILOGD("get fms proxy success.");
|
||||
@ -1057,7 +1049,8 @@ void DistributedSchedService::RemoteConnectAbilityMappingLocked(const sptr<IRemo
|
||||
if (itConnect == distributedConnectAbilityMap_.end()) {
|
||||
// add uid's connect number
|
||||
uint32_t number = ++trackingUidMap_[callerInfo.uid];
|
||||
HILOGD("uid %d has %u connection(s), targetComponent:%d", callerInfo.uid, number, targetComponent);
|
||||
HILOGD("uid %{public}d has %{public}u connection(s), targetComponent: %{public}d.",
|
||||
callerInfo.uid, number, targetComponent);
|
||||
// new connect, add death recipient
|
||||
connect->AddDeathRecipient(connectDeathRecipient_);
|
||||
ReportDistributedComponentChange(callerInfo, DISTRIBUTED_COMPONENT_ADD, IDistributedSched::CONNECT,
|
||||
@ -1080,12 +1073,12 @@ void DistributedSchedService::RemoteConnectAbilityMappingLocked(const sptr<IRemo
|
||||
int32_t DistributedSchedService::CheckDistributedConnectLocked(const CallerInfo& callerInfo) const
|
||||
{
|
||||
if (callerInfo.uid < 0) {
|
||||
HILOGE("uid %d is invalid", callerInfo.uid);
|
||||
HILOGE("uid %{public}d is invalid.", callerInfo.uid);
|
||||
return BIND_ABILITY_UID_INVALID_ERR;
|
||||
}
|
||||
auto it = trackingUidMap_.find(callerInfo.uid);
|
||||
if (it != trackingUidMap_.end() && it->second >= MAX_DISTRIBUTED_CONNECT_NUM) {
|
||||
HILOGE("uid %{public}d connected too much abilities, it maybe leak", callerInfo.uid);
|
||||
HILOGE("uid %{public}d connected too much abilities, it maybe leak.", callerInfo.uid);
|
||||
return BIND_ABILITY_LEAK_ERR;
|
||||
}
|
||||
return ERR_OK;
|
||||
@ -1305,8 +1298,8 @@ int32_t DistributedSchedService::TryStartRemoteAbilityByCall(const OHOS::AAFwk::
|
||||
HILOGD("[PerformanceTest] TryStartRemoteAbilityByCall get remote DMS");
|
||||
sptr<IDistributedSched> remoteDms = GetRemoteDms(remoteDeviceId);
|
||||
if (remoteDms == nullptr) {
|
||||
HILOGE("TryStartRemoteAbilityByCall get remote DMS failed, remoteDeviceId : %{public}s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(remoteDeviceId).c_str());
|
||||
HILOGE("TryStartRemoteAbilityByCall get remote DMS failed, remoteDeviceId: %{public}s",
|
||||
GetAnonymStr(remoteDeviceId).c_str());
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
HILOGD("[PerformanceTest] TryStartRemoteAbilityByCall RPC begin");
|
||||
@ -1493,8 +1486,8 @@ int32_t DistributedSchedService::ReleaseRemoteAbility(const sptr<IRemoteObject>&
|
||||
}
|
||||
sptr<IDistributedSched> remoteDms = GetRemoteDms(element.GetDeviceID());
|
||||
if (remoteDms == nullptr) {
|
||||
HILOGE("ReleaseRemoteAbility get remote dms failed, devId : %{public}s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(element.GetDeviceID()).c_str());
|
||||
HILOGE("ReleaseRemoteAbility get remote dms failed, devId: %{public}s",
|
||||
GetAnonymStr(element.GetDeviceID()).c_str());
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
CallerInfo callerInfo;
|
||||
@ -1612,8 +1605,8 @@ int32_t DistributedSchedService::StartRemoteShareForm(const std::string& remoteD
|
||||
|
||||
sptr<IDistributedSched> remoteDms = GetRemoteDms(remoteDeviceId);
|
||||
if (remoteDms == nullptr) {
|
||||
HILOGE("StartRemoteShareForm get remote DMS failed, remoteDeviceId : %{public}s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(remoteDeviceId).c_str());
|
||||
HILOGE("StartRemoteShareForm get remote DMS failed, remoteDeviceId: %{public}s",
|
||||
GetAnonymStr(remoteDeviceId).c_str());
|
||||
return GET_REMOTE_DMS_FAIL;
|
||||
}
|
||||
std::string localDeviceId = "";
|
||||
@ -1643,9 +1636,8 @@ int32_t DistributedSchedService::StartShareFormFromRemote(
|
||||
std::string localDeviceId = "";
|
||||
GetLocalDeviceId(localDeviceId);
|
||||
if (CheckDeviceId(localDeviceId, remoteDeviceId)) {
|
||||
HILOGE("localId is %{public}s != %{public}s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(localDeviceId).c_str(),
|
||||
DnetworkAdapter::AnonymizeNetworkId(remoteDeviceId).c_str());
|
||||
HILOGE("localId is %{public}s != %{public}s", GetAnonymStr(localDeviceId).c_str(),
|
||||
GetAnonymStr(remoteDeviceId).c_str());
|
||||
return INVALID_REMOTE_PARAMETERS_ERR;
|
||||
}
|
||||
|
||||
@ -2358,15 +2350,15 @@ int32_t DistributedSchedService::UnRegisterDSchedEventListener(const std::string
|
||||
|
||||
int32_t DistributedSchedService::GetContinueInfo(std::string& dstNetworkId, std::string& srcNetworkId)
|
||||
{
|
||||
HILOGI("%{public}s called", __func__);
|
||||
HILOGI("GetContinueInfo called");
|
||||
if (dschedContinuation_ == nullptr) {
|
||||
HILOGE("continuation object null!");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
dstNetworkId = dschedContinuation_->continueInfo_.dstNetworkId;
|
||||
srcNetworkId = dschedContinuation_->continueInfo_.srcNetworkId;
|
||||
HILOGI("dstNetworkId: %{public}s", DnetworkAdapter::AnonymizeNetworkId(dstNetworkId).c_str());
|
||||
HILOGI("srcNetworkId: %{public}s", DnetworkAdapter::AnonymizeNetworkId(srcNetworkId).c_str());
|
||||
HILOGI("GetContinueInfo dstNetworkId: %{public}s, srcNetworkId: %{public}s",
|
||||
GetAnonymStr(dstNetworkId).c_str(), GetAnonymStr(srcNetworkId).c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -16,32 +16,36 @@
|
||||
#include "distributed_sched_stub.h"
|
||||
|
||||
#include "ability_info.h"
|
||||
#include "datetime_ex.h"
|
||||
#include "ipc_skeleton.h"
|
||||
#include "message_parcel.h"
|
||||
|
||||
#include "adapter/dnetwork_adapter.h"
|
||||
#include "bundle/bundle_manager_internal.h"
|
||||
#include "caller_info.h"
|
||||
#include "datetime_ex.h"
|
||||
#include "dfx/dms_continue_time_dumper.h"
|
||||
#include "dfx/dms_hisysevent_report.h"
|
||||
#include "dfx/dms_hitrace_chain.h"
|
||||
#include "dfx/dms_hitrace_constants.h"
|
||||
#include "distributed_want.h"
|
||||
#include "distributed_sched_permission.h"
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "dms_version_manager.h"
|
||||
#include "dsched_continue_manager.h"
|
||||
#include "dsched_transport_softbus_adapter.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "parcel_helper.h"
|
||||
|
||||
#ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER
|
||||
#include "image_source.h"
|
||||
|
||||
#include "mission/distributed_sched_mission_manager.h"
|
||||
#include "mission/dms_continue_recv_manager.h"
|
||||
#include "mission/mission_info_converter.h"
|
||||
#include "mission/snapshot_converter.h"
|
||||
#include "napi_error_code.h"
|
||||
#endif
|
||||
#include "ipc_skeleton.h"
|
||||
#include "message_parcel.h"
|
||||
#include "parcel_helper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
@ -237,7 +241,7 @@ int32_t DistributedSchedStub::StartRemoteAbilityInner(MessageParcel& data, Messa
|
||||
PARCEL_READ_HELPER(data, Int32, requestCode);
|
||||
uint32_t accessToken = 0;
|
||||
PARCEL_READ_HELPER(data, Uint32, accessToken);
|
||||
HILOGD("get callerUid = %d, AccessTokenID = %u", callerUid, accessToken);
|
||||
HILOGD("get callerUid = %{public}d, AccessTokenID = %{private}u", callerUid, accessToken);
|
||||
if (DistributedSchedPermission::GetInstance().CheckPermission(accessToken,
|
||||
PERMISSION_DISTRIBUTED_DATASYNC) != ERR_OK) {
|
||||
HILOGE("check data_sync permission failed!");
|
||||
@ -606,7 +610,7 @@ int32_t DistributedSchedStub::ConnectRemoteAbilityInner(MessageParcel& data, Mes
|
||||
PARCEL_READ_HELPER(data, Int32, callerPid);
|
||||
uint32_t accessToken = 0;
|
||||
PARCEL_READ_HELPER(data, Uint32, accessToken);
|
||||
HILOGD("get callerUid = %d, callerPid = %d, AccessTokenID = %u", callerUid, callerPid,
|
||||
HILOGD("get callerUid = %{public}d, callerPid = %{public}d, AccessTokenID = %{private}u", callerUid, callerPid,
|
||||
accessToken);
|
||||
if (DistributedSchedPermission::GetInstance().CheckPermission(accessToken,
|
||||
PERMISSION_DISTRIBUTED_DATASYNC) != ERR_OK) {
|
||||
@ -631,7 +635,7 @@ int32_t DistributedSchedStub::DisconnectRemoteAbilityInner(MessageParcel& data,
|
||||
PARCEL_READ_HELPER(data, Int32, callerUid);
|
||||
uint32_t accessToken = 0;
|
||||
PARCEL_READ_HELPER(data, Uint32, accessToken);
|
||||
HILOGD("get callerUid = %d, AccessTokenID = %u", callerUid, accessToken);
|
||||
HILOGD("get callerUid = %{public}d, AccessTokenID = %{private}u", callerUid, accessToken);
|
||||
if (DistributedSchedPermission::GetInstance().CheckPermission(accessToken,
|
||||
PERMISSION_DISTRIBUTED_DATASYNC) != ERR_OK) {
|
||||
HILOGE("check data_sync permission failed!");
|
||||
@ -1066,8 +1070,7 @@ bool DistributedSchedStub::CallerInfoUnmarshalling(CallerInfo& callerInfo, Messa
|
||||
PARCEL_READ_HELPER_RET(data, Int32, callerType, false);
|
||||
std::string sourceDeviceId;
|
||||
PARCEL_READ_HELPER_RET(data, String, sourceDeviceId, false);
|
||||
HILOGI("sourceDeviceId = %{public}s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(sourceDeviceId).c_str());
|
||||
HILOGI("sourceDeviceId = %{public}s", GetAnonymStr(sourceDeviceId).c_str());
|
||||
int32_t duid = -1;
|
||||
PARCEL_READ_HELPER_RET(data, Int32, duid, false);
|
||||
std::string callerAppId;
|
||||
@ -1339,7 +1342,7 @@ int32_t DistributedSchedStub::CreateJsonObject(std::string& extraInfo, CallerInf
|
||||
if (extraInfoJson.find(EXTRO_INFO_JSON_KEY_REQUEST_CODE) != extraInfoJson.end() &&
|
||||
extraInfoJson[EXTRO_INFO_JSON_KEY_REQUEST_CODE].is_number_integer()) {
|
||||
requestCode = extraInfoJson[EXTRO_INFO_JSON_KEY_REQUEST_CODE];
|
||||
HILOGD("parse extra info, requestCode = %d", requestCode);
|
||||
HILOGD("parse extra info, requestCode = %{public}d", requestCode);
|
||||
}
|
||||
}
|
||||
return requestCode;
|
||||
|
@ -19,14 +19,16 @@
|
||||
#include <thread>
|
||||
|
||||
#include "device_manager.h"
|
||||
#include "distributed_device_node_listener.h"
|
||||
#include "distributed_sched_service.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "ipc_object_proxy.h"
|
||||
#include "ipc_skeleton.h"
|
||||
#include "iservice_registry.h"
|
||||
#include "system_ability_definition.h"
|
||||
|
||||
#include "distributed_device_node_listener.h"
|
||||
#include "distributed_sched_service.h"
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
|
||||
using namespace std;
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
@ -77,7 +79,7 @@ bool DtbschedmgrDeviceInfoStorage::ConnectSoftbus()
|
||||
}
|
||||
std::shared_ptr<DnetworkAdapter> dnetworkAdapter = DnetworkAdapter::GetInstance();
|
||||
if (dnetworkAdapter == nullptr) {
|
||||
HILOGE("DnetworkAdapter::GetInstance() null");
|
||||
HILOGE("DnetworkAdapter::GetInstance is null");
|
||||
return false;
|
||||
}
|
||||
if (!InitNetworkIdManager(dnetworkAdapter)) {
|
||||
@ -189,7 +191,7 @@ bool DtbschedmgrDeviceInfoStorage::UpdateDeviceInfoStorage()
|
||||
std::string networkId = deviceInfo->GetNetworkId();
|
||||
RegisterUuidNetworkIdMap(networkId);
|
||||
{
|
||||
HILOGI("Add remote device networkId %{public}s", DnetworkAdapter::AnonymizeNetworkId(networkId).c_str());
|
||||
HILOGI("Add remote device networkId %{public}s", GetAnonymStr(networkId).c_str());
|
||||
lock_guard<mutex> autoLock(deviceLock_);
|
||||
remoteDevices_[networkId] = deviceInfo;
|
||||
}
|
||||
@ -221,8 +223,7 @@ bool DtbschedmgrDeviceInfoStorage::GetLocalDeviceFromDnet(std::string& networkId
|
||||
return false;
|
||||
}
|
||||
networkId = dmDeviceInfo.networkId;
|
||||
HILOGI("get local networkId from DnetworkAdapter, networkId = %{public}s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(networkId).c_str());
|
||||
HILOGI("get local networkId from DnetworkAdapter, networkId = %{public}s", GetAnonymStr(networkId).c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -239,7 +240,7 @@ bool DtbschedmgrDeviceInfoStorage::GetLocalDeviceUdid(std::string& udid)
|
||||
return false;
|
||||
}
|
||||
udid = GetUdidByNetworkId(dmDeviceInfo.networkId);
|
||||
HILOGD("GetLocalDeviceUdid = %{public}s", DnetworkAdapter::AnonymizeNetworkId(udid).c_str());
|
||||
HILOGD("GetLocalDeviceUdid = %{public}s", GetAnonymStr(udid).c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -254,25 +255,23 @@ std::shared_ptr<DmsDeviceInfo> DtbschedmgrDeviceInfoStorage::FindDeviceInfoInSto
|
||||
lock_guard<mutex> autoLock(deviceLock_);
|
||||
auto iter = remoteDevices_.find(networkId);
|
||||
if (iter == remoteDevices_.end()) {
|
||||
HILOGE("Get remote device info from storage fail, networkId %{public}s.",
|
||||
DnetworkAdapter::AnonymizeNetworkId(networkId).c_str());
|
||||
HILOGE("Get remote device info from storage fail, networkId %{public}s.", GetAnonymStr(networkId).c_str());
|
||||
return nullptr;
|
||||
}
|
||||
HILOGI("Get remote device info from storage success, networkId %{public}s.",
|
||||
DnetworkAdapter::AnonymizeNetworkId(networkId).c_str());
|
||||
HILOGI("Get remote device info from storage success, networkId %{public}s.", GetAnonymStr(networkId).c_str());
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
std::shared_ptr<DmsDeviceInfo> DtbschedmgrDeviceInfoStorage::GetDeviceInfoById(const std::string& networkId)
|
||||
{
|
||||
HILOGI("Get device info by networkId %{public}s start.", DnetworkAdapter::AnonymizeNetworkId(networkId).c_str());
|
||||
HILOGI("Get device info by networkId %{public}s start.", GetAnonymStr(networkId).c_str());
|
||||
auto devInfo = FindDeviceInfoInStorage(networkId);
|
||||
if (devInfo != nullptr) {
|
||||
return devInfo;
|
||||
}
|
||||
|
||||
HILOGI("NetworkId %{public}s not in storage, update devices info from device manager.",
|
||||
DnetworkAdapter::AnonymizeNetworkId(networkId).c_str());
|
||||
GetAnonymStr(networkId).c_str());
|
||||
if (!UpdateDeviceInfoStorage()) {
|
||||
HILOGE("Update device info storage from device manager trusted device list fail.");
|
||||
return nullptr;
|
||||
@ -343,9 +342,8 @@ void DtbschedmgrDeviceInfoStorage::DeviceOnlineNotify(const std::shared_ptr<DmsD
|
||||
std::string networkId = devInfo->GetNetworkId();
|
||||
RegisterUuidNetworkIdMap(networkId);
|
||||
std::string uuid = GetUuidByNetworkId(networkId);
|
||||
HILOGI("networkId = %{public}s, uuid = %{public}s, deviceName = %{public}s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(networkId).c_str(),
|
||||
DnetworkAdapter::AnonymizeNetworkId(uuid).c_str(), devInfo->GetDeviceName().c_str());
|
||||
HILOGI("networkId: %{public}s, uuid: %{public}s, deviceName: %{public}s", GetAnonymStr(networkId).c_str(),
|
||||
GetAnonymStr(uuid).c_str(), devInfo->GetDeviceName().c_str());
|
||||
{
|
||||
lock_guard<mutex> autoLock(deviceLock_);
|
||||
remoteDevices_[networkId] = devInfo;
|
||||
@ -363,16 +361,15 @@ void DtbschedmgrDeviceInfoStorage::DeviceOfflineNotify(const std::string& networ
|
||||
HILOGE("DeviceOfflineNotify networkId empty");
|
||||
return;
|
||||
}
|
||||
HILOGD("DeviceOfflineNotify networkId = %{public}s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(networkId).c_str());
|
||||
HILOGD("DeviceOfflineNotify networkId: %{public}s", GetAnonymStr(networkId).c_str());
|
||||
if (networkIdMgrHandler_ == nullptr) {
|
||||
HILOGE("DeviceOfflineNotify networkIdMgrHandler null");
|
||||
return;
|
||||
}
|
||||
auto nodeOffline = [this, networkId]() {
|
||||
std::string uuid = GetUuidByNetworkId(networkId);
|
||||
HILOGI("DeviceOfflineNotify process networkId = %{public}s, uuid = %{public}s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(networkId).c_str(), DnetworkAdapter::AnonymizeNetworkId(uuid).c_str());
|
||||
HILOGI("DeviceOfflineNotify process networkId: %{public}s, uuid: %{public}s",
|
||||
GetAnonymStr(networkId).c_str(), GetAnonymStr(uuid).c_str());
|
||||
DistributedSchedService::GetInstance().DeviceOfflineNotify(networkId);
|
||||
UnregisterUuidNetworkIdMap(networkId);
|
||||
lock_guard<mutex> autoLock(deviceLock_);
|
||||
@ -409,7 +406,7 @@ std::vector<std::string> DtbschedmgrDeviceInfoStorage::GetNetworkIdList()
|
||||
{
|
||||
std::vector<std::string> devices;
|
||||
for (auto device = remoteDevices_.begin(); device != remoteDevices_.end(); ++device) {
|
||||
HILOGI("NetworkId: %{public}s", DnetworkAdapter::AnonymizeNetworkId(device->second->GetNetworkId()).c_str());
|
||||
HILOGI("NetworkId: %{public}s", GetAnonymStr(device->second->GetNetworkId()).c_str());
|
||||
devices.push_back(device->second->GetNetworkId());
|
||||
}
|
||||
return devices;
|
||||
|
@ -16,13 +16,15 @@
|
||||
|
||||
#include "mission/distributed_bm_storage.h"
|
||||
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "iservice_registry.h"
|
||||
#include "mission/distributed_sched_mission_manager.h"
|
||||
#include "system_ability_definition.h"
|
||||
#include "os_account_manager.h"
|
||||
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "mission/distributed_sched_mission_manager.h"
|
||||
|
||||
using namespace OHOS::DistributedKv;
|
||||
|
||||
namespace OHOS {
|
||||
@ -206,8 +208,7 @@ bool DmsBmStorage::GetStorageDistributeInfo(const std::string &networkId,
|
||||
bool DmsBmStorage::DealGetBundleName(const std::string &networkId, const uint16_t& bundleNameId,
|
||||
std::string &bundleName)
|
||||
{
|
||||
HILOGD("networkId: %{public}s bundleNameId: %{public}d",
|
||||
DnetworkAdapter::AnonymizeNetworkId(networkId).c_str(), bundleNameId);
|
||||
HILOGD("networkId: %{public}s bundleNameId: %{public}d", GetAnonymStr(networkId).c_str(), bundleNameId);
|
||||
if (!CheckKvStore()) {
|
||||
HILOGE("kvStore is nullptr");
|
||||
return false;
|
||||
@ -244,8 +245,7 @@ bool DmsBmStorage::DealGetBundleName(const std::string &networkId, const uint16_
|
||||
bool DmsBmStorage::GetDistributedBundleName(const std::string &networkId, const uint16_t& bundleNameId,
|
||||
std::string &bundleName)
|
||||
{
|
||||
HILOGD("networkId: %{public}s bundleNameId: %{public}d",
|
||||
DnetworkAdapter::AnonymizeNetworkId(networkId).c_str(), bundleNameId);
|
||||
HILOGD("networkId: %{public}s bundleNameId: %{public}d", GetAnonymStr(networkId).c_str(), bundleNameId);
|
||||
bool ret = DealGetBundleName(networkId, bundleNameId, bundleName);
|
||||
if (!ret) {
|
||||
HILOGW("GetDistributedBundleName error and try to call again");
|
||||
@ -619,7 +619,7 @@ std::string DmsBmStorage::GetContinueType(const std::string &networkId, std::str
|
||||
uint8_t continueTypeId)
|
||||
{
|
||||
HILOGD("networkId: %{public}s, bundleName: %{public}s, continueTypeId: %{public}d",
|
||||
DnetworkAdapter::AnonymizeNetworkId(networkId).c_str(), bundleName.c_str(), continueTypeId);
|
||||
GetAnonymStr(networkId).c_str(), bundleName.c_str(), continueTypeId);
|
||||
if (!CheckKvStore()) {
|
||||
HILOGE("kvStore is nullptr");
|
||||
return "";
|
||||
@ -670,7 +670,7 @@ std::string DmsBmStorage::GetAbilityName(const std::string &networkId, std::stri
|
||||
std::string &continueType)
|
||||
{
|
||||
HILOGD("networkId: %{public}s, bundleName: %{public}s, continueTypeId: %{public}s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(networkId).c_str(), bundleName.c_str(), continueType.c_str());
|
||||
GetAnonymStr(networkId).c_str(), bundleName.c_str(), continueType.c_str());
|
||||
if (!CheckKvStore()) {
|
||||
HILOGE("kvStore is nullptr");
|
||||
return "";
|
||||
|
@ -16,10 +16,13 @@
|
||||
#include "mission/distributed_data_change_listener.h"
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
#include "string_ex.h"
|
||||
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "mission/distributed_sched_mission_manager.h"
|
||||
#include "string_ex.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace OHOS::DistributedKv;
|
||||
@ -63,8 +66,7 @@ void DistributedDataChangeListener::OnChange(const ChangeNotification &changeNot
|
||||
for (const auto& entry : inserts) {
|
||||
unique_ptr<KeyInfo> keyInfo = KeyInfo::ParseInfo(entry.key.ToString());
|
||||
if (keyInfo != nullptr) {
|
||||
string keyStr = DnetworkAdapter::AnonymizeNetworkId(keyInfo->uuid) + "_" +
|
||||
to_string(keyInfo->missionId);
|
||||
string keyStr = GetAnonymStr(keyInfo->uuid) + "_" + to_string(keyInfo->missionId);
|
||||
HILOGI("insertEntries Key:%{public}s, Value:%{public}s", keyStr.c_str(), entry.value.ToString().c_str());
|
||||
string networkId = DtbschedmgrDeviceInfoStorage::GetInstance().GetNetworkIdByUuid(keyInfo->uuid);
|
||||
if (networkId.empty()) {
|
||||
@ -79,8 +81,7 @@ void DistributedDataChangeListener::OnChange(const ChangeNotification &changeNot
|
||||
for (const auto& entry : deletes) {
|
||||
unique_ptr<KeyInfo> keyInfo = KeyInfo::ParseInfo(entry.key.ToString());
|
||||
if (keyInfo != nullptr) {
|
||||
string keyStr = DnetworkAdapter::AnonymizeNetworkId(keyInfo->uuid) + "_" +
|
||||
to_string(keyInfo->missionId);
|
||||
string keyStr = GetAnonymStr(keyInfo->uuid) + "_" + to_string(keyInfo->missionId);
|
||||
HILOGI("deleteEntries Key:%{public}s, Value:%{public}s", keyStr.c_str(), entry.value.ToString().c_str());
|
||||
(void)DistributedSchedMissionManager::GetInstance().DequeueCachedSnapshotInfo(keyInfo->uuid,
|
||||
keyInfo->missionId);
|
||||
@ -91,8 +92,7 @@ void DistributedDataChangeListener::OnChange(const ChangeNotification &changeNot
|
||||
for (const auto& entry : updates) {
|
||||
unique_ptr<KeyInfo> keyInfo = KeyInfo::ParseInfo(entry.key.ToString());
|
||||
if (keyInfo != nullptr) {
|
||||
string keyStr = DnetworkAdapter::AnonymizeNetworkId(keyInfo->uuid) + "_" +
|
||||
to_string(keyInfo->missionId);
|
||||
string keyStr = GetAnonymStr(keyInfo->uuid) + "_" + to_string(keyInfo->missionId);
|
||||
HILOGI("updateEntries Key:%{public}s, Value:%{public}s", keyStr.c_str(), entry.value.ToString().c_str());
|
||||
string networkId = DtbschedmgrDeviceInfoStorage::GetInstance().GetNetworkIdByUuid(keyInfo->uuid);
|
||||
if (networkId.empty()) {
|
||||
|
@ -17,15 +17,18 @@
|
||||
|
||||
#include <thread>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "datetime_ex.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "ipc_object_proxy.h"
|
||||
#include "ipc_skeleton.h"
|
||||
#include "iservice_registry.h"
|
||||
#include "mission/distributed_sched_mission_manager.h"
|
||||
#include "system_ability_definition.h"
|
||||
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "mission/distributed_sched_mission_manager.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace OHOS::DistributedKv;
|
||||
|
||||
@ -246,13 +249,11 @@ bool DistributedDataStorage::Insert(const string& networkId, int32_t missionId,
|
||||
unique_lock<shared_mutex> writeLock(initLock_);
|
||||
bool ret = InsertInnerLocked(uuid, missionId, byteStream, len);
|
||||
if (!ret) {
|
||||
HILOGE("Insert uuid = %{public}s + missionId = %{public}d failed!",
|
||||
DnetworkAdapter::AnonymizeNetworkId(uuid).c_str(), missionId);
|
||||
HILOGE("Insert fail, uuid: %{public}s, missionId: %{public}d.", GetAnonymStr(uuid).c_str(), missionId);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
HILOGI("Insert uuid = %{public}s + missionId = %{public}d successful!",
|
||||
DnetworkAdapter::AnonymizeNetworkId(uuid).c_str(), missionId);
|
||||
HILOGI("Insert success, uuid: %{public}s, missionId: %{public}d.", GetAnonymStr(uuid).c_str(), missionId);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -297,13 +298,11 @@ bool DistributedDataStorage::Delete(const string& networkId, int32_t missionId)
|
||||
unique_lock<shared_mutex> writeLock(initLock_);
|
||||
bool ret = DeleteInnerLocked(uuid, missionId);
|
||||
if (!ret) {
|
||||
HILOGE("Delete uuid = %{public}s + missionId = %{public}d failed!",
|
||||
DnetworkAdapter::AnonymizeNetworkId(uuid).c_str(), missionId);
|
||||
HILOGE("Delete fail, uuid: %{public}s, missionId: %{public}d.", GetAnonymStr(uuid).c_str(), missionId);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
HILOGI("Delete uuid = %{public}s + missionId = %{public}d successful!",
|
||||
DnetworkAdapter::AnonymizeNetworkId(uuid).c_str(), missionId);
|
||||
HILOGI("Delete success, uuid: %{public}s, missionId: %{public}d.", GetAnonymStr(uuid).c_str(), missionId);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -336,12 +335,11 @@ bool DistributedDataStorage::FuzzyDelete(const string& networkId)
|
||||
unique_lock<shared_mutex> writeLock(initLock_);
|
||||
bool ret = FuzzyDeleteInnerLocked(networkId);
|
||||
if (!ret) {
|
||||
HILOGW("FuzzyDelete networkId = %{public}s failed!",
|
||||
DnetworkAdapter::AnonymizeNetworkId(networkId).c_str());
|
||||
HILOGW("FuzzyDelete networkId: %{public}s fail.", GetAnonymStr(networkId).c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
HILOGI("FuzzyDelete networkId = %{public}s successful!", DnetworkAdapter::AnonymizeNetworkId(networkId).c_str());
|
||||
HILOGI("FuzzyDelete networkId: %{public}s success.", GetAnonymStr(networkId).c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -381,13 +379,11 @@ bool DistributedDataStorage::Query(const string& networkId, int32_t missionId, V
|
||||
shared_lock<shared_mutex> readLock(initLock_);
|
||||
bool ret = QueryInnerLocked(uuid, missionId, value);
|
||||
if (!ret) {
|
||||
HILOGE("Query uuid = %{public}s + missionId = %{public}d failed!",
|
||||
DnetworkAdapter::AnonymizeNetworkId(uuid).c_str(), missionId);
|
||||
HILOGE("Query uuid: %{public}s, missionId: %{public}d fail.", GetAnonymStr(uuid).c_str(), missionId);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
HILOGI("Query uuid = %{public}s + missionId = %{public}d successful!",
|
||||
DnetworkAdapter::AnonymizeNetworkId(uuid).c_str(), missionId);
|
||||
HILOGI("Query uuid: %{public}s, missionId: %{public}d success.", GetAnonymStr(uuid).c_str(), missionId);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -20,18 +20,20 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "datetime_ex.h"
|
||||
#include "distributed_sched_adapter.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "ipc_skeleton.h"
|
||||
#include "iservice_registry.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
#include "string_ex.h"
|
||||
#include "system_ability_definition.h"
|
||||
|
||||
#include "distributed_sched_adapter.h"
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "mission/mission_changed_notify.h"
|
||||
#include "mission/mission_constant.h"
|
||||
#include "mission/mission_info_converter.h"
|
||||
#include "mission/snapshot_converter.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
#include "string_ex.h"
|
||||
#include "system_ability_definition.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
@ -114,8 +116,7 @@ sptr<IDistributedSched> DistributedSchedMissionManager::GetRemoteDms(const std::
|
||||
}
|
||||
auto object = samgr->CheckSystemAbility(DISTRIBUTED_SCHED_SA_ID, deviceId);
|
||||
if (object == nullptr) {
|
||||
HILOGE("GetRemoteDms failed to get dms for remote device:%{public}s!",
|
||||
DnetworkAdapter::AnonymizeNetworkId(deviceId).c_str());
|
||||
HILOGE("GetRemoteDms failed to get dms for remote device: %{public}s!", GetAnonymStr(deviceId).c_str());
|
||||
return nullptr;
|
||||
}
|
||||
auto ret = object->AddDeathRecipient(remoteDmsRecipient_);
|
||||
@ -218,13 +219,13 @@ int32_t DistributedSchedMissionManager::GetRemoteMissionSnapshotInfo(const std::
|
||||
}
|
||||
std::unique_ptr<Snapshot> snapshotPtr = DequeueCachedSnapshotInfo(uuid, missionId);
|
||||
if (snapshotPtr != nullptr) {
|
||||
HILOGI("get uuid = %{public}s + missionId = %{public}d snapshot from cache successful!",
|
||||
DnetworkAdapter::AnonymizeNetworkId(uuid).c_str(), missionId);
|
||||
HILOGI("Get snapshot from cache success, uuid: %{public}s, missionId: %{public}d.",
|
||||
GetAnonymStr(uuid).c_str(), missionId);
|
||||
SnapshotConverter::ConvertToMissionSnapshot(*snapshotPtr, missionSnapshot);
|
||||
return ERR_NONE;
|
||||
}
|
||||
if (distributedDataStorage_ == nullptr) {
|
||||
HILOGE("DistributedDataStorage null!");
|
||||
HILOGE("DistributedDataStorage is null!");
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
DistributedKv::Value value;
|
||||
@ -238,8 +239,8 @@ int32_t DistributedSchedMissionManager::GetRemoteMissionSnapshotInfo(const std::
|
||||
HILOGE("snapshot create failed!");
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
HILOGI("get uuid = %{public}s + missionId = %{public}d snapshot from DistributedDB successful!",
|
||||
DnetworkAdapter::AnonymizeNetworkId(uuid).c_str(), missionId);
|
||||
HILOGI("Get snapshot from DistributedDB success, uuid: %{public}s, missionId: %{public}d.",
|
||||
GetAnonymStr(uuid).c_str(), missionId);
|
||||
SnapshotConverter::ConvertToMissionSnapshot(*snapshotPtr, missionSnapshot);
|
||||
return ERR_NONE;
|
||||
}
|
||||
@ -274,8 +275,7 @@ void DistributedSchedMissionManager::DeviceOfflineNotify(const std::string& netw
|
||||
remoteDmsMap_.erase(iter);
|
||||
}
|
||||
}
|
||||
HILOGI("DeviceOfflineNotify erase value for networkId: %{public}s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(networkId).c_str());
|
||||
HILOGI("DeviceOfflineNotify erase value for networkId: %{public}s.", GetAnonymStr(networkId).c_str());
|
||||
}
|
||||
|
||||
void DistributedSchedMissionManager::DeleteDataStorage(const std::string& deviceId, bool isDelayed)
|
||||
@ -476,7 +476,7 @@ int32_t DistributedSchedMissionManager::StopSyncRemoteMissions(const std::string
|
||||
}
|
||||
int64_t begin = GetTickCount();
|
||||
int32_t ret = remoteDms->StopSyncMissionsFromRemote(callerInfo);
|
||||
HILOGI("[PerformanceTest] ret:%d, spend %{public}" PRId64 " ms", ret, GetTickCount() - begin);
|
||||
HILOGI("[PerformanceTest] ret: %{public}d, spend %{public}" PRId64 " ms", ret, GetTickCount() - begin);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -493,8 +493,7 @@ int32_t DistributedSchedMissionManager::StartSyncRemoteMissions(const std::strin
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
HILOGI("begin, dstDevId is %{public}s, local deviceId is %{public}s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(dstDevId).c_str(),
|
||||
DnetworkAdapter::AnonymizeNetworkId(localDeviceId).c_str());
|
||||
GetAnonymStr(dstDevId).c_str(), GetAnonymStr(localDeviceId).c_str());
|
||||
auto ret = StartSyncRemoteMissions(dstDevId, localDeviceId);
|
||||
if (ret != ERR_NONE) {
|
||||
HILOGE("StartSyncRemoteMissions failed, %{public}d", ret);
|
||||
@ -692,8 +691,7 @@ int32_t DistributedSchedMissionManager::FetchCachedRemoteMissions(const std::str
|
||||
std::lock_guard<std::mutex> autoLock(remoteMissionInfosLock_);
|
||||
auto iter = deviceMissionInfos_.find(uuid);
|
||||
if (iter == deviceMissionInfos_.end()) {
|
||||
HILOGE("can not find uuid, deviceId: %{public}s!",
|
||||
DnetworkAdapter::AnonymizeNetworkId(srcId).c_str());
|
||||
HILOGE("can not find uuid, deviceId: %{public}s!", GetAnonymStr(srcId).c_str());
|
||||
return ERR_NULL_OBJECT;
|
||||
}
|
||||
|
||||
@ -711,8 +709,7 @@ int32_t DistributedSchedMissionManager::FetchCachedRemoteMissions(const std::str
|
||||
void DistributedSchedMissionManager::RebornMissionCache(const std::string& deviceId,
|
||||
const std::vector<DstbMissionInfo>& missionInfoSet)
|
||||
{
|
||||
HILOGI("start! deviceId is %{public}s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(deviceId).c_str());
|
||||
HILOGI("start! deviceId is %{public}s.", GetAnonymStr(deviceId).c_str());
|
||||
std::string uuid = DtbschedmgrDeviceInfoStorage::GetInstance().GetUuidByNetworkId(deviceId);
|
||||
if (uuid.empty()) {
|
||||
HILOGE("uuid empty!");
|
||||
@ -727,8 +724,7 @@ void DistributedSchedMissionManager::RebornMissionCache(const std::string& devic
|
||||
|
||||
void DistributedSchedMissionManager::CleanMissionCache(const std::string& deviceId)
|
||||
{
|
||||
HILOGI("CleanMissionCache start! deviceId is %{public}s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(deviceId).c_str());
|
||||
HILOGI("CleanMissionCache start! deviceId is %{public}s.", GetAnonymStr(deviceId).c_str());
|
||||
std::string uuid = DtbschedmgrDeviceInfoStorage::GetInstance().GetUuidByNetworkId(deviceId);
|
||||
if (uuid.empty()) {
|
||||
HILOGE("CleanMissionCache uuid empty!");
|
||||
@ -888,8 +884,7 @@ std::shared_ptr<AppExecFwk::EventHandler> DistributedSchedMissionManager::FetchD
|
||||
const std::string& deviceId)
|
||||
{
|
||||
if (!IsDeviceIdValidated(deviceId)) {
|
||||
HILOGW("FetchDeviceHandler device:%{public}s offline.",
|
||||
DnetworkAdapter::AnonymizeNetworkId(deviceId).c_str());
|
||||
HILOGW("FetchDeviceHandler device:%{public}s offline.", GetAnonymStr(deviceId).c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -904,7 +899,7 @@ std::shared_ptr<AppExecFwk::EventHandler> DistributedSchedMissionManager::FetchD
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
auto anonyUuid = DnetworkAdapter::AnonymizeNetworkId(uuid);
|
||||
auto anonyUuid = GetAnonymStr(uuid);
|
||||
auto runner = AppExecFwk::EventRunner::Create(anonyUuid + "_MissionN");
|
||||
auto handler = std::make_shared<AppExecFwk::EventHandler>(runner);
|
||||
deviceHandle_.emplace(uuid, handler);
|
||||
|
@ -15,8 +15,10 @@
|
||||
|
||||
#include "mission/dms_continue_recv_manager.h"
|
||||
|
||||
#include "adapter/dnetwork_adapter.h"
|
||||
#include <sys/prctl.h>
|
||||
|
||||
#include "datetime_ex.h"
|
||||
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "distributed_radar.h"
|
||||
#include "distributed_sched_adapter.h"
|
||||
@ -24,7 +26,6 @@
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "parcel_helper.h"
|
||||
#include "softbus_adapter/softbus_adapter.h"
|
||||
#include <sys/prctl.h>
|
||||
#include "switch_status_dependency.h"
|
||||
#include "datashare_manager.h"
|
||||
|
||||
@ -82,8 +83,8 @@ void DMSContinueRecvMgr::UnInit()
|
||||
void DMSContinueRecvMgr::NotifyDataRecv(std::string& senderNetworkId,
|
||||
uint8_t* payload, uint32_t dataLen)
|
||||
{
|
||||
HILOGI("NotifyDataRecv start, senderNetworkId: %{public}s, dataLen: %{public}u",
|
||||
DnetworkAdapter::AnonymizeNetworkId(senderNetworkId).c_str(), dataLen);
|
||||
HILOGI("NotifyDataRecv start, senderNetworkId: %{public}s, dataLen: %{public}u.",
|
||||
GetAnonymStr(senderNetworkId).c_str(), dataLen);
|
||||
bool IsContinueSwitchOn = SwitchStatusDependency::GetInstance().IsContinueSwitchOn();
|
||||
if (!IsContinueSwitchOn) {
|
||||
HILOGE("ContinueSwitch status is off");
|
||||
@ -198,9 +199,8 @@ int32_t DMSContinueRecvMgr::VerifyBroadcastSource(const std::string& senderNetwo
|
||||
iconInfo_.continueType = continueType;
|
||||
} else {
|
||||
if (senderNetworkId != iconInfo_.senderNetworkId) {
|
||||
HILOGW("Sender not match, task abort. senderNetworkId: %{public}s, saved NetworkId: %{public}s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(senderNetworkId).c_str(),
|
||||
DnetworkAdapter::AnonymizeNetworkId(iconInfo_.senderNetworkId).c_str());
|
||||
HILOGW("Sender not match, task abort. senderNetworkId: %{public}s, saved NetworkId: %{public}s.",
|
||||
GetAnonymStr(senderNetworkId).c_str(), GetAnonymStr(iconInfo_.senderNetworkId).c_str());
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
|
||||
@ -246,8 +246,8 @@ int32_t DMSContinueRecvMgr::RetryPostBroadcast(const std::string& senderNetworkI
|
||||
int32_t DMSContinueRecvMgr::DealOnBroadcastBusiness(const std::string& senderNetworkId,
|
||||
uint16_t bundleNameId, uint8_t continueTypeId, const int32_t state, const int32_t retry)
|
||||
{
|
||||
HILOGI("DealOnBroadcastBusiness start, senderNetworkId: %{public}s, bundleNameId: %{public}u, state: %{public}d",
|
||||
DnetworkAdapter::AnonymizeNetworkId(senderNetworkId).c_str(), bundleNameId, state);
|
||||
HILOGI("DealOnBroadcastBusiness start, senderNetworkId: %{public}s, bundleNameId: %{public}u, state: %{public}d.",
|
||||
GetAnonymStr(senderNetworkId).c_str(), bundleNameId, state);
|
||||
std::string bundleName;
|
||||
int32_t ret = BundleManagerInternal::GetBundleNameById(senderNetworkId, bundleNameId, bundleName);
|
||||
bool res = (state == INACTIVE) ? DmsRadar::GetInstance().UnfocusedGetBundleName("GetBundleNameById", ret)
|
||||
@ -375,8 +375,8 @@ void DMSContinueRecvMgr::OnDeviceScreenOff()
|
||||
iconInfo_.bundleName = "";
|
||||
iconInfo_.continueType = "";
|
||||
}
|
||||
HILOGI("Saved iconInfo cleared, networkId = %{public}s, bundleName = %{public}s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(senderNetworkId).c_str(), bundleName.c_str());
|
||||
HILOGI("Saved iconInfo cleared, networkId: %{public}s, bundleName: %{public}s.",
|
||||
GetAnonymStr(senderNetworkId).c_str(), bundleName.c_str());
|
||||
{
|
||||
std::lock_guard<std::mutex> registerOnListenerMapLock(eventMutex_);
|
||||
auto iterItem = registerOnListener_.find(onType_);
|
||||
@ -417,8 +417,8 @@ void DMSContinueRecvMgr::OnContinueSwitchOff()
|
||||
iconInfo_.bundleName = "";
|
||||
iconInfo_.continueType = "";
|
||||
}
|
||||
HILOGI("Saved iconInfo cleared, networkId = %{public}s, bundleName = %{public}s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(senderNetworkId).c_str(), bundleName.c_str());
|
||||
HILOGI("Saved iconInfo cleared, networkId: %{public}s, bundleName: %{public}s.",
|
||||
GetAnonymStr(senderNetworkId).c_str(), bundleName.c_str());
|
||||
{
|
||||
std::lock_guard<std::mutex> registerOnListenerMapLock(eventMutex_);
|
||||
auto iterItem = registerOnListener_.find(onType_);
|
||||
@ -445,7 +445,7 @@ void DMSContinueRecvMgr::NotifyDeviceOffline(const std::string& networkId)
|
||||
HILOGE("NotifyDeviceOffline networkId empty");
|
||||
return;
|
||||
}
|
||||
HILOGI("NotifyDeviceOffline begin. networkId = %{public}s", DnetworkAdapter::AnonymizeNetworkId(networkId).c_str());
|
||||
HILOGI("NotifyDeviceOffline begin. networkId: %{public}s.", GetAnonymStr(networkId).c_str());
|
||||
std::string localNetworkId;
|
||||
if (!DtbschedmgrDeviceInfoStorage::GetInstance().GetLocalDeviceId(localNetworkId)) {
|
||||
HILOGE("Get local networkId failed");
|
||||
@ -467,8 +467,8 @@ void DMSContinueRecvMgr::NotifyDeviceOffline(const std::string& networkId)
|
||||
iconInfo_.bundleName = "";
|
||||
iconInfo_.continueType = "";
|
||||
}
|
||||
HILOGI("Saved iconInfo cleared, networkId = %{public}s, bundleName = %{public}s",
|
||||
DnetworkAdapter::AnonymizeNetworkId(senderNetworkId).c_str(), bundleName.c_str());
|
||||
HILOGI("Saved iconInfo cleared, networkId: %{public}s, bundleName: %{public}s.",
|
||||
GetAnonymStr(senderNetworkId).c_str(), bundleName.c_str());
|
||||
{
|
||||
std::lock_guard<std::mutex> registerOnListenerMapLock(eventMutex_);
|
||||
auto iterItem = registerOnListener_.find(onType_);
|
||||
|
@ -87,7 +87,7 @@ int32_t SoftbusAdapter::RegisterSoftbusEventListener(const std::shared_ptr<Softb
|
||||
int32_t ret = RegisterEventListener(pkgName_.c_str(), &eventListener);
|
||||
DmsRadar::GetInstance().RegisterSoftbusCallbackRes("RegisterSoftbusEventListener", ret);
|
||||
if (ret != SOFTBUS_OK) {
|
||||
HILOGE("RegisterSoftbusEventListener failed, ret:%d.", ret);
|
||||
HILOGE("RegisterSoftbusEventListener failed, ret: %{public}d.", ret);
|
||||
return ret;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
@ -108,7 +108,7 @@ int32_t SoftbusAdapter::UnregisterSoftbusEventListener(const std::shared_ptr<Sof
|
||||
HILOGI("UnregisterSoftbusEventListener pkgName: %s.", pkgName_.c_str());
|
||||
int32_t ret = UnregisterEventListener(pkgName_.c_str(), &eventListener);
|
||||
if (ret != SOFTBUS_OK) {
|
||||
HILOGE("UnregisterSoftbusEventListener failed, ret:%d.", ret);
|
||||
HILOGE("UnregisterSoftbusEventListener failed, ret: %{public}d.", ret);
|
||||
return ret;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
|
@ -17,8 +17,8 @@
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#include "adapter/dnetwork_adapter.h"
|
||||
#include "distributed_sched_adapter.h"
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "dsched_transport_softbus_adapter.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "session.h"
|
||||
@ -191,17 +191,16 @@ uint16_t DSchedSoftbusSession::U16Get(const uint8_t *ptr)
|
||||
void DSchedSoftbusSession::AssembleNoFrag(std::shared_ptr<DSchedDataBuffer> buffer, SessionDataHeader& headerPara)
|
||||
{
|
||||
if (headerPara.dataLen != headerPara.totalLen) {
|
||||
HILOGE("error, header lenth not match, dataLen: %d, totalLen: %d, session id: %d peerNetworkId: %s",
|
||||
headerPara.dataLen, headerPara.totalLen, sessionId_,
|
||||
DnetworkAdapter::AnonymizeNetworkId(peerDeviceId_).c_str());
|
||||
HILOGE("header lenth error, dataLen: %{public}d, totalLen: %{public}d, sessionId: %{public}d, peerNetworkId: "
|
||||
"%{public}s.", headerPara.dataLen, headerPara.totalLen, sessionId_, GetAnonymStr(peerDeviceId_).c_str());
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<DSchedDataBuffer> postData = std::make_shared<DSchedDataBuffer>(headerPara.dataLen);
|
||||
int32_t ret = memcpy_s(postData->Data(), postData->Size(), buffer->Data() + BINARY_HEADER_FRAG_LEN,
|
||||
buffer->Size() - BINARY_HEADER_FRAG_LEN);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("memcpy_s failed, ret: %d, session id: %d peerNetworkId: %s",
|
||||
ret, sessionId_, DnetworkAdapter::AnonymizeNetworkId(peerDeviceId_).c_str());
|
||||
HILOGE("memcpy failed, ret: %{public}d, sessionId: %{public}d, peerNetworkId: %{public}s.",
|
||||
ret, sessionId_, GetAnonymStr(peerDeviceId_).c_str());
|
||||
return;
|
||||
}
|
||||
DSchedTransportSoftbusAdapter::GetInstance().OnDataReady(sessionId_, postData, headerPara.dataType);
|
||||
@ -219,8 +218,8 @@ void DSchedSoftbusSession::AssembleFrag(std::shared_ptr<DSchedDataBuffer> buffer
|
||||
int32_t ret = memcpy_s(packBuffer_->Data(), packBuffer_->Size(), buffer->Data() + BINARY_HEADER_FRAG_LEN,
|
||||
buffer->Size() - BINARY_HEADER_FRAG_LEN);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("FRAG_START memcpy_s failed, ret: %d session id: %d peerNetworkId: %s",
|
||||
ret, sessionId_, DnetworkAdapter::AnonymizeNetworkId(peerDeviceId_).c_str());
|
||||
HILOGE("FRAG_START memcpy fail, ret: %{public}d, sessionId: %{public}d peerNetworkId: %{public}s.",
|
||||
ret, sessionId_, GetAnonymStr(peerDeviceId_).c_str());
|
||||
ResetAssembleFrag();
|
||||
return;
|
||||
}
|
||||
@ -238,8 +237,8 @@ void DSchedSoftbusSession::AssembleFrag(std::shared_ptr<DSchedDataBuffer> buffer
|
||||
ret = memcpy_s(packBuffer_->Data() + offset_, packBuffer_->Size() - offset_,
|
||||
buffer->Data() + BINARY_HEADER_FRAG_LEN, buffer->Size() - BINARY_HEADER_FRAG_LEN);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("memcpy_s failed, ret: %d session id: %d peerNetworkId: %s",
|
||||
ret, sessionId_, DnetworkAdapter::AnonymizeNetworkId(peerDeviceId_).c_str());
|
||||
HILOGE("memcpy_s failed, ret: %{public}d, sessionId: %{public}d, peerNetworkId: %{public}s.",
|
||||
ret, sessionId_, GetAnonymStr(peerDeviceId_).c_str());
|
||||
ResetAssembleFrag();
|
||||
return;
|
||||
}
|
||||
@ -255,26 +254,26 @@ void DSchedSoftbusSession::AssembleFrag(std::shared_ptr<DSchedDataBuffer> buffer
|
||||
int32_t DSchedSoftbusSession::CheckUnPackBuffer(SessionDataHeader& headerPara)
|
||||
{
|
||||
if (!isWaiting_) {
|
||||
HILOGE("failed, not waiting, session id: %d peerNetworkId: %s", sessionId_,
|
||||
DnetworkAdapter::AnonymizeNetworkId(peerDeviceId_).c_str());
|
||||
HILOGE("failed, not waiting, sessionId: %{public}d peerNetworkId: %{public}s.",
|
||||
sessionId_, GetAnonymStr(peerDeviceId_).c_str());
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
|
||||
if (nowSeq_ != headerPara.seqNum) {
|
||||
HILOGE("seq error, nowSeq: %d actualSeq: %d, session id: %d peerNetworkId: %s",
|
||||
nowSeq_, headerPara.seqNum, sessionId_, DnetworkAdapter::AnonymizeNetworkId(peerDeviceId_).c_str());
|
||||
HILOGE("seq error, nowSeq: %{public}d, actualSeq: %{public}d, sessionId: %{public}d, peerNetworkId: "
|
||||
"%{public}s.", nowSeq_, headerPara.seqNum, sessionId_, GetAnonymStr(peerDeviceId_).c_str());
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
|
||||
if (nowSubSeq_ + 1 != headerPara.subSeq) {
|
||||
HILOGE("subSeq error, nowSeq: %d actualSeq: %d, session id: %d peerNetworkId: %s",
|
||||
nowSubSeq_, headerPara.subSeq, sessionId_, DnetworkAdapter::AnonymizeNetworkId(peerDeviceId_).c_str());
|
||||
HILOGE("subSeq error, nowSeq: %{public}d, actualSeq: %{public}d, sessionId: %{public}d, peerNetworkId: "
|
||||
"%{public}s.", nowSubSeq_, headerPara.subSeq, sessionId_, GetAnonymStr(peerDeviceId_).c_str());
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
|
||||
if (totalLen_ < headerPara.dataLen + offset_) {
|
||||
HILOGE("data len error cap: %d size: %d, dataLen: %d, session id: %d peerNetworkId: %s", totalLen_,
|
||||
offset_, headerPara.dataLen, sessionId_, DnetworkAdapter::AnonymizeNetworkId(peerDeviceId_).c_str());
|
||||
HILOGE("data len error cap: %{public}d, size: %{public}d, dataLen: %d, sessionId: %{public}d, peerNetworkId: "
|
||||
"%{public}s.", totalLen_, offset_, headerPara.dataLen, sessionId_, GetAnonymStr(peerDeviceId_).c_str());
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
return ERR_OK;
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "dsched_transport_softbus_adapter.h"
|
||||
|
||||
#include "adapter/dnetwork_adapter.h"
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "softbus_bus_center.h"
|
||||
@ -103,7 +103,7 @@ int32_t DSchedTransportSoftbusAdapter::CreateServerSocket()
|
||||
|
||||
int32_t DSchedTransportSoftbusAdapter::ConnectDevice(const std::string &peerDeviceId)
|
||||
{
|
||||
HILOGI("try to connect peer: %s", DnetworkAdapter::AnonymizeNetworkId(peerDeviceId).c_str());
|
||||
HILOGI("try to connect peer: %{public}s.", GetAnonymStr(peerDeviceId).c_str());
|
||||
{
|
||||
std::lock_guard<std::mutex> sessionLock(sessionMutex_);
|
||||
if (!sessions_.empty()) {
|
||||
@ -183,7 +183,7 @@ int32_t DSchedTransportSoftbusAdapter::CreateSessionRecord(int32_t sessionId, co
|
||||
|
||||
void DSchedTransportSoftbusAdapter::DisconnectDevice(const std::string &peerDeviceId)
|
||||
{
|
||||
HILOGI("try to disconnect peer: %s", DnetworkAdapter::AnonymizeNetworkId(peerDeviceId).c_str());
|
||||
HILOGI("try to disconnect peer: %{public}s.", GetAnonymStr(peerDeviceId).c_str());
|
||||
int32_t sessionId = 0;
|
||||
std::lock_guard<std::mutex> sessionLock(sessionMutex_);
|
||||
for (auto iter = sessions_.begin(); iter != sessions_.end(); iter++) {
|
||||
@ -193,8 +193,8 @@ void DSchedTransportSoftbusAdapter::DisconnectDevice(const std::string &peerDevi
|
||||
}
|
||||
}
|
||||
if (sessionId != 0 && sessions_[sessionId]->OnDisconnect()) {
|
||||
HILOGI("peer %s shutdown, socket session id: %d",
|
||||
DnetworkAdapter::AnonymizeNetworkId(sessions_[sessionId]->GetPeerDeviceId()).c_str(), sessionId);
|
||||
HILOGI("peer %{public}s shutdown, socket sessionId: %{public}d.",
|
||||
GetAnonymStr(sessions_[sessionId]->GetPeerDeviceId()).c_str(), sessionId);
|
||||
Shutdown(sessionId);
|
||||
sessions_.erase(sessionId);
|
||||
NotifyListenersSessionShutdown(sessionId, true);
|
||||
@ -223,8 +223,8 @@ void DSchedTransportSoftbusAdapter::OnShutdown(int32_t sessionId, bool isSelfcal
|
||||
HILOGE("error, invalid sessionId %d", sessionId);
|
||||
return;
|
||||
}
|
||||
HILOGI("peer %s shutdown, socket session id: %d",
|
||||
DnetworkAdapter::AnonymizeNetworkId(sessions_[sessionId]->GetPeerDeviceId()).c_str(), sessionId);
|
||||
HILOGI("peer %{public}s shutdown, socket sessionId: %{public}d.",
|
||||
GetAnonymStr(sessions_[sessionId]->GetPeerDeviceId()).c_str(), sessionId);
|
||||
Shutdown(sessionId);
|
||||
sessions_.erase(sessionId);
|
||||
}
|
||||
@ -253,8 +253,8 @@ int32_t DSchedTransportSoftbusAdapter::ReleaseChannel()
|
||||
{
|
||||
std::lock_guard<std::mutex> sessionLock(sessionMutex_);
|
||||
for (auto iter = sessions_.begin(); iter != sessions_.end(); iter++) {
|
||||
HILOGI("shutdown client: %s, socket session id: %d",
|
||||
DnetworkAdapter::AnonymizeNetworkId(iter->second->GetPeerDeviceId()).c_str(), iter->first);
|
||||
HILOGI("shutdown client: %{public}s, socket sessionId: %{public}d.",
|
||||
GetAnonymStr(iter->second->GetPeerDeviceId()).c_str(), iter->first);
|
||||
Shutdown(iter->first);
|
||||
}
|
||||
sessions_.clear();
|
||||
|
@ -27,13 +27,14 @@ dsched_configs =
|
||||
config("test_config") {
|
||||
visibility = [ ":*" ]
|
||||
include_dirs = [
|
||||
"//foundation/ability/dmsfwk/services/dtbschedmgr/test/unittest",
|
||||
"${distributed_service}/dtbschedmgr/include",
|
||||
"${distributed_service}/dtbschedmgr/include/continue",
|
||||
"${distributed_service}/dtbschedmgr/include/continue/state",
|
||||
"${distributed_service}/dtbschedmgr/include/continue/state/source_state",
|
||||
"${distributed_service}/dtbschedmgr/include/continue/state/sink_state",
|
||||
"${distributed_service}/dtbschedmgr/include/distributedWant",
|
||||
"${distributed_service}/dtbschedmgr/include/softbus_adapter/transport",
|
||||
"${distributed_service}/dtbschedmgr/test/unittest",
|
||||
"${dms_path}/common/include",
|
||||
]
|
||||
}
|
||||
@ -110,108 +111,13 @@ if (dmsfwk_mmi_listener) {
|
||||
}
|
||||
|
||||
dsched_public_deps = [
|
||||
"${distributed_service}/dtbschedmgr:distributedschedsvr",
|
||||
"${dms_path}/common:distributed_sched_utils",
|
||||
"//third_party/googletest:gmock_main",
|
||||
"//third_party/googletest:gtest_main",
|
||||
]
|
||||
|
||||
dtbschedmgr_sources = [
|
||||
"${distributed_service}/dtbschedmgr/src/ability_connection_wrapper_proxy.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/ability_connection_wrapper_stub.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/adapter/dnetwork_adapter.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/app_state_observer.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/bundle/bundle_manager_callback_stub.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/bundle/bundle_manager_internal.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/connect_death_recipient.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/continue/dsched_continue.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/continue/dsched_continue_event.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/continue/dsched_continue_event_handler.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/continue/dsched_continue_manager.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/continue/state/dsched_continue_state_machine.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/continue/state/sink_state/dsched_continue_data_state.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/continue/state/sink_state/dsched_continue_sink_end_state.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/continue/state/sink_state/dsched_continue_sink_start_state.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/continue/state/sink_state/dsched_continue_sink_wait_end_state.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/continue/state/source_state/dsched_continue_ability_state.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/continue/state/source_state/dsched_continue_source_end_state.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/continue/state/source_state/dsched_continue_source_start_state.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/continue/state/source_state/dsched_continue_source_wait_end_state.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/continue_scene_session_handler.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/datashare_manager.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/deviceManager/dms_device_info.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/dfx/dms_continue_time_dumper.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/dfx/dms_hisysevent_report.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/dfx/dms_hitrace_chain.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/distributedWant/distributed_operation.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/distributedWant/distributed_operation_builder.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/distributedWant/distributed_want.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/distributedWant/distributed_want_params.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/distributedWant/distributed_want_params_wrapper.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/distributed_device_node_listener.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/distributed_event_died_listener.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/distributed_radar.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/distributed_sched_adapter.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/distributed_sched_continuation.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/distributed_sched_dumper.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/distributed_sched_permission.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/distributed_sched_proxy.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/distributed_sched_service.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/distributed_sched_stub.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/dms_callback_task.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/dms_free_install_callback.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/dms_free_install_callback_proxy.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/dms_free_install_callback_stub.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/dms_token_callback.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/dms_version_manager.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/dtbschedmgr_device_info_storage.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/softbus_adapter/softbus_adapter_common.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/softbus_adapter/transport/dsched_data_buffer.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/softbus_adapter/transport/dsched_softbus_session.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/softbus_adapter/transport/dsched_transport_softbus_adapter.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/switch_status_dependency.cpp",
|
||||
"unittest/distributed_sched_util.cpp",
|
||||
]
|
||||
|
||||
if (dmsfwk_mission_manager) {
|
||||
dtbschedmgr_sources += [
|
||||
"${distributed_service}/dtbschedmgr/src/mission/distributed_bm_storage.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/mission/distributed_bundle_info.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/mission/distributed_data_change_listener.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/mission/distributed_data_storage.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/mission/distributed_mission_broadcast_listener.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/mission/distributed_mission_change_listener.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/mission/distributed_mission_died_listener.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/mission/distributed_mission_focused_listener.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/mission/distributed_mission_info.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/mission/distributed_sched_mission_manager.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/mission/dms_continue_recv_manager.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/mission/dms_continue_send_manager.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/mission/kvstore_death_recipient.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/mission/mission_changed_notify.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/mission/mission_info_converter.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/mission/snapshot.cpp",
|
||||
"${distributed_service}/dtbschedmgr/src/mission/snapshot_converter.cpp",
|
||||
]
|
||||
}
|
||||
|
||||
if (dmsfwk_standard_form_share) {
|
||||
dtbschedmgr_sources +=
|
||||
[ "${distributed_service}/dtbschedmgr/src/form_mgr_death_recipient.cpp" ]
|
||||
}
|
||||
|
||||
if (dmsfwk_ces_listener) {
|
||||
dtbschedmgr_sources +=
|
||||
[ "${distributed_service}/dtbschedmgr/src/common_event_listener.cpp" ]
|
||||
}
|
||||
|
||||
if (dmsfwk_mmi_listener) {
|
||||
dtbschedmgr_sources +=
|
||||
[ "${distributed_service}/dtbschedmgr/src/adapter/mmi_adapter.cpp" ]
|
||||
} else {
|
||||
dtbschedmgr_sources += [
|
||||
"${distributed_service}/dtbschedmgr/src/adapter/mmi_adapter_common.cpp",
|
||||
]
|
||||
}
|
||||
dtbschedmgr_sources = [ "unittest/distributed_sched_test_util.cpp" ]
|
||||
|
||||
ohos_unittest("distributedschedsvrtest") {
|
||||
sanitize = {
|
||||
@ -240,9 +146,10 @@ ohos_unittest("distributedschedsvrtest") {
|
||||
"unittest/mock_remote_stub.cpp",
|
||||
]
|
||||
sources += dtbschedmgr_sources
|
||||
|
||||
configs = [
|
||||
":test_config",
|
||||
"//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags",
|
||||
"${distributed_service}/dtbschedmgr/test/resource:coverage_flags",
|
||||
]
|
||||
configs += dsched_configs
|
||||
if (is_standard_system) {
|
||||
@ -270,10 +177,10 @@ ohos_unittest("distributedcalltest") {
|
||||
"unittest/app_state_observer_test.cpp",
|
||||
"unittest/distributed_sched_call_test.cpp",
|
||||
]
|
||||
sources += dtbschedmgr_sources
|
||||
|
||||
configs = [
|
||||
":test_config",
|
||||
"//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags",
|
||||
"${distributed_service}/dtbschedmgr/test/resource:coverage_flags",
|
||||
]
|
||||
configs += dsched_configs
|
||||
if (is_standard_system) {
|
||||
@ -296,10 +203,10 @@ ohos_unittest("dmsfreeinstallcbtest") {
|
||||
"unittest/dms_free_install_callback_test.cpp",
|
||||
"unittest/mock_remote_stub.cpp",
|
||||
]
|
||||
sources += dtbschedmgr_sources
|
||||
|
||||
configs = [
|
||||
":test_config",
|
||||
"//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags",
|
||||
"${distributed_service}/dtbschedmgr/test/resource:coverage_flags",
|
||||
]
|
||||
configs += dsched_configs
|
||||
if (is_standard_system) {
|
||||
@ -324,9 +231,10 @@ ohos_unittest("dschedcontinuetest") {
|
||||
"unittest/mock_remote_stub.cpp",
|
||||
]
|
||||
sources += dtbschedmgr_sources
|
||||
|
||||
configs = [
|
||||
":test_config",
|
||||
"//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags",
|
||||
"${distributed_service}/dtbschedmgr/test/resource:coverage_flags",
|
||||
]
|
||||
configs += dsched_configs
|
||||
if (is_standard_system) {
|
||||
@ -364,9 +272,10 @@ ohos_unittest("dschedconnecttest") {
|
||||
"unittest/mock_remote_stub.cpp",
|
||||
]
|
||||
sources += dtbschedmgr_sources
|
||||
|
||||
configs = [
|
||||
":test_config",
|
||||
"//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags",
|
||||
"${distributed_service}/dtbschedmgr/test/resource:coverage_flags",
|
||||
]
|
||||
configs += dsched_configs
|
||||
if (is_standard_system) {
|
||||
@ -387,9 +296,10 @@ ohos_unittest("dschedpermissiontest") {
|
||||
|
||||
sources = [ "unittest/distributed_sched_permission_test.cpp" ]
|
||||
sources += dtbschedmgr_sources
|
||||
|
||||
configs = [
|
||||
":test_config",
|
||||
"//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags",
|
||||
"${distributed_service}/dtbschedmgr/test/resource:coverage_flags",
|
||||
]
|
||||
configs += dsched_configs
|
||||
if (is_standard_system) {
|
||||
@ -411,6 +321,7 @@ ohos_unittest("dschedmissionmanagertest") {
|
||||
}
|
||||
module_out_path = module_output_path
|
||||
sources = [
|
||||
"${dms_path}/common/src/distributed_sched_utils.cpp",
|
||||
"unittest/mission/distributed_bm_storage_test.cpp",
|
||||
"unittest/mission/distributed_data_storage_test.cpp",
|
||||
"unittest/mission/distributed_mission_info_test.cpp",
|
||||
@ -424,14 +335,16 @@ ohos_unittest("dschedmissionmanagertest") {
|
||||
sources += [ "unittest/adapter/mmi_adapter_test.cpp" ]
|
||||
}
|
||||
sources += dtbschedmgr_sources
|
||||
|
||||
configs = [
|
||||
":test_config",
|
||||
"//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags",
|
||||
"${distributed_service}/dtbschedmgr/test/resource:coverage_flags",
|
||||
]
|
||||
configs += dsched_configs
|
||||
deps = [ "${distributed_service}/dtbschedmgr:distributedschedsvr" ]
|
||||
|
||||
if (is_standard_system) {
|
||||
external_deps = dsched_external_deps
|
||||
external_deps += [ "config_policy:configpolicy_util" ]
|
||||
public_deps = dsched_public_deps
|
||||
}
|
||||
part_name = "dmsfwk"
|
||||
@ -447,13 +360,13 @@ ohos_unittest("bundlemanagerinternaltest") {
|
||||
module_out_path = module_output_path
|
||||
sources = [ "unittest/bundle_manager_internal_test.cpp" ]
|
||||
sources += dtbschedmgr_sources
|
||||
|
||||
configs = [
|
||||
":test_config",
|
||||
"//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags",
|
||||
"${distributed_service}/dtbschedmgr/test/resource:coverage_flags",
|
||||
]
|
||||
configs += dsched_configs
|
||||
deps = [
|
||||
"${distributed_service}/dtbschedmgr:distributedschedsvr",
|
||||
"${dms_path}/test/sceneProject/unittest/bundle_dependencies/bmsThirdBundle:bmsThirdBundle",
|
||||
"${dms_path}/test/sceneProject/unittest/ohos_test:copy_ohos_test",
|
||||
]
|
||||
@ -473,14 +386,13 @@ ohos_unittest("softbusadaptertest") {
|
||||
}
|
||||
module_out_path = module_output_path
|
||||
sources = [ "unittest/softbus_adapter/softbus_adapter_test.cpp" ]
|
||||
sources += dtbschedmgr_sources
|
||||
|
||||
configs = [
|
||||
":test_config",
|
||||
"${dms_path}/services/dtbschedmgr/test/resource:coverage_flags",
|
||||
]
|
||||
configs += dsched_configs
|
||||
deps = [
|
||||
"${distributed_service}/dtbschedmgr:distributedschedsvr",
|
||||
"${dms_path}/test/sceneProject/unittest/bundle_dependencies/bmsThirdBundle:bmsThirdBundle",
|
||||
"${dms_path}/test/sceneProject/unittest/ohos_test:copy_ohos_test",
|
||||
]
|
||||
@ -500,13 +412,13 @@ ohos_unittest("hisyseventreporttest") {
|
||||
}
|
||||
module_out_path = module_output_path
|
||||
sources = [ "unittest/dms_hisysevent_report_test.cpp" ]
|
||||
sources += dtbschedmgr_sources
|
||||
|
||||
configs = [
|
||||
":test_config",
|
||||
"//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags",
|
||||
"${distributed_service}/dtbschedmgr/test/resource:coverage_flags",
|
||||
]
|
||||
configs += dsched_configs
|
||||
deps = [ "${distributed_service}/dtbschedmgr:distributedschedsvr" ]
|
||||
deps = []
|
||||
if (is_standard_system) {
|
||||
external_deps = dsched_external_deps
|
||||
public_deps = dsched_public_deps
|
||||
@ -525,9 +437,10 @@ ohos_unittest("distributeduidtest") {
|
||||
|
||||
sources = [ "unittest/distributed_sched_uid_test.cpp" ]
|
||||
sources += dtbschedmgr_sources
|
||||
|
||||
configs = [
|
||||
":test_config",
|
||||
"//foundation/ability/dmsfwk/services/dtbschedmgr/test/resource:coverage_flags",
|
||||
"${distributed_service}/dtbschedmgr/test/resource:coverage_flags",
|
||||
]
|
||||
configs += dsched_configs
|
||||
if (is_standard_system) {
|
||||
@ -553,7 +466,7 @@ ohos_unittest("distributedwanttest") {
|
||||
"unittest/distributedWant/distributed_want_params_wrapper_test.cpp",
|
||||
"unittest/distributedWant/distributed_want_test.cpp",
|
||||
]
|
||||
sources += dtbschedmgr_sources
|
||||
|
||||
configs = [
|
||||
":test_config",
|
||||
"${distributed_service}/dtbschedmgr/test/resource:coverage_flags",
|
||||
@ -582,6 +495,7 @@ ohos_unittest("dmsbasetest") {
|
||||
"unittest/dtbschedmgr_device_info_storage_test.cpp",
|
||||
]
|
||||
sources += dtbschedmgr_sources
|
||||
|
||||
configs = [
|
||||
":test_config",
|
||||
"./resource:coverage_flags",
|
||||
@ -605,13 +519,13 @@ ohos_unittest("dschedswitchstatustest") {
|
||||
module_out_path = module_output_path
|
||||
|
||||
sources = [ "unittest/switch_status_dependency_test.cpp" ]
|
||||
sources += dtbschedmgr_sources
|
||||
|
||||
configs = [
|
||||
":test_config",
|
||||
"${dms_path}/services/dtbschedmgr/test/resource:coverage_flags",
|
||||
]
|
||||
configs += dsched_configs
|
||||
deps = [ "${distributed_service}/dtbschedmgr:distributedschedsvr" ]
|
||||
deps = []
|
||||
if (is_standard_system) {
|
||||
external_deps = dsched_external_deps
|
||||
public_deps = dsched_public_deps
|
||||
@ -629,13 +543,13 @@ ohos_unittest("datasharemanagertest") {
|
||||
module_out_path = module_output_path
|
||||
|
||||
sources = [ "unittest/datashare_manager_test.cpp" ]
|
||||
sources += dtbschedmgr_sources
|
||||
|
||||
configs = [
|
||||
":test_config",
|
||||
"${dms_path}/services/dtbschedmgr/test/resource:coverage_flags",
|
||||
]
|
||||
configs += dsched_configs
|
||||
deps = [ "${distributed_service}/dtbschedmgr:distributedschedsvr" ]
|
||||
deps = []
|
||||
if (is_standard_system) {
|
||||
external_deps = dsched_external_deps
|
||||
public_deps = dsched_public_deps
|
||||
@ -658,13 +572,13 @@ ohos_unittest("dschedcontinuestatetest") {
|
||||
"unittest/continue/dsched_continue_test.cpp",
|
||||
"unittest/mock_distributed_sched.cpp",
|
||||
]
|
||||
sources += dtbschedmgr_sources
|
||||
|
||||
configs = [
|
||||
":test_config",
|
||||
"${dms_path}/services/dtbschedmgr/test/resource:coverage_flags",
|
||||
]
|
||||
configs += dsched_configs
|
||||
deps = [ "${distributed_service}/dtbschedmgr:distributedschedsvr" ]
|
||||
deps = []
|
||||
if (is_standard_system) {
|
||||
external_deps = dsched_external_deps
|
||||
public_deps = dsched_public_deps
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "mmi_adapter_test.h"
|
||||
|
||||
#include "distributed_sched_util.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#include "test_log.h"
|
||||
|
||||
using namespace testing;
|
||||
@ -54,10 +54,10 @@ void MMIAdapterTest::SetUp()
|
||||
HWTEST_F(MMIAdapterTest, AddMMIListener_001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "MMIAdapterTest AddMMIListener_001 begin" << std::endl;
|
||||
static const char *PERMS[] = {
|
||||
static const char *perms[] = {
|
||||
"ohos.permission.INPUT_MONITORING"
|
||||
};
|
||||
DistributedSchedUtil::MockProcessAndPermission("MMIAdapterTest", PERMS, sizeof(PERMS) / sizeof(PERMS[0]));
|
||||
DistributedSchedUtil::MockProcessAndPermission("MMIAdapterTest", perms, sizeof(perms) / sizeof(perms[0]));
|
||||
int32_t ret = MMIAdapter::GetInstance().AddMMIListener();
|
||||
EXPECT_GT(ret, 0);
|
||||
DTEST_LOG << "MMIAdapterTest AddMMIListener_001 end" << std::endl;
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "bundle/bundle_manager_callback_stub.h"
|
||||
#undef private
|
||||
|
||||
#include "distributed_sched_util.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "test_log.h"
|
||||
|
||||
|
@ -14,16 +14,17 @@
|
||||
*/
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#define private public
|
||||
#define protected public
|
||||
#include "ability_connect_callback_stub.h"
|
||||
#include "distributed_sched_adapter.h"
|
||||
#include "distributed_sched_service.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "if_system_ability_manager.h"
|
||||
#include "ipc_skeleton.h"
|
||||
#include "iservice_registry.h"
|
||||
#include "system_ability_definition.h"
|
||||
|
||||
#define private public
|
||||
#define protected public
|
||||
#include "distributed_sched_adapter.h"
|
||||
#include "distributed_sched_service.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "test_log.h"
|
||||
#undef private
|
||||
#undef protected
|
||||
|
@ -14,22 +14,24 @@
|
||||
*/
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#define private public
|
||||
#define protected public
|
||||
#include "ability_connect_callback_interface.h"
|
||||
#include "ability_connect_callback_stub.h"
|
||||
#include "ability_connection_wrapper_stub.h"
|
||||
#include "device_manager.h"
|
||||
#include "distributed_sched_service.h"
|
||||
#include "distributed_sched_util.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "if_system_ability_manager.h"
|
||||
#include "ipc_skeleton.h"
|
||||
#include "iservice_registry.h"
|
||||
#include "parcel_helper.h"
|
||||
#include "system_ability_definition.h"
|
||||
|
||||
#include "ability_connection_wrapper_stub.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "parcel_helper.h"
|
||||
#include "test_log.h"
|
||||
|
||||
#define private public
|
||||
#define protected public
|
||||
#include "distributed_sched_service.h"
|
||||
#undef private
|
||||
#undef protected
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "dfx/dms_continue_time_dumper.h"
|
||||
#include "distributed_sched_continuation_test.h"
|
||||
#include "distributed_sched_util.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#include "dms_constant.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "ipc_skeleton.h"
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
#include "distributed_sched_dumper_test.h"
|
||||
#include "distributed_sched_util.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#include "test_log.h"
|
||||
|
||||
using namespace testing;
|
||||
|
@ -22,7 +22,7 @@
|
||||
#define private public
|
||||
#include "distributed_sched_permission.h"
|
||||
#undef private
|
||||
#include "distributed_sched_util.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "dms_constant.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "distributed_sched_permission.h"
|
||||
#include "distributed_sched_proxy.h"
|
||||
#include "distributed_sched_service.h"
|
||||
#include "distributed_sched_util.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#include "dms_constant.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "distributed_sched_permission.h"
|
||||
#include "distributed_sched_proxy.h"
|
||||
#include "distributed_sched_service.h"
|
||||
#include "distributed_sched_util.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "distributed_sched_service.h"
|
||||
#undef private
|
||||
#include "distributed_sched_stub_test.h"
|
||||
#include "distributed_sched_util.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#define private public
|
||||
#include "mission/distributed_sched_mission_manager.h"
|
||||
#undef private
|
||||
|
@ -13,13 +13,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "distributed_sched_util.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
|
||||
#include <future>
|
||||
|
||||
#include "accesstoken_kit.h"
|
||||
#include "bundle_installer_interface.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "if_system_ability_manager.h"
|
||||
#include "iservice_registry.h"
|
||||
#include "nativetoken_kit.h"
|
||||
@ -29,6 +28,8 @@
|
||||
#include "system_ability_definition.h"
|
||||
#include "token_setproc.h"
|
||||
|
||||
#include "dtbschedmgr_log.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
using namespace AppExecFwk;
|
||||
@ -84,22 +85,22 @@ std::condition_variable DistributedSchedUtil::remoteConVar_;
|
||||
|
||||
void DistributedSchedUtil::MockPermission()
|
||||
{
|
||||
static const char *PERMS[] = {
|
||||
static const char *perms[] = {
|
||||
"ohos.permission.ABILITY_BACKGROUND_COMMUNICATION",
|
||||
"ohos.permission.ACCESS_SERVICE_DM",
|
||||
"ohos.permission.DISTRIBUTED_DATASYNC",
|
||||
"ohos.permission.RUNNING_STATE_OBSERVER"
|
||||
|
||||
};
|
||||
MockProcessAndPermission(DISTSCHED_PROCESS_NAME, PERMS, PERMS_NUM);
|
||||
MockProcessAndPermission(DISTSCHED_PROCESS_NAME, perms, PERMS_NUM);
|
||||
}
|
||||
|
||||
void DistributedSchedUtil::MockBundlePermission()
|
||||
{
|
||||
static const char *PERMS[] = {
|
||||
static const char *perms[] = {
|
||||
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
|
||||
};
|
||||
MockProcessAndPermission("DistributedSchedPermissionTest", PERMS, sizeof(PERMS) / sizeof(PERMS[0]));
|
||||
MockProcessAndPermission("DistributedSchedPermissionTest", perms, sizeof(perms) / sizeof(perms[0]));
|
||||
}
|
||||
|
||||
void DistributedSchedUtil::MockManageMissions()
|
@ -17,7 +17,7 @@
|
||||
#include "distributed_sched_service.h"
|
||||
#undef private
|
||||
#include "distributed_sched_uid_test.h"
|
||||
#include "distributed_sched_util.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#define private public
|
||||
#include "mission/distributed_sched_mission_manager.h"
|
||||
#undef private
|
||||
|
@ -21,7 +21,7 @@
|
||||
#define private public
|
||||
#include "adapter/dnetwork_adapter.h"
|
||||
#undef private
|
||||
#include "distributed_sched_util.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "dms_token_callback_test.h"
|
||||
|
||||
#include "distributed_sched_util.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#include "dms_token_callback.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "test_log.h"
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "dtbschedmgr_device_info_storage_test.h"
|
||||
|
||||
#include "distributed_sched_util.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "test_log.h"
|
||||
#include <cstddef>
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "distributed_bm_storage_test.h"
|
||||
|
||||
#include <thread>
|
||||
#include "distributed_sched_util.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "test_log.h"
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "distributed_data_storage_test.h"
|
||||
|
||||
#include <thread>
|
||||
#include "distributed_sched_util.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "test_log.h"
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "dms_continue_manager_test.h"
|
||||
|
||||
#include "datetime_ex.h"
|
||||
#include "distributed_sched_util.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#define private public
|
||||
#include "mission/dms_continue_send_manager.h"
|
||||
|
@ -13,26 +13,30 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define private public
|
||||
#define protected public
|
||||
#include "dms_mission_manager_test.h"
|
||||
#include "distributed_sched_proxy.h"
|
||||
#include "distributed_sched_service.h"
|
||||
#include "distributed_sched_util.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
|
||||
#include <thread>
|
||||
|
||||
#include "if_system_ability_manager.h"
|
||||
#include "ipc_skeleton.h"
|
||||
#include "iservice_registry.h"
|
||||
#include "string_ex.h"
|
||||
#include "system_ability_definition.h"
|
||||
|
||||
#define private public
|
||||
#define protected public
|
||||
#include "distributed_sched_proxy.h"
|
||||
#include "distributed_sched_service.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "mission/distributed_sched_mission_manager.h"
|
||||
#include "mission/mission_constant.h"
|
||||
#include "mission/snapshot_converter.h"
|
||||
#include "string_ex.h"
|
||||
#include "system_ability_definition.h"
|
||||
#include "test_log.h"
|
||||
#undef private
|
||||
#undef protected
|
||||
|
||||
#include <thread>
|
||||
using namespace std;
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
@ -2963,7 +2967,7 @@ HWTEST_F(DMSMissionManagerTest, testFetchDeviceHandler005, TestSize.Level3)
|
||||
lock_guard<mutex> autoLock(DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdLock_);
|
||||
DtbschedmgrDeviceInfoStorage::GetInstance().uuidNetworkIdMap_[uuid] = DEVICE_ID;
|
||||
}
|
||||
auto anonyUuid = DnetworkAdapter::AnonymizeNetworkId(uuid);
|
||||
auto anonyUuid = GetAnonymStr(uuid);
|
||||
auto runner = AppExecFwk::EventRunner::Create(anonyUuid + "_MissionN");
|
||||
auto handler = std::make_shared<AppExecFwk::EventHandler>(runner);
|
||||
DistributedSchedMissionManager::GetInstance().deviceHandle_.emplace(uuid, handler);
|
||||
|
@ -19,9 +19,10 @@
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "device_manager.h"
|
||||
#include "distributed_sched_interface.h"
|
||||
#include "remote_mission_listener_stub.h"
|
||||
|
||||
#include "distributed_sched_interface.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
class DMSMissionManagerTest : public testing::Test {
|
||||
|
@ -27,10 +27,10 @@ const char* DISTSCHED_PROCESS_NAME = "foundation";
|
||||
|
||||
void FuzzUtil::MockPermission()
|
||||
{
|
||||
static const char *PERMS[] = {
|
||||
static const char *perms[] = {
|
||||
"ohos.permission.DISTRIBUTED_DATASYNC"
|
||||
};
|
||||
MockProcessAndPermission(DISTSCHED_PROCESS_NAME, PERMS, 1);
|
||||
MockProcessAndPermission(DISTSCHED_PROCESS_NAME, perms, 1);
|
||||
}
|
||||
|
||||
void FuzzUtil::MockProcessAndPermission(const char* processName, const char *perms[], int32_t permsNum)
|
||||
|
Loading…
Reference in New Issue
Block a user