mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-23 06:20:07 +00:00
打点信息及缓存优化
Signed-off-by: MisterE <smart_e@126.com>
This commit is contained in:
commit
c3d42e6836
@ -73,6 +73,7 @@ private:
|
|||||||
static std::set<std::shared_ptr<DeviceListener>> listenerSet_;
|
static std::set<std::shared_ptr<DeviceListener>> listenerSet_;
|
||||||
|
|
||||||
std::shared_ptr<DistributedHardware::DeviceStateCallback> stateCallback_;
|
std::shared_ptr<DistributedHardware::DeviceStateCallback> stateCallback_;
|
||||||
|
std::shared_ptr<DistributedHardware::DevTrustChangeCallback> devTrustChangeCallback_;
|
||||||
std::shared_ptr<DistributedHardware::DmInitCallback> initCallback_;
|
std::shared_ptr<DistributedHardware::DmInitCallback> initCallback_;
|
||||||
class DeviceInitCallBack : public DistributedHardware::DmInitCallback {
|
class DeviceInitCallBack : public DistributedHardware::DmInitCallback {
|
||||||
void OnRemoteDied() override;
|
void OnRemoteDied() override;
|
||||||
@ -84,6 +85,11 @@ class DmsDeviceStateCallback : public DistributedHardware::DeviceStateCallback {
|
|||||||
void OnDeviceChanged(const DistributedHardware::DmDeviceInfo& deviceInfo) override;
|
void OnDeviceChanged(const DistributedHardware::DmDeviceInfo& deviceInfo) override;
|
||||||
void OnDeviceReady(const DistributedHardware::DmDeviceInfo& deviceInfo) override;
|
void OnDeviceReady(const DistributedHardware::DmDeviceInfo& deviceInfo) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DmsDevTrustChangeCallback : public DistributedHardware::DevTrustChangeCallback {
|
||||||
|
void OnDeviceTrustChange(const std::string &udid, const std::string &uuid,
|
||||||
|
const DistributedHardware::DmAuthForm authform) override;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
} // namespace DistributedSchedule
|
} // namespace DistributedSchedule
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
||||||
|
@ -66,7 +66,7 @@ private:
|
|||||||
void HandleContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId, int32_t missionId,
|
void HandleContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId, int32_t missionId,
|
||||||
const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams);
|
const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams);
|
||||||
void HandleContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId,
|
void HandleContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId,
|
||||||
std::string bundleName, const std::string& continueType,
|
std::string srcBundleName, std::string bundleName, const std::string& continueType,
|
||||||
const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams);
|
const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams);
|
||||||
bool GetFirstBundleName(DSchedContinueInfo &info, std::string &firstBundleNamme, std::string bundleName,
|
bool GetFirstBundleName(DSchedContinueInfo &info, std::string &firstBundleNamme, std::string bundleName,
|
||||||
std::string deviceId);
|
std::string deviceId);
|
||||||
|
@ -48,6 +48,7 @@ const std::string TO_CALL_PKG = "TO_CALL_PKG";
|
|||||||
const std::string HOST_PKG = "HOST_PKG";
|
const std::string HOST_PKG = "HOST_PKG";
|
||||||
const std::string ERROR_CODE = "ERROR_CODE";
|
const std::string ERROR_CODE = "ERROR_CODE";
|
||||||
const std::string PEER_UDID = "PEER_UDID";
|
const std::string PEER_UDID = "PEER_UDID";
|
||||||
|
const std::string APP_CALLEE = "APP_CALLEE";
|
||||||
const std::string APP_CALLER = "APP_CALLER";
|
const std::string APP_CALLER = "APP_CALLER";
|
||||||
constexpr char APP_CONTINUE_DOMAIN[] = "APP_CONTINUE";
|
constexpr char APP_CONTINUE_DOMAIN[] = "APP_CONTINUE";
|
||||||
constexpr int32_t ANONYM_MIN_LENGTH = 10;
|
constexpr int32_t ANONYM_MIN_LENGTH = 10;
|
||||||
@ -168,7 +169,7 @@ public:
|
|||||||
bool UnfocusedGetBundleName(const std::string& func, int32_t errCode);
|
bool UnfocusedGetBundleName(const std::string& func, int32_t errCode);
|
||||||
bool NotifyDockUnfocused(const std::string& func, int32_t errCode);
|
bool NotifyDockUnfocused(const std::string& func, int32_t errCode);
|
||||||
bool ClickIconDmsContinue(const std::string& func, int32_t errCode, std::string peerUdid,
|
bool ClickIconDmsContinue(const std::string& func, int32_t errCode, std::string peerUdid,
|
||||||
const std::string& bundleName);
|
const std::string& srcBundleName, const std::string& dstBundleName);
|
||||||
bool ClickIconDmsStartAbility(const std::string& func, int32_t errCode);
|
bool ClickIconDmsStartAbility(const std::string& func, int32_t errCode);
|
||||||
bool ClickIconDmsRecvOver(const std::string& func, int32_t errCode);
|
bool ClickIconDmsRecvOver(const std::string& func, int32_t errCode);
|
||||||
bool SaveDataDmsContinue(const std::string& func, int32_t errCode);
|
bool SaveDataDmsContinue(const std::string& func, int32_t errCode);
|
||||||
|
@ -76,6 +76,7 @@ public:
|
|||||||
uint32_t result, const std::string& bundleName);
|
uint32_t result, const std::string& bundleName);
|
||||||
void DmsPutBatch(const std::vector<DmsBundleInfo> &dmsBundleInfos);
|
void DmsPutBatch(const std::vector<DmsBundleInfo> &dmsBundleInfos);
|
||||||
bool UpdatePublicRecords(const std::string &localUdid);
|
bool UpdatePublicRecords(const std::string &localUdid);
|
||||||
|
bool DelDataOfLogoutDev(const std::string &udid, const std::string &uuid);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string DeviceAndNameToKey(const std::string &udid, const std::string &bundleName) const;
|
std::string DeviceAndNameToKey(const std::string &udid, const std::string &bundleName) const;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "distributed_sched_utils.h"
|
#include "distributed_sched_utils.h"
|
||||||
#include "dtbschedmgr_device_info_storage.h"
|
#include "dtbschedmgr_device_info_storage.h"
|
||||||
#include "dtbschedmgr_log.h"
|
#include "dtbschedmgr_log.h"
|
||||||
|
#include "mission/distributed_bm_storage.h"
|
||||||
#include "mission/dsched_sync_e2e.h"
|
#include "mission/dsched_sync_e2e.h"
|
||||||
|
|
||||||
namespace OHOS {
|
namespace OHOS {
|
||||||
@ -56,6 +57,7 @@ void DnetworkAdapter::Init()
|
|||||||
{
|
{
|
||||||
initCallback_ = std::make_shared<DeviceInitCallBack>();
|
initCallback_ = std::make_shared<DeviceInitCallBack>();
|
||||||
stateCallback_ = std::make_shared<DmsDeviceStateCallback>();
|
stateCallback_ = std::make_shared<DmsDeviceStateCallback>();
|
||||||
|
devTrustChangeCallback_ = std::make_shared<DmsDevTrustChangeCallback>();
|
||||||
auto runner = AppExecFwk::EventRunner::Create("dmsDnetwork");
|
auto runner = AppExecFwk::EventRunner::Create("dmsDnetwork");
|
||||||
dnetworkHandler_ = std::make_shared<AppExecFwk::EventHandler>(runner);
|
dnetworkHandler_ = std::make_shared<AppExecFwk::EventHandler>(runner);
|
||||||
}
|
}
|
||||||
@ -117,6 +119,23 @@ void DnetworkAdapter::DmsDeviceStateCallback::OnDeviceReady(const DmDeviceInfo&
|
|||||||
HILOGI("called");
|
HILOGI("called");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DnetworkAdapter::DmsDevTrustChangeCallback::OnDeviceTrustChange(const std::string &udid,
|
||||||
|
const std::string &uuid, const DmAuthForm authform)
|
||||||
|
{
|
||||||
|
HILOGI("called");
|
||||||
|
if (udid.empty() || uuid.empty()) {
|
||||||
|
HILOGE("udid or uuid is empty!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (authform != DmAuthForm::IDENTICAL_ACCOUNT) {
|
||||||
|
HILOGE("peer is not same account");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (DmsBmStorage::GetInstance()->DelDataOfLogoutDev(udid, uuid)) {
|
||||||
|
HILOGE("DelDataOfLogoutDev failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool DnetworkAdapter::AddDeviceChangeListener(const std::shared_ptr<DeviceListener>& listener)
|
bool DnetworkAdapter::AddDeviceChangeListener(const std::shared_ptr<DeviceListener>& listener)
|
||||||
{
|
{
|
||||||
HILOGD("AddDeviceChangeListener called");
|
HILOGD("AddDeviceChangeListener called");
|
||||||
|
@ -499,7 +499,7 @@ int32_t DSchedContinue::ExecuteContinueReq(std::shared_ptr<DistributedWantParams
|
|||||||
continueInfo_.sinkDeviceId_ : continueInfo_.sourceDeviceId_;
|
continueInfo_.sinkDeviceId_ : continueInfo_.sourceDeviceId_;
|
||||||
|
|
||||||
std::string peerUdid = DtbschedmgrDeviceInfoStorage::GetInstance().GetUdidByNetworkId(peerDeviceId);
|
std::string peerUdid = DtbschedmgrDeviceInfoStorage::GetInstance().GetUdidByNetworkId(peerDeviceId);
|
||||||
DmsRadar::GetInstance().ClickIconDmsContinue("ContinueMission", ERR_OK, peerUdid, continueInfo_.sinkBundleName_);
|
DmsRadar::GetInstance().ClickIconDmsContinue("ContinueMission", ERR_OK, peerUdid, continueInfo_.sourceBundleName_, continueInfo_.sinkBundleName_);
|
||||||
|
|
||||||
DmsUE::GetInstance().TriggerDmsContinue(continueInfo_.sinkBundleName_, continueInfo_.sinkAbilityName_,
|
DmsUE::GetInstance().TriggerDmsContinue(continueInfo_.sinkBundleName_, continueInfo_.sinkAbilityName_,
|
||||||
continueInfo_.sourceDeviceId_, ERR_OK);
|
continueInfo_.sourceDeviceId_, ERR_OK);
|
||||||
@ -853,10 +853,10 @@ int32_t DSchedContinue::SetWantForContinuation(AAFwk::Want& newWant)
|
|||||||
DmsContinueTime::GetInstance().WriteDurationInfo(DmsContinueTime::GetInstance().GetSaveDataDuration());
|
DmsContinueTime::GetInstance().WriteDurationInfo(DmsContinueTime::GetInstance().GetSaveDataDuration());
|
||||||
newWant.SetParam(DMSDURATION_SAVETIME, saveDataTime);
|
newWant.SetParam(DMSDURATION_SAVETIME, saveDataTime);
|
||||||
if (subServiceType_ == CONTINUE_PUSH) {
|
if (subServiceType_ == CONTINUE_PUSH) {
|
||||||
DmsContinueTime::GetInstance().SetSrcBundleName(newWant.GetElement().GetBundleName());
|
DmsContinueTime::GetInstance().SetSrcBundleName(continueInfo_.sourceBundleName_);
|
||||||
DmsContinueTime::GetInstance().SetSrcAbilityName(newWant.GetElement().GetAbilityName());
|
DmsContinueTime::GetInstance().SetSrcAbilityName(continueInfo_.sourceDeviceId_);
|
||||||
DmsContinueTime::GetInstance().SetDstBundleName(newWant.GetElement().GetBundleName());
|
DmsContinueTime::GetInstance().SetDstBundleName(continueInfo_.sinkBundleName_);
|
||||||
DmsContinueTime::GetInstance().SetDstAbilityName(newWant.GetElement().GetAbilityName());
|
DmsContinueTime::GetInstance().SetDstAbilityName(continueInfo_.sinkAbilityName_);
|
||||||
}
|
}
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
@ -980,10 +980,10 @@ void DSchedContinue::DurationDumperBeforeStartAbility(std::shared_ptr<DSchedCont
|
|||||||
if (subServiceType_ == CONTINUE_PULL && cmd != nullptr) {
|
if (subServiceType_ == CONTINUE_PULL && cmd != nullptr) {
|
||||||
std::string timeInfo = cmd->want_.GetStringParam(DMSDURATION_SAVETIME);
|
std::string timeInfo = cmd->want_.GetStringParam(DMSDURATION_SAVETIME);
|
||||||
DmsContinueTime::GetInstance().ReadDurationInfo(timeInfo.c_str());
|
DmsContinueTime::GetInstance().ReadDurationInfo(timeInfo.c_str());
|
||||||
DmsContinueTime::GetInstance().SetSrcBundleName(cmd->want_.GetElement().GetBundleName());
|
DmsContinueTime::GetInstance().SetSrcBundleName(continueInfo_.sourceBundleName_);
|
||||||
DmsContinueTime::GetInstance().SetSrcAbilityName(cmd->want_.GetElement().GetAbilityName());
|
DmsContinueTime::GetInstance().SetSrcAbilityName(continueInfo_.sourceDeviceId_);
|
||||||
DmsContinueTime::GetInstance().SetDstBundleName(cmd->want_.GetElement().GetBundleName());
|
DmsContinueTime::GetInstance().SetDstBundleName(continueInfo_.sinkBundleName_);
|
||||||
DmsContinueTime::GetInstance().SetDstAbilityName(cmd->want_.GetElement().GetAbilityName());
|
DmsContinueTime::GetInstance().SetDstAbilityName(continueInfo_.sinkBundleName_);
|
||||||
}
|
}
|
||||||
DmsContinueTime::GetInstance().SetDurationBegin(CONTINUE_START_ABILITY_TIME, GetTickCount());
|
DmsContinueTime::GetInstance().SetDurationBegin(CONTINUE_START_ABILITY_TIME, GetTickCount());
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ void DSchedContinueManager::HandleContinueMission(const std::string& srcDeviceId
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t DSchedContinueManager::ContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId,
|
int32_t DSchedContinueManager::ContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId,
|
||||||
std::string bundleName, const std::string& continueType,
|
std::string srcBundleName, std::string bundleName, const std::string& continueType,
|
||||||
const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams)
|
const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams)
|
||||||
{
|
{
|
||||||
if (srcDeviceId.empty() || dstDeviceId.empty() || callback == nullptr) {
|
if (srcDeviceId.empty() || dstDeviceId.empty() || callback == nullptr) {
|
||||||
@ -214,8 +214,8 @@ int32_t DSchedContinueManager::ContinueMission(const std::string& srcDeviceId, c
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto func = [this, srcDeviceId, dstDeviceId, bundleName, continueType, callback, wantParams]() {
|
auto func = [this, srcDeviceId, dstDeviceId, srcBundleName, bundleName, continueType, callback, wantParams]() {
|
||||||
HandleContinueMission(srcDeviceId, dstDeviceId, bundleName, continueType, callback, wantParams);
|
HandleContinueMission(srcDeviceId, dstDeviceId, srcBundleName, bundleName, continueType, callback, wantParams);
|
||||||
};
|
};
|
||||||
if (eventHandler_ == nullptr) {
|
if (eventHandler_ == nullptr) {
|
||||||
HILOGE("eventHandler_ is nullptr");
|
HILOGE("eventHandler_ is nullptr");
|
||||||
@ -226,7 +226,7 @@ int32_t DSchedContinueManager::ContinueMission(const std::string& srcDeviceId, c
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DSchedContinueManager::HandleContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId,
|
void DSchedContinueManager::HandleContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId,
|
||||||
std::string bundleName, const std::string& continueType,
|
std::string srcBundleName, std::string bundleName, const std::string& continueType,
|
||||||
const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams)
|
const sptr<IRemoteObject>& callback, const OHOS::AAFwk::WantParams& wantParams)
|
||||||
{
|
{
|
||||||
HILOGI("start, srcDeviceId: %{public}s. dstDeviceId: %{public}s. bundleName: %{public}s."
|
HILOGI("start, srcDeviceId: %{public}s. dstDeviceId: %{public}s. bundleName: %{public}s."
|
||||||
@ -238,7 +238,7 @@ void DSchedContinueManager::HandleContinueMission(const std::string& srcDeviceId
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DSchedContinueInfo info = DSchedContinueInfo(srcDeviceId, bundleName, dstDeviceId, bundleName, continueType);
|
DSchedContinueInfo info = DSchedContinueInfo(srcDeviceId, srcBundleName, dstDeviceId, bundleName, continueType);
|
||||||
HandleContinueMissionWithBundleName(info, callback, wantParams);
|
HandleContinueMissionWithBundleName(info, callback, wantParams);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -317,7 +317,14 @@ void DSchedContinueManager::HandleContinueMissionWithBundleName(DSchedContinueIn
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int32_t subType = CONTINUE_PUSH;
|
int32_t subType = CONTINUE_PUSH;
|
||||||
CompleteBundleName(info, direction, subType);
|
if (direction == CONTINUE_SOURCE) {
|
||||||
|
cntSource_++;
|
||||||
|
} else {
|
||||||
|
cntSink_++;
|
||||||
|
subType = CONTINUE_PULL;
|
||||||
|
}
|
||||||
|
HILOGE("AAAAAAAAA continue info: %{public}s", info.toString().c_str());
|
||||||
|
// CompleteBundleName(info, direction, subType);
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> continueLock(continueMutex_);
|
std::lock_guard<std::mutex> continueLock(continueMutex_);
|
||||||
if (!continues_.empty() && continues_.find(info) != continues_.end()) {
|
if (!continues_.empty() && continues_.find(info) != continues_.end()) {
|
||||||
|
@ -729,7 +729,7 @@ bool DmsRadar::NotifyDockUnfocused(const std::string& func, int32_t errCode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DmsRadar::ClickIconDmsContinue(const std::string& func, int32_t errCode, std::string peerUdid,
|
bool DmsRadar::ClickIconDmsContinue(const std::string& func, int32_t errCode, std::string peerUdid,
|
||||||
const std::string& bundleName)
|
const std::string& srcBundleName, const std::string& dstBundleName)
|
||||||
{
|
{
|
||||||
if (peerUdid.empty()) {
|
if (peerUdid.empty()) {
|
||||||
HILOGE("peerUdid is empty.");
|
HILOGE("peerUdid is empty.");
|
||||||
@ -748,7 +748,8 @@ bool DmsRadar::ClickIconDmsContinue(const std::string& func, int32_t errCode, st
|
|||||||
BIZ_STAGE, static_cast<int32_t>(ClickIcon::DMS_CONTINUE),
|
BIZ_STAGE, static_cast<int32_t>(ClickIcon::DMS_CONTINUE),
|
||||||
STAGE_RES, static_cast<int32_t>(StageRes::STAGE_SUCC),
|
STAGE_RES, static_cast<int32_t>(StageRes::STAGE_SUCC),
|
||||||
PEER_UDID, GetAnonyUdid(peerUdid),
|
PEER_UDID, GetAnonyUdid(peerUdid),
|
||||||
APP_CALLER, bundleName);
|
APP_CALLEE, srcBundleName,
|
||||||
|
APP_CALLER, dstBundleName);
|
||||||
} else {
|
} else {
|
||||||
res = HiSysEventWrite(
|
res = HiSysEventWrite(
|
||||||
APP_CONTINUE_DOMAIN,
|
APP_CONTINUE_DOMAIN,
|
||||||
@ -760,7 +761,8 @@ bool DmsRadar::ClickIconDmsContinue(const std::string& func, int32_t errCode, st
|
|||||||
BIZ_STAGE, static_cast<int32_t>(ClickIcon::DMS_CONTINUE),
|
BIZ_STAGE, static_cast<int32_t>(ClickIcon::DMS_CONTINUE),
|
||||||
STAGE_RES, static_cast<int32_t>(StageRes::STAGE_FAIL),
|
STAGE_RES, static_cast<int32_t>(StageRes::STAGE_FAIL),
|
||||||
PEER_UDID, GetAnonyUdid(peerUdid),
|
PEER_UDID, GetAnonyUdid(peerUdid),
|
||||||
APP_CALLER, bundleName,
|
APP_CALLEE, srcBundleName,
|
||||||
|
APP_CALLER, dstBundleName,
|
||||||
ERROR_CODE, errCode);
|
ERROR_CODE, errCode);
|
||||||
}
|
}
|
||||||
if (res != ERR_OK) {
|
if (res != ERR_OK) {
|
||||||
|
@ -916,7 +916,7 @@ int32_t DistributedSchedService::ContinueRemoteMission(const std::string& srcDev
|
|||||||
DmsUE::GetInstance().TriggerDmsContinue(bundleName, abilityName, srcDeviceId, ERR_OK);
|
DmsUE::GetInstance().TriggerDmsContinue(bundleName, abilityName, srcDeviceId, ERR_OK);
|
||||||
|
|
||||||
std::string peerUdid = DtbschedmgrDeviceInfoStorage::GetInstance().GetUdidByNetworkId(srcDeviceId);
|
std::string peerUdid = DtbschedmgrDeviceInfoStorage::GetInstance().GetUdidByNetworkId(srcDeviceId);
|
||||||
DmsRadar::GetInstance().ClickIconDmsContinue("ContinueMission", ERR_OK, peerUdid, bundleName);
|
DmsRadar::GetInstance().ClickIconDmsContinue("ContinueMission", ERR_OK, peerUdid, bundleName, bundleName);
|
||||||
|
|
||||||
int32_t result = remoteDms->ContinueMission(srcDeviceId, dstDeviceId, missionId, callback, wantParams);
|
int32_t result = remoteDms->ContinueMission(srcDeviceId, dstDeviceId, missionId, callback, wantParams);
|
||||||
HILOGI("ContinueRemoteMission result: %{public}d!", result);
|
HILOGI("ContinueRemoteMission result: %{public}d!", result);
|
||||||
|
@ -855,6 +855,39 @@ void DmsBmStorage::DmsPutBatch(const std::vector<DmsBundleInfo> &dmsBundleInfos)
|
|||||||
HILOGI("end.");
|
HILOGI("end.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DmsBmStorage::DelDataOfLogoutDev(const std::string &udid, const std::string &uuid)
|
||||||
|
{
|
||||||
|
if (!CheckKvStore()) {
|
||||||
|
HILOGE("kvStore is nullptr");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (udid.empty() || uuid.empty()) {
|
||||||
|
HILOGE("udid or uuid is empty!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Key remoteKeyPrefix(udid);
|
||||||
|
std::vector<Entry> remoteEntries;
|
||||||
|
Status status = kvStorePtr_->GetEntries(remoteKeyPrefix, remoteEntries);
|
||||||
|
if (status != Status::SUCCESS || remoteEntries.empty()) {
|
||||||
|
HILOGE("GetEntries error: %{public}d, or remoteEntries is empty", status);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::vector<Key> remoteKeyArr;
|
||||||
|
for (auto remoteEntry : remoteEntries) {
|
||||||
|
remoteKeyArr.push_back(remoteEntry.key);
|
||||||
|
}
|
||||||
|
status = kvStorePtr_->DeleteBatch(remoteKeyArr);
|
||||||
|
if (status != Status::SUCCESS) {
|
||||||
|
HILOGE("DeleteBatch error: %{public}d", status);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (kvStorePtr_->RemoveDeviceData(uuid) != Status::SUCCESS) {
|
||||||
|
HILOGE("RemoveDeviceData fail, uuid=%{public}s", GetAnonymStr(uuid).c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void DmsBmStorage::AddBundleNameId(const uint16_t &bundleNameId, const std::string &bundleName)
|
void DmsBmStorage::AddBundleNameId(const uint16_t &bundleNameId, const std::string &bundleName)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock_l(mutex_);
|
std::lock_guard<std::mutex> lock_l(mutex_);
|
||||||
|
@ -535,7 +535,7 @@ HWTEST_F(DistributedRadarTest, NotifyDockUnfocused_002, TestSize.Level3)
|
|||||||
HWTEST_F(DistributedRadarTest, ClickIconDmsContinue_001, TestSize.Level3)
|
HWTEST_F(DistributedRadarTest, ClickIconDmsContinue_001, TestSize.Level3)
|
||||||
{
|
{
|
||||||
DTEST_LOG << "DistributedRadarTest ClickIconDmsContinue_001 begin" << std::endl;
|
DTEST_LOG << "DistributedRadarTest ClickIconDmsContinue_001 begin" << std::endl;
|
||||||
bool ret = DmsRadar::GetInstance().ClickIconDmsContinue(FUNC, ERR_OK, DEVICE_ID, BUNDLE_NAME);
|
bool ret = DmsRadar::GetInstance().ClickIconDmsContinue(FUNC, ERR_OK, DEVICE_ID, BUNDLE_NAME, BUNDLE_NAME);
|
||||||
EXPECT_EQ(ret, true);
|
EXPECT_EQ(ret, true);
|
||||||
DTEST_LOG << "DistributedRadarTest ClickIconDmsContinue_001 end" << std::endl;
|
DTEST_LOG << "DistributedRadarTest ClickIconDmsContinue_001 end" << std::endl;
|
||||||
}
|
}
|
||||||
@ -548,7 +548,7 @@ HWTEST_F(DistributedRadarTest, ClickIconDmsContinue_001, TestSize.Level3)
|
|||||||
HWTEST_F(DistributedRadarTest, ClickIconDmsContinue_002, TestSize.Level3)
|
HWTEST_F(DistributedRadarTest, ClickIconDmsContinue_002, TestSize.Level3)
|
||||||
{
|
{
|
||||||
DTEST_LOG << "DistributedRadarTest ClickIconDmsContinue_002 begin" << std::endl;
|
DTEST_LOG << "DistributedRadarTest ClickIconDmsContinue_002 begin" << std::endl;
|
||||||
bool ret = DmsRadar::GetInstance().ClickIconDmsContinue(FUNC, ERR_NO, DEVICE_ID, BUNDLE_NAME);
|
bool ret = DmsRadar::GetInstance().ClickIconDmsContinue(FUNC, ERR_NO, DEVICE_ID, BUNDLE_NAME, BUNDLE_NAME);
|
||||||
EXPECT_EQ(ret, true);
|
EXPECT_EQ(ret, true);
|
||||||
DTEST_LOG << "DistributedRadarTest ClickIconDmsContinue_002 end" << std::endl;
|
DTEST_LOG << "DistributedRadarTest ClickIconDmsContinue_002 end" << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -544,5 +544,25 @@ HWTEST_F(DistributedBmStorageTest, ConvertToDistributedBundleInfoTest_001, TestS
|
|||||||
}
|
}
|
||||||
DTEST_LOG << "DistributedBmStorageTest ConvertToDistributedBundleInfoTest_001 end" << std::endl;
|
DTEST_LOG << "DistributedBmStorageTest ConvertToDistributedBundleInfoTest_001 end" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @tc.name: DmsPutBatchTest_001
|
||||||
|
* @tc.desc: test delete DistributedBmStorage
|
||||||
|
* @tc.type: FUNC
|
||||||
|
*/
|
||||||
|
HWTEST_F(DistributedBmStorageTest, DelDataOfLogoutDevTest_001, TestSize.Level1)
|
||||||
|
{
|
||||||
|
DTEST_LOG << "DistributedBmStorageTest DelDataOfLogoutDevTest_001 start" << std::endl;
|
||||||
|
ASSERT_NE(dmsBmStorage_, nullptr);
|
||||||
|
auto distributedDataStorage = GetDmsBmStorage();
|
||||||
|
EXPECT_NE(distributedDataStorage, nullptr);
|
||||||
|
if (distributedDataStorage != nullptr) {
|
||||||
|
const std::string udid = "";
|
||||||
|
const std::string uuid = "";
|
||||||
|
bool ret = dmsBmStorage_->GetInstance()->DelDataOfLogoutDev(udid, uuid);
|
||||||
|
EXPECT_EQ(ret, false);
|
||||||
|
}
|
||||||
|
DTEST_LOG << "DistributedBmStorageTest DelDataOfLogoutDevTest_001 end" << std::endl;
|
||||||
|
}
|
||||||
} // namespace DistributedSchedule
|
} // namespace DistributedSchedule
|
||||||
} // namespace OHOS
|
} // namespace OHOS
|
Loading…
Reference in New Issue
Block a user