From 7f553e209a734493d0d325dc5464bb8fd41ec163 Mon Sep 17 00:00:00 2001 From: sunjiakun Date: Thu, 12 Dec 2024 20:07:53 +0800 Subject: [PATCH] byte_align Signed-off-by: sunjiakun --- .../bundlemgr/include/inner_bundle_info.h | 84 +++++++++---------- .../include/inner_bundle_user_info.h | 12 +-- .../include/ipc/check_encryption_param.h | 6 +- .../bundlemgr/include/ipc/create_dir_param.h | 6 +- services/bundlemgr/include/ipc/file_stat.h | 6 +- services/bundlemgr/include/module_profile.h | 4 +- .../bundlemgr/include/navigation/sem_ver.h | 2 +- .../include/pre_install_bundle_info.h | 18 ++-- .../include/pre_install_exception_mgr.h | 4 +- services/bundlemgr/include/pre_scan_info.h | 6 +- .../include/quick_fix/inner_app_quick_fix.h | 4 +- .../include/quick_fix/quick_fix_deleter.h | 4 +- .../include/quick_fix/quick_fix_deployer.h | 8 +- .../quick_fix/quick_fix_manager_host_impl.h | 4 +- .../bundlemgr/include/rdb/bms_rdb_config.h | 4 +- .../bundlemgr/include/rdb/rdb_data_manager.h | 6 +- .../sandbox_app/bundle_sandbox_data_mgr.h | 6 +- .../bundle_sandbox_exception_handler.h | 4 +- .../sandbox_app/bundle_sandbox_installer.h | 6 +- .../shared/inner_shared_bundle_installer.h | 20 ++--- .../bundlemgr/include/status_receiver_proxy.h | 4 +- .../uninstall_bundle_info.h | 2 +- .../include/verify/verify_manager_host_impl.h | 4 +- services/bundlemgr/include/zip_file.h | 10 +-- 24 files changed, 117 insertions(+), 117 deletions(-) diff --git a/services/bundlemgr/include/inner_bundle_info.h b/services/bundlemgr/include/inner_bundle_info.h index fba78bfc37..d7c5998624 100644 --- a/services/bundlemgr/include/inner_bundle_info.h +++ b/services/bundlemgr/include/inner_bundle_info.h @@ -81,9 +81,9 @@ struct InnerModuleInfo { uint32_t labelId = 0; uint32_t descriptionId = 0; uint32_t iconId = 0; + uint32_t versionCode = 0; int32_t upgradeFlag = 0; int32_t targetPriority; - uint32_t versionCode = 0; BundleType bundleType = BundleType::SHARED; AOTCompileStatus aotCompileStatus = AOTCompileStatus::NOT_COMPILED; ModuleColorMode colorMode = ModuleColorMode::AUTO; @@ -118,6 +118,7 @@ struct InnerModuleInfo { std::string routerMap; std::string packageName; std::string appStartup; + Distro distro; // all user's value of isRemovable // key:userId // value:isRemovable true or flase @@ -141,7 +142,6 @@ struct InnerModuleInfo { std::vector appEnvironments; std::map isRemovable; MetaData metaData; - Distro distro; }; struct ExtendResourceInfo { @@ -2251,23 +2251,51 @@ private: void PrintSetEnabledInfo(bool isEnabled, int32_t userId, int32_t appIndex, const std::string &bundleName, const std::string &caller) const; + bool isSandboxApp_ = false; + // Auxiliary property, which is used when the application + // has been installed when the user is created. + bool onlyCreateBundleUser_ = 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; + BundleStatus bundleStatus_ = BundleStatus::ENABLED; + int32_t appIndex_ = Constants::INITIAL_APP_INDEX; + // apply quick fix frequency + int32_t applyQuickFixFrequency_ = 0; + int32_t overlayType_ = NON_OVERLAY_TYPE; // 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; + // curDynamicIconModule only in ExtendResourceInfos + std::string curDynamicIconModule_; + + // for odid + std::string developerId_; + std::string odid_; + std::shared_ptr baseApplicationInfo_; + std::shared_ptr baseBundleInfo_; // applicationInfo and abilityInfo empty + + std::shared_ptr bundlePackInfo_; + InstallMark mark_; + std::vector allowedAcls_; + + // quick fix hqf info + std::vector hqfInfos_; + + // overlay bundleInfo + std::vector overlayBundleInfo_; + + // provision metadata + std::vector provisionMetadatas_; std::map innerModuleInfos_; @@ -2279,45 +2307,17 @@ private: std::map> skillInfos_; std::map innerBundleUserInfos_; - - std::shared_ptr bundlePackInfo_; - // new version fields - bool isNewVersion_ = false; std::map baseExtensionInfos_; std::map> extensionSkillInfos_; - // 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_; - // 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; - - // need to send a notification when uninstallState_ change - bool isNeedSendNotify_ = false; + // data group info + std::unordered_map> dataGroupInfos_; }; 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..77377ff966 100644 --- a/services/bundlemgr/include/inner_bundle_user_info.h +++ b/services/bundlemgr/include/inner_bundle_user_info.h @@ -23,12 +23,12 @@ 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. @@ -37,15 +37,15 @@ struct InnerBundleUserInfo { // 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; + 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 { diff --git a/services/bundlemgr/include/ipc/check_encryption_param.h b/services/bundlemgr/include/ipc/check_encryption_param.h index 8a99490e76..717fed67fb 100644 --- a/services/bundlemgr/include/ipc/check_encryption_param.h +++ b/services/bundlemgr/include/ipc/check_encryption_param.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 @@ -29,12 +29,12 @@ enum class InstallBundleType : uint8_t { }; struct CheckEncryptionParam : public Parcelable { + bool isCompressNativeLibrary = false; + InstallBundleType installBundleType = InstallBundleType::HAP; std::string modulePath; std::string cpuAbi; std::string targetSoPath; - bool isCompressNativeLibrary = false; int32_t bundleId = -1; - InstallBundleType installBundleType = InstallBundleType::HAP; bool ReadFromParcel(Parcel &parcel); virtual bool Marshalling(Parcel &parcel) const override; diff --git a/services/bundlemgr/include/ipc/create_dir_param.h b/services/bundlemgr/include/ipc/create_dir_param.h index 710b9a9f75..f15003c1ba 100644 --- a/services/bundlemgr/include/ipc/create_dir_param.h +++ b/services/bundlemgr/include/ipc/create_dir_param.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 @@ -33,13 +33,13 @@ struct CreateDirParam : public Parcelable { bool isPreInstallApp = false; bool debug = false; bool isDlpSandbox = false; + CreateDirFlag createDirFlag = CreateDirFlag::CREATE_DIR_ALL; int32_t userId; int32_t uid; int32_t gid; std::string bundleName; - std::vector extensionDirs; std::string apl; - CreateDirFlag createDirFlag = CreateDirFlag::CREATE_DIR_ALL; + std::vector extensionDirs; bool ReadFromParcel(Parcel &parcel); virtual bool Marshalling(Parcel &parcel) const override; diff --git a/services/bundlemgr/include/ipc/file_stat.h b/services/bundlemgr/include/ipc/file_stat.h index 99e6abfad8..9c74c48621 100755 --- a/services/bundlemgr/include/ipc/file_stat.h +++ b/services/bundlemgr/include/ipc/file_stat.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 @@ -21,11 +21,11 @@ namespace OHOS { namespace AppExecFwk { struct FileStat : public Parcelable { + bool isDir = false; int32_t uid = -1; int32_t gid = -1; - int64_t lastModifyTime = -1; - bool isDir = false; int32_t mode = -1; + int64_t lastModifyTime = -1; bool ReadFromParcel(Parcel &parcel); virtual bool Marshalling(Parcel &parcel) const override; diff --git a/services/bundlemgr/include/module_profile.h b/services/bundlemgr/include/module_profile.h index b8146b312c..ed26a2ea0e 100644 --- a/services/bundlemgr/include/module_profile.h +++ b/services/bundlemgr/include/module_profile.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,9 +24,9 @@ namespace OHOS { namespace AppExecFwk { struct OverlayMsg { - OverlayType type = NON_OVERLAY_TYPE; bool isAppPriorityExisted = false; bool isModulePriorityExisted = false; + OverlayType type = NON_OVERLAY_TYPE; }; class ModuleProfile { diff --git a/services/bundlemgr/include/navigation/sem_ver.h b/services/bundlemgr/include/navigation/sem_ver.h index c611f915d5..4571668f98 100644 --- a/services/bundlemgr/include/navigation/sem_ver.h +++ b/services/bundlemgr/include/navigation/sem_ver.h @@ -29,9 +29,9 @@ public: std::string major; std::string minor; std::string patch; + std::string raw; std::vector prerelease; std::vector buildMeta; - std::string raw; explicit SemVer(std::string versionString); }; diff --git a/services/bundlemgr/include/pre_install_bundle_info.h b/services/bundlemgr/include/pre_install_bundle_info.h index e0fc8593f2..43570e13d0 100644 --- a/services/bundlemgr/include/pre_install_bundle_info.h +++ b/services/bundlemgr/include/pre_install_bundle_info.h @@ -275,20 +275,20 @@ public: } private: - std::string bundleName_; - std::string moduleName_; - int64_t hapTotalSize_ = 0; - uint32_t versionCode_; - uint32_t labelId_ = 0; - uint32_t iconId_ = 0; - std::vector bundlePaths_; bool removable_ = true; bool isUninstalled_ = false; - Constants::AppType appType_ = Constants::AppType::SYSTEM_APP; bool systemApp_ = false; - BundleType bundleType_ = BundleType::APP; // non pre-installed driver app also need to be pre-installed for new user bool isNonPreDriverApp_ = false; + uint32_t versionCode_; + uint32_t labelId_ = 0; + uint32_t iconId_ = 0; + Constants::AppType appType_ = Constants::AppType::SYSTEM_APP; + std::string bundleName_; + std::string moduleName_; + int64_t hapTotalSize_ = 0; + BundleType bundleType_ = BundleType::APP; + std::vector bundlePaths_; }; } // namespace AppExecFwk } // namespace OHOS diff --git a/services/bundlemgr/include/pre_install_exception_mgr.h b/services/bundlemgr/include/pre_install_exception_mgr.h index b4c951c971..5f72837960 100644 --- a/services/bundlemgr/include/pre_install_exception_mgr.h +++ b/services/bundlemgr/include/pre_install_exception_mgr.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 @@ -45,12 +45,12 @@ private: void SavePreInstallExceptionInfosToDb(); void DeletePreInstallExceptionInfosFromDb(); + bool hasInit_ = false; std::mutex preInstallExceptionMutex_; std::set exceptionPaths_; std::set exceptionBundleNames_; std::set exceptionAppServicePaths_; std::set exceptionAppServiceBundleNames_; - bool hasInit_ = false; }; } // namespace AppExecFwk } // namespace OHOS diff --git a/services/bundlemgr/include/pre_scan_info.h b/services/bundlemgr/include/pre_scan_info.h index f283e96f14..1ead1ee3d7 100644 --- a/services/bundlemgr/include/pre_scan_info.h +++ b/services/bundlemgr/include/pre_scan_info.h @@ -27,7 +27,6 @@ namespace { } } struct PreBundleConfigInfo { - std::string bundleName; bool keepAlive = false; bool singleton = false; bool runningResourcesApply = false; @@ -43,6 +42,7 @@ struct PreBundleConfigInfo { bool appShareLibrary = false; bool allowEnableNotification = false; bool allowAppRunWhenDeviceFirstLocked = false; + std::string bundleName; std::vector allowCommonEvent; std::vector appSignature; std::vector existInJsonFile; @@ -99,11 +99,11 @@ struct PreBundleConfigInfo { }; struct PreScanInfo { - std::string bundleDir; bool removable = true; + bool isDataPreloadHap = false; int32_t priority = 0; + std::string bundleDir; std::string appIdentifier; - bool isDataPreloadHap = false; bool operator < (const PreScanInfo &preScanInfo) const { diff --git a/services/bundlemgr/include/quick_fix/inner_app_quick_fix.h b/services/bundlemgr/include/quick_fix/inner_app_quick_fix.h index 936257c35c..eeab7e0f36 100644 --- a/services/bundlemgr/include/quick_fix/inner_app_quick_fix.h +++ b/services/bundlemgr/include/quick_fix/inner_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 @@ -39,8 +39,8 @@ enum QuickFixStatus : uint8_t { }; struct QuickFixMark { - std::string bundleName; int32_t status = QuickFixStatus::DEFAULT_STATUS; + std::string bundleName; }; class InnerAppQuickFix { diff --git a/services/bundlemgr/include/quick_fix/quick_fix_deleter.h b/services/bundlemgr/include/quick_fix/quick_fix_deleter.h index 1724206035..a1cad41c75 100755 --- a/services/bundlemgr/include/quick_fix/quick_fix_deleter.h +++ b/services/bundlemgr/include/quick_fix/quick_fix_deleter.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 @@ -37,9 +37,9 @@ private: ErrCode GetDataMgr(); ErrCode RemoveDeployingInfo(const std::string &bundleName); + std::string bundleName_; std::shared_ptr quickFixDataMgr_ = nullptr; std::shared_ptr dataMgr_ = nullptr; - std::string bundleName_; }; } // AppExecFwk } // OHOS diff --git a/services/bundlemgr/include/quick_fix/quick_fix_deployer.h b/services/bundlemgr/include/quick_fix/quick_fix_deployer.h index 28e6e970c7..8337633625 100755 --- a/services/bundlemgr/include/quick_fix/quick_fix_deployer.h +++ b/services/bundlemgr/include/quick_fix/quick_fix_deployer.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 @@ -126,11 +126,11 @@ private: ErrCode ExtractQuickFixResFile(const AppQuickFix &appQuickFix, const BundleInfo &bundleInfo); std::vector patchPaths_; - std::shared_ptr quickFixDataMgr_ = nullptr; - DeployQuickFixResult deployQuickFixResult_; - std::string appDistributionType_ = Constants::APP_DISTRIBUTION_TYPE_NONE; bool isDebug_ = false; + std::string appDistributionType_ = Constants::APP_DISTRIBUTION_TYPE_NONE; std::string targetPath_ = ""; + std::shared_ptr quickFixDataMgr_ = nullptr; + DeployQuickFixResult deployQuickFixResult_; #define CHECK_QUICK_FIX_RESULT_RETURN_IF_FAIL(errcode) \ do { \ diff --git a/services/bundlemgr/include/quick_fix/quick_fix_manager_host_impl.h b/services/bundlemgr/include/quick_fix/quick_fix_manager_host_impl.h index c0ccb6e5a5..4a765de169 100644 --- a/services/bundlemgr/include/quick_fix/quick_fix_manager_host_impl.h +++ b/services/bundlemgr/include/quick_fix/quick_fix_manager_host_impl.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 @@ -46,8 +46,8 @@ private: ErrCode CopyHqfToSecurityDir(const std::vector &bundleFilePaths, std::vector &securityFilePaths) const; - std::shared_ptr quickFixMgr_ = nullptr; std::atomic id_ = 0; + std::shared_ptr quickFixMgr_ = nullptr; }; } // AppExecFwk } // OHOS diff --git a/services/bundlemgr/include/rdb/bms_rdb_config.h b/services/bundlemgr/include/rdb/bms_rdb_config.h index 3e6e81a3bb..16a40241c8 100644 --- a/services/bundlemgr/include/rdb/bms_rdb_config.h +++ b/services/bundlemgr/include/rdb/bms_rdb_config.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 @@ -25,12 +25,12 @@ namespace OHOS { namespace AppExecFwk { struct BmsRdbConfig { + int32_t version { ServiceConstants::BUNDLE_RDB_VERSION }; std::string dbPath { ServiceConstants::BUNDLE_MANAGER_SERVICE_PATH }; std::string dbName; std::string tableName; std::string createTableSql; std::vector insertColumnSql; - int32_t version { ServiceConstants::BUNDLE_RDB_VERSION }; }; } // namespace AppExecFwk } // namespace OHOS diff --git a/services/bundlemgr/include/rdb/rdb_data_manager.h b/services/bundlemgr/include/rdb/rdb_data_manager.h index da85cdb63b..060c4d52c9 100644 --- a/services/bundlemgr/include/rdb/rdb_data_manager.h +++ b/services/bundlemgr/include/rdb/rdb_data_manager.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 @@ -58,11 +58,11 @@ public: bool CheckIsSatisfyTime(); private: std::shared_ptr GetRdbStore(); - std::mutex rdbMutex_; - std::shared_ptr rdbStore_; bool isInitial_ = false; + std::mutex rdbMutex_; static std::mutex restoreRdbMutex_; + std::shared_ptr rdbStore_; BmsRdbConfig bmsRdbConfig_; }; diff --git a/services/bundlemgr/include/sandbox_app/bundle_sandbox_data_mgr.h b/services/bundlemgr/include/sandbox_app/bundle_sandbox_data_mgr.h index 8cfc48a46d..08b4448a45 100644 --- a/services/bundlemgr/include/sandbox_app/bundle_sandbox_data_mgr.h +++ b/services/bundlemgr/include/sandbox_app/bundle_sandbox_data_mgr.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 @@ -53,13 +53,13 @@ public: private: bool RestoreSandboxAppIndex(const std::string &bundleName, int32_t appIndex); + mutable std::mutex sandboxAppIndexMapMutex_; mutable std::shared_mutex sandboxAppMutex_; mutable std::shared_mutex sandboxDbMutex_; - mutable std::mutex sandboxAppIndexMapMutex_; + std::shared_ptr sandboxManagerDb_ = nullptr; // key: bundleName_appindex std::unordered_map sandboxAppInfos_; std::unordered_map> sandboxAppIndexMap_; - std::shared_ptr sandboxManagerDb_ = nullptr; }; } // AppExecFwk } // OHOS diff --git a/services/bundlemgr/include/sandbox_app/bundle_sandbox_exception_handler.h b/services/bundlemgr/include/sandbox_app/bundle_sandbox_exception_handler.h index 16bf6ed82a..f72d3808cd 100644 --- a/services/bundlemgr/include/sandbox_app/bundle_sandbox_exception_handler.h +++ b/services/bundlemgr/include/sandbox_app/bundle_sandbox_exception_handler.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 @@ -56,8 +56,8 @@ private: void RemoveDataDir(); void ListeningUserUnlocked(); - std::map> sandboxDirs_; std::weak_ptr dataStorage_; + std::map> sandboxDirs_; }; } // namespace AppExecFwk } // namespace OHOS diff --git a/services/bundlemgr/include/sandbox_app/bundle_sandbox_installer.h b/services/bundlemgr/include/sandbox_app/bundle_sandbox_installer.h index 75616bdb74..b256581ca1 100644 --- a/services/bundlemgr/include/sandbox_app/bundle_sandbox_installer.h +++ b/services/bundlemgr/include/sandbox_app/bundle_sandbox_installer.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 @@ -60,10 +60,10 @@ private: ErrCode GetDataMgr(); ErrCode GetSandboxDataMgr(); + int32_t userId_ = Constants::INVALID_USERID; + std::string bundleName_; std::shared_ptr dataMgr_ = nullptr; std::shared_ptr sandboxDataMgr_ = nullptr; - std::string bundleName_; - int32_t userId_ = Constants::INVALID_USERID; }; } // AppExecFwk } // OHOS diff --git a/services/bundlemgr/include/shared/inner_shared_bundle_installer.h b/services/bundlemgr/include/shared/inner_shared_bundle_installer.h index d251e557d5..aae921b5ae 100644 --- a/services/bundlemgr/include/shared/inner_shared_bundle_installer.h +++ b/services/bundlemgr/include/shared/inner_shared_bundle_installer.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 @@ -122,26 +122,26 @@ private: void UpdateInnerModuleInfo(const std::string packageName, const InnerModuleInfo &innerModuleInfo); void MarkInstallFinish(); + bool isBundleExist_ = false; + bool isEnterpriseBundle_ = false; + bool isPreInstalledBundle_ = false; // the real path or the parent directory of hsp files to be installed. std::string sharedBundlePath_; std::string bundleName_; std::string signatureFileDir_; + std::string nativeLibraryPath_; + std::string appIdentifier_; + std::string compileSdkType_; + std::string cpuAbi_; + std::string tempSoPath_; + std::unique_ptr bundleInstallChecker_ = nullptr; std::vector toDeleteTempHspPath_; // the key is the real path of each hsp file std::unordered_map parsedBundles_; // created directories during installation, will be deleted when rollback. std::vector createdDirs_; - bool isBundleExist_ = false; InnerBundleInfo oldBundleInfo_; InnerBundleInfo newBundleInfo_; - std::unique_ptr bundleInstallChecker_ = nullptr; - std::string nativeLibraryPath_; - bool isEnterpriseBundle_ = false; - std::string appIdentifier_; - std::string compileSdkType_; - std::string cpuAbi_; - std::string tempSoPath_; - bool isPreInstalledBundle_ = false; DISALLOW_COPY_AND_MOVE(InnerSharedBundleInstaller); diff --git a/services/bundlemgr/include/status_receiver_proxy.h b/services/bundlemgr/include/status_receiver_proxy.h index e722959ec1..3510e3ed91 100644 --- a/services/bundlemgr/include/status_receiver_proxy.h +++ b/services/bundlemgr/include/status_receiver_proxy.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 @@ -46,8 +46,8 @@ private: private: int32_t resultCode_ = -1; - std::string resultMsg_; uint32_t streamInstallerId_ = 0; + std::string resultMsg_; static inline BrokerDelegator delegator_; }; } // namespace AppExecFwk diff --git a/services/bundlemgr/include/uninstall_data_mgr/uninstall_bundle_info.h b/services/bundlemgr/include/uninstall_data_mgr/uninstall_bundle_info.h index 0fd1e2530c..6e65dc9a2f 100644 --- a/services/bundlemgr/include/uninstall_data_mgr/uninstall_bundle_info.h +++ b/services/bundlemgr/include/uninstall_data_mgr/uninstall_bundle_info.h @@ -23,9 +23,9 @@ namespace OHOS { namespace AppExecFwk { struct UninstallDataUserInfo { int32_t uid = 0; - std::vector gids; uint32_t accessTokenId = 0; uint64_t accessTokenIdEx = 0; + std::vector gids; }; struct UninstallBundleInfo { std::string appId; diff --git a/services/bundlemgr/include/verify/verify_manager_host_impl.h b/services/bundlemgr/include/verify/verify_manager_host_impl.h index 1295a22e99..2e67c0add0 100644 --- a/services/bundlemgr/include/verify/verify_manager_host_impl.h +++ b/services/bundlemgr/include/verify/verify_manager_host_impl.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 @@ -55,9 +55,9 @@ private: bool GetCallingBundleName(std::string &bundleName); std::atomic id_ = 0; + mutable std::shared_mutex bundleMutex_; // using for locking by bundleName std::unordered_map bundleMutexMap_; - mutable std::shared_mutex bundleMutex_; }; } // AppExecFwk } // OHOS diff --git a/services/bundlemgr/include/zip_file.h b/services/bundlemgr/include/zip_file.h index 758db1fbd9..9226d8c175 100644 --- a/services/bundlemgr/include/zip_file.h +++ b/services/bundlemgr/include/zip_file.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 @@ -140,11 +140,11 @@ struct ZipEntry { ~ZipEntry() = default; // for CodeDEX warning uint16_t compressionMethod = 0; + uint16_t flags = 0; uint32_t uncompressedSize = 0; uint32_t compressedSize = 0; uint32_t localHeaderOffset = 0; uint32_t crc = 0; - uint16_t flags = 0; std::string fileName; }; @@ -291,17 +291,17 @@ private: bool ReadZStream(const BytePtr &buffer, z_stream &zstream, uint32_t &remainCompressedSize) const; private: + bool isOpen_ = false; std::string pathName_; FILE *file_ = nullptr; - EndDir endDir_; - ZipEntryMap entriesMap_; // offset of central directory relative to zip file. ZipPos centralDirPos_ = 0; // this zip content start offset relative to zip file. ZipPos fileStartPos_ = 0; // this zip content length in the zip file. ZipPos fileLength_ = 0; - bool isOpen_ = false; + EndDir endDir_; + ZipEntryMap entriesMap_; }; } // namespace AppExecFwk } // namespace OHOS -- Gitee