IssueNo:#I571XN:【免安装】传给服务中心的json字符串不对

Description:修复传给服务中心的json字符串不对问题
Sig:SIG_ApplicationFramework
Feature or Bugfix:Bugfix
Binary Source: No

Signed-off-by: dy <dingyao5@huawei.com>
This commit is contained in:
dy 2022-05-17 14:17:49 +08:00
parent daf942df27
commit 1b43a2bdf8
2 changed files with 13 additions and 10 deletions

View File

@ -141,14 +141,15 @@ bool TargetInfo::ReadFromParcel(Parcel &parcel)
flags = parcel.ReadInt32();
callingUid = parcel.ReadInt32();
callingAppType = parcel.ReadInt32();
if (!parcel.ReadStringVector(&callingBundleNames)) {
APP_LOGE("read callingBundleNames from parcel failed");
return false;
int32_t callingBundleNamesSize = 0;
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, callingBundleNamesSize);
for (int32_t i = 0; i < callingBundleNamesSize; i++) {
callingBundleNames.emplace_back(Str16ToStr8(parcel.ReadString16()));
}
if (!parcel.ReadStringVector(&callingAppIds)) {
APP_LOGE("read callingAppIds from parcel failed");
return false;
int32_t callingAppIdsSize = 0;
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, callingAppIdsSize);
for (int32_t i = 0; i < callingAppIdsSize; i++) {
callingAppIds.emplace_back(Str16ToStr8(parcel.ReadString16()));
}
return true;
}
@ -162,9 +163,11 @@ bool TargetInfo::Marshalling(Parcel &parcel) const
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, flags);
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, callingUid);
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, callingAppType);
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, callingBundleNames.size());
for (auto &callingBundleName : callingBundleNames) {
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(callingBundleName));
}
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, callingAppIds.size());
for (auto &callingAppId : callingAppIds) {
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(callingAppId));
}

View File

@ -30,8 +30,8 @@ namespace {
const std::u16string ATOMIC_SERVICE_STATUS_CALLBACK_TOKEN = u"ohos.aafwk.IAtomicServiceStatusCallback";
const std::string serviceCenterBundleName = "com.ohos.hag.famanager";
const std::string serviceCenterAbilityName = "com.ohos.hag.famanager.HapInstallServiceAbility";
const std::string DEFAULT_VERSION = "1";
constexpr uint32_t FREE_INSTALL_DONE = 0;
constexpr uint32_t DEFAULT_VERSION = 1;
constexpr uint32_t CALLING_TYPE_HARMONY = 2;
constexpr uint32_t BIT_ONE_COMPATIBLE = 0;
constexpr uint32_t BIT_TWO_BACK_MODE = 1;
@ -447,11 +447,11 @@ void BundleConnectAbilityMgr::GetTargetAbilityInfo(const Want &want, InnerBundle
BIT_ONE_SEVEN_SAME_BUNDLE * BIT_SEVEN;
targetInfo->callingUid = IPCSkeleton::GetCallingUid();
targetInfo->callingAppType = CALLING_TYPE_HARMONY;
targetAbilityInfo->targetInfo = *targetInfo;
this->GetCallingInfo(innerBundleInfo, callingBundleNames, callingAppids);
targetAbilityInfo->version = DEFAULT_VERSION;
targetInfo->callingBundleNames = callingBundleNames;
targetInfo->callingAppIds = callingAppids;
targetAbilityInfo->targetInfo = *targetInfo;
targetAbilityInfo->version = DEFAULT_VERSION;
}
void BundleConnectAbilityMgr::CallAbilityManager(