1 /* 2 * Copyright (c) 2021-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_SYSTEM_BUNDLE_INSTALLER_H 17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_SYSTEM_BUNDLE_INSTALLER_H 18 19 #include "base_bundle_installer.h" 20 21 namespace OHOS { 22 namespace AppExecFwk { 23 class SystemBundleInstaller : public BaseBundleInstaller { 24 public: 25 SystemBundleInstaller(); 26 virtual ~SystemBundleInstaller() override; 27 /** 28 * @brief Install preinstall app. 29 * @param filePath Indicates the filePath. 30 * @param installParam Indicates the installParam. 31 * @param appType Indicates the bundle type. 32 * @return Returns true if this function called successfully; returns false otherwise. 33 */ 34 ErrCode InstallSystemBundle( 35 const std::string &filePath, 36 InstallParam &installParam, 37 Constants::AppType appType); 38 /** 39 * @brief Install preinstall hsp. 40 * @param installParam Indicates the installParam. 41 * @param isOTA OTA install or not. 42 * @param appType Indicates the bundle type. 43 * @return Returns true if this function called successfully; returns false otherwise. 44 */ 45 bool InstallSystemSharedBundle(InstallParam &installParam, bool isOTA, Constants::AppType appType); 46 /** 47 * @brief OTA Install preinstall app. 48 * @param filePath Indicates the filePaths. 49 * @param installParam Indicates the installParam. 50 * @param appType Indicates the bundle type. 51 * @return Returns true if this function called successfully; returns false otherwise. 52 */ 53 ErrCode OTAInstallSystemBundle( 54 const std::vector<std::string> &filePaths, 55 InstallParam &installParam, 56 Constants::AppType appType); 57 /** 58 * @brief OTA Install preinstall app. 59 * @param filePath Indicates the filePaths. 60 * @param installParam Indicates the installParam. 61 * @param bundleName Indicates the bundleName. 62 * @param appType Indicates the bundle type. 63 * @return Returns true if this function called successfully; returns false otherwise. 64 */ 65 ErrCode OTAInstallSystemBundleNeedCheckUser( 66 const std::vector<std::string> &filePaths, 67 InstallParam &installParam, 68 const std::string &bundleName, 69 Constants::AppType appType); 70 /** 71 * @brief Uninstall preinstall app. 72 * @param bundleName Indicates the bundle name. 73 * @return Returns true if this function called successfully; returns false otherwise. 74 */ 75 bool UninstallSystemBundle(const std::string &bundleName); 76 77 bool UninstallSystemBundle(const std::string &bundleName, const InstallParam &installParam); 78 /** 79 * @brief Deleting apps while retaining user data. 80 * @param bundleName Indicates the bundle name. 81 * @param isKeepData Delete app keep app data. 82 * @return Returns true if this function called successfully; returns false otherwise. 83 */ 84 bool UninstallSystemBundle(const std::string &bundleName, bool isKeepData); 85 /** 86 * @brief Uninstall preinstall app by modulePackage. 87 * @param bundleName Indicates the bundle name. 88 * @param moduleName Indicates the module name. 89 * @return Returns true if this function called successfully; returns false otherwise. 90 */ 91 bool UninstallSystemBundle(const std::string &bundleName, const std::string &modulePackage); 92 void CheckUninstallSystemHsp(const std::string &bundleName); 93 94 private: 95 96 DISALLOW_COPY_AND_MOVE(SystemBundleInstaller); 97 }; 98 } // namespace AppExecFwk 99 } // namespace OHOS 100 #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_SYSTEM_BUNDLE_INSTALLER_H