diff --git a/interfaces/inner_api/appexecfwk_base/include/extension_ability_info.h b/interfaces/inner_api/appexecfwk_base/include/extension_ability_info.h index b5d75e319..3ae704971 100644 --- a/interfaces/inner_api/appexecfwk_base/include/extension_ability_info.h +++ b/interfaces/inner_api/appexecfwk_base/include/extension_ability_info.h @@ -180,6 +180,7 @@ struct ExtensionAbilityInfo : public Parcelable { bool needCreateSandbox = false; std::vector dataGroupIds; std::vector validDataGroupIds; + std::string customProcess; bool ReadFromParcel(Parcel &parcel); virtual bool Marshalling(Parcel &parcel) const override; diff --git a/interfaces/inner_api/appexecfwk_base/src/extension_ability_info.cpp b/interfaces/inner_api/appexecfwk_base/src/extension_ability_info.cpp index f6829fc24..752bc6551 100644 --- a/interfaces/inner_api/appexecfwk_base/src/extension_ability_info.cpp +++ b/interfaces/inner_api/appexecfwk_base/src/extension_ability_info.cpp @@ -59,6 +59,7 @@ const char* SKILLS = "skills"; const char* NEED_CREATE_SANDBOX = "needCreateSandbox"; const char* DATA_GROUP_IDS = "dataGroupIds"; const char* JSON_KEY_VALID_DATA_GROUP_IDS = "validDataGroupIds"; +const char* JSON_KEY_CUSTOM_PROCESS = "customProcess"; const std::unordered_map EXTENSION_TYPE_MAP = { { "form", ExtensionAbilityType::FORM }, @@ -259,6 +260,7 @@ bool ExtensionAbilityInfo::ReadFromParcel(Parcel &parcel) for (auto i = 0; i < validDataGroupIdsSize; i++) { dataGroupIds.emplace_back(Str16ToStr8(parcel.ReadString16())); } + customProcess = Str16ToStr8(parcel.ReadString16()); return true; } @@ -343,6 +345,7 @@ bool ExtensionAbilityInfo::Marshalling(Parcel &parcel) const for (auto &dataGroupId : validDataGroupIds) { WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(dataGroupId)); } + WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(customProcess)); return true; } @@ -380,7 +383,8 @@ void to_json(nlohmann::json &jsonObject, const ExtensionAbilityInfo &extensionIn {JSON_KEY_SKILLS, extensionInfo.skills}, {NEED_CREATE_SANDBOX, extensionInfo.needCreateSandbox}, {DATA_GROUP_IDS, extensionInfo.dataGroupIds}, - {JSON_KEY_VALID_DATA_GROUP_IDS, extensionInfo.validDataGroupIds} + {JSON_KEY_VALID_DATA_GROUP_IDS, extensionInfo.validDataGroupIds}, + {JSON_KEY_CUSTOM_PROCESS, extensionInfo.customProcess} }; } @@ -603,6 +607,12 @@ void from_json(const nlohmann::json &jsonObject, ExtensionAbilityInfo &extension false, parseResult, ArrayType::STRING); + BMSJsonUtil::GetStrValueIfFindKey(jsonObject, + jsonObjectEnd, + JSON_KEY_CUSTOM_PROCESS, + extensionInfo.customProcess, + false, + parseResult); if (parseResult != ERR_OK) { APP_LOGE("ExtensionAbilityInfo from_json error : %{public}d", parseResult); } diff --git a/services/bundlemgr/src/module_profile.cpp b/services/bundlemgr/src/module_profile.cpp index 92088cc31..5d5e53ea3 100644 --- a/services/bundlemgr/src/module_profile.cpp +++ b/services/bundlemgr/src/module_profile.cpp @@ -199,6 +199,7 @@ struct Ability { std::string preferMultiWindowOrientation = "default"; std::vector continueType; std::vector continueBundleNames; + std::string process; }; struct Extension { @@ -221,6 +222,7 @@ struct Extension { std::vector metadata; std::string extensionProcessMode; std::vector dataGroupIds; + std::string customProcess; }; struct MultiAppMode { @@ -642,6 +644,12 @@ void from_json(const nlohmann::json &jsonObject, Ability &ability) false, g_parseResult, ArrayType::STRING); + BMSJsonUtil::GetStrValueIfFindKey(jsonObject, + jsonObjectEnd, + MODULE_PROCESS, + ability.process, + false, + g_parseResult); } void from_json(const nlohmann::json &jsonObject, Extension &extension) @@ -795,6 +803,12 @@ void from_json(const nlohmann::json &jsonObject, Extension &extension) false, g_parseResult, ArrayType::STRING); + BMSJsonUtil::GetStrValueIfFindKey(jsonObject, + jsonObjectEnd, + MODULE_PROCESS, + extension.customProcess, + false, + g_parseResult); } void from_json(const nlohmann::json &jsonObject, DeviceConfig &deviceConfig) @@ -2136,6 +2150,7 @@ bool ToAbilityInfo( abilityInfo.continueType = ability.continueType; } abilityInfo.orientationId = ability.orientationId; + abilityInfo.process = ability.process; return true; } @@ -2194,6 +2209,7 @@ void ToExtensionInfo( for (const std::string &dataGroup : extension.dataGroupIds) { extensionInfo.dataGroupIds.emplace_back(dataGroup); } + extensionInfo.customProcess = extension.customProcess; } bool GetPermissions( diff --git a/services/bundlemgr/test/unittest/bms_bundle_data_storage_test/bms_bundle_data_storage_database_test.cpp b/services/bundlemgr/test/unittest/bms_bundle_data_storage_test/bms_bundle_data_storage_database_test.cpp index dbd1fc11e..c06f704e4 100644 --- a/services/bundlemgr/test/unittest/bms_bundle_data_storage_test/bms_bundle_data_storage_database_test.cpp +++ b/services/bundlemgr/test/unittest/bms_bundle_data_storage_test/bms_bundle_data_storage_database_test.cpp @@ -865,7 +865,8 @@ protected: "continueType": [], "continueBundleName": [], "appIndex": 0, - "orientationId": 0 + "orientationId": 0, + "process": "" }, "com.ohos.launcher.com.ohos.launcher.recents.com.ohos.launcher.recents.MainAbility": { "applicationName": "com.ohos.launcher",