mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-27 00:20:44 +00:00
Merge branch 'master' of https://gitee.com/gritking/ability_dmsfwk
Signed-off-by: MisterE <smart_e@126.com>
This commit is contained in:
commit
9b20c4159d
34
.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
Normal file
34
.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
Normal file
@ -0,0 +1,34 @@
|
||||
**Issue编号**:
|
||||
|
||||
**描述**:
|
||||
|
||||
**安全及低级编码自检:**
|
||||
|
||||
- [ ] 【变量初始化】变量使用前保证赋有效初值
|
||||
- [ ] 【变量初始化】结构体预留字段也必须初始化为0,不允许出现随机值
|
||||
- [ ] 【变量初始化】指针变量必须显示初始化为空
|
||||
- [ ] 【内存和资源】涉及内存拷贝时合理校验目标内存大小,保证目标内存大于等于源内存
|
||||
- [ ] 【内存和资源】进行字符串操作时,如字符串复制、申请字符串内存等,需要考虑字符串结束符
|
||||
- [ ] 【内存和资源】cJSON指针在异常分支里均需考虑内存释放(cJSON_free/cJSON_Delete),防止内存泄漏
|
||||
- [ ] 【内存和资源】内存资源、文件句柄、管道资源、Socket句柄异常退出时要及时关闭
|
||||
- [ ] 【指针】malloc申请内存后必须判断是否为空
|
||||
- [ ] 【指针】指针解引用或释放前判空(lamda表达式,异步任务等使用指针前需判空)
|
||||
- [ ] 【指针】内存释放后立即置空,防止出现UAF
|
||||
- [ ] 【指针】循环时容器的增、删、改操作,必须保证迭代器有效
|
||||
- [ ] 【指针】禁止将栈内存地址作为返回值或赋值给全局变量
|
||||
- [ ] 【数值边界】加法、乘法、减法操作,必须进行溢出和翻转保护,确保先校验再运算
|
||||
- [ ] 【数值边界】除法、求余操作必须进行除零保护
|
||||
- [ ] 【数值边界】循环变量用整型,禁止使用浮点型
|
||||
- [ ] 【数值边界】循环退出条件一定确保可达,防止出现死循环等问题
|
||||
- [ ] 【数值边界】不同大小结构体禁止强转
|
||||
- [ ] 【安全隐私】禁止使用非安全函数,使用封装好的安全函数
|
||||
- [ ] 【安全隐私】日志必须检查PassWord/位置信息/networkId/devId/uuid/udid等关键字,避免明文打印敏感信息
|
||||
- [ ] 【入参及权限校验】对函数入参坚持先校验后使用的原则(指针判空、整型变量校验范围)
|
||||
- [ ] 【入参及权限校验】跨进程调用需注意权限校验,对外部传入的PID、tokenID进行权限校验
|
||||
- [ ] 【条件竞争】共享数据均需加锁保护,并且锁配对使用
|
||||
- [ ] 【条件竞争】条件变量正确加锁,消除条件变量唤醒丢失等问题
|
||||
- [ ] 【条件竞争】加锁范围确保合理,避免过大或过小导致死锁问题
|
||||
|
||||
**TDD结果**:
|
||||
|
||||
**XTS结果**:
|
@ -71,7 +71,7 @@ bool IsValidPath(const std::string &inFilePath, std::string &realFilePath)
|
||||
char path[PATH_MAX + 1] = { 0 };
|
||||
if (inFilePath.empty() || inFilePath.length() > PATH_MAX || inFilePath.length() + 1 > MAX_CONFIG_PATH_LEN ||
|
||||
realpath(inFilePath.c_str(), path) == nullptr) {
|
||||
HILOGE("Get continue config file real path fail, inFilePath %{public}s.", inFilePath.c_str());
|
||||
HILOGE("Get continue config file real path fail, inFilePath %{public}s.", GetAnonymStr(inFilePath).c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -81,11 +81,11 @@ bool IsValidPath(const std::string &inFilePath, std::string &realFilePath)
|
||||
return false;
|
||||
}
|
||||
if (!std::filesystem::exists(realFilePath)) {
|
||||
HILOGE("The real file path %{public}s does not exist in the file system.", realFilePath.c_str());
|
||||
HILOGE("The real file path %{public}s does not exist in the file system.", GetAnonymStr(realFilePath).c_str());
|
||||
realFilePath = "";
|
||||
return false;
|
||||
}
|
||||
HILOGI("The real file path %{public}s exist in the file system.", realFilePath.c_str());
|
||||
HILOGI("The real file path %{public}s exist in the file system.", GetAnonymStr(realFilePath).c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -132,37 +132,38 @@ bool UpdateAllowAppList(const std::string &cfgJsonStr)
|
||||
int32_t LoadContinueConfig()
|
||||
{
|
||||
HILOGI("Load continue config, isMissContinueCfg %{public}d, ContinueCfgFullPath %{public}s.",
|
||||
g_isMissContinueCfg.load(), g_continueCfgFullPath.c_str());
|
||||
g_isMissContinueCfg.load(), GetAnonymStr(g_continueCfgFullPath).c_str());
|
||||
std::string tempPath = g_continueCfgFullPath;
|
||||
if (!g_isMissContinueCfg.load() &&
|
||||
(g_continueCfgFullPath.empty() || !IsValidPath(tempPath, g_continueCfgFullPath))) {
|
||||
char cfgPathBuf[MAX_CONFIG_PATH_LEN] = { 0 };
|
||||
char *filePath = GetOneCfgFile(CONTINUE_CONFIG_RELATIVE_PATH.c_str(), cfgPathBuf, MAX_CONFIG_PATH_LEN);
|
||||
if (filePath == nullptr || filePath != cfgPathBuf) {
|
||||
HILOGI("Not find continue config file, relative path %{public}s.", CONTINUE_CONFIG_RELATIVE_PATH.c_str());
|
||||
HILOGI("Not find continue config file, relative path %{public}s.",
|
||||
GetAnonymStr(CONTINUE_CONFIG_RELATIVE_PATH).c_str());
|
||||
g_isMissContinueCfg.store(true);
|
||||
g_continueCfgFullPath = "";
|
||||
return ERR_OK;
|
||||
}
|
||||
g_isMissContinueCfg.store(false);
|
||||
g_continueCfgFullPath = std::string(filePath);
|
||||
HILOGI("Get Continue config file full path success, cfgFullPath %{public}s.", g_continueCfgFullPath.c_str());
|
||||
HILOGI("Get Continue config file full path success, cfgFullPath %{public}s.",
|
||||
GetAnonymStr(g_continueCfgFullPath).c_str());
|
||||
}
|
||||
|
||||
if (g_isMissContinueCfg.load()) {
|
||||
HILOGI("Current device does not carry continue config file.");
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
tempPath = g_continueCfgFullPath;
|
||||
std::string anonymPath = GetAnonymStr(g_continueCfgFullPath);
|
||||
if (!IsValidPath(tempPath, g_continueCfgFullPath)) {
|
||||
HILOGE("Continue config full path is invalid, cfgFullPath %{public}s.", g_continueCfgFullPath.c_str());
|
||||
HILOGE("Continue config full path is invalid, cfgFullPath %{public}s.", anonymPath.c_str());
|
||||
return DMS_PERMISSION_DENIED;
|
||||
}
|
||||
std::ifstream in;
|
||||
in.open(g_continueCfgFullPath.c_str(), std::ios::binary | std::ios::in);
|
||||
if (!in.is_open()) {
|
||||
HILOGE("Open continue config json file fail, cfgFullPath %{public}s.", g_continueCfgFullPath.c_str());
|
||||
HILOGE("Open continue config json file fail, cfgFullPath %{public}s.", anonymPath.c_str());
|
||||
return DMS_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
@ -174,11 +175,11 @@ int32_t LoadContinueConfig()
|
||||
in.close();
|
||||
|
||||
if (!UpdateAllowAppList(cfgFileContent)) {
|
||||
HILOGE("Update allow app list fail, cfgFullPath %{public}s.", g_continueCfgFullPath.c_str());
|
||||
HILOGE("Update allow app list fail, cfgFullPath %{public}s.", anonymPath.c_str());
|
||||
return DMS_PERMISSION_DENIED;
|
||||
}
|
||||
HILOGI("Load continue config success, isMissContinueCfg %{public}d, cfgFullPath %{public}s.",
|
||||
g_isMissContinueCfg.load(), g_continueCfgFullPath.c_str());
|
||||
g_isMissContinueCfg.load(), anonymPath.c_str());
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
@ -193,12 +194,12 @@ bool CheckBundleContinueConfig(const std::string &bundleName)
|
||||
auto it = std::find(g_allowAppList.begin(), g_allowAppList.end(), bundleName);
|
||||
if (it == g_allowAppList.end()) {
|
||||
HILOGE("Current app is not allow to continue in config file, bundleName %{public}s, cfgPath %{public}s.",
|
||||
bundleName.c_str(), g_continueCfgFullPath.c_str());
|
||||
bundleName.c_str(), GetAnonymStr(g_continueCfgFullPath).c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
HILOGI("Current app is allow to continue in config file, bundleName %{public}s, cfgPath %{public}s.",
|
||||
bundleName.c_str(), g_continueCfgFullPath.c_str());
|
||||
bundleName.c_str(), GetAnonymStr(g_continueCfgFullPath).c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -45,10 +45,11 @@ public:
|
||||
private:
|
||||
DmsSaClient() {};
|
||||
~DmsSaClient() {};
|
||||
bool hasSubscribeDmsSA_ = false;
|
||||
std::atomic<bool> hasSubscribeDmsSA_ = false;
|
||||
OHOS::sptr<ISystemAbilityManager> saMgrProxy_;
|
||||
std::map<DSchedEventType, sptr<IDSchedEventListener>> listeners_;
|
||||
std::mutex eventMutex_;
|
||||
std::mutex saMgrMutex_;
|
||||
};
|
||||
|
||||
class DmsSystemAbilityStatusChange : public SystemAbilityStatusChangeStub {
|
||||
|
@ -47,7 +47,10 @@ bool DmsSaClient::SubscribeDmsSA()
|
||||
int32_t DmsSaClient::AddDSchedEventListener(const DSchedEventType& type, const sptr<IDSchedEventListener>& listener)
|
||||
{
|
||||
HILOGI("%{public}s called, the type is %{public}d", __func__, type);
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(saMgrMutex_);
|
||||
saMgrProxy_ = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
}
|
||||
if (saMgrProxy_ == nullptr) {
|
||||
HILOGE("fail to get saMgrProxy.");
|
||||
return AAFwk::INNER_ERR;
|
||||
@ -56,11 +59,13 @@ int32_t DmsSaClient::AddDSchedEventListener(const DSchedEventType& type, const s
|
||||
DistributedClient distributedClient;
|
||||
distributedClient.RegisterDSchedEventListener(type, listener);
|
||||
}
|
||||
std::lock_guard<std::mutex> lock(eventMutex_);
|
||||
if (!hasSubscribeDmsSA_) {
|
||||
if (SubscribeDmsSA()) {
|
||||
hasSubscribeDmsSA_ = true;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(eventMutex_);
|
||||
listeners_[type] = listener;
|
||||
}
|
||||
} else {
|
||||
return AAFwk::INNER_ERR;
|
||||
}
|
||||
@ -71,7 +76,10 @@ int32_t DmsSaClient::AddDSchedEventListener(const DSchedEventType& type, const s
|
||||
int32_t DmsSaClient::DelDSchedEventListener(const DSchedEventType& type, const sptr<IDSchedEventListener>& listener)
|
||||
{
|
||||
HILOGI("%{public}s called, the type is %{public}d", __func__, type);
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(saMgrMutex_);
|
||||
saMgrProxy_ = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
}
|
||||
if (saMgrProxy_ == nullptr) {
|
||||
HILOGE("fail to get saMgrProxy.");
|
||||
return AAFwk::INNER_ERR;
|
||||
@ -88,7 +96,10 @@ int32_t DmsSaClient::DelDSchedEventListener(const DSchedEventType& type, const s
|
||||
int32_t DmsSaClient::GetContinueInfo(ContinueInfo &continueInfo)
|
||||
{
|
||||
HILOGI("%{public}s called", __func__);
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(saMgrMutex_);
|
||||
saMgrProxy_ = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
}
|
||||
if (saMgrProxy_ == nullptr) {
|
||||
HILOGE("fail to get saMgrProxy.");
|
||||
return AAFwk::INNER_ERR;
|
||||
@ -103,7 +114,10 @@ int32_t DmsSaClient::GetContinueInfo(ContinueInfo &continueInfo)
|
||||
int32_t DmsSaClient::GetDSchedEventInfo(const DSchedEventType &type, std::vector<EventNotify> &events)
|
||||
{
|
||||
HILOGI("%{public}s called", __func__);
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(saMgrMutex_);
|
||||
saMgrProxy_ = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
}
|
||||
if (saMgrProxy_ == nullptr) {
|
||||
HILOGE("Get SA manager proxy fail.");
|
||||
return AAFwk::INNER_ERR;
|
||||
|
@ -62,6 +62,9 @@ config("distributed_sched_config") {
|
||||
if (dmsfwk_mmi_listener) {
|
||||
defines += [ "SUPPORT_MULTIMODALINPUT_SERVICE" ]
|
||||
}
|
||||
if (use_libfuzzer || use_clang_coverage) {
|
||||
defines += [ "TEST_COVERAGE" ]
|
||||
}
|
||||
}
|
||||
|
||||
ohos_shared_library("distributedschedsvr") {
|
||||
|
@ -43,12 +43,14 @@ public:
|
||||
static void InitAbilityInfoFromExtension(const AppExecFwk::ExtensionAbilityInfo &extensionAbilityInfo,
|
||||
AppExecFwk::AbilityInfo &abilityInfo);
|
||||
static bool IsSameAppId(const std::string& callerAppId, const std::string& targetBundleName);
|
||||
static bool IsSameDeveloperId(const std::string &callerDeveloperId,
|
||||
const std::string &targetBundleName);
|
||||
static bool IsSameDeveloperId(const std::string &bundleNameInCurrentSide,
|
||||
const std::string &developerId4OtherSide);
|
||||
static int32_t GetLocalBundleInfo(const std::string& bundleName, AppExecFwk::BundleInfo &localBundleInfo);
|
||||
static int32_t GetLocalBundleInfoV9(const std::string& bundleName, AppExecFwk::BundleInfo &bundleInfo);
|
||||
static bool GetContinueBundle4Src(const std::string& srcBundleName,
|
||||
std::vector<std::string>& bundleNameList);
|
||||
static bool BundleManagerInternal::GetAppProvisionInfo4CurrentUser(const std::string& bundleName,
|
||||
const AppExecFwk::AppProvisionInfo& appProvisionInfo);
|
||||
static int32_t CheckRemoteBundleInfoForContinuation(const std::string& dstDeviceId,
|
||||
const std::string& bundleName, AppExecFwk::DistributedBundleInfo& remoteBundleInfo);
|
||||
static sptr<AppExecFwk::IBundleMgr> GetBundleManager();
|
||||
|
@ -36,8 +36,6 @@ struct CallerInfo {
|
||||
std::string sourceDeviceId;
|
||||
int32_t duid = -1;
|
||||
std::string callerAppId;
|
||||
std::string callerBundleName;
|
||||
std::string callerDeveloperId;
|
||||
std::vector<std::string> bundleNames;
|
||||
int32_t dmsVersion = -1;
|
||||
uint32_t accessToken = 0;
|
||||
|
@ -152,7 +152,6 @@ private:
|
||||
int32_t ExecuteContinueReq(std::shared_ptr<DistributedWantParams> wantParams);
|
||||
int32_t ExecuteContinueAbility(int32_t appVersion);
|
||||
int32_t ExecuteContinueReply();
|
||||
bool MakeCallerInfo(std::shared_ptr<ContinueAbilityData> data, CallerInfo &callerInfo);
|
||||
int32_t ExecuteContinueSend(std::shared_ptr<ContinueAbilityData> data);
|
||||
int32_t ExecuteContinueData(std::shared_ptr<DSchedContinueDataCmd> cmd);
|
||||
int32_t ExecuteNotifyComplete(int32_t result);
|
||||
|
@ -61,8 +61,10 @@ public:
|
||||
int32_t command_ = 0;
|
||||
std::string srcDeviceId_;
|
||||
std::string srcBundleName_;
|
||||
std::string srcDeveloperId_;
|
||||
std::string dstDeviceId_;
|
||||
std::string dstBundleName_;
|
||||
std::string dstDeveloperId_;
|
||||
std::string continueType_;
|
||||
int32_t continueByType_ = 0;
|
||||
int32_t sourceMissionId_ = 0;
|
||||
|
@ -68,7 +68,7 @@ private:
|
||||
void HandleContinueMission(const std::string& srcDeviceId, const std::string& dstDeviceId,
|
||||
std::string bundleName, const std::string& continueType,
|
||||
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);
|
||||
void CompleteBundleName(DSchedContinueInfo &info, int32_t direction, int32_t &subType);
|
||||
void HandleContinueMissionWithBundleName(DSchedContinueInfo &info, const sptr<IRemoteObject> &callback,
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include "base_interfaces.h"
|
||||
#include "parcel.h"
|
||||
#include "refbase.h"
|
||||
@ -57,9 +58,6 @@ public:
|
||||
|
||||
static bool CompareInterface(const sptr<AAFwk::IInterface> iIt1, const sptr<AAFwk::IInterface> iIt2, int typeId);
|
||||
|
||||
static bool CompareNumberInterface(const sptr<AAFwk::IInterface> iIt1,
|
||||
const sptr<AAFwk::IInterface> iIt2, int typeId);
|
||||
|
||||
static int GetDataType(const sptr<AAFwk::IInterface> iIt);
|
||||
|
||||
static int GetNumberDataType(const sptr<AAFwk::IInterface> iIt);
|
||||
@ -89,39 +87,29 @@ public:
|
||||
AAFwk::WantParams ToWantParams();
|
||||
|
||||
private:
|
||||
enum {
|
||||
VALUE_TYPE_NULL = -1,
|
||||
VALUE_TYPE_BOOLEAN = 1,
|
||||
VALUE_TYPE_BYTE = 2,
|
||||
VALUE_TYPE_CHAR = 3,
|
||||
VALUE_TYPE_SHORT = 4,
|
||||
VALUE_TYPE_INT = 5,
|
||||
VALUE_TYPE_LONG = 6,
|
||||
VALUE_TYPE_FLOAT = 7,
|
||||
VALUE_TYPE_DOUBLE = 8,
|
||||
VALUE_TYPE_STRING = 9,
|
||||
VALUE_TYPE_CHARSEQUENCE = 10,
|
||||
VALUE_TYPE_BOOLEANARRAY = 11,
|
||||
VALUE_TYPE_BYTEARRAY = 12,
|
||||
VALUE_TYPE_CHARARRAY = 13,
|
||||
VALUE_TYPE_SHORTARRAY = 14,
|
||||
VALUE_TYPE_INTARRAY = 15,
|
||||
VALUE_TYPE_LONGARRAY = 16,
|
||||
VALUE_TYPE_FLOATARRAY = 17,
|
||||
VALUE_TYPE_DOUBLEARRAY = 18,
|
||||
VALUE_TYPE_STRINGARRAY = 19,
|
||||
VALUE_TYPE_CHARSEQUENCEARRAY = 20,
|
||||
static std::string BooleanQueryToStr(const sptr<AAFwk::IInterface> iIt);
|
||||
static std::string ByteQueryToStr(const sptr<AAFwk::IInterface> iIt);
|
||||
static std::string CharQueryToStr(const sptr<AAFwk::IInterface> iIt);
|
||||
static std::string ShortQueryToStr(const sptr<AAFwk::IInterface> iIt);
|
||||
static std::string IntegerQueryToStr(const sptr<AAFwk::IInterface> iIt);
|
||||
static std::string LongQueryToStr(const sptr<AAFwk::IInterface> iIt);
|
||||
static std::string FloatQueryToStr(const sptr<AAFwk::IInterface> iIt);
|
||||
static std::string DoubleQueryToStr(const sptr<AAFwk::IInterface> iIt);
|
||||
static std::string StringQueryToStr(const sptr<AAFwk::IInterface> iIt);
|
||||
static std::string ArrayQueryToStr(const sptr<AAFwk::IInterface> iIt);
|
||||
static std::string DistributedWantParamsQueryToStr(const sptr<AAFwk::IInterface> iIt);
|
||||
|
||||
VALUE_TYPE_PARCELABLE = 21,
|
||||
VALUE_TYPE_PARCELABLEARRAY = 22,
|
||||
VALUE_TYPE_SERIALIZABLE = 23,
|
||||
VALUE_TYPE_LIST = 50,
|
||||
|
||||
VALUE_TYPE_WANTPARAMS = 101,
|
||||
VALUE_TYPE_ARRAY = 102,
|
||||
VALUE_TYPE_FD = 103,
|
||||
VALUE_TYPE_REMOTE_OBJECT = 104
|
||||
};
|
||||
static bool BooleanQueryEquals(const sptr<AAFwk::IInterface> iIt);
|
||||
static bool ByteQueryEquals(const sptr<AAFwk::IInterface> iIt);
|
||||
static bool CharQueryEquals(const sptr<AAFwk::IInterface> iIt);
|
||||
static bool StringQueryEquals(const sptr<AAFwk::IInterface> iIt);
|
||||
static bool ArrayQueryEquals(const sptr<AAFwk::IInterface> iIt);
|
||||
static bool DistributedWantParamsQueryEquals(const sptr<AAFwk::IInterface> iIt);
|
||||
static bool ShortQueryEquals(const sptr<AAFwk::IInterface> iIt);
|
||||
static bool IntegerQueryEquals(const sptr<AAFwk::IInterface> iIt);
|
||||
static bool LongQueryEquals(const sptr<AAFwk::IInterface> iIt);
|
||||
static bool FloatQueryEquals(const sptr<AAFwk::IInterface> iIt);
|
||||
static bool DoubleQueryEquals(const sptr<AAFwk::IInterface> iIt);
|
||||
|
||||
bool WriteArrayToParcel(Parcel& parcel, AAFwk::IArray* ao) const;
|
||||
bool ReadArrayToParcel(Parcel& parcel, int type, sptr<AAFwk::IArray>& ao);
|
||||
@ -178,11 +166,52 @@ private:
|
||||
bool DoMarshalling(Parcel& parcel) const;
|
||||
bool ReadUnsupportedData(Parcel& parcel, const std::string& key, int type);
|
||||
|
||||
friend class DistributedWantParamWrapper;
|
||||
friend class DistributedWant;
|
||||
// inner use function
|
||||
bool NewArrayData(AAFwk::IArray* source, sptr<AAFwk::IArray>& dest);
|
||||
bool NewParams(const DistributedWantParams& source, DistributedWantParams& dest);
|
||||
|
||||
private:
|
||||
enum {
|
||||
VALUE_TYPE_NULL = -1,
|
||||
VALUE_TYPE_BOOLEAN = 1,
|
||||
VALUE_TYPE_BYTE = 2,
|
||||
VALUE_TYPE_CHAR = 3,
|
||||
VALUE_TYPE_SHORT = 4,
|
||||
VALUE_TYPE_INT = 5,
|
||||
VALUE_TYPE_LONG = 6,
|
||||
VALUE_TYPE_FLOAT = 7,
|
||||
VALUE_TYPE_DOUBLE = 8,
|
||||
VALUE_TYPE_STRING = 9,
|
||||
VALUE_TYPE_CHARSEQUENCE = 10,
|
||||
VALUE_TYPE_BOOLEANARRAY = 11,
|
||||
VALUE_TYPE_BYTEARRAY = 12,
|
||||
VALUE_TYPE_CHARARRAY = 13,
|
||||
VALUE_TYPE_SHORTARRAY = 14,
|
||||
VALUE_TYPE_INTARRAY = 15,
|
||||
VALUE_TYPE_LONGARRAY = 16,
|
||||
VALUE_TYPE_FLOATARRAY = 17,
|
||||
VALUE_TYPE_DOUBLEARRAY = 18,
|
||||
VALUE_TYPE_STRINGARRAY = 19,
|
||||
VALUE_TYPE_CHARSEQUENCEARRAY = 20,
|
||||
|
||||
VALUE_TYPE_PARCELABLE = 21,
|
||||
VALUE_TYPE_PARCELABLEARRAY = 22,
|
||||
VALUE_TYPE_SERIALIZABLE = 23,
|
||||
VALUE_TYPE_LIST = 50,
|
||||
|
||||
VALUE_TYPE_WANTPARAMS = 101,
|
||||
VALUE_TYPE_ARRAY = 102,
|
||||
VALUE_TYPE_FD = 103,
|
||||
VALUE_TYPE_REMOTE_OBJECT = 104
|
||||
};
|
||||
|
||||
friend class DistributedWantParamWrapper;
|
||||
friend class DistributedWant;
|
||||
using InterfaceQueryToStrFunc = std::string (*)(const sptr<AAFwk::IInterface> iIt);
|
||||
using InterfaceQueryEqualsFunc = bool (*)(const sptr<AAFwk::IInterface> iIt);
|
||||
static std::map<int, InterfaceQueryToStrFunc> interfaceQueryToStrMap;
|
||||
static std::map<int, InterfaceQueryEqualsFunc> interfaceQueryEqualsMap;
|
||||
|
||||
// inner use function
|
||||
std::map<std::string, sptr<AAFwk::IInterface>> params_;
|
||||
std::map<std::string, int> fds_;
|
||||
std::vector<DistributedUnsupportedData> cachedUnsupportedData_;
|
||||
|
@ -47,17 +47,18 @@ public:
|
||||
const AccountInfo& accountInfo, AppExecFwk::AbilityInfo& targetAbility);
|
||||
int32_t CheckStartPermission(const AAFwk::Want& want, const CallerInfo& callerInfo,
|
||||
const AccountInfo& accountInfo, AppExecFwk::AbilityInfo& targetAbility);
|
||||
int32_t CheckStartPermission(const AAFwk::Want& want, const CallerInfo& callerInfo,
|
||||
const AccountInfo& accountInfo, AppExecFwk::AbilityInfo& targetAbility, bool isSameBundle);
|
||||
int32_t CheckGetCallerPermission(const AAFwk::Want& want, const CallerInfo& callerInfo,
|
||||
const AccountInfo& accountInfo, AppExecFwk::AbilityInfo& targetAbility);
|
||||
bool IsFoundationCall() const;
|
||||
bool IsSceneBoardCall() const;
|
||||
int32_t CheckPermission(uint32_t accessToken, const std::string& permissionName) const;Z
|
||||
int32_t CheckPermission(uint32_t accessToken, const std::string& permissionName) const;
|
||||
int32_t CheckPermissionAll(uint32_t accessToken, const std::string& permissionName) const;
|
||||
int32_t GetAccountInfo(const std::string& remoteNetworkId, const CallerInfo& callerInfo,
|
||||
AccountInfo& accountInfo);
|
||||
bool GetTargetAbility(const AAFwk::Want& want, AppExecFwk::AbilityInfo& targetAbility,
|
||||
bool needQueryExtension = false) const;
|
||||
bool isSameAppIdOrDeveloperId(const CallerInfo &callerInfo, const AppExecFwk::AbilityInfo &targetAbility) const;
|
||||
void MarkUriPermission(OHOS::AAFwk::Want& want, uint32_t accessToken);
|
||||
void RemoveRemoteObjectFromWant(std::shared_ptr<AAFwk::Want> want) const;
|
||||
|
||||
@ -81,6 +82,8 @@ private:
|
||||
const CallerInfo& callerInfo, const AAFwk::Want& want) const;
|
||||
bool CheckStartControlPermission(const AppExecFwk::AbilityInfo& targetAbility,
|
||||
const CallerInfo& callerInfo, const AAFwk::Want& want) const;
|
||||
bool CheckStartControlPermission(const AppExecFwk::AbilityInfo& targetAbility,
|
||||
const CallerInfo& callerInfo, const AAFwk::Want& want, bool isSameBundle) const;
|
||||
bool CheckBackgroundPermission(const AppExecFwk::AbilityInfo& targetAbility,
|
||||
const CallerInfo& callerInfo, const AAFwk::Want& want, bool needCheckApiVersion) const;
|
||||
bool CheckMinApiVersion(const AppExecFwk::AbilityInfo& targetAbility, int32_t apiVersion) const;
|
||||
|
@ -41,6 +41,8 @@
|
||||
#include "mission/distributed_mission_info.h"
|
||||
#include "nocopyable.h"
|
||||
#endif
|
||||
#include "dsched_continue.h"
|
||||
#include "dsched_continue_event.h"
|
||||
#include "single_instance.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -207,6 +209,8 @@ public:
|
||||
const AccountInfo& accountInfo, int32_t extensionType) override;
|
||||
int32_t CheckTargetPermission(const OHOS::AAFwk::Want& want, const CallerInfo& callerInfo,
|
||||
const AccountInfo& accountInfo, int32_t flag, bool needQueryExtension);
|
||||
int32_t CheckTargetPermission(const OHOS::AAFwk::Want& want, const CallerInfo& callerInfo,
|
||||
const AccountInfo& accountInfo, int32_t flag, bool needQueryExtension, bool isSameBundle);
|
||||
ErrCode QueryOsAccount(int32_t& activeAccountId);
|
||||
|
||||
#ifdef DMSFWK_INTERACTIVE_ADAPTER
|
||||
|
@ -40,20 +40,18 @@ struct currentIconInfo {
|
||||
std::string bundleName;
|
||||
std::string continueType;
|
||||
|
||||
std::string sourceDeviceId_;
|
||||
std::string sourceBundleName_;
|
||||
std::string sinkBundleName_;
|
||||
|
||||
bool isEmpty()
|
||||
{
|
||||
return (this->senderNetworkId == "" && this->bundleName == "" && this->continueType == "");
|
||||
}
|
||||
|
||||
currentIconInfo(std::string source_device_id, std::string source_bundle_name,
|
||||
std::string sink_bundle_name)
|
||||
: sourceDeviceId_(std::move(source_device_id)),
|
||||
sourceBundleName_(std::move(source_bundle_name)),
|
||||
sinkBundleName_(std::move(sink_bundle_name)) {
|
||||
currentIconInfo(const std::string& source_device_id, const std::string& source_bundle_name,
|
||||
const std::string& sink_bundle_name)
|
||||
: senderNetworkId(source_device_id),
|
||||
sourceBundleName_(source_bundle_name),
|
||||
bundleName(sink_bundle_name) {
|
||||
}
|
||||
|
||||
currentIconInfo() = default;
|
||||
@ -95,19 +93,21 @@ private:
|
||||
int32_t RetryPostBroadcast(const std::string& senderNetworkId, uint16_t bundleNameId, uint8_t continueTypeId,
|
||||
const int32_t state, const int32_t retry);
|
||||
|
||||
bool GetFinalBundleName(const std::string &senderNetworkId, uint8_t continueTypeId,
|
||||
DmsBundleInfo distributedBundleInfo, std::string &finalBundleName,
|
||||
AppExecFwk::BundleInfo localBundleInfo, std::string& continueType);
|
||||
bool GetFinalBundleName(const std::string &senderNetworkId, uint8_t& continueTypeId,
|
||||
DmsBundleInfo& distributedBundleInfo, std::string &finalBundleName,
|
||||
AppExecFwk::BundleInfo& localBundleInfo, std::string& continueType);
|
||||
int32_t VerifyBroadcastSource(const std::string& senderNetworkId, const std::string& bundleName,
|
||||
const std::string& continueType, const int32_t state);
|
||||
void PostOnBroadcastBusiness(const std::string& senderNetworkId, uint16_t bundleNameId, uint8_t continueTypeId,
|
||||
const int32_t state, const int32_t delay = 0, const int32_t retry = 0);
|
||||
void FindContinueType(const DmsBundleInfo &distributedBundleInfo, uint8_t &continueTypeId,
|
||||
std::string &continueType);
|
||||
int32_t DealOnBroadcastBusiness(const std::string& senderNetworkId, uint16_t bundleNameId, uint8_t continueTypeId,
|
||||
const int32_t state, const int32_t retry = 0);
|
||||
void NotifyRecvBroadcast(const sptr<IRemoteObject>& obj, const std::string& networkId,
|
||||
const std::string& bundleName, const int32_t state, const std::string& continueType = "");
|
||||
bool continueTypeCheck(const DmsBundleInfo &distributedBundleInfo, const std::string &continueType);
|
||||
void pushLatRecvCache(currentIconInfo &lastRecvInfo);
|
||||
bool ContinueTypeCheck(const AppExecFwk::BundleInfo& bundleInfo, const std::string& continueType);
|
||||
void PushLatRecvCache(currentIconInfo &lastRecvInfo);
|
||||
private:
|
||||
currentIconInfo iconInfo_;
|
||||
sptr<DistributedMissionDiedListener> missionDiedListener_;
|
||||
|
@ -48,6 +48,7 @@ private:
|
||||
std::thread eventThread_;
|
||||
std::condition_variable eventCon_;
|
||||
std::mutex eventMutex_;
|
||||
std::mutex softbusAdapterListenerMutex_;
|
||||
std::shared_ptr<OHOS::AppExecFwk::EventHandler> eventHandler_ = nullptr;
|
||||
};
|
||||
} // namespace DistributedSchedule
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "mission/dsched_sync_e2e.h"
|
||||
#include "ipc_skeleton.h"
|
||||
#include "iservice_registry.h"
|
||||
#include "mock_form_mgr_service.h"
|
||||
#include "os_account_manager.h"
|
||||
#include "system_ability_definition.h"
|
||||
|
||||
@ -185,12 +184,12 @@ bool BundleManagerInternal::IsSameAppId(const std::string& callerAppId, const st
|
||||
return callerAppId == calleeAppId;
|
||||
}
|
||||
|
||||
bool BundleManagerInternal::IsSameDeveloperId(const std::string &callerDeveloperId,
|
||||
const std::string &targetBundleName)
|
||||
bool BundleManagerInternal::IsSameDeveloperId(const std::string &bundleNameInCurrentSide,
|
||||
const std::string &developerId4OtherSide)
|
||||
{
|
||||
if (targetBundleName.empty() || callerDeveloperId.empty()) {
|
||||
HILOGE("targetBundleName: %{public}s or callerDeveloperId: %{public}s is empty",
|
||||
targetBundleName.c_str(), GetAnonymStr(callerDeveloperId).c_str());
|
||||
if (bundleNameInCurrentSide.empty() || developerId4OtherSide.empty()) {
|
||||
HILOGE("bundleNameInCurrentSide: %{public}s or developerId4OtherSide: %{public}s is empty",
|
||||
bundleNameInCurrentSide.c_str(), developerId4OtherSide.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -206,8 +205,8 @@ bool BundleManagerInternal::IsSameDeveloperId(const std::string &callerDeveloper
|
||||
HILOGE("Get userId from active Os AccountIds fail, ret : %{public}d", ret);
|
||||
return false;
|
||||
}
|
||||
bundleMgr->GetAppProvisionInfo(targetBundleName, ids[0], targetAppProvisionInfo);
|
||||
return callerDeveloperId == targetAppProvisionInfo.developerId;
|
||||
bundleMgr->GetAppProvisionInfo(bundleNameInCurrentSide, ids[0], targetAppProvisionInfo);
|
||||
return developerId4OtherSide == targetAppProvisionInfo.developerId;
|
||||
}
|
||||
|
||||
int32_t BundleManagerInternal::GetLocalBundleInfo(const std::string& bundleName,
|
||||
@ -278,6 +277,22 @@ bool BundleManagerInternal::GetContinueBundle4Src(const std::string &srcBundleNa
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BundleManagerInternal::GetAppProvisionInfo4CurrentUser(const std::string& bundleName, const AppExecFwk::AppProvisionInfo& appProvisionInfo) {
|
||||
sptr<AppExecFwk::IBundleMgr> bundleMgr = GetBundleManager();
|
||||
if (bundleMgr == nullptr) {
|
||||
HILOGE("get bundle manager failed");
|
||||
return false;
|
||||
}
|
||||
std::vector<int32_t> ids;
|
||||
ErrCode ret = AccountSA::OsAccountManager::QueryActiveOsAccountIds(ids);
|
||||
if (ret != ERR_OK || ids.empty()) {
|
||||
HILOGE("Get userId from active Os AccountIds fail, ret : %{public}d", ret);
|
||||
return false;
|
||||
}
|
||||
uint32_t result = bundleMgr->GetAppProvisionInfo(bundleName, ids[0], appProvisionInfo);
|
||||
return result == ERR_OK;
|
||||
}
|
||||
|
||||
int32_t BundleManagerInternal::CheckRemoteBundleInfoForContinuation(const std::string& dstDeviceId,
|
||||
const std::string& bundleName, AppExecFwk::DistributedBundleInfo& remoteBundleInfo)
|
||||
{
|
||||
|
@ -650,6 +650,14 @@ int32_t DSchedContinue::PackStartCmd(std::shared_ptr<DSchedContinueStartCmd>& cm
|
||||
}
|
||||
cmd->appVersion_ = static_cast<int32_t>(localBundleInfo.versionCode);
|
||||
}
|
||||
AppExecFwk::AppProvisionInfo appProvisionInfo;
|
||||
if (subServiceType_ == CONTINUE_PULL
|
||||
&& BundleManagerInternal::GetAppProvisionInfo4CurrentUser(cmd->dstBundleName_, appProvisionInfo)) {
|
||||
cmd->dstDeveloperId_ = appProvisionInfo.developerId;
|
||||
} else if (subServiceType_ == CONTINUE_PUSH
|
||||
&& BundleManagerInternal::GetAppProvisionInfo4CurrentUser(cmd->srcBundleName_, appProvisionInfo)) {
|
||||
cmd->srcDeveloperId_ = appProvisionInfo.developerId;
|
||||
}
|
||||
cmd->wantParams_ = *wantParams;
|
||||
return ERR_OK;
|
||||
}
|
||||
@ -749,35 +757,6 @@ int32_t DSchedContinue::ExecuteContinueReply()
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
bool DSchedContinue::MakeCallerInfo(std::shared_ptr<ContinueAbilityData> data, CallerInfo &callerInfo)
|
||||
{
|
||||
callerInfo.sourceDeviceId = continueInfo_.sourceDeviceId_;
|
||||
callerInfo.uid = data->callerUid;
|
||||
callerInfo.accessToken = data->accessToken;
|
||||
callerInfo.callerBundleName = continueInfo_.sinkBundleName_;
|
||||
callerInfo.extraInfoJson[DMS_VERSION_ID] = DMS_VERSION;
|
||||
|
||||
sptr<AppExecFwk::IBundleMgr> bundleMgr = BundleManagerInternal::GetBundleManager();
|
||||
if (bundleMgr == nullptr) {
|
||||
HILOGE("get bundle manager failed");
|
||||
return false;
|
||||
}
|
||||
AppExecFwk::AppProvisionInfo appProvisionInfo;
|
||||
std::vector<int32_t> ids;
|
||||
ErrCode ret = AccountSA::OsAccountManager::QueryActiveOsAccountIds(ids);
|
||||
if (ret != ERR_OK || ids.empty()) {
|
||||
HILOGE("Get userId from active Os AccountIds fail, ret : %{public}d", ret);
|
||||
return false;
|
||||
}
|
||||
uint32_t result = bundleMgr->GetAppProvisionInfo(continueInfo_.sinkBundleName_, ids[0], appProvisionInfo);
|
||||
if(result != ERR_OK) {
|
||||
HILOGE("get app provision info failed for bundle name:%{public}s", continueInfo_.sinkBundleName_.c_str());
|
||||
return false;
|
||||
}
|
||||
callerInfo.callerDeveloperId = appProvisionInfo.developerId;
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t DSchedContinue::ExecuteContinueSend(std::shared_ptr<ContinueAbilityData> data)
|
||||
{
|
||||
HILOGI("ExecuteContinueSend start, continueInfo: %{public}s", continueInfo_.toString().c_str());
|
||||
@ -801,9 +780,9 @@ int32_t DSchedContinue::ExecuteContinueSend(std::shared_ptr<ContinueAbilityData>
|
||||
|
||||
AppExecFwk::AbilityInfo abilityInfo;
|
||||
CallerInfo callerInfo;
|
||||
if (!MakeCallerInfo(data, callerInfo)) {
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
callerInfo.sourceDeviceId = continueInfo_.sourceDeviceId_;
|
||||
callerInfo.uid = data->callerUid;
|
||||
callerInfo.accessToken = data->accessToken;
|
||||
if (!BundleManagerInternal::GetCallerAppIdFromBms(callerInfo.uid, callerInfo.callerAppId)) {
|
||||
HILOGE("GetCallerAppIdFromBms failed");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
@ -812,6 +791,7 @@ int32_t DSchedContinue::ExecuteContinueSend(std::shared_ptr<ContinueAbilityData>
|
||||
HILOGE("GetBundleNameListFromBms failed");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
callerInfo.extraInfoJson[DMS_VERSION_ID] = DMS_VERSION;
|
||||
AccountInfo accountInfo;
|
||||
int32_t ret = DistributedSchedPermission::GetInstance().GetAccountInfo(continueInfo_.sinkDeviceId_, callerInfo,
|
||||
accountInfo);
|
||||
@ -856,7 +836,6 @@ int32_t DSchedContinue::SetWantForContinuation(AAFwk::Want& newWant)
|
||||
{
|
||||
newWant.SetParam("sessionId", continueInfo_.missionId_);
|
||||
newWant.SetParam("deviceId", continueInfo_.sourceDeviceId_);
|
||||
newWant.SetBundle(continueInfo_.sourceBundleName_);
|
||||
|
||||
AppExecFwk::BundleInfo localBundleInfo;
|
||||
if (BundleManagerInternal::GetLocalBundleInfo(newWant.GetBundle(), localBundleInfo) != ERR_OK) {
|
||||
@ -871,7 +850,7 @@ int32_t DSchedContinue::SetWantForContinuation(AAFwk::Want& newWant)
|
||||
if (!isPageStackContinue && !moduleName.empty() && moduleName.length() <= MAX_MODULENAME_LEN) {
|
||||
HILOGD("set application moduleName = %{public}s!", moduleName.c_str());
|
||||
auto element = newWant.GetElement();
|
||||
newWant.SetElementName(element.GetDeviceID(), element.GetBundleName(), element.GetAbilityName(), moduleName);
|
||||
newWant.SetElementName(element.GetDeviceID(), continueInfo_.sinkBundleName_, element.GetAbilityName(), moduleName);
|
||||
}
|
||||
|
||||
std::string saveDataTime =
|
||||
@ -934,10 +913,19 @@ int32_t DSchedContinue::ExecuteContinueData(std::shared_ptr<DSchedContinueDataCm
|
||||
HILOGE("check deviceId failed");
|
||||
return INVALID_REMOTE_PARAMETERS_ERR;
|
||||
}
|
||||
|
||||
int32_t ret = DistributedSchedService::GetInstance().CheckTargetPermission(cmd->want_, cmd->callerInfo_,
|
||||
int32_t ret;
|
||||
bool permissionCheckResult;
|
||||
if(cmd->srcBundleName_ == cmd->dstBundleName_) {
|
||||
ret = DistributedSchedService::GetInstance().CheckTargetPermission(cmd->want_, cmd->callerInfo_,
|
||||
cmd->accountInfo_, START_PERMISSION, true);
|
||||
if (ret != ERR_OK) {
|
||||
permissionCheckResult = ret == ERR_OK;
|
||||
}else {
|
||||
ret = DistributedSchedService::GetInstance().CheckTargetPermission(cmd->want_, cmd->callerInfo_,
|
||||
cmd->accountInfo_, START_PERMISSION, true, false);
|
||||
permissionCheckResult = ret == ERR_OK && BundleManagerInternal::IsSameDeveloperId(cmd->srcBundleName_, cmd->dstDeveloperId_);
|
||||
}
|
||||
|
||||
if (!permissionCheckResult) {
|
||||
HILOGE("ExecuteContinueData CheckTargetPermission failed!");
|
||||
return ret;
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ void DSchedContinueManager::HandleContinueMission(const std::string& srcDeviceId
|
||||
return;
|
||||
}
|
||||
|
||||
bool DSchedContinueManager::getFirstBundleName(DSchedContinueInfo &info, std::string &firstBundleNamme,
|
||||
bool DSchedContinueManager::GetFirstBundleName(DSchedContinueInfo &info, std::string &firstBundleName,
|
||||
std::string bundleName, std::string deviceId) {
|
||||
uint16_t bundleNameId;
|
||||
DmsBundleInfo distributedBundleInfo;
|
||||
@ -259,12 +259,12 @@ bool DSchedContinueManager::getFirstBundleName(DSchedContinueInfo &info, std::st
|
||||
std::vector<std::string> abilityContinueTypes = ability.continueType;
|
||||
for (std::string &ability_continue_type: abilityContinueTypes) {
|
||||
if (ability_continue_type == info.continueType_ && !ability.continueBundleName.empty()) {
|
||||
firstBundleNamme = *ability.continueBundleName.begin();
|
||||
firstBundleName = *ability.continueBundleName.begin();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
HILOGE("caon not get abilicy info or continue bundle names is empty for continue type:%{public}s",
|
||||
HILOGE("can not get abilicy info or continue bundle names is empty for continue type:%{public}s",
|
||||
info.continueType_.c_str());
|
||||
return false;
|
||||
}
|
||||
@ -272,11 +272,11 @@ bool DSchedContinueManager::getFirstBundleName(DSchedContinueInfo &info, std::st
|
||||
void DSchedContinueManager::CompleteBundleName(DSchedContinueInfo &info, int32_t direction, int32_t &subType) {
|
||||
if (direction == CONTINUE_SOURCE) {
|
||||
cntSource_++;
|
||||
std::string firstBundleNamme;
|
||||
std::string firstBundleName;
|
||||
std::string bundleName = info.sourceBundleName_;
|
||||
std::string deviceId = info.sourceDeviceId_;
|
||||
if (getFirstBundleName(info, firstBundleNamme, bundleName, deviceId)) {
|
||||
info.sinkBundleName_ = firstBundleNamme;
|
||||
if (GetFirstBundleName(info, firstBundleName, bundleName, deviceId)) {
|
||||
info.sinkBundleName_ = firstBundleName;
|
||||
}
|
||||
} else {
|
||||
cntSink_++;
|
||||
@ -285,7 +285,7 @@ void DSchedContinueManager::CompleteBundleName(DSchedContinueInfo &info, int32_t
|
||||
std::string sourceBundleName;
|
||||
std::vector<currentIconInfo>::iterator recvInfoEndItr = lastRecvList.end();
|
||||
while (recvInfoEndItr != lastRecvList.begin()) {
|
||||
if (recvInfoEndItr->sourceDeviceId_ == info.sourceDeviceId_ && recvInfoEndItr->sinkBundleName_ == info.
|
||||
if (recvInfoEndItr->senderNetworkId == info.sourceDeviceId_ && recvInfoEndItr->bundleName == info.
|
||||
sinkBundleName_) {
|
||||
sourceBundleName = recvInfoEndItr->sourceBundleName_;
|
||||
break;
|
||||
@ -293,10 +293,11 @@ void DSchedContinueManager::CompleteBundleName(DSchedContinueInfo &info, int32_t
|
||||
recvInfoEndItr--;
|
||||
}
|
||||
if (sourceBundleName.empty()) {
|
||||
HILOGW("current sub type is continue pull; but can not get source bundle name from recv cache.");
|
||||
std::string firstBundleNamme;
|
||||
std::string bundleName = info.sinkBundleName_;
|
||||
std::string deviceId = info.sinkDeviceId_;
|
||||
if (getFirstBundleName(info, firstBundleNamme, bundleName, deviceId)) {
|
||||
if (GetFirstBundleName(info, firstBundleNamme, bundleName, deviceId)) {
|
||||
sourceBundleName = firstBundleNamme;
|
||||
}
|
||||
}
|
||||
@ -450,9 +451,13 @@ std::shared_ptr<DSchedContinue> DSchedContinueManager::GetDSchedContinueByWant(
|
||||
return nullptr;
|
||||
}
|
||||
for (auto iter = continues_.begin(); iter != continues_.end(); iter++) {
|
||||
if (iter->second != nullptr && srcDeviceId == iter->second->GetContinueInfo().sourceDeviceId_
|
||||
&& bundleName == iter->second->GetContinueInfo().sourceBundleName_
|
||||
&& dstDeviceId == iter->second->GetContinueInfo().sinkDeviceId_) {
|
||||
if(iter->second == nullptr) {
|
||||
continue;
|
||||
}
|
||||
DSchedContinueInfo continueInfo = iter->second->GetContinueInfo();
|
||||
if (srcDeviceId == continueInfo.sourceDeviceId_
|
||||
&& bundleName == continueInfo.sourceBundleName_
|
||||
&& dstDeviceId == continueInfo.sinkDeviceId_) {
|
||||
return iter->second;
|
||||
}
|
||||
}
|
||||
|
@ -69,8 +69,8 @@ int32_t DSchedContinueDataState::DoContinueDataTask(std::shared_ptr<DSchedContin
|
||||
HILOGE("dContinue or event is null");
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
std::shard_ptr<DSchedContinueDataCmd> syncContinueData = event->GetSharedObject<DSchedContinueDataCmd>();
|
||||
syncContinueData->want_.SetBundle(syncContinueData->dstBundleName_);
|
||||
// todo: 这里在构造cmd的时候,对bundleName进行了设置,测试一下是否能够带过来
|
||||
auto syncContinueData = event->GetSharedObject<DSchedContinueDataCmd>();
|
||||
int32_t ret = dContinue->ExecuteContinueData(syncContinueData);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("DSchedContinueAbilityState ExecuteContinueSend failed, ret: %{public}d", ret);
|
||||
|
@ -194,7 +194,7 @@ DmsDumperInfo DmsContinueTime::GetDstInfo()
|
||||
void DmsContinueTime::SetDurationBegin(const int32_t idx, const int64_t time)
|
||||
{
|
||||
std::lock_guard<std::mutex> vecLock(infoMutex_);
|
||||
if (durationInfo_.empty() || durationInfo_.size() <= idx) {
|
||||
if (durationInfo_.empty() || durationInfo_.size() <= static_cast<size_t>(idx)) {
|
||||
return;
|
||||
}
|
||||
durationInfo_[idx].SetBeginTime(time);
|
||||
@ -203,7 +203,7 @@ void DmsContinueTime::SetDurationBegin(const int32_t idx, const int64_t time)
|
||||
void DmsContinueTime::SetDurationEnd(const int32_t idx, const int64_t time)
|
||||
{
|
||||
std::lock_guard<std::mutex> vecLock(infoMutex_);
|
||||
if (durationInfo_.empty() || durationInfo_.size() <= idx) {
|
||||
if (durationInfo_.empty() || durationInfo_.size() <= static_cast<size_t>(idx)) {
|
||||
return;
|
||||
}
|
||||
durationInfo_[idx].SetEndTime(time);
|
||||
@ -212,7 +212,7 @@ void DmsContinueTime::SetDurationEnd(const int32_t idx, const int64_t time)
|
||||
void DmsContinueTime::SetDurationStrTime(const int32_t idx, const std::string info)
|
||||
{
|
||||
std::lock_guard<std::mutex> vecLock(infoMutex_);
|
||||
if (durationInfo_.empty() || durationInfo_.size() <= idx) {
|
||||
if (durationInfo_.empty() || durationInfo_.size() <= static_cast<size_t>(idx)) {
|
||||
return;
|
||||
}
|
||||
durationInfo_[idx].SetStrTime(info);
|
||||
|
@ -44,6 +44,57 @@ const char* TYPE_PROPERTY = "type";
|
||||
const char* VALUE_PROPERTY = "value";
|
||||
const std::string TAG = "DistributedUnsupportedData";
|
||||
}
|
||||
|
||||
std::map<int, DistributedWantParams::InterfaceQueryToStrFunc> DistributedWantParams::interfaceQueryToStrMap = {
|
||||
std::map<int, DistributedWantParams::InterfaceQueryToStrFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_BOOLEAN, &DistributedWantParams::BooleanQueryToStr),
|
||||
std::map<int, DistributedWantParams::InterfaceQueryToStrFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_BYTE, &DistributedWantParams::ByteQueryToStr),
|
||||
std::map<int, DistributedWantParams::InterfaceQueryToStrFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_CHAR, &DistributedWantParams::CharQueryToStr),
|
||||
std::map<int, DistributedWantParams::InterfaceQueryToStrFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_SHORT, &DistributedWantParams::ShortQueryToStr),
|
||||
std::map<int, DistributedWantParams::InterfaceQueryToStrFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_INT, &DistributedWantParams::IntegerQueryToStr),
|
||||
std::map<int, DistributedWantParams::InterfaceQueryToStrFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_LONG, &DistributedWantParams::LongQueryToStr),
|
||||
std::map<int, DistributedWantParams::InterfaceQueryToStrFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_FLOAT, &DistributedWantParams::FloatQueryToStr),
|
||||
std::map<int, DistributedWantParams::InterfaceQueryToStrFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_DOUBLE, &DistributedWantParams::DoubleQueryToStr),
|
||||
std::map<int, DistributedWantParams::InterfaceQueryToStrFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_STRING, &DistributedWantParams::StringQueryToStr),
|
||||
std::map<int, DistributedWantParams::InterfaceQueryToStrFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_ARRAY, &DistributedWantParams::ArrayQueryToStr),
|
||||
std::map<int, DistributedWantParams::InterfaceQueryToStrFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_WANTPARAMS, &DistributedWantParams::DistributedWantParamsQueryToStr),
|
||||
};
|
||||
|
||||
std::map<int, DistributedWantParams::InterfaceQueryEqualsFunc> DistributedWantParams::interfaceQueryEqualsMap = {
|
||||
std::map<int, DistributedWantParams::InterfaceQueryEqualsFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_BOOLEAN, &DistributedWantParams::BooleanQueryEquals),
|
||||
std::map<int, DistributedWantParams::InterfaceQueryEqualsFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_BYTE, &DistributedWantParams::ByteQueryEquals),
|
||||
std::map<int, DistributedWantParams::InterfaceQueryEqualsFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_CHAR, &DistributedWantParams::CharQueryEquals),
|
||||
std::map<int, DistributedWantParams::InterfaceQueryEqualsFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_STRING, &DistributedWantParams::StringQueryEquals),
|
||||
std::map<int, DistributedWantParams::InterfaceQueryEqualsFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_ARRAY, &DistributedWantParams::ArrayQueryEquals),
|
||||
std::map<int, DistributedWantParams::InterfaceQueryEqualsFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_WANTPARAMS, &DistributedWantParams::DistributedWantParamsQueryEquals),
|
||||
std::map<int, DistributedWantParams::InterfaceQueryEqualsFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_SHORT, &DistributedWantParams::ShortQueryEquals),
|
||||
std::map<int, DistributedWantParams::InterfaceQueryEqualsFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_INT, &DistributedWantParams::IntegerQueryEquals),
|
||||
std::map<int, DistributedWantParams::InterfaceQueryEqualsFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_LONG, &DistributedWantParams::LongQueryEquals),
|
||||
std::map<int, DistributedWantParams::InterfaceQueryEqualsFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_FLOAT, &DistributedWantParams::FloatQueryEquals),
|
||||
std::map<int, DistributedWantParams::InterfaceQueryEqualsFunc>::value_type(
|
||||
DistributedWantParams::VALUE_TYPE_DOUBLE, &DistributedWantParams::DoubleQueryEquals),
|
||||
};
|
||||
|
||||
DistributedUnsupportedData::~DistributedUnsupportedData()
|
||||
{
|
||||
if (buffer != nullptr) {
|
||||
@ -114,36 +165,144 @@ DistributedUnsupportedData& DistributedUnsupportedData::operator=(DistributedUns
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::string DistributedWantParams::BooleanQueryToStr(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
AAFwk::IBoolean* obj = AAFwk::IBoolean::Query(iIt);
|
||||
return obj == nullptr ? "" : static_cast<AAFwk::Boolean*>(obj)->ToString();
|
||||
}
|
||||
|
||||
std::string DistributedWantParams::ByteQueryToStr(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
AAFwk::IByte* obj = AAFwk::IByte::Query(iIt);
|
||||
return obj == nullptr ? "" : static_cast<AAFwk::Byte*>(obj)->ToString();
|
||||
}
|
||||
|
||||
std::string DistributedWantParams::CharQueryToStr(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
AAFwk::IChar* obj = AAFwk::IChar::Query(iIt);
|
||||
return obj == nullptr ? "" : static_cast<AAFwk::Char*>(obj)->ToString();
|
||||
}
|
||||
|
||||
std::string DistributedWantParams::ShortQueryToStr(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
AAFwk::IShort* obj = AAFwk::IShort::Query(iIt);
|
||||
return obj == nullptr ? "" : static_cast<AAFwk::Short*>(obj)->ToString();
|
||||
}
|
||||
|
||||
std::string DistributedWantParams::IntegerQueryToStr(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
AAFwk::IInteger* obj = AAFwk::IInteger::Query(iIt);
|
||||
return obj == nullptr ? "" : static_cast<AAFwk::Integer*>(obj)->ToString();
|
||||
}
|
||||
|
||||
std::string DistributedWantParams::LongQueryToStr(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
AAFwk::ILong* obj = AAFwk::ILong::Query(iIt);
|
||||
return obj == nullptr ? "" : static_cast<AAFwk::Long*>(obj)->ToString();
|
||||
}
|
||||
|
||||
std::string DistributedWantParams::FloatQueryToStr(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
AAFwk::IFloat* obj = AAFwk::IFloat::Query(iIt);
|
||||
return obj == nullptr ? "" : static_cast<AAFwk::Float*>(obj)->ToString();
|
||||
}
|
||||
|
||||
std::string DistributedWantParams::DoubleQueryToStr(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
AAFwk::IDouble* obj = AAFwk::IDouble::Query(iIt);
|
||||
return obj == nullptr ? "" : static_cast<AAFwk::Double*>(obj)->ToString();
|
||||
}
|
||||
|
||||
std::string DistributedWantParams::StringQueryToStr(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
AAFwk::IString* obj = AAFwk::IString::Query(iIt);
|
||||
return obj == nullptr ? "" : static_cast<AAFwk::String*>(obj)->ToString();
|
||||
}
|
||||
|
||||
std::string DistributedWantParams::ArrayQueryToStr(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
AAFwk::IArray* obj = AAFwk::IArray::Query(iIt);
|
||||
return obj == nullptr ? "" : static_cast<AAFwk::Array*>(obj)->ToString();
|
||||
}
|
||||
|
||||
std::string DistributedWantParams::DistributedWantParamsQueryToStr(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
IDistributedWantParams* obj = IDistributedWantParams::Query(iIt);
|
||||
return obj == nullptr ? "" : static_cast<DistributedWantParamWrapper*>(obj)->ToString();
|
||||
}
|
||||
|
||||
bool DistributedWantParams::BooleanQueryEquals(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
AAFwk::IBoolean* obj = AAFwk::IBoolean::Query(iIt);
|
||||
return obj == nullptr ? false : static_cast<AAFwk::Boolean*>(obj)->Equals(*static_cast<AAFwk::Boolean*>(obj));
|
||||
}
|
||||
|
||||
bool DistributedWantParams::ByteQueryEquals(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
AAFwk::IByte* obj = AAFwk::IByte::Query(iIt);
|
||||
return obj == nullptr ? false : static_cast<AAFwk::Byte*>(obj)->Equals(*static_cast<AAFwk::Byte*>(obj));
|
||||
}
|
||||
|
||||
bool DistributedWantParams::CharQueryEquals(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
AAFwk::IChar* obj = AAFwk::IChar::Query(iIt);
|
||||
return obj == nullptr ? false : static_cast<AAFwk::Char*>(obj)->Equals(*static_cast<AAFwk::Char*>(obj));
|
||||
}
|
||||
|
||||
bool DistributedWantParams::StringQueryEquals(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
AAFwk::IString* obj = AAFwk::IString::Query(iIt);
|
||||
return obj == nullptr ? false : static_cast<AAFwk::String*>(obj)->Equals(*static_cast<AAFwk::String*>(obj));
|
||||
}
|
||||
|
||||
bool DistributedWantParams::ArrayQueryEquals(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
AAFwk::IArray* obj = AAFwk::IArray::Query(iIt);
|
||||
return obj == nullptr ? false : static_cast<AAFwk::Array*>(obj)->Equals(*static_cast<AAFwk::Array*>(obj));
|
||||
}
|
||||
|
||||
bool DistributedWantParams::DistributedWantParamsQueryEquals(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
IDistributedWantParams* obj = IDistributedWantParams::Query(iIt);
|
||||
return obj == nullptr ? false : static_cast<DistributedWantParamWrapper*>(obj)
|
||||
->Equals(*static_cast<DistributedWantParamWrapper*>(obj));
|
||||
}
|
||||
bool DistributedWantParams::ShortQueryEquals(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
AAFwk::IShort* obj = AAFwk::IShort::Query(iIt);
|
||||
return obj == nullptr ? false : static_cast<AAFwk::Short*>(obj)->Equals(*static_cast<AAFwk::Short*>(obj));
|
||||
}
|
||||
|
||||
bool DistributedWantParams::IntegerQueryEquals(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
AAFwk::IInteger* obj = AAFwk::IInteger::Query(iIt);
|
||||
return obj == nullptr ? false : static_cast<AAFwk::Integer*>(obj)->Equals(*static_cast<AAFwk::Integer*>(obj));
|
||||
}
|
||||
|
||||
bool DistributedWantParams::LongQueryEquals(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
AAFwk::ILong* obj = AAFwk::ILong::Query(iIt);
|
||||
return obj == nullptr ? false : static_cast<AAFwk::Long*>(obj)->Equals(*static_cast<AAFwk::Long*>(obj));
|
||||
}
|
||||
|
||||
bool DistributedWantParams::FloatQueryEquals(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
AAFwk::IFloat* obj = AAFwk::IFloat::Query(iIt);
|
||||
return obj == nullptr ? false : static_cast<AAFwk::Float*>(obj)->Equals(*static_cast<AAFwk::Float*>(obj));
|
||||
}
|
||||
|
||||
bool DistributedWantParams::DoubleQueryEquals(const sptr<AAFwk::IInterface> iIt)
|
||||
{
|
||||
AAFwk::IDouble* obj = AAFwk::IDouble::Query(iIt);
|
||||
return obj == nullptr ? false : static_cast<AAFwk::Double*>(obj)->Equals(*static_cast<AAFwk::Double*>(obj));
|
||||
}
|
||||
|
||||
std::string DistributedWantParams::GetStringByType(const sptr<AAFwk::IInterface> iIt, int typeId)
|
||||
{
|
||||
if (iIt == nullptr) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (typeId == VALUE_TYPE_BOOLEAN) {
|
||||
return static_cast<AAFwk::Boolean*>(AAFwk::IBoolean::Query(iIt))->ToString();
|
||||
} else if (typeId == VALUE_TYPE_BYTE) {
|
||||
return static_cast<AAFwk::Byte*>(AAFwk::IByte::Query(iIt))->ToString();
|
||||
} else if (typeId == VALUE_TYPE_CHAR) {
|
||||
return static_cast<AAFwk::Char*>(AAFwk::IChar::Query(iIt))->ToString();
|
||||
} else if (typeId == VALUE_TYPE_SHORT) {
|
||||
return static_cast<AAFwk::Short*>(AAFwk::IShort::Query(iIt))->ToString();
|
||||
} else if (typeId == VALUE_TYPE_INT) {
|
||||
return static_cast<AAFwk::Integer*>(AAFwk::IInteger::Query(iIt))->ToString();
|
||||
} else if (typeId == VALUE_TYPE_LONG) {
|
||||
return static_cast<AAFwk::Long*>(AAFwk::ILong::Query(iIt))->ToString();
|
||||
} else if (typeId == VALUE_TYPE_FLOAT) {
|
||||
return static_cast<AAFwk::Float*>(AAFwk::IFloat::Query(iIt))->ToString();
|
||||
} else if (typeId == VALUE_TYPE_DOUBLE) {
|
||||
return static_cast<AAFwk::Double*>(AAFwk::IDouble::Query(iIt))->ToString();
|
||||
} else if (typeId == VALUE_TYPE_STRING) {
|
||||
return static_cast<AAFwk::String*>(AAFwk::IString::Query(iIt))->ToString();
|
||||
} else if (typeId == VALUE_TYPE_ARRAY) {
|
||||
return static_cast<AAFwk::Array*>(AAFwk::IArray::Query(iIt))->ToString();
|
||||
} else if (typeId == VALUE_TYPE_WANTPARAMS) {
|
||||
return static_cast<DistributedWantParamWrapper*>(IDistributedWantParams::Query(iIt))->ToString();
|
||||
} else {
|
||||
return "";
|
||||
auto iter = interfaceQueryToStrMap.find(typeId);
|
||||
if (iter != interfaceQueryToStrMap.end()) {
|
||||
DistributedWantParams::InterfaceQueryToStrFunc &func = iter->second;
|
||||
return (*func)(iIt);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@ -315,74 +474,13 @@ sptr<IInterface> DistributedWantParams::GetInterfaceByType(int typeId, const std
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool DistributedWantParams::CompareNumberInterface(const sptr<IInterface> iIt1,
|
||||
const sptr<IInterface> iIt2, int typeId)
|
||||
{
|
||||
if (iIt1 == nullptr) {
|
||||
return false;
|
||||
}
|
||||
bool flag = false;
|
||||
switch (typeId) {
|
||||
case VALUE_TYPE_SHORT:
|
||||
flag = static_cast<AAFwk::Short*>(AAFwk::IShort::Query(iIt1))
|
||||
->Equals(*(static_cast<AAFwk::Short*>(AAFwk::IShort::Query(iIt1))));
|
||||
break;
|
||||
case VALUE_TYPE_INT:
|
||||
flag = static_cast<AAFwk::Integer*>(AAFwk::IInteger::Query(iIt1))
|
||||
->Equals(*(static_cast<AAFwk::Integer*>(AAFwk::IInteger::Query(iIt1))));
|
||||
break;
|
||||
case VALUE_TYPE_LONG:
|
||||
flag = static_cast<AAFwk::Long*>(AAFwk::ILong::Query(iIt1))
|
||||
->Equals(*(static_cast<AAFwk::Long*>(AAFwk::ILong::Query(iIt1))));
|
||||
break;
|
||||
case VALUE_TYPE_FLOAT:
|
||||
flag = static_cast<AAFwk::Float*>(AAFwk::IFloat::Query(iIt1))
|
||||
->Equals(*(static_cast<AAFwk::Float*>(AAFwk::IFloat::Query(iIt1))));
|
||||
break;
|
||||
case VALUE_TYPE_DOUBLE:
|
||||
flag = static_cast<AAFwk::Double*>(AAFwk::IDouble::Query(iIt1))
|
||||
->Equals(*(static_cast<AAFwk::Double*>(AAFwk::IDouble::Query(iIt1))));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
bool DistributedWantParams::CompareInterface(const sptr<IInterface> iIt1, const sptr<IInterface> iIt2, int typeId)
|
||||
{
|
||||
if (iIt1 == nullptr) {
|
||||
return false;
|
||||
}
|
||||
bool flag = false;
|
||||
switch (typeId) {
|
||||
case VALUE_TYPE_BOOLEAN:
|
||||
flag = static_cast<AAFwk::Boolean*>(AAFwk::IBoolean::Query(iIt1))
|
||||
->Equals(*(static_cast<AAFwk::Boolean*>(AAFwk::IBoolean::Query(iIt1))));
|
||||
break;
|
||||
case VALUE_TYPE_BYTE:
|
||||
flag = static_cast<AAFwk::Byte*>(AAFwk::IByte::Query(iIt1))
|
||||
->Equals(*(static_cast<AAFwk::Byte*>(AAFwk::IByte::Query(iIt1))));
|
||||
break;
|
||||
case VALUE_TYPE_CHAR:
|
||||
flag = static_cast<AAFwk::Char*>(AAFwk::IChar::Query(iIt1))
|
||||
->Equals(*(static_cast<AAFwk::Char*>(AAFwk::IChar::Query(iIt1))));
|
||||
break;
|
||||
case VALUE_TYPE_STRING:
|
||||
flag = static_cast<AAFwk::String*>(AAFwk::IString::Query(iIt1))
|
||||
->Equals(*(static_cast<AAFwk::String*>(AAFwk::IString::Query(iIt1))));
|
||||
break;
|
||||
case VALUE_TYPE_ARRAY:
|
||||
flag = static_cast<AAFwk::Array*>(AAFwk::IArray::Query(iIt1))
|
||||
->Equals(*(static_cast<AAFwk::Array*>(AAFwk::IArray::Query(iIt1))));
|
||||
break;
|
||||
case VALUE_TYPE_WANTPARAMS:
|
||||
flag = static_cast<DistributedWantParamWrapper*>(IDistributedWantParams::Query(iIt1))
|
||||
->Equals(*(static_cast<DistributedWantParamWrapper*>(IDistributedWantParams::Query(iIt1))));
|
||||
break;
|
||||
default:
|
||||
flag = CompareNumberInterface(iIt1, iIt2, typeId);
|
||||
break;
|
||||
auto iter = interfaceQueryEqualsMap.find(typeId);
|
||||
if (iter != interfaceQueryEqualsMap.end()) {
|
||||
DistributedWantParams::InterfaceQueryEqualsFunc &func = iter->second;
|
||||
return (*func)(iIt1);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
@ -475,11 +573,12 @@ bool DistributedWantParams::WriteToParcelWantParams(Parcel& parcel, sptr<IInterf
|
||||
if (!parcel.WriteInt32(VALUE_TYPE_WANTPARAMS)) {
|
||||
return false;
|
||||
}
|
||||
if (o == nullptr) {
|
||||
|
||||
auto wantParams = static_cast<DistributedWantParamWrapper*>(IDistributedWantParams::Query(o));
|
||||
if (wantParams == nullptr) {
|
||||
return false;
|
||||
}
|
||||
return parcel.WriteString16(Str8ToStr16(
|
||||
static_cast<DistributedWantParamWrapper*>(IDistributedWantParams::Query(o))->ToString()));
|
||||
return parcel.WriteString16(Str8ToStr16(wantParams->ToString()));
|
||||
}
|
||||
|
||||
bool DistributedWantParams::WriteToParcelFD(Parcel& parcel, const DistributedWantParams& value) const
|
||||
|
@ -126,6 +126,12 @@ int32_t DistributedSchedPermission::CheckSendResultPermission(const AAFwk::Want&
|
||||
|
||||
int32_t DistributedSchedPermission::CheckStartPermission(const AAFwk::Want& want, const CallerInfo& callerInfo,
|
||||
const AccountInfo& accountInfo, AppExecFwk::AbilityInfo& targetAbility)
|
||||
{
|
||||
return CheckStartPermission(want, callerInfo, accountInfo, targetAbility, true);
|
||||
}
|
||||
|
||||
int32_t DistributedSchedPermission::CheckStartPermission(const AAFwk::Want& want, const CallerInfo& callerInfo,
|
||||
const AccountInfo& accountInfo, AppExecFwk::AbilityInfo& targetAbility, bool isSameBundle)
|
||||
{
|
||||
// 1.check account access permission in no account networking environment.
|
||||
if (!CheckAccountAccessPermission(callerInfo, accountInfo, targetAbility.bundleName)) {
|
||||
@ -335,22 +341,6 @@ bool DistributedSchedPermission::GetTargetAbility(const AAFwk::Want& want,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DistributedSchedPermission::isSameAppIdOrDeveloperId(const CallerInfo &callerInfo,
|
||||
const AppExecFwk::AbilityInfo &targetAbility) const
|
||||
{
|
||||
HILOGI("check appId target bundle name: %{public}s, caller bundle name: %{public}s",
|
||||
targetAbility.bundleName.c_str(), callerInfo.callerBundleName.c_str());
|
||||
if (targetAbility.bundleName == callerInfo.callerBundleName &&
|
||||
BundleManagerInternal::IsSameAppId(callerInfo.callerAppId, targetAbility.bundleName)) {
|
||||
return true;
|
||||
}
|
||||
if (targetAbility.bundleName != callerInfo.callerBundleName &&
|
||||
BundleManagerInternal::IsSameDeveloperId(callerInfo.callerDeveloperId, targetAbility.bundleName)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t DistributedSchedPermission::CheckGetCallerPermission(const AAFwk::Want& want, const CallerInfo& callerInfo,
|
||||
const AccountInfo& accountInfo, AppExecFwk::AbilityInfo& targetAbility)
|
||||
{
|
||||
@ -360,8 +350,8 @@ int32_t DistributedSchedPermission::CheckGetCallerPermission(const AAFwk::Want&
|
||||
return DMS_ACCOUNT_ACCESS_PERMISSION_DENIED;
|
||||
}
|
||||
// 2. check call with same appid
|
||||
if (!isSameAppIdOrDeveloperId(callerInfo, targetAbility)) {
|
||||
return CALL_PERMISSION_DENIED;
|
||||
if (!BundleManagerInternal::IsSameAppId(callerInfo.callerAppId, targetAbility.bundleName)) {
|
||||
HILOGE("the appId is different, check permission denied!");
|
||||
}
|
||||
|
||||
// 3. check background permission
|
||||
@ -559,6 +549,12 @@ bool DistributedSchedPermission::CheckComponentAccessPermission(const AppExecFwk
|
||||
|
||||
bool DistributedSchedPermission::CheckMigrateStartCtrlPer(const AppExecFwk::AbilityInfo& targetAbility,
|
||||
const CallerInfo& callerInfo, const AAFwk::Want& want) const
|
||||
{
|
||||
return CheckMigrateStartCtrlPer(targetAbility, callerInfo, want, true);
|
||||
}
|
||||
|
||||
bool DistributedSchedPermission::CheckMigrateStartCtrlPer(const AppExecFwk::AbilityInfo& targetAbility,
|
||||
const CallerInfo& callerInfo, const AAFwk::Want& want, bool isSameBundle) const
|
||||
{
|
||||
std::string bundleName = want.GetBundle();
|
||||
if (!CheckBundleContinueConfig(bundleName)) {
|
||||
@ -573,11 +569,15 @@ bool DistributedSchedPermission::CheckMigrateStartCtrlPer(const AppExecFwk::Abil
|
||||
HILOGE("check device security level failed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isSameAppIdOrDeveloperId(callerInfo, targetAbility)) {
|
||||
return false;
|
||||
}
|
||||
if(!isSameBundle) {
|
||||
return true;
|
||||
}
|
||||
if (BundleManagerInternal::IsSameAppId(callerInfo.callerAppId, targetAbility.bundleName)) {
|
||||
HILOGD("the appId is the same, check migration start control permission success!");
|
||||
return true;
|
||||
}
|
||||
HILOGE("the appId is different in the migration scenario, permission denied!");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DistributedSchedPermission::CheckCollaborateStartCtrlPer(const AppExecFwk::AbilityInfo& targetAbility,
|
||||
@ -596,8 +596,8 @@ bool DistributedSchedPermission::CheckCollaborateStartCtrlPer(const AppExecFwk::
|
||||
return false;
|
||||
}
|
||||
// 3. check start or connect ability with same appid
|
||||
if (isSameAppIdOrDeveloperId(callerInfo, targetAbility)) {
|
||||
return true;
|
||||
if (BundleManagerInternal::IsSameAppId(callerInfo.callerAppId, targetAbility.bundleName)) {
|
||||
HILOGD("the appId is the same, check permission success!");
|
||||
}
|
||||
// 4. check if target ability is not visible and without PERMISSION_START_INVISIBLE_ABILITY
|
||||
if (!CheckTargetAbilityVisible(targetAbility, callerInfo)) {
|
||||
@ -616,6 +616,12 @@ bool DistributedSchedPermission::CheckCollaborateStartCtrlPer(const AppExecFwk::
|
||||
|
||||
bool DistributedSchedPermission::CheckStartControlPermission(const AppExecFwk::AbilityInfo& targetAbility,
|
||||
const CallerInfo& callerInfo, const AAFwk::Want& want) const
|
||||
{
|
||||
return CheckStartControlPermission(targetAbility, callerInfo, want, true);
|
||||
}
|
||||
|
||||
bool DistributedSchedPermission::CheckStartControlPermission(const AppExecFwk::AbilityInfo& targetAbility,
|
||||
const CallerInfo& callerInfo, const AAFwk::Want& want, bool isSameBundle) const
|
||||
{
|
||||
HILOGD("Check start control permission enter");
|
||||
return ((want.GetFlags() & AAFwk::Want::FLAG_ABILITY_CONTINUATION) != 0) ?
|
||||
@ -747,6 +753,9 @@ bool DistributedSchedPermission::CheckTargetAbilityVisible(const AppExecFwk::Abi
|
||||
|
||||
void DistributedSchedPermission::RemoveRemoteObjectFromWant(std::shared_ptr<AAFwk::Want> want) const
|
||||
{
|
||||
if (want == nullptr) {
|
||||
return;
|
||||
}
|
||||
WantParams wantParams = want->GetParams();
|
||||
std::map<std::string, sptr<IInterface>> params = wantParams.GetParams();
|
||||
for (auto param : params) {
|
||||
|
@ -1135,6 +1135,9 @@ int32_t DistributedSchedService::DealDSchedEventResult(const OHOS::AAFwk::Want&
|
||||
|
||||
bool DistributedSchedService::GetIsFreeInstall(int32_t missionId)
|
||||
{
|
||||
if (dschedContinuation_ == nullptr) {
|
||||
return false;
|
||||
}
|
||||
return dschedContinuation_->IsFreeInstall(missionId);
|
||||
}
|
||||
|
||||
@ -3468,6 +3471,13 @@ int32_t DistributedSchedService::NotifyStateChangedFromRemote(int32_t abilitySta
|
||||
|
||||
int32_t DistributedSchedService::CheckTargetPermission(const OHOS::AAFwk::Want& want,
|
||||
const CallerInfo& callerInfo, const AccountInfo& accountInfo, int32_t flag, bool needQueryExtension)
|
||||
{
|
||||
return CheckTargetPermission(want, callerInfo, accountInfo, flag, needQueryExtension, true);
|
||||
}
|
||||
|
||||
int32_t DistributedSchedService::CheckTargetPermission(const OHOS::AAFwk::Want& want,
|
||||
const CallerInfo& callerInfo, const AccountInfo& accountInfo, int32_t flag,
|
||||
bool needQueryExtension, bool isSameBundle)
|
||||
{
|
||||
DistributedSchedPermission& permissionInstance = DistributedSchedPermission::GetInstance();
|
||||
AppExecFwk::AbilityInfo targetAbility;
|
||||
@ -3495,6 +3505,8 @@ int32_t DistributedSchedService::CheckTargetPermission(const OHOS::AAFwk::Want&
|
||||
return DMS_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int32_t DistributedSchedService::StopRemoteExtensionAbility(const OHOS::AAFwk::Want& want, int32_t callerUid,
|
||||
uint32_t accessToken, int32_t extensionType)
|
||||
{
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "distributed_sched_utils.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "mock_form_mgr_service.h"
|
||||
#include "mission/distributed_sched_mission_manager.h"
|
||||
#include "mission/dsched_sync_e2e.h"
|
||||
|
||||
@ -114,7 +113,7 @@ bool DmsBmStorage::SaveStorageDistributeInfo(const std::string &bundleName, bool
|
||||
uint32_t result = AccountSA::OsAccountManager::QueryAllCreatedOsAccounts(accounts);
|
||||
if(result == ERR_OK && !accounts.empty()) {
|
||||
for(auto &account: accounts) {
|
||||
result = bundleMgr->GetAppprovisionInfo(bundleName, account.GetLocalId(), appProvisionInfo);
|
||||
result = bundleMgr->GetAppProvisionInfo(bundleName, account.GetLocalId(), appProvisionInfo);
|
||||
if(result == ERR_OK && !appProvisionInfo.developerId.empty()) {
|
||||
break;
|
||||
}
|
||||
@ -771,7 +770,7 @@ void DmsBmStorage::UpdateDistributedData()
|
||||
|
||||
AppExecFwk::AppProvisionInfo appProvisionInfo;
|
||||
std::vector<AccountSA::OsAccountInfo> accounts;
|
||||
uint32_t result = AccountSA::OsAccountManager::QoeryAllCreatedOsAccounts(accounts);
|
||||
uint32_t result = AccountSA::OsAccountManager::QueryAllCreatedOsAccounts(accounts);
|
||||
|
||||
std::vector<DmsBundleInfo> dmsBundleInfos;
|
||||
for (const auto &bundleInfo : bundleInfos) {
|
||||
|
@ -253,62 +253,68 @@ int32_t DMSContinueRecvMgr::RetryPostBroadcast(const std::string& senderNetworkI
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
|
||||
bool DMSContinueRecvMgr::GetFinalBundleName(const std::string &senderNetworkId, uint8_t continueTypeId,
|
||||
DmsBundleInfo distributedBundleInfo,
|
||||
std::string &finalBundleName, AppExecFwk::BundleInfo localBundleInfo,
|
||||
std::string &continueType)
|
||||
bool DMSContinueRecvMgr::GetFinalBundleName(const std::string& senderNetworkId, uint8_t& continueTypeId,
|
||||
DmsBundleInfo& distributedBundleInfo, std::string& finalBundleName,
|
||||
AppExecFwk::BundleInfo& localBundleInfo, std::string& continueType)
|
||||
{
|
||||
std::string bundleName = distributedBundleInfo.bundleName;
|
||||
continueType = BundleManagerInternal::GetContinueType(senderNetworkId, bundleName, continueTypeId);
|
||||
if (continueType.empty()) {
|
||||
if (BundleManagerInternal::GetLocalBundleInfoV9(bundleName, localBundleInfo) == ERR_OK) {
|
||||
finalBundleName = bundleName;
|
||||
return true;
|
||||
}
|
||||
HILOGE("continue type is empty and can not get local bundle info for bundle name: %{public}s", bundleName.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
bool continueTypeGot = continueTypeCheck(distributedBundleInfo, continueType);
|
||||
if (continueTypeGot && BundleManagerInternal::GetLocalBundleInfoV9(bundleName, localBundleInfo) == ERR_OK) {
|
||||
if (BundleManagerInternal::GetLocalBundleInfoV9(bundleName, localBundleInfo) == ERR_OK
|
||||
&& ContinueTypeCheck(localBundleInfo, continueType)) {
|
||||
finalBundleName = bundleName;
|
||||
return true;
|
||||
}
|
||||
std::vector<std::string> bundleNameList;
|
||||
bool continueBundleGot = BundleManagerInternal::GetContinueBundle4Src(bundleName, bundleNameList);
|
||||
if (continueBundleGot) {
|
||||
sptr<AppExecFwk::IBundleMgr> bundleMgr = BundleManagerInternal::GetBundleManager();
|
||||
if (bundleMgr == nullptr) {
|
||||
HILOGE("get bundle manager failed");
|
||||
return false;
|
||||
}
|
||||
std::vector<int32_t> ids;
|
||||
ErrCode ret = AccountSA::OsAccountManager::QueryActiveOsAccountIds(ids);
|
||||
if (ret != ERR_OK || ids.empty()) {
|
||||
HILOGE("Get userId from active Os AccountIds fail, ret : %{public}d", ret);
|
||||
HILOGE("can not get local bundle info or continue bundle for bundle name: %{public}s", bundleName.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
for (std::string &bundleNameItem: bundleNameList) {
|
||||
continueType = BundleManagerInternal::GetContinueType(
|
||||
senderNetworkId, bundleNameItem, continueTypeId);
|
||||
if (continueType.empty() || !continueTypeCheck(distributedBundleInfo, continueType)
|
||||
|| BundleManagerInternal::GetLocalBundleInfoV9(bundleNameItem, localBundleInfo) != ERR_OK) {
|
||||
continue;
|
||||
}
|
||||
AppExecFwk::AppProvisionInfo appProvisionInfo;
|
||||
if (bundleMgr->GetAppProvisionInfo(bundleNameItem, ids[0], appProvisionInfo) == ERR_OK
|
||||
&& appProvisionInfo.developerId == distributedBundleInfo.developerId) {
|
||||
if (BundleManagerInternal::GetAppProvisionInfo4CurrentUser(bundleNameItem, appProvisionInfo)
|
||||
&& appProvisionInfo.developerId == distributedBundleInfo.developerId
|
||||
&& BundleManagerInternal::GetLocalBundleInfoV9(bundleName, localBundleInfo) == ERR_OK
|
||||
&& ContinueTypeCheck(localBundleInfo, continueType)) {
|
||||
finalBundleName = bundleNameItem;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
HILOGE("continue type is not empty and can not get local bundle info and continue nundle for "
|
||||
"bundle name: %{public}s", bundleName.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DMSContinueRecvMgr::ContinueTypeCheck(const AppExecFwk::BundleInfo& bundleInfo, const std::string& continueType) {
|
||||
for (const auto &abilityInfo: bundleInfo.abilityInfos) {
|
||||
DmsAbilityInfo dmsAbilityInfo;
|
||||
dmsAbilityInfo.abilityName = abilityInfo.name;
|
||||
for (const auto &continueTypeItem: abilityInfo.continueType) {
|
||||
if(continueTypeItem == continueType) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
HILOGE("can not mate continue type: %{public}s in buninfo for bundleName: %{public}s", continueType.c_str(), bundleInfo.name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
void DMSContinueRecvMgr::FindContinueType(const DmsBundleInfo& distributedBundleInfo,
|
||||
uint8_t& continueTypeId, std::string& continueType)
|
||||
{
|
||||
uint32_t pos = 0;
|
||||
for (auto dmsAbilityInfo : distributedBundleInfo.dmsAbilityInfos) {
|
||||
for (auto continueTypeElement : dmsAbilityInfo.continueType) {
|
||||
if (pos == continueTypeId) {
|
||||
continueType = continueTypeElement;
|
||||
return;
|
||||
}
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
continueType = "";
|
||||
}
|
||||
|
||||
int32_t DMSContinueRecvMgr::DealOnBroadcastBusiness(const std::string& senderNetworkId,
|
||||
uint16_t bundleNameId, uint8_t continueTypeId, const int32_t state, const int32_t retry)
|
||||
{
|
||||
@ -331,6 +337,7 @@ int32_t DMSContinueRecvMgr::DealOnBroadcastBusiness(const std::string& senderNet
|
||||
std::string finalBundleName;
|
||||
AppExecFwk::BundleInfo localBundleInfo;
|
||||
std::string continueType;
|
||||
FindContinueType(distributedBundleInfo, continueTypeId, continueType);
|
||||
if (!GetFinalBundleName(senderNetworkId, continueTypeId,
|
||||
distributedBundleInfo, finalBundleName, localBundleInfo, continueType)) {
|
||||
HILOGE("The app is not installed on the local device.");
|
||||
@ -338,14 +345,14 @@ int32_t DMSContinueRecvMgr::DealOnBroadcastBusiness(const std::string& senderNet
|
||||
}
|
||||
HILOGI("got finalBundleName: %{public}s", finalBundleName.c_str());
|
||||
currentIconInfo lastRecvInfo = currentIconInfo(senderNetworkId, bundleName, finalBundleName);
|
||||
pushLatRecvCache(lastRecvInfo);
|
||||
PushLatRecvCache(lastRecvInfo);
|
||||
|
||||
if (localBundleInfo.applicationInfo.bundleType != AppExecFwk::BundleType::APP) {
|
||||
HILOGE("The bundleType must be app, but it is %{public}d", localBundleInfo.applicationInfo.bundleType);
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
|
||||
uint32_t ret = VerifyBroadcastSource(senderNetworkId, finalBundleName, continueType, state);
|
||||
int32_t ret = VerifyBroadcastSource(senderNetworkId, finalBundleName, continueType, state);
|
||||
if (ret != ERR_OK) {
|
||||
return ret;
|
||||
}
|
||||
@ -355,7 +362,7 @@ int32_t DMSContinueRecvMgr::DealOnBroadcastBusiness(const std::string& senderNet
|
||||
HILOGE("get iterItem failed from registerOnListener_, bundleNameId: %{public}u", bundleNameId);
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
std::vector<sptr<IRemoteObject> > objs = iterItem->second;
|
||||
std::vector<sptr<IRemoteObject>> objs = iterItem->second;
|
||||
for (auto iter: objs) {
|
||||
NotifyRecvBroadcast(iter, senderNetworkId, finalBundleName, state, continueType);
|
||||
}
|
||||
@ -363,21 +370,7 @@ int32_t DMSContinueRecvMgr::DealOnBroadcastBusiness(const std::string& senderNet
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
bool DMSContinueRecvMgr::continueTypeCheck(const DmsBundleInfo &distributedBundleInfo,
|
||||
const std::string &continueType)
|
||||
{
|
||||
std::vector<DmsAbilityInfo> dmsAbilityInfos = distributedBundleInfo.dmsAbilityInfos;
|
||||
bool continueTypeGot = false;
|
||||
for (const auto &abilityInfo: dmsAbilityInfos) {
|
||||
std::vector<std::string> continueTypeConfig = abilityInfo.continueType;
|
||||
for (const auto &continueTypeConfigItem: continueTypeConfig) {
|
||||
continueTypeGot = continueTypeGot || (continueType == continueTypeConfigItem);
|
||||
}
|
||||
}
|
||||
return continueTypeGot;
|
||||
}
|
||||
|
||||
void DMSContinueRecvMgr::pushLatRecvCache(currentIconInfo &lastRecvInfo)
|
||||
void DMSContinueRecvMgr::PushLatRecvCache(currentIconInfo &lastRecvInfo)
|
||||
{
|
||||
if (lastRecvList_.size() >= LAST_RECV_INFO_QUEUE_SIZE) {
|
||||
lastRecvList_.erase(lastRecvList_.begin());
|
||||
|
@ -385,8 +385,7 @@ int32_t DMSContinueSendMgr::DealUnfocusedBusiness(const int32_t missionId, Unfoc
|
||||
return ret;
|
||||
}
|
||||
if (reason != UnfocusedReason::TIMEOUT) {
|
||||
bool isContinue = IsContinue(missionId, bundleName);
|
||||
if (!isContinue) {
|
||||
if (!IsContinue(missionId, bundleName)) {
|
||||
HILOGE("Not current mission to be continued, missionId: %{public}d", missionId);
|
||||
EraseFocusedMission(bundleName, missionId, reason);
|
||||
return NO_MISSION_INFO_FOR_MISSION_ID;
|
||||
@ -395,13 +394,6 @@ int32_t DMSContinueSendMgr::DealUnfocusedBusiness(const int32_t missionId, Unfoc
|
||||
RemoveMMIListener();
|
||||
#endif
|
||||
}
|
||||
ret = CheckContinueState(missionId);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("Continue state is inactive or can't be obtained, mission id : %{public}d, ret: %{public}d",
|
||||
missionId, ret);
|
||||
EraseFocusedMission(bundleName, missionId, reason);
|
||||
return ret;
|
||||
}
|
||||
uint16_t bundleNameId = 0;
|
||||
uint8_t continueTypeId = 0;
|
||||
ret = GetAccessTokenIdSendEvent(bundleName, reason, bundleNameId, continueTypeId);
|
||||
|
@ -71,7 +71,9 @@ int32_t DSchedAllConnectManager::UninitAllConnectManager()
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("Unregist lifecycle callback fail, ret %{public}d.", ret);
|
||||
}
|
||||
#ifndef TEST_COVERAGE
|
||||
dlclose(dllHandle_);
|
||||
#endif
|
||||
dllHandle_ = nullptr;
|
||||
allConnectMgrApi_ = {
|
||||
.ServiceCollaborationManager_PublishServiceState = nullptr,
|
||||
@ -93,14 +95,16 @@ int32_t DSchedAllConnectManager::GetServiceCollaborationManagerProxy()
|
||||
#endif
|
||||
char path[PATH_MAX + 1] = {0};
|
||||
if (resolvedPath.length() > PATH_MAX || realpath(resolvedPath.c_str(), path) == nullptr) {
|
||||
HILOGE("Check all connect so real path failed, resolvedPath [%{public}s].", resolvedPath.c_str());
|
||||
HILOGE("Check all connect so real path failed, resolvedPath [%{public}s].",
|
||||
GetAnonymStr(resolvedPath).c_str());
|
||||
return INVALID_PARAMETERS_ERR;
|
||||
}
|
||||
int32_t (*ServiceCollaborationManagerExport)(ServiceCollaborationManager_API *exportapi) = nullptr;
|
||||
|
||||
dllHandle_ = dlopen(resolvedPath.c_str(), RTLD_LAZY);
|
||||
if (dllHandle_ == nullptr) {
|
||||
HILOGE("Open dms interactive adapter shared object fail, resolvedPath [%{public}s].", resolvedPath.c_str());
|
||||
HILOGE("Open dms interactive adapter shared object fail, resolvedPath [%{public}s].",
|
||||
GetAnonymStr(resolvedPath).c_str());
|
||||
return NOT_FIND_SERVICE_REGISTRY;
|
||||
}
|
||||
|
||||
@ -125,7 +129,9 @@ int32_t DSchedAllConnectManager::GetServiceCollaborationManagerProxy()
|
||||
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("Get remote dms interactive adapter proxy fail, dlclose handle.");
|
||||
#ifndef TEST_COVERAGE
|
||||
dlclose(dllHandle_);
|
||||
#endif
|
||||
dllHandle_ = nullptr;
|
||||
}
|
||||
return ret;
|
||||
|
@ -173,7 +173,10 @@ int32_t SoftbusAdapter::RegisterSoftbusEventListener(const std::shared_ptr<Softb
|
||||
HILOGE("Registering listener failed");
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(softbusAdapterListenerMutex_);
|
||||
softbusAdapterListener_ = listener;
|
||||
}
|
||||
EventListener eventListener;
|
||||
eventListener.event = FOREGROUND_APP;
|
||||
eventListener.freq = EVENT_MID_FREQ;
|
||||
@ -195,7 +198,10 @@ int32_t SoftbusAdapter::UnregisterSoftbusEventListener(const std::shared_ptr<Sof
|
||||
HILOGE("Unregistering listener failed");
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(softbusAdapterListenerMutex_);
|
||||
softbusAdapterListener_ = listener;
|
||||
}
|
||||
EventListener eventListener;
|
||||
eventListener.event = FOREGROUND_APP;
|
||||
eventListener.freq = EVENT_MID_FREQ;
|
||||
|
Loading…
Reference in New Issue
Block a user