mirror of
https://github.com/openharmony/appexecfwk_standard.git
synced 2026-07-19 14:06:09 -04:00
IssueNo:#I52A33:remove userid
Description:remove userid Sig:SIG_ApplicaitonFramework Feature or Bugfix:Feature Binary Source:No Signed-off-by: wanghang <wanghang26@huawei.com> Change-Id: If0d58026e941cc1445984c878d2fea296ec027eb
This commit is contained in:
@@ -833,13 +833,11 @@ public:
|
||||
/**
|
||||
* @brief Obtains the DistributedBundleInfo based on a given bundle name and networkId.
|
||||
* @param networkId Indicates the networkId of remote device.
|
||||
* @param userId Indicates the user id.
|
||||
* @param bundleName Indicates the application bundle name to be queried.
|
||||
* @param distributedBundleInfo Indicates the obtained DistributedBundleInfo object.
|
||||
* @return Returns true if the DistributedBundleInfo is successfully obtained; returns false otherwise.
|
||||
*/
|
||||
virtual bool GetDistributedBundleInfo(
|
||||
const std::string &networkId, int32_t userId, const std::string &bundleName,
|
||||
virtual bool GetDistributedBundleInfo(const std::string &networkId, const std::string &bundleName,
|
||||
DistributedBundleInfo &distributedBundleInfo)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -603,13 +603,11 @@ public:
|
||||
/**
|
||||
* @brief Obtains the DistributedBundleInfo based on a given bundle name and networkId.
|
||||
* @param networkId Indicates the networkId of remote device.
|
||||
* @param userId Indicates the user id.
|
||||
* @param bundleName Indicates the application bundle name to be queried.
|
||||
* @param distributedBundleInfo Indicates the obtained DistributedBundleInfo object.
|
||||
* @return Returns true if the DistributedBundleInfo is successfully obtained; returns false otherwise.
|
||||
*/
|
||||
virtual bool GetDistributedBundleInfo(
|
||||
const std::string &networkId, int32_t userId, const std::string &bundleName,
|
||||
virtual bool GetDistributedBundleInfo(const std::string &networkId, const std::string &bundleName,
|
||||
DistributedBundleInfo &distributedBundleInfo) override;
|
||||
/**
|
||||
* @brief Get app privilege level.
|
||||
|
||||
@@ -1652,10 +1652,9 @@ ErrCode BundleMgrHost::HandleRemoveClonedBundle(Parcel &data, Parcel &reply)
|
||||
ErrCode BundleMgrHost::HandleGetDistributedBundleInfo(Parcel &data, Parcel &reply)
|
||||
{
|
||||
std::string networkId = data.ReadString();
|
||||
int32_t userId = data.ReadInt32();
|
||||
std::string bundleName = data.ReadString();
|
||||
DistributedBundleInfo distributedBundleInfo;
|
||||
bool ret = GetDistributedBundleInfo(networkId, userId, bundleName, distributedBundleInfo);
|
||||
bool ret = GetDistributedBundleInfo(networkId, bundleName, distributedBundleInfo);
|
||||
if (!reply.WriteBool(ret)) {
|
||||
APP_LOGE("write failed");
|
||||
return ERR_APPEXECFWK_PARCEL_ERROR;
|
||||
|
||||
@@ -2271,8 +2271,7 @@ bool BundleMgrProxy::RemoveClonedBundle(const std::string &bundleName, const int
|
||||
return reply.ReadBool();
|
||||
}
|
||||
|
||||
bool BundleMgrProxy::GetDistributedBundleInfo(
|
||||
const std::string &networkId, int32_t userId, const std::string &bundleName,
|
||||
bool BundleMgrProxy::GetDistributedBundleInfo(const std::string &networkId, const std::string &bundleName,
|
||||
DistributedBundleInfo &distributedBundleInfo)
|
||||
{
|
||||
APP_LOGI("begin to GetDistributedBundleInfo of %{public}s", bundleName.c_str());
|
||||
@@ -2291,11 +2290,6 @@ bool BundleMgrProxy::GetDistributedBundleInfo(
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!data.WriteInt32(userId)) {
|
||||
APP_LOGE("fail to GetDistributedBundleInfo due to write userId fail");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!data.WriteString(bundleName)) {
|
||||
APP_LOGE("fail to GetDistributedBundleInfo due to write bundleName fail");
|
||||
return false;
|
||||
|
||||
@@ -617,13 +617,11 @@ public:
|
||||
/**
|
||||
* @brief Obtains the DistributedBundleInfo based on a given bundle name and networkId.
|
||||
* @param networkId Indicates the networkId of remote device.
|
||||
* @param userId Indicates the user id.
|
||||
* @param bundleName Indicates the application bundle name to be queried.
|
||||
* @param distributedBundleInfo Indicates the obtained DistributedBundleInfo object.
|
||||
* @return Returns true if the DistributedBundleInfo is successfully obtained; returns false otherwise.
|
||||
*/
|
||||
bool GetDistributedBundleInfo(
|
||||
const std::string &networkId, int32_t userId, const std::string &bundleName,
|
||||
bool GetDistributedBundleInfo(const std::string &networkId, const std::string &bundleName,
|
||||
DistributedBundleInfo &distributedBundleInfo);
|
||||
/**
|
||||
* @brief Has initial user created.
|
||||
|
||||
@@ -590,13 +590,11 @@ public:
|
||||
/**
|
||||
* @brief Obtains the DistributedBundleInfo based on a given bundle name and networkId.
|
||||
* @param networkId Indicates the networkId of remote device.
|
||||
* @param userId Indicates the user id.
|
||||
* @param bundleName Indicates the application bundle name to be queried.
|
||||
* @param distributedBundleInfo Indicates the obtained DistributedBundleInfo object.
|
||||
* @return Returns true if the DistributedBundleInfo is successfully obtained; returns false otherwise.
|
||||
*/
|
||||
virtual bool GetDistributedBundleInfo(
|
||||
const std::string &networkId, int32_t userId, const std::string &bundleName,
|
||||
virtual bool GetDistributedBundleInfo(const std::string &networkId, const std::string &bundleName,
|
||||
DistributedBundleInfo &distributedBundleInfo) override;
|
||||
/**
|
||||
* @brief Get app privilege level.
|
||||
|
||||
@@ -34,8 +34,7 @@ public:
|
||||
|
||||
bool SaveStorageDistributeInfo(const std::string &bundleName, int32_t userId);
|
||||
bool DeleteStorageDistributeInfo(const std::string &bundleName, int32_t userId);
|
||||
bool QueryStroageDistributeInfo(
|
||||
const std::string &bundleName, int32_t userId, const std::string &networkId,
|
||||
bool QueryStroageDistributeInfo(const std::string &bundleName, const std::string &networkId,
|
||||
DistributedBundleInfo &info);
|
||||
bool QueryAllDeviceIds(std::vector<std::string> &deviceIds);
|
||||
void UpdateDistributedData(const std::vector<BundleInfo> &bundleInfos);
|
||||
|
||||
@@ -2495,15 +2495,10 @@ std::set<int32_t> BundleDataMgr::GetAllUser() const
|
||||
return multiUserIdsSet_;
|
||||
}
|
||||
|
||||
bool BundleDataMgr::GetDistributedBundleInfo(
|
||||
const std::string &networkId, int32_t userId, const std::string &bundleName,
|
||||
bool BundleDataMgr::GetDistributedBundleInfo(const std::string &networkId, const std::string &bundleName,
|
||||
DistributedBundleInfo &distributedBundleInfo)
|
||||
{
|
||||
if (userId == Constants::INVALID_USERID) {
|
||||
return false;
|
||||
}
|
||||
return distributedDataStorage_->QueryStroageDistributeInfo(
|
||||
bundleName, userId, networkId, distributedBundleInfo);
|
||||
return distributedDataStorage_->QueryStroageDistributeInfo(bundleName, networkId, distributedBundleInfo);
|
||||
}
|
||||
|
||||
bool BundleDataMgr::GetInnerBundleUserInfos(
|
||||
|
||||
@@ -1192,18 +1192,17 @@ bool BundleMgrHostImpl::CheckBundleNameInAllowList(const std::string &bundleName
|
||||
return result;
|
||||
}
|
||||
|
||||
bool BundleMgrHostImpl::GetDistributedBundleInfo(
|
||||
const std::string &networkId, int32_t userId, const std::string &bundleName,
|
||||
bool BundleMgrHostImpl::GetDistributedBundleInfo(const std::string &networkId, const std::string &bundleName,
|
||||
DistributedBundleInfo &distributedBundleInfo)
|
||||
{
|
||||
APP_LOGD("start GetDistributedBundleInfo, networkId : %{public}s, userId : %{public}d, bundleName : %{public}s",
|
||||
networkId.c_str(), userId, bundleName.c_str());
|
||||
APP_LOGD("start GetDistributedBundleInfo, networkId : %{public}s, bundleName : %{public}s",
|
||||
networkId.c_str(), bundleName.c_str());
|
||||
auto dataMgr = GetDataMgrFromService();
|
||||
if (dataMgr == nullptr) {
|
||||
APP_LOGE("DataMgr is nullptr");
|
||||
return false;
|
||||
}
|
||||
return dataMgr->GetDistributedBundleInfo(networkId, userId, bundleName, distributedBundleInfo);
|
||||
return dataMgr->GetDistributedBundleInfo(networkId, bundleName, distributedBundleInfo);
|
||||
}
|
||||
|
||||
bool BundleMgrHostImpl::QueryExtensionAbilityInfos(const Want &want, const int32_t &flag, const int32_t &userId,
|
||||
|
||||
@@ -172,16 +172,10 @@ bool DistributedDataStorage::DeleteStorageDistributeInfo(const std::string &bund
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DistributedDataStorage::QueryStroageDistributeInfo(
|
||||
const std::string &bundleName, int32_t userId, const std::string &networkId,
|
||||
bool DistributedDataStorage::QueryStroageDistributeInfo(const std::string &bundleName, const std::string &networkId,
|
||||
DistributedBundleInfo &info)
|
||||
{
|
||||
APP_LOGI("query DistributedBundleInfo");
|
||||
if (userId != AccountHelper::GetCurrentActiveUserId()) {
|
||||
APP_LOGI("userid is not current active userid");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string udid;
|
||||
int32_t ret = GetUdidByNetworkId(networkId, udid);
|
||||
if (ret != 0) {
|
||||
|
||||
@@ -1718,7 +1718,7 @@ static void BenchmarkTestGetDistributedBundleInfo(benchmark::State &state)
|
||||
"/RfcAdrHXaM8F0QOiwVEhnV5ebE5jNIYnAx+weFRT3QTyUjRNdhmc2aAzWyi+5t5CoBM=";
|
||||
for (auto _ : state) {
|
||||
/* @tc.steps: step1.call ReadFromParcel in loop */
|
||||
bundleMgrProxy->GetDistributedBundleInfo(networkId, DEFAULT_USERID, bundleName, distributedBundleInfo);
|
||||
bundleMgrProxy->GetDistributedBundleInfo(networkId, bundleName, distributedBundleInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ private:
|
||||
std::string DumpBundleInfo(const std::string &bundleName, int32_t userId) const;
|
||||
std::string DumpBundleInfos(int32_t userId) const;
|
||||
std::string DumpShortcutInfos(const std::string &bundleName, int32_t userId) const;
|
||||
std::string DumpDistributedBundleInfo(const std::string &deviceId, int32_t userId, const std::string &bundleName);
|
||||
std::string DumpDistributedBundleInfo(const std::string &deviceId, const std::string &bundleName);
|
||||
|
||||
int32_t InstallOperation(const std::vector<std::string> &bundlePaths, InstallParam &installParam) const;
|
||||
int32_t UninstallOperation(const std::string &bundleName, const std::string &moduleName,
|
||||
|
||||
@@ -1012,7 +1012,7 @@ ErrCode BundleManagerShellCommand::RunAsDumpCommand()
|
||||
if (bundleDumpShortcut) {
|
||||
dumpResults = DumpShortcutInfos(bundleName, userId);
|
||||
} else if (bundleDumpDistributedBundleInfo) {
|
||||
dumpResults = DumpDistributedBundleInfo(deviceId, userId, bundleName);
|
||||
dumpResults = DumpDistributedBundleInfo(deviceId, bundleName);
|
||||
} else if (bundleDumpAll) {
|
||||
dumpResults = DumpBundleList(userId);
|
||||
} else if (bundleDumpInfos) {
|
||||
@@ -1835,18 +1835,18 @@ std::string BundleManagerShellCommand::DumpShortcutInfos(const std::string &bund
|
||||
return dumpResults;
|
||||
}
|
||||
|
||||
std::string BundleManagerShellCommand::DumpDistributedBundleInfo(const std::string &deviceId,
|
||||
int32_t userId, const std::string &bundleName)
|
||||
std::string BundleManagerShellCommand::DumpDistributedBundleInfo(
|
||||
const std::string &deviceId, const std::string &bundleName)
|
||||
{
|
||||
std::string dumpResults = "";
|
||||
DistributedBundleInfo bundleInfo;
|
||||
bool dumpRet = bundleMgrProxy_->GetDistributedBundleInfo(deviceId, userId, bundleName, bundleInfo);
|
||||
DistributedBundleInfo distributedBundleInfo;
|
||||
bool dumpRet = bundleMgrProxy_->GetDistributedBundleInfo(deviceId, bundleName, distributedBundleInfo);
|
||||
if (!dumpRet) {
|
||||
APP_LOGE("failed to dump distributed bundleInfo.");
|
||||
} else {
|
||||
dumpResults.append("distributed bundleInfo");
|
||||
dumpResults.append(":\n");
|
||||
dumpResults.append(bundleInfo.ToString());
|
||||
dumpResults.append(distributedBundleInfo.ToString());
|
||||
dumpResults.append("\n");
|
||||
}
|
||||
return dumpResults;
|
||||
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
MOCK_METHOD2(QueryAbilityInfosByUri, bool(const std::string &abilityUri, std::vector<AbilityInfo> &abilityInfos));
|
||||
MOCK_METHOD3(CheckPermissionByUid,
|
||||
int(const std::string &bundleName, const std::string &permission, const int userId));
|
||||
MOCK_METHOD4(GetDistributedBundleInfo, bool(const std::string &networkId, int32_t userId,
|
||||
MOCK_METHOD3(GetDistributedBundleInfo, bool(const std::string &networkId,
|
||||
const std::string &bundleName, DistributedBundleInfo &distributedBundleInfo));
|
||||
};
|
||||
} // namespace AppExecFwk
|
||||
|
||||
Reference in New Issue
Block a user