1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_IPRE_INSTALL_DATA_STORAGE_H 17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_IPRE_INSTALL_DATA_STORAGE_H 18 19 #include "pre_install_bundle_info.h" 20 21 namespace OHOS { 22 namespace AppExecFwk { 23 class IPreInstallDataStorage { 24 public: 25 IPreInstallDataStorage() = default; 26 virtual ~IPreInstallDataStorage() = default; 27 /** 28 * @brief Save the preInstall bundle data corresponding to the device Id of the bundle name to KvStore. 29 * @param preInstallBundleInfo Indicates the PreInstallBundleInfo object to be save. 30 * @return Returns true if the data is successfully saved; returns false otherwise. 31 */ 32 virtual bool SavePreInstallStorageBundleInfo(const PreInstallBundleInfo &preInstallBundleInfo) = 0; 33 /** 34 * @brief Obtains the PreInstallBundleInfo objects provided by bundleName. 35 * @param preInstallBundleInfos Indicates information about the PreInstallBundleInfo. 36 * @return Returns true if this function is successfully called; returns false otherwise. 37 */ 38 virtual bool LoadAllPreInstallBundleInfos(std::vector<PreInstallBundleInfo> &preInstallBundleInfos) = 0; 39 /** 40 * @brief Delete the bundle data corresponding to the device Id of the bundle name to KvStore. 41 * @param innerBundleInfo Indicates the InnerBundleInfo object to be Delete. 42 * @return Returns true if the data is successfully deleted; returns false otherwise. 43 */ 44 virtual bool DeletePreInstallStorageBundleInfo(const PreInstallBundleInfo &preInstallBundleInfo) = 0; 45 /** 46 * @brief Obtains the PreInstallBundleInfo objects provided by bundleName. 47 * @param preInstallBundleInfos Indicates information about the PreInstallBundleInfo. 48 * @return Returns true if this function is successfully called; returns false otherwise. 49 */ 50 virtual bool LoadPreInstallBundleInfo(const std::string &bundleName, 51 PreInstallBundleInfo &preInstallBundleInfo) = 0; 52 }; 53 } // namespace AppExecFwk 54 } // namespace OHOS 55 #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_IPRE_INSTALL_DATA_STORAGE_H 56