• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <string>
20 
21 #include "bundle_constants.h"
22 #include "parcel.h"
23 namespace OHOS {
24 namespace AppExecFwk {
25 enum class InstallFlag {
26     NORMAL = 0,
27     // Allow to replace the existing bundle when the new version isn't lower than the old one.
28     // If the bundle does not exist, just like normal flag.
29     REPLACE_EXISTING = 1,
30     FREE_INSTALL = 0x10,
31 };
32 
33 enum class InstallLocation {
34     INTERNAL_ONLY = 1,
35     PREFER_EXTERNAL = 2,
36 };
37 
38 // provides parameters required for installing or uninstalling an application
39 struct InstallParam : public Parcelable {
40     InstallFlag installFlag = InstallFlag::NORMAL;
41     InstallLocation installLocation = InstallLocation::INTERNAL_ONLY;
42     int userId = Constants::UNSPECIFIED_USERID;
43     // is keep user data while uninstall.
44     bool isKeepData = false;
45     bool needSavePreInstallInfo = false;
46     bool isPreInstallApp = false;
47     // should force uninstall when delete userinfo.
48     bool forceExecuted  = false;
49     // OTA upgrade skips the killing process
50     bool noSkipsKill  = true;
51     bool needSendEvent = true;
52 
53     // the parcel object function is not const.
54     bool ReadFromParcel(Parcel &parcel);
55     virtual bool Marshalling(Parcel &parcel) const override;
56     static InstallParam *Unmarshalling(Parcel &parcel);
57 };
58 }  // namespace AppExecFwk
59 }  // namespace OHOS
60 #endif  // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_INSTALL_PARAM_H
61