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_INSTALL_PARAM_H 17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_INSTALL_PARAM_H 18 19 #include <map> 20 #include <string> 21 #include <vector> 22 23 #include "bundle_constants.h" 24 #include "parcel.h" 25 namespace OHOS { 26 namespace AppExecFwk { 27 enum class InstallFlag { 28 NORMAL = 0, 29 // Allow to replace the existing bundle when the new version isn't lower than the old one. 30 // If the bundle does not exist, just like normal flag. 31 REPLACE_EXISTING = 1, 32 FREE_INSTALL = 0x10, 33 }; 34 35 enum class InstallLocation { 36 INTERNAL_ONLY = 1, 37 PREFER_EXTERNAL = 2, 38 }; 39 40 enum class PermissionStatus { 41 NOT_VERIFIED_PERMISSION_STATUS = 0, 42 HAVE_PERMISSION_STATUS, 43 NON_HAVE_PERMISSION_STATUS 44 }; 45 46 // provides parameters required for installing or uninstalling an application 47 struct InstallParam : public Parcelable { 48 InstallFlag installFlag = InstallFlag::NORMAL; 49 InstallLocation installLocation = InstallLocation::INTERNAL_ONLY; 50 int32_t userId = Constants::UNSPECIFIED_USERID; 51 int64_t crowdtestDeadline = Constants::INVALID_CROWDTEST_DEADLINE; // for crowdtesting type hap 52 // is keep user data while uninstall. 53 bool isKeepData = false; 54 bool needSavePreInstallInfo = false; 55 bool isPreInstallApp = false; 56 bool removable = true; 57 // should force uninstall when delete userinfo. 58 bool forceExecuted = false; 59 // OTA upgrade skips the killing process 60 bool noSkipsKill = true; 61 bool needSendEvent = true; 62 bool withCopyHaps = false; 63 std::map<std::string, std::string> hashParams; 64 // whether need copy hap to install path 65 bool copyHapToInstallPath = true; 66 // is aging Cause uninstall. 67 bool isAgingUninstall = false; 68 // shared bundle directory paths 69 std::vector<std::string> sharedBundleDirPaths; 70 // status of install bundle permission 71 PermissionStatus installBundlePermissionStatus = PermissionStatus::NOT_VERIFIED_PERMISSION_STATUS; 72 // status of install enterprise bundle permission 73 PermissionStatus installEnterpriseBundlePermissionStatus = PermissionStatus::NOT_VERIFIED_PERMISSION_STATUS; 74 // status of install enterprise normal bundle permission 75 PermissionStatus installEtpNormalBundlePermissionStatus = PermissionStatus::NOT_VERIFIED_PERMISSION_STATUS; 76 // status of install enterprise mdm bundle permission 77 PermissionStatus installEtpMdmBundlePermissionStatus = PermissionStatus::NOT_VERIFIED_PERMISSION_STATUS; 78 // status of mdm update bundle for self 79 PermissionStatus installUpdateSelfBundlePermissionStatus = PermissionStatus::NOT_VERIFIED_PERMISSION_STATUS; 80 // is shell token 81 bool isCallByShell = false; 82 // Indicates the distribution type 83 std::string specifiedDistributionType = ""; 84 // Indicates the additional Info 85 std::string additionalInfo = ""; 86 // for AOT 87 bool isOTA = false; 88 // utilizing for code-signature 89 std::map<std::string, std::string> verifyCodeParams; 90 // for MDM self update 91 bool isSelfUpdate = false; 92 // the parcel object function is not const. 93 bool ReadFromParcel(Parcel &parcel); 94 virtual bool Marshalling(Parcel &parcel) const override; 95 static InstallParam *Unmarshalling(Parcel &parcel); 96 }; 97 98 struct UninstallParam : public Parcelable { 99 std::string bundleName; 100 std::string moduleName; 101 int32_t versionCode = Constants::ALL_VERSIONCODE; 102 int32_t userId; 103 104 bool ReadFromParcel(Parcel &parcel); 105 virtual bool Marshalling(Parcel &parcel) const override; 106 static UninstallParam *Unmarshalling(Parcel &parcel); 107 }; 108 } // namespace AppExecFwk 109 } // namespace OHOS 110 #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_INSTALL_PARAM_H 111