From 1b43a2bdf88f413d738540f6165bb02b957684d7 Mon Sep 17 00:00:00 2001 From: dy Date: Tue, 17 May 2022 14:17:49 +0800 Subject: [PATCH] =?UTF-8?q?IssueNo:#I571XN:=E3=80=90=E5=85=8D=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E3=80=91=E4=BC=A0=E7=BB=99=E6=9C=8D=E5=8A=A1=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E7=9A=84json=E5=AD=97=E7=AC=A6=E4=B8=B2=E4=B8=8D?= =?UTF-8?q?=E5=AF=B9=20Description:=E4=BF=AE=E5=A4=8D=E4=BC=A0=E7=BB=99?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E4=B8=AD=E5=BF=83=E7=9A=84json=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2=E4=B8=8D=E5=AF=B9=E9=97=AE=E9=A2=98=20Sig:SI?= =?UTF-8?q?G=5FApplicationFramework=20Feature=20or=20Bugfix:Bugfix=20Binar?= =?UTF-8?q?y=20Source:=20No?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dy --- .../src/free_install/target_ability_info.cpp | 17 ++++++++++------- .../free_install/bundle_connect_ability_mgr.cpp | 6 +++--- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/interfaces/inner_api/appexecfwk_base/src/free_install/target_ability_info.cpp b/interfaces/inner_api/appexecfwk_base/src/free_install/target_ability_info.cpp index 2c099c59..4e9857e0 100644 --- a/interfaces/inner_api/appexecfwk_base/src/free_install/target_ability_info.cpp +++ b/interfaces/inner_api/appexecfwk_base/src/free_install/target_ability_info.cpp @@ -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)); } diff --git a/services/bundlemgr/src/free_install/bundle_connect_ability_mgr.cpp b/services/bundlemgr/src/free_install/bundle_connect_ability_mgr.cpp index 3f055140..7c41ae26 100644 --- a/services/bundlemgr/src/free_install/bundle_connect_ability_mgr.cpp +++ b/services/bundlemgr/src/free_install/bundle_connect_ability_mgr.cpp @@ -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(