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 OTA Install preinstall app. 72 * @param filePath Indicates the filePaths. 73 * @param installParam Indicates the installParam. 74 * @param bundleName Indicates the bundleName. 75 * @param appType Indicates the bundle type. 76 * @param userIds Indicates the user to which the app needs to be installed. 77 * @return Returns true if this function called successfully; returns false otherwise. 78 */ 79 ErrCode OTAInstallSystemBundleTargetUser( 80 const std::vector<std::string> &filePaths, 81 InstallParam &installParam, 82 const std::string &bundleName, 83 Constants::AppType appType, 84 const std::vector<int32_t> &userIds); 85 /** 86 * @brief Uninstall preinstall app. 87 * @param bundleName Indicates the bundle name. 88 * @return Returns true if this function called successfully; returns false otherwise. 89 */ 90 bool UninstallSystemBundle(const std::string &bundleName); 91 92 bool UninstallSystemBundle(const std::string &bundleName, const InstallParam &installParam); 93 /** 94 * @brief Deleting apps while retaining user data. 95 * @param bundleName Indicates the bundle name. 96 * @param isKeepData Delete app keep app data. 97 * @return Returns true if this function called successfully; returns false otherwise. 98 */ 99 bool UninstallSystemBundle(const std::string &bundleName, bool isKeepData); 100 /** 101 * @brief Uninstall preinstall app by modulePackage. 102 * @param bundleName Indicates the bundle name. 103 * @param moduleName Indicates the module name. 104 * @return Returns true if this function called successfully; returns false otherwise. 105 */ 106 bool UninstallSystemBundle(const std::string &bundleName, const std::string &modulePackage); 107 void CheckUninstallSystemHsp(const std::string &bundleName); 108 109 private: 110 111 DISALLOW_COPY_AND_MOVE(SystemBundleInstaller); 112 }; 113 } // namespace AppExecFwk 114 } // namespace OHOS 115 #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_SYSTEM_BUNDLE_INSTALLER_H