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_FREE_INSTALL_FREE_INSTALL_PARAMS_H
17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_FREE_INSTALL_FREE_INSTALL_PARAMS_H
18 
19 #include <string>
20 
21 #include "iremote_object.h"
22 #include "want.h"
23 
24 namespace OHOS {
25 namespace AppExecFwk {
26 
27 enum UpgradeFlag {
28     NOT_UPGRADE = 0,
29     SINGLE_UPGRADE = 1,
30     RELATION_UPGRADE = 2,
31 };
32 
33 enum FreeInstallErrorCode {
34     CONNECT_ERROR = 0x820101,
35     SERVICE_CENTER_CRASH = 0x820102,
36     SERVICE_CENTER_TIMEOUT = 0x820103,
37     UNDEFINED_ERROR = 0x820104,
38 };
39 
40 enum ServiceCenterFunction {
41     CONNECT_DISPATCHER_INFO = 1,
42     CONNECT_SILENT_INSTALL = 2,
43     CONNECT_UPGRADE_CHECK = 3,
44     CONNECT_UPGRADE_INSTALL = 4,
45     CONNECT_QUERY_RPCID = 5,
46     CONNECT_PRELOAD_INSTALL = 6,
47     CONNECT_DELAYED_HEARTBEAT = 8,
48 };
49 
50 const std::set<ServiceCenterFunction> DISCONNECT_ABILITY_FUNC = {
51     ServiceCenterFunction::CONNECT_UPGRADE_CHECK,
52     ServiceCenterFunction::CONNECT_PRELOAD_INSTALL
53 };
54 
55 enum ServiceCenterResultCode {
56     FREE_INSTALL_OK = 0,
57     FREE_INSTALL_DOWNLOADING = 1,
58 };
59 
60 enum ServiceCenterConnectState {
61     CONNECTED = 0,
62     CONNECTING = 1,
63     DISCONNECTED = 2,
64 };
65 
66 struct FreeInstallParams : public virtual RefBase {
67     sptr<IRemoteObject> callback;
68     OHOS::AAFwk::Want want;
69     int32_t userId;
70     ServiceCenterFunction serviceCenterFunction;
71 };
72 }  // namespace AppExecFwk
73 }  // namespace OHOS
74 #endif  // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_FREE_INSTALL_FREE_INSTALL_PARAMS_H
75