From 8457e59bc11f50bb96afb6e7e8c68817658bf22c Mon Sep 17 00:00:00 2001 From: sunjiakun Date: Wed, 6 Nov 2024 13:52:50 +0800 Subject: [PATCH] memory_1 Signed-off-by: sunjiakun --- .../appexecfwk_base/include/ability_info.h | 189 +++++++++--------- .../include/application_info.h | 164 +++++++-------- .../appexecfwk_base/include/bundle_info.h | 74 +++---- .../include/common_event_info.h | 4 +- .../appexecfwk_base/include/data_group_info.h | 6 +- .../include/extension_ability_info.h | 42 ++-- .../appexecfwk_base/include/form_info.h | 44 ++-- .../appexecfwk_base/include/hap_module_info.h | 70 +++---- .../include/overlay/overlay_bundle_info.h | 6 +- .../include/quick_fix/app_quick_fix.h | 4 +- .../include/quick_fix/appqf_info.h | 6 +- .../include/quick_fix/hqf_info.h | 4 +- .../inner_api/appexecfwk_base/include/skill.h | 4 +- .../include/inner_bundle_clone_info.h | 22 +- .../bundlemgr/include/inner_bundle_info.h | 97 +++++---- .../include/inner_bundle_user_info.h | 17 +- 16 files changed, 345 insertions(+), 408 deletions(-) diff --git a/interfaces/inner_api/appexecfwk_base/include/ability_info.h b/interfaces/inner_api/appexecfwk_base/include/ability_info.h index 79a9a434d5..f4164d2340 100644 --- a/interfaces/inner_api/appexecfwk_base/include/ability_info.h +++ b/interfaces/inner_api/appexecfwk_base/include/ability_info.h @@ -117,6 +117,29 @@ struct AbilityInfo; * According to Ability profile 1.0 */ struct CompatibleAbilityInfo : public Parcelable { + bool visible = false; + bool formEnabled = false; + bool multiUserShared = false; + bool supportPipMode = false; + bool grantPermission = false; + bool directLaunch = true; + bool enabled = true; + int32_t minFormHeight = 0; // minimum height of ability. + int32_t defaultFormHeight = 0; // default height of ability. + int32_t minFormWidth = 0; // minimum width of ability. + int32_t defaultFormWidth = 0; // default width of ability. + uint32_t iconId = 0; + uint32_t labelId = 0; + uint32_t descriptionId = 0; + uint32_t backgroundModes = 0; + uint32_t packageSize = 0; // The size of the package that AbilityInfo.uri points to. + // form widget info + uint32_t formEntity = 1; // where form can be displayed + // deprecated: remove this field in new package format. + AbilityType type = AbilityType::UNKNOWN; + AbilitySubType subType = AbilitySubType::UNSPECIFIED; + DisplayOrientation orientation = DisplayOrientation::UNSPECIFIED; + LaunchMode launchMode = LaunchMode::SINGLETON; // deprecated: ability code class simple name, use 'className' instead. std::string package; std::string name; @@ -132,46 +155,20 @@ struct CompatibleAbilityInfo : public Parcelable { std::string privacyName; std::string downloadUrl; std::string versionName; - uint32_t backgroundModes = 0; - uint32_t packageSize = 0; // The size of the package that AbilityInfo.uri points to. - bool visible = false; - bool formEnabled = false; - bool multiUserShared = false; - // deprecated: remove this field in new package format. - AbilityType type = AbilityType::UNKNOWN; - AbilitySubType subType = AbilitySubType::UNSPECIFIED; - DisplayOrientation orientation = DisplayOrientation::UNSPECIFIED; - LaunchMode launchMode = LaunchMode::SINGLETON; - std::vector permissions; - std::vector deviceTypes; - std::vector deviceCapabilities; - bool supportPipMode = false; - bool grantPermission = false; std::string readPermission; std::string writePermission; std::string uriPermissionMode; std::string uriPermissionPath; - bool directLaunch = true; - // set when install - std::string bundleName; // bundle name which has this ability. + std::string bundleName; // bundle name which has this ability. std::string className; // the ability full class name. std::string originalClassName; // the original ability full class name std::string deviceId; // device UDID information. + std::vector permissions; + std::vector deviceTypes; + std::vector deviceCapabilities; CompatibleApplicationInfo applicationInfo; - // form widget info - uint32_t formEntity = 1; // where form can be displayed - int32_t minFormHeight = 0; // minimum height of ability. - int32_t defaultFormHeight = 0; // default height of ability. - int32_t minFormWidth = 0; // minimum width of ability. - int32_t defaultFormWidth = 0; // default width of ability. - - uint32_t iconId = 0; - uint32_t labelId = 0; - uint32_t descriptionId = 0; - bool enabled = true; - bool ReadFromParcel(Parcel& parcel); virtual bool Marshalling(Parcel& parcel) const override; static CompatibleAbilityInfo* Unmarshalling(Parcel& parcel); @@ -181,53 +178,71 @@ struct CompatibleAbilityInfo : public Parcelable { // configuration information about an ability struct AbilityInfo : public Parcelable { - std::string name; // ability name, only the main class name - std::string label; - std::string description; - std::string iconPath; + bool visible = false; + bool isLauncherAbility = false; + bool isNativeAbility = false; + bool enabled = false; + bool supportPipMode = false; + bool formEnabled = false; + bool removeMissionAfterTerminate = false; + bool isModuleJson = false; + bool isStageBasedModel = false; + bool continuable = false; + // whether to support recover UI interface + bool recoverable = false; + bool isolationProcess = false; + // whether to display in the missions list + bool excludeFromMissions = false; + bool unclearableMission = false; + bool excludeFromDock = false; + bool grantPermission = false; + bool directLaunch = true; + bool multiUserShared = false; + int32_t minFormHeight = 0; + int32_t defaultFormHeight = 0; + int32_t minFormWidth = 0; + int32_t defaultFormWidth = 0; + int32_t priority = 0; + // for NAPI, save self query cache + int32_t uid = -1; + int32_t appIndex = 0; uint32_t labelId = 0; uint32_t descriptionId = 0; uint32_t iconId = 0; - std::string theme; - bool visible = false; - std::string kind; // ability category + uint32_t formEntity = 0; + uint32_t backgroundModes = 0; + uint32_t startWindowIconId = 0; + uint32_t startWindowBackgroundId = 0; + uint32_t maxWindowWidth = 0; + uint32_t minWindowWidth = 0; + uint32_t maxWindowHeight = 0; + uint32_t minWindowHeight = 0; + uint32_t packageSize = 0; + uint32_t orientationId = 0; + int64_t installTime = 0; AbilityType type = AbilityType::UNKNOWN; ExtensionAbilityType extensionAbilityType = ExtensionAbilityType::UNSPECIFIED; - std::string extensionTypeName; DisplayOrientation orientation = DisplayOrientation::UNSPECIFIED; - uint32_t orientationId = 0; LaunchMode launchMode = LaunchMode::SINGLETON; + CompileMode compileMode = CompileMode::JS_BUNDLE; + LinkType linkType = LinkType::DEEP_LINK; + AbilitySubType subType = AbilitySubType::UNSPECIFIED; + double maxWindowRatio = 0; + double minWindowRatio = 0; + std::string name; // ability name, only the main class name + std::string label; + std::string description; + std::string iconPath; + std::string theme; + std::string kind; // ability category + std::string extensionTypeName; std::string srcPath; std::string srcLanguage = "js"; - std::vector permissions; - std::string process; - std::vector deviceTypes; - std::vector deviceCapabilities; std::string uri; std::string targetAbility; - ApplicationInfo applicationInfo; - bool isLauncherAbility = false; - bool isNativeAbility = false; - bool enabled = false; - bool supportPipMode = false; - bool formEnabled = false; - bool removeMissionAfterTerminate = false; std::string readPermission; std::string writePermission; - std::vector configChanges; - uint32_t formEntity = 0; - int32_t minFormHeight = 0; - int32_t defaultFormHeight = 0; - int32_t minFormWidth = 0; - int32_t defaultFormWidth = 0; - MetaData metaData; - uint32_t backgroundModes = 0; - - // for Check flags, add to abilityInfo and extensionAbilityInfo - std::vector skillUri; - std::vector skills; - // set when install std::string package; // the "module.package" in config.json std::string bundleName; @@ -239,39 +254,10 @@ struct AbilityInfo : public Parcelable { std::string hapPath; std::string srcEntrance; - std::vector metadata; - bool isModuleJson = false; - bool isStageBasedModel = false; - bool continuable = false; - int32_t priority = 0; - // configuration fields on startup page std::string startWindowIcon; - uint32_t startWindowIconId = 0; std::string startWindowBackground; - uint32_t startWindowBackgroundId = 0; - // whether to display in the missions list - bool excludeFromMissions = false; - bool unclearableMission = false; - bool excludeFromDock = false; std::string preferMultiWindowOrientation = "default"; - // whether to support recover UI interface - bool recoverable = false; - bool isolationProcess = false; - - // support windows mode - std::vector windowModes; - double maxWindowRatio = 0; - double minWindowRatio = 0; - uint32_t maxWindowWidth = 0; - uint32_t minWindowWidth = 0; - uint32_t maxWindowHeight = 0; - uint32_t minWindowHeight = 0; - // for NAPI, save self query cache - int32_t uid = -1; - CompileMode compileMode = CompileMode::JS_BUNDLE; - int32_t appIndex = 0; - std::string originalBundleName; std::string appName; std::string privacyUrl; @@ -282,19 +268,24 @@ struct AbilityInfo : public Parcelable { std::string originalClassName; std::string uriPermissionMode; std::string uriPermissionPath; - uint32_t packageSize = 0; - bool multiUserShared = false; - bool grantPermission = false; - bool directLaunch = true; - AbilitySubType subType = AbilitySubType::UNSPECIFIED; std::string libPath; std::string deviceId; - int64_t installTime = 0; + ApplicationInfo applicationInfo; + std::vector permissions; + std::vector deviceTypes; + std::vector deviceCapabilities; + std::vector configChanges; std::vector supportExtNames; std::vector supportMimeTypes; std::vector continueType; std::unordered_set continueBundleNames; - LinkType linkType = LinkType::DEEP_LINK; + // support windows mode + std::vector windowModes; + // for Check flags, add to abilityInfo and extensionAbilityInfo + std::vector skillUri; + std::vector skills; + std::vector metadata; + MetaData metaData; bool ReadFromParcel(Parcel &parcel); virtual bool Marshalling(Parcel &parcel) const override; diff --git a/interfaces/inner_api/appexecfwk_base/include/application_info.h b/interfaces/inner_api/appexecfwk_base/include/application_info.h index c6512def10..64eb187a32 100644 --- a/interfaces/inner_api/appexecfwk_base/include/application_info.h +++ b/interfaces/inner_api/appexecfwk_base/include/application_info.h @@ -93,8 +93,8 @@ enum class ApplicationInfoFlag { }; struct MultiAppModeData : public Parcelable { - MultiAppModeType multiAppModeType = MultiAppModeType::UNSPECIFIED; int32_t maxCount = 0; + MultiAppModeType multiAppModeType = MultiAppModeType::UNSPECIFIED; bool ReadFromParcel(Parcel &parcel); virtual bool Marshalling(Parcel &parcel) const override; static MultiAppModeData *Unmarshalling(Parcel &parcel); @@ -136,15 +136,15 @@ struct MetaData { }; struct Resource : public Parcelable { + /** the resource id in hap */ + uint32_t id = 0; + /** the hap bundle name */ std::string bundleName; /** the hap module name */ std::string moduleName; - /** the resource id in hap */ - uint32_t id = 0; - bool ReadFromParcel(Parcel &parcel); virtual bool Marshalling(Parcel &parcel) const override; static Resource *Unmarshalling(Parcel &parcel); @@ -162,6 +162,14 @@ struct ApplicationEnvironment : public Parcelable { struct ApplicationInfo; struct CompatibleApplicationInfo : public Parcelable { + bool isCompressNativeLibs = true; + bool systemApp = false; + bool enabled = true; + bool debug = false; + int32_t supportedModes = 0; // supported modes. + uint32_t iconId = 0; + uint32_t labelId = 0; + uint32_t descriptionId = 0; // items set when installing. std::string name; // application name. std::string icon; // application icon resource index. @@ -169,21 +177,9 @@ struct CompatibleApplicationInfo : public Parcelable { std::string description; // description of application. std::string cpuAbi; // current device cpu abi. std::string process; - bool isCompressNativeLibs = true; - - uint32_t iconId = 0; - uint32_t labelId = 0; - uint32_t descriptionId = 0; - - bool systemApp = false; - std::vector permissions; std::vector moduleInfos; - int32_t supportedModes = 0; // supported modes. - bool enabled = true; - bool debug = false; - bool ReadFromParcel(Parcel& parcel); virtual bool Marshalling(Parcel& parcel) const override; static CompatibleApplicationInfo* Unmarshalling(Parcel& parcel); @@ -192,29 +188,6 @@ struct CompatibleApplicationInfo : public Parcelable { // configuration information about an application struct ApplicationInfo : public Parcelable { - std::string name; // application name is same to bundleName - std::string bundleName; - - uint32_t versionCode = 0; - int32_t minCompatibleVersionCode = 0; - std::string versionName; - - uint32_t apiCompatibleVersion = 0; - int32_t apiTargetVersion = 0; - int64_t crowdtestDeadline = Constants::INVALID_CROWDTEST_DEADLINE; - - std::string iconPath; - uint32_t iconId = 0; - Resource iconResource; - - std::string label; - uint32_t labelId = 0; - Resource labelResource; - - std::string description; - uint32_t descriptionId = 0; - Resource descriptionResource; - bool keepAlive = false; bool removable = true; bool singleton = false; @@ -231,13 +204,45 @@ struct ApplicationInfo : public Parcelable { bool asanEnabled = false; bool debug = false; bool distributedNotificationEnabled = true; - std::vector resourcesApply; - std::vector allowCommonEvent; - bool allowEnableNotification = false; bool gwpAsanEnabled = false; - int32_t supportedModes = 0; // returns 0 if the application does not support the driving mode - + // switch + bool multiProjects = false; + bool isCompressNativeLibs = true; + bool tsanEnabled = false; + bool hwasanEnabled = false; + bool cloudFileSyncEnabled = false; + // app detail ability + bool needAppDetail = false; + bool enabled = false; + bool ubsanEnabled = false; + int32_t minCompatibleVersionCode = 0; + int32_t apiTargetVersion = 0; + int32_t supportedModes = 0; // returns 0 if the application does not support the driving mode + int32_t appIndex = 0; + int32_t uid = -1; + int32_t flags = 0; + int32_t targetPriority = 0; + int32_t overlayState = 0; + int32_t maxChildProcess = 0; + int32_t applicationFlags = static_cast(ApplicationInfoFlag::FLAG_INSTALLED); + uint32_t versionCode = 0; + uint32_t apiCompatibleVersion = 0; + uint32_t iconId = 0; + uint32_t labelId = 0; + uint32_t descriptionId = 0; + // user related fields, assign when calling the get interface + uint32_t accessTokenId = 0; + uint32_t applicationReservedFlag = 0; + BundleType bundleType = BundleType::APP; + int64_t crowdtestDeadline = Constants::INVALID_CROWDTEST_DEADLINE; + uint64_t accessTokenIdEx = 0; + std::string name; // application name is same to bundleName + std::string bundleName; + std::string versionName; + std::string iconPath; + std::string label; + std::string description; std::string asanLogPath; std::string codePath; std::string dataDir; @@ -255,72 +260,41 @@ struct ApplicationInfo : public Parcelable { // provision std::string appDistributionType = Constants::APP_DISTRIBUTION_TYPE_NONE; std::string appProvisionType = Constants::APP_PROVISION_TYPE_RELEASE; - - // user related fields, assign when calling the get interface - uint32_t accessTokenId = 0; - int32_t appIndex = 0; - uint64_t accessTokenIdEx = 0; - bool enabled = false; - int32_t uid = -1; - // native so std::string nativeLibraryPath; std::string cpuAbi; std::string arkNativeFilePath; std::string arkNativeFileAbi; - + std::string fingerprint; + std::string signatureKey; + // overlay installation + std::string targetBundleName; + std::string compileSdkVersion; + std::string compileSdkType = DEFAULT_COMPILE_SDK_TYPE; + std::string installSource; + std::string configuration; + std::string icon; + std::string entryModuleName; + std::string organization; + std::string appDetailAbilityLibraryPath; + std::vector resourcesApply; + std::vector allowCommonEvent; // assign when calling the get interface std::vector permissions; std::vector moduleSourceDirs; + // Installation-free + std::vector targetBundleList; + std::vector appEnvironments; std::vector moduleInfos; std::map> hnpPackages; std::map> metaData; std::map> metadata; - // Installation-free - std::vector targetBundleList; - - std::string fingerprint; + Resource iconResource; + Resource labelResource; + Resource descriptionResource; // quick fix info AppQuickFix appQuickFix; - - // switch - bool multiProjects = false; - - bool isCompressNativeLibs = true; - int32_t flags = 0; - std::string icon; - std::string entryModuleName; - std::string signatureKey; - - // overlay installation - std::string targetBundleName; - int32_t targetPriority = 0; - int32_t overlayState = 0; - - BundleType bundleType = BundleType::APP; - - std::string compileSdkVersion; - std::string compileSdkType = DEFAULT_COMPILE_SDK_TYPE; - - std::vector appEnvironments; - std::string organization; - uint32_t applicationReservedFlag = 0; - bool tsanEnabled = false; - bool hwasanEnabled = false; - bool ubsanEnabled = false; - bool cloudFileSyncEnabled = false; - - // app detail ability - bool needAppDetail = false; - std::string appDetailAbilityLibraryPath; - MultiAppModeData multiAppMode; - int32_t maxChildProcess = 0; - - std::string installSource; - std::string configuration; - - int32_t applicationFlags = static_cast(ApplicationInfoFlag::FLAG_INSTALLED); bool ReadFromParcel(Parcel &parcel); bool ReadMetaDataFromParcel(Parcel &parcel); diff --git a/interfaces/inner_api/appexecfwk_base/include/bundle_info.h b/interfaces/inner_api/appexecfwk_base/include/bundle_info.h index ea265a37e4..6ce7bfeccc 100644 --- a/interfaces/inner_api/appexecfwk_base/include/bundle_info.h +++ b/interfaces/inner_api/appexecfwk_base/include/bundle_info.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -68,8 +68,8 @@ enum class GetBundleInfoFlag { }; struct RequestPermissionUsedScene : public Parcelable { - std::vector abilities; std::string when; + std::vector abilities; bool ReadFromParcel(Parcel &parcel); virtual bool Marshalling(Parcel &parcel) const override; @@ -77,10 +77,10 @@ struct RequestPermissionUsedScene : public Parcelable { }; struct RequestPermission : public Parcelable { + uint32_t reasonId = 0; std::string name; std::string moduleName; std::string reason; - uint32_t reasonId = 0; RequestPermissionUsedScene usedScene; bool ReadFromParcel(Parcel &parcel); @@ -101,65 +101,55 @@ struct SignatureInfo : public Parcelable { // configuration information about a bundle struct BundleInfo : public Parcelable { - std::string name; - - uint32_t versionCode = 0; - uint32_t minCompatibleVersionCode = 0; - std::string versionName; - - uint32_t compatibleVersion = 0; - uint32_t targetVersion = 0; - bool isNewVersion = false; bool isKeepAlive = false; bool singleton = false; bool isPreInstallApp = false; - - std::string vendor; - std::string releaseType; - bool isNativeApp = false; - bool entryInstallationFree = false; // application : false; atomic service : true - std::string mainEntry; // modulePackage - std::string entryModuleName; // moduleName - std::string appId; - std::vector oldAppIds; // used for appId changed - + bool isNativeApp = false; + bool isDifferentName = false; + int32_t appIndex = 0; // index for sandbox app + int32_t minSdkVersion = -1; + int32_t maxSdkVersion = -1; + int32_t overlayType = NON_OVERLAY_TYPE; + uint32_t versionCode = 0; + uint32_t minCompatibleVersionCode = 0; + uint32_t compatibleVersion = 0; + uint32_t targetVersion = 0; // user related fields, assign when calling the get interface int uid = -1; int gid = -1; int64_t installTime = 0; int64_t updateTime = 0; - int32_t appIndex = 0; // index for sandbox app - - ApplicationInfo applicationInfo; - std::vector abilityInfos; - std::vector extensionInfos; - std::vector hapModuleInfos; + std::string name; + std::string versionName; + std::string vendor; + std::string releaseType; + std::string mainEntry; // modulePackage + std::string entryModuleName; // moduleName + std::string appId; + std::string cpuAbi; + std::string seInfo; + std::string label; + std::string description; + std::string jointUserId; + std::vector reqPermissionStates; + std::vector oldAppIds; // used for appId changed std::vector hapModuleNames; // the "module.package" in each config.json std::vector moduleNames; // the "module.name" in each config.json std::vector modulePublicDirs; // the public paths of all modules of the application. std::vector moduleDirs; // the paths of all modules of the application. std::vector moduleResPaths; // the paths of all resources paths. - std::vector reqPermissions; std::vector defPermissions; - std::vector reqPermissionStates; std::vector reqPermissionDetails; std::vector overlayBundleInfos; - - std::string cpuAbi; - std::string seInfo; - std::string label; - std::string description; - std::string jointUserId; - int32_t minSdkVersion = -1; - int32_t maxSdkVersion = -1; - bool isDifferentName = false; - int32_t overlayType = NON_OVERLAY_TYPE; - - SignatureInfo signatureInfo; std::vector routerArray; + std::vector abilityInfos; + std::vector extensionInfos; + std::vector hapModuleInfos; + SignatureInfo signatureInfo; + ApplicationInfo applicationInfo; bool ReadFromParcel(Parcel &parcel); virtual bool Marshalling(Parcel &parcel) const override; diff --git a/interfaces/inner_api/appexecfwk_base/include/common_event_info.h b/interfaces/inner_api/appexecfwk_base/include/common_event_info.h index 23f76acdd9..8996120e79 100644 --- a/interfaces/inner_api/appexecfwk_base/include/common_event_info.h +++ b/interfaces/inner_api/appexecfwk_base/include/common_event_info.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -22,9 +22,9 @@ namespace OHOS { namespace AppExecFwk { struct CommonEventInfo : public Parcelable { + int32_t uid = -1; std::string name; std::string bundleName; - int32_t uid = -1; std::string permission; std::vector data; std::vector type; diff --git a/interfaces/inner_api/appexecfwk_base/include/data_group_info.h b/interfaces/inner_api/appexecfwk_base/include/data_group_info.h index b4cda07a57..1c83b9635a 100644 --- a/interfaces/inner_api/appexecfwk_base/include/data_group_info.h +++ b/interfaces/inner_api/appexecfwk_base/include/data_group_info.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -25,11 +25,11 @@ namespace OHOS { namespace AppExecFwk { struct DataGroupInfo : public Parcelable { public: - std::string dataGroupId; - std::string uuid; int32_t uid = 0; int32_t gid = 0; int32_t userId = 0; + std::string uuid; + std::string dataGroupId; bool ReadFromParcel(Parcel &parcel); virtual bool Marshalling(Parcel &parcel) const override; 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 b5d75e3197..c29004a173 100644 --- a/interfaces/inner_api/appexecfwk_base/include/extension_ability_info.h +++ b/interfaces/inner_api/appexecfwk_base/include/extension_ability_info.h @@ -127,6 +127,9 @@ enum class ExtensionProcessMode { }; struct SkillUriForAbilityAndExtension { + bool isMatch = false; + int32_t maxFileSupported = 0; + std::string scheme; std::string host; std::string port; @@ -136,50 +139,45 @@ struct SkillUriForAbilityAndExtension { std::string type; std::string utd; std::string linkFeature; - int32_t maxFileSupported = 0; - bool isMatch = false; }; struct ExtensionAbilityInfo : public Parcelable { + bool visible = false; + // set when install + bool enabled = true; + bool needCreateSandbox = false; + int32_t priority = 0; + // for NAPI, save self query cache + int32_t uid = -1; + int32_t appIndex = 0; + uint32_t iconId = 0; + uint32_t labelId = 0; + uint32_t descriptionId = 0; + ExtensionAbilityType type = ExtensionAbilityType::UNSPECIFIED; + CompileMode compileMode = CompileMode::JS_BUNDLE; + ExtensionProcessMode extensionProcessMode = ExtensionProcessMode::UNDEFINED; std::string bundleName; std::string moduleName; std::string name; std::string srcEntrance; std::string icon; - uint32_t iconId = 0; - uint32_t labelId = 0; std::string label; std::string description; - uint32_t descriptionId = 0; - int32_t priority = 0; - std::vector permissions; std::string readPermission; std::string writePermission; std::string uri; - ExtensionAbilityType type = ExtensionAbilityType::UNSPECIFIED; std::string extensionTypeName; - std::vector metadata; - ApplicationInfo applicationInfo; - ExtensionProcessMode extensionProcessMode = ExtensionProcessMode::UNDEFINED; - bool visible = false; - - // set when install - bool enabled = true; std::string resourcePath; std::string hapPath; std::string process; - CompileMode compileMode = CompileMode::JS_BUNDLE; - // for NAPI, save self query cache - int32_t uid = -1; - int32_t appIndex = 0; - + std::vector permissions; + std::vector metadata; // for Check flags, add to abilityInfo and extensionAbilityInfo std::vector skillUri; std::vector skills; - - bool needCreateSandbox = false; std::vector dataGroupIds; std::vector validDataGroupIds; + ApplicationInfo applicationInfo; bool ReadFromParcel(Parcel &parcel); virtual bool Marshalling(Parcel &parcel) const override; diff --git a/interfaces/inner_api/appexecfwk_base/include/form_info.h b/interfaces/inner_api/appexecfwk_base/include/form_info.h index 81f9e7f7e5..45b7024895 100644 --- a/interfaces/inner_api/appexecfwk_base/include/form_info.h +++ b/interfaces/inner_api/appexecfwk_base/include/form_info.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -25,6 +25,27 @@ namespace OHOS { namespace AppExecFwk { struct FormInfo : public Parcelable { + bool defaultFlag = false; + bool formVisibleNotify = false; + bool updateEnabled = false; + bool isStatic = true; + bool dataProxyEnabled = false; + bool isDynamic = true; + bool transparencyEnabled = false; + bool fontScaleFollowSystem = true; + + int32_t updateDuration = 0; + int32_t defaultDimension = 0; + int32_t privacyLevel = 0; + uint32_t displayNameId = 0; + uint32_t descriptionId = 0; + uint32_t versionCode = 0; + + FormType type = FormType::JS; + FormType uiSyntax = FormType::JS; + FormsColorMode colorMode = FormsColorMode::AUTO_MODE; + BundleType bundleType = BundleType::APP; + std::string package; std::string bundleName; std::string originalBundleName; @@ -39,34 +60,17 @@ struct FormInfo : public Parcelable { std::string formConfigAbility; std::string scheduledUpdateTime = ""; std::string src; + FormWindow window; - uint32_t displayNameId = 0; - uint32_t descriptionId = 0; - int32_t updateDuration = 0; - int32_t defaultDimension = 0; - bool defaultFlag = false; - bool formVisibleNotify = false; - bool updateEnabled = false; - bool isStatic = true; - bool dataProxyEnabled = false; - bool isDynamic = true; - bool transparencyEnabled = false; - bool fontScaleFollowSystem = true; - FormType type = FormType::JS; - FormType uiSyntax = FormType::JS; + std::vector supportDimensions; - FormsColorMode colorMode = FormsColorMode::AUTO_MODE; std::vector landscapeLayouts; std::vector portraitLayouts; std::vector customizeDatas; std::vector supportShapes; - int32_t privacyLevel = 0; - uint32_t versionCode = 0; - BundleType bundleType = BundleType::APP; FormInfo() = default; explicit FormInfo(const ExtensionAbilityInfo &abilityInfo, const ExtensionFormInfo &formInfo); - bool ReadFromParcel(Parcel &parcel); virtual bool Marshalling(Parcel &parcel) const override; static FormInfo *Unmarshalling(Parcel &parcel); diff --git a/interfaces/inner_api/appexecfwk_base/include/hap_module_info.h b/interfaces/inner_api/appexecfwk_base/include/hap_module_info.h index 8f92475170..5a79d86226 100644 --- a/interfaces/inner_api/appexecfwk_base/include/hap_module_info.h +++ b/interfaces/inner_api/appexecfwk_base/include/hap_module_info.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -70,9 +70,9 @@ struct PreloadItem : public Parcelable { }; struct Dependency : public Parcelable { + uint32_t versionCode = 0; std::string bundleName; std::string moduleName; - uint32_t versionCode = 0; bool ReadFromParcel(Parcel &parcel); virtual bool Marshalling(Parcel &parcel) const override; @@ -94,11 +94,11 @@ struct RouterItem : public Parcelable { std::string name; std::string pageSourceFile; std::string buildFunction; - std::map data; std::string customData; std::string ohmurl; std::string bundleName; std::string moduleName; + std::map data; bool ReadFromParcel(Parcel &parcel); virtual bool Marshalling(Parcel &parcel) const override; @@ -118,11 +118,24 @@ struct AppEnvironment : public Parcelable { struct HapModuleInfo : public Parcelable { bool compressNativeLibs = true; bool isLibIsolated = false; + bool deliveryWithInstall = false; + bool installationFree = false; + bool isModuleJson = false; + bool isStageBasedModel = false; + + int32_t upgradeFlag = 0; uint32_t descriptionId = 0; uint32_t iconId = 0; uint32_t labelId = 0; int supportedModes = 0; - std::string name; // module.name in config.json + + ModuleColorMode colorMode = ModuleColorMode::AUTO; + ModuleType moduleType = ModuleType::UNKNOWN; + CompileMode compileMode = CompileMode::JS_BUNDLE; + AOTCompileStatus aotCompileStatus = AOTCompileStatus::NOT_COMPILED; + IsolationMode isolationMode = IsolationMode::NONISOLATION_FIRST; + + std::string name; // module.name in config.json std::string package; std::string moduleName; // module.distro.moduleName in config.json std::string description; @@ -135,19 +148,6 @@ struct HapModuleInfo : public Parcelable { std::string hapPath; std::string nativeLibraryPath; std::string cpuAbi; - std::vector nativeLibraryFileNames; - - // quick fix hqf info - HqfInfo hqfInfo; - - // overlay module info - std::vector overlayModuleInfos; - - std::vector reqCapabilities; - std::vector deviceTypes; - std::vector dependencies; - std::vector abilityInfos; - ModuleColorMode colorMode = ModuleColorMode::AUTO; // new version fields std::string bundleName; std::string mainElementName; @@ -157,31 +157,33 @@ struct HapModuleInfo : public Parcelable { std::string srcEntrance; std::string uiSyntax; std::string virtualMachine; - bool deliveryWithInstall = false; - bool installationFree = false; - bool isModuleJson = false; - bool isStageBasedModel = false; - int32_t upgradeFlag = 0; - std::map isRemovable; - ModuleType moduleType = ModuleType::UNKNOWN; - std::vector extensionInfos; - std::vector metadata; - std::vector proxyDatas; - CompileMode compileMode = CompileMode::JS_BUNDLE; std::string moduleSourceDir; - std::vector preloads; std::string buildHash; - IsolationMode isolationMode = IsolationMode::NONISOLATION_FIRST; - AOTCompileStatus aotCompileStatus = AOTCompileStatus::NOT_COMPILED; std::string fileContextMenu; std::string routerMap; - std::vector routerArray; - std::vector appEnvironments; std::string packageName; + std::string appStartup; + + std::vector nativeLibraryFileNames; + std::vector reqCapabilities; + std::vector deviceTypes; + std::vector dependencies; + std::vector abilityInfos; + std::vector extensionInfos; + std::vector metadata; + std::vector proxyDatas; + std::vector preloads; + std::vector appEnvironments; + // overlay module info + std::vector overlayModuleInfos; + std::vector routerArray; + std::map isRemovable; + // quick fix hqf info + HqfInfo hqfInfo; + bool ReadFromParcel(Parcel &parcel); virtual bool Marshalling(Parcel &parcel) const override; static HapModuleInfo *Unmarshalling(Parcel &parcel); - std::string appStartup; }; } // namespace AppExecFwk } // namespace OHOS diff --git a/interfaces/inner_api/appexecfwk_base/include/overlay/overlay_bundle_info.h b/interfaces/inner_api/appexecfwk_base/include/overlay/overlay_bundle_info.h index f594bd8e5d..6262999ece 100644 --- a/interfaces/inner_api/appexecfwk_base/include/overlay/overlay_bundle_info.h +++ b/interfaces/inner_api/appexecfwk_base/include/overlay/overlay_bundle_info.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -30,10 +30,10 @@ enum OverlayType : int8_t { }; struct OverlayBundleInfo : public Parcelable { - std::string bundleName; - std::string bundleDir; int32_t state = 0; // 0 is for disable and 1 is for enable int32_t priority = 0; + std::string bundleName; + std::string bundleDir; bool ReadFromParcel(Parcel &parcel); virtual bool Marshalling(Parcel &parcel) const override; diff --git a/interfaces/inner_api/appexecfwk_base/include/quick_fix/app_quick_fix.h b/interfaces/inner_api/appexecfwk_base/include/quick_fix/app_quick_fix.h index 08555201ea..fd76ea0f54 100644 --- a/interfaces/inner_api/appexecfwk_base/include/quick_fix/app_quick_fix.h +++ b/interfaces/inner_api/appexecfwk_base/include/quick_fix/app_quick_fix.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -24,8 +24,8 @@ namespace OHOS { namespace AppExecFwk { struct AppQuickFix : public Parcelable { - std::string bundleName; // original bundle name uint32_t versionCode = 0; // original bundle version code + std::string bundleName; // original bundle name std::string versionName; // original bundle version name AppqfInfo deployedAppqfInfo; // deployed quick fix patch diff --git a/interfaces/inner_api/appexecfwk_base/include/quick_fix/appqf_info.h b/interfaces/inner_api/appexecfwk_base/include/quick_fix/appqf_info.h index 7289995f6e..94a10ac532 100644 --- a/interfaces/inner_api/appexecfwk_base/include/quick_fix/appqf_info.h +++ b/interfaces/inner_api/appexecfwk_base/include/quick_fix/appqf_info.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -26,10 +26,10 @@ namespace OHOS { namespace AppExecFwk { struct AppqfInfo : public Parcelable { uint32_t versionCode = 0; // quick fix version code + QuickFixType type = QuickFixType::UNKNOWN; // quick fix type std::string versionName; // quick fix version name std::string cpuAbi; // quick fix abi - std::string nativeLibraryPath; // quick fix so path - QuickFixType type = QuickFixType::UNKNOWN; // quick fix type + std::string nativeLibraryPath; // quick fix so path std::vector hqfInfos; bool ReadFromParcel(Parcel &parcel); diff --git a/interfaces/inner_api/appexecfwk_base/include/quick_fix/hqf_info.h b/interfaces/inner_api/appexecfwk_base/include/quick_fix/hqf_info.h index f73ce4d6d3..77912dc6f6 100644 --- a/interfaces/inner_api/appexecfwk_base/include/quick_fix/hqf_info.h +++ b/interfaces/inner_api/appexecfwk_base/include/quick_fix/hqf_info.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -29,10 +29,10 @@ enum class QuickFixType : int8_t { }; struct HqfInfo : public Parcelable { + QuickFixType type = QuickFixType::UNKNOWN; // quick fix type std::string moduleName; std::string hapSha256; std::string hqfFilePath; - QuickFixType type = QuickFixType::UNKNOWN; // quick fix type std::string cpuAbi; std::string nativeLibraryPath; diff --git a/interfaces/inner_api/appexecfwk_base/include/skill.h b/interfaces/inner_api/appexecfwk_base/include/skill.h index c71217605a..c481a74a42 100644 --- a/interfaces/inner_api/appexecfwk_base/include/skill.h +++ b/interfaces/inner_api/appexecfwk_base/include/skill.h @@ -26,6 +26,7 @@ namespace OHOS { namespace AppExecFwk { struct SkillUri { + int32_t maxFileSupported = 0; std::string scheme; std::string host; std::string port; @@ -34,16 +35,15 @@ struct SkillUri { std::string pathRegex; std::string type; std::string utd; - int32_t maxFileSupported = 0; std::string linkFeature; }; struct Skill : public Parcelable { public: + bool domainVerify = false; std::vector actions; std::vector entities; std::vector uris; - bool domainVerify = false; std::vector permissions; static std::string GetOptParamUri(const std::string &uriString); bool Match(const OHOS::AAFwk::Want &want) const; diff --git a/services/bundlemgr/include/inner_bundle_clone_info.h b/services/bundlemgr/include/inner_bundle_clone_info.h index 9174649f3f..06479885ba 100644 --- a/services/bundlemgr/include/inner_bundle_clone_info.h +++ b/services/bundlemgr/include/inner_bundle_clone_info.h @@ -22,32 +22,22 @@ namespace OHOS { namespace AppExecFwk { struct InnerBundleCloneInfo { - int32_t userId = Constants::INVALID_USERID; - // Indicates whether the bundle is disabled. bool enabled = true; - + bool encryptedKeyExisted = false; + int32_t userId = Constants::INVALID_USERID; // indicates whether the appIndex of clone app int32_t appIndex = 0; - int32_t uid = 0; - - std::vector gids; - - // disabled abilities of the user. - std::vector disabledAbilities; - uint32_t accessTokenId = 0; - - uint64_t accessTokenIdEx = 0; - // The time(unix time) will be recalculated // if the application is reinstalled after being uninstalled. int64_t installTime = 0; - - bool encryptedKeyExisted = false; - + uint64_t accessTokenIdEx = 0; std::string setEnabledCaller; + std::vector gids; + // disabled abilities of the user. + std::vector disabledAbilities; }; void from_json(const nlohmann::json& jsonObject, InnerBundleCloneInfo& bundleCloneInfo); diff --git a/services/bundlemgr/include/inner_bundle_info.h b/services/bundlemgr/include/inner_bundle_info.h index fba78bfc37..e0e1e7f8e7 100644 --- a/services/bundlemgr/include/inner_bundle_info.h +++ b/services/bundlemgr/include/inner_bundle_info.h @@ -77,12 +77,13 @@ struct InnerModuleInfo { bool gwpAsanEnabled = false; bool tsanEnabled = false; bool needDelete = false; + + int32_t targetPriority; + int32_t upgradeFlag = 0; uint32_t innerModuleInfoFlag = 0; uint32_t labelId = 0; uint32_t descriptionId = 0; uint32_t iconId = 0; - int32_t upgradeFlag = 0; - int32_t targetPriority; uint32_t versionCode = 0; BundleType bundleType = BundleType::SHARED; AOTCompileStatus aotCompileStatus = AOTCompileStatus::NOT_COMPILED; @@ -131,10 +132,10 @@ struct InnerModuleInfo { std::vector querySchemes; std::vector preloads; std::vector hnpPackages; + std::vector metadata; // new version fields std::vector definePermissions; std::vector requestPermissions; - std::vector metadata; std::vector dependencies; std::vector overlayModuleInfo; std::vector proxyDatas; @@ -2251,73 +2252,65 @@ private: void PrintSetEnabledInfo(bool isEnabled, int32_t userId, int32_t appIndex, const std::string &bundleName, const std::string &caller) const; - // using for get - Constants::AppType appType_ = Constants::AppType::THIRD_PARTY_APP; - int userId_ = Constants::DEFAULT_USERID; - BundleStatus bundleStatus_ = BundleStatus::ENABLED; - std::shared_ptr baseApplicationInfo_; - std::shared_ptr baseBundleInfo_; // applicationInfo and abilityInfo empty - std::string appFeature_; - std::vector allowedAcls_; - InstallMark mark_; - int32_t appIndex_ = Constants::INITIAL_APP_INDEX; - bool isSandboxApp_ = false; - - // only using for install or update progress, doesn't need to save to database - std::string currentPackage_; // Auxiliary property, which is used when the application // has been installed when the user is created. bool onlyCreateBundleUser_ = false; + bool isSandboxApp_ = false; + // new version fields + bool isNewVersion_ = false; + // use to control uninstalling + bool uninstallState_ = true; + // need to send a notification when uninstallState_ change + bool isNeedSendNotify_ = false; - std::map innerModuleInfos_; - - std::map> formInfos_; - std::map commonEvents_; - std::map shortcutInfos_; + int userId_ = Constants::DEFAULT_USERID; + int32_t appIndex_ = Constants::INITIAL_APP_INDEX; + int32_t overlayType_ = NON_OVERLAY_TYPE; + // apply quick fix frequency + int32_t applyQuickFixFrequency_ = 0; + // using for get + Constants::AppType appType_ = Constants::AppType::THIRD_PARTY_APP; - std::map baseAbilityInfos_; - std::map> skillInfos_; + std::string appFeature_; + // only using for install or update progress, doesn't need to save to database + std::string currentPackage_; + // for odid + std::string developerId_; + std::string odid_; + // curDynamicIconModule only in ExtendResourceInfos + std::string curDynamicIconModule_; - std::map innerBundleUserInfos_; + BundleStatus bundleStatus_ = BundleStatus::ENABLED; + std::shared_ptr baseApplicationInfo_; + std::shared_ptr baseBundleInfo_; // applicationInfo and abilityInfo empty std::shared_ptr bundlePackInfo_; - // new version fields - bool isNewVersion_ = false; - std::map baseExtensionInfos_; - std::map> extensionSkillInfos_; + std::vector allowedAcls_; // quick fix hqf info std::vector hqfInfos_; - // apply quick fix frequency - int32_t applyQuickFixFrequency_ = 0; - // overlay bundleInfo std::vector overlayBundleInfo_; - int32_t overlayType_ = NON_OVERLAY_TYPE; - // provision metadata std::vector provisionMetadatas_; - - // shared module info - std::map> innerSharedModuleInfos_ ; - - // data group info - std::unordered_map> dataGroupInfos_; - + + std::map innerModuleInfos_; + std::map> formInfos_; + std::map commonEvents_; + std::map shortcutInfos_; + std::map baseAbilityInfos_; + std::map> skillInfos_; + std::map innerBundleUserInfos_; + std::map baseExtensionInfos_; + std::map> extensionSkillInfos_; // key:moduleName value:ExtendResourceInfo std::map extendResourceInfos_; - // curDynamicIconModule only in ExtendResourceInfos - std::string curDynamicIconModule_; - - // for odid - std::string developerId_; - std::string odid_; - - // use to control uninstalling - bool uninstallState_ = true; + // data group info + std::unordered_map> dataGroupInfos_; + // shared module info + std::map> innerSharedModuleInfos_ ; - // need to send a notification when uninstallState_ change - bool isNeedSendNotify_ = false; + InstallMark mark_; }; void from_json(const nlohmann::json &jsonObject, InnerModuleInfo &info); diff --git a/services/bundlemgr/include/inner_bundle_user_info.h b/services/bundlemgr/include/inner_bundle_user_info.h index 5dad0465cd..2fb135e1bf 100644 --- a/services/bundlemgr/include/inner_bundle_user_info.h +++ b/services/bundlemgr/include/inner_bundle_user_info.h @@ -23,29 +23,24 @@ namespace OHOS { namespace AppExecFwk { struct InnerBundleUserInfo { - BundleUserInfo bundleUserInfo; - std::vector gids; + // app install control + bool isRemovable = true; int32_t uid = Constants::INVALID_UID; uint32_t accessTokenId = 0; - uint64_t accessTokenIdEx = 0; - std::string bundleName; - // The time(unix time) will be recalculated // if the application is reinstalled after being uninstalled. int64_t installTime = 0; - // The time(unix time) will be recalculated // if the application is uninstalled after being installed. int64_t updateTime = 0; - - // app install control - bool isRemovable = true; - + uint64_t accessTokenIdEx = 0; + std::string bundleName; // encryption key id std::string keyId; - + std::vector gids; // appIndex -> cloneInfo std::map cloneInfos; + BundleUserInfo bundleUserInfo; bool operator() (const InnerBundleUserInfo& info) const { -- Gitee