1 /*
2  * Copyright (c) 2020-2023 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 OHOS_BMS_INTERFACE_H
17 #define OHOS_BMS_INTERFACE_H
18 
19 #include "feature.h"
20 #ifndef __LITEOS_M__
21 #include "iproxy_server.h"
22 #else
23 #include "iunknown.h"
24 #endif
25 #include "want.h"
26 #include "install_param.h"
27 #include "bundle_manager.h"
28 #include "bundle_info.h"
29 #include "bundle_install_msg.h"
30 
31 #ifdef __cplusplus
32 #if __cplusplus
33 extern "C" {
34 #endif
35 #endif /* __cplusplus */
36 
37 const char BMS_SERVICE[] = "bundlems";
38 const char BMS_FEATURE[] = "BmsFeature";
39 const char BMS_SLITE_FEATURE[] = "BmsSliteFeature";
40 const char BMS_INNER_FEATURE[] = "BmsInnerFeature";
41 const unsigned int MAX_PATH_LEN = 256;
42 
43 typedef struct {
44     char bundleParameter[MAX_PATH_LEN];
45     InstallParam *bundleInstallParam;
46     InstallerCallback bundleInstallerCallback;
47 } Bmsbuff;
48 
49 struct BmsSliteInterface {
50     INHERIT_IUNKNOWN;
51     bool (*Install)(const char *hapPath, const InstallParam *installParam, InstallerCallback installerCallback);
52     bool (*Uninstall)(const char *bundleName, const InstallParam *installParam, InstallerCallback installerCallback);
53     uint8_t (*QueryAbilityInfo)(const Want *want, AbilityInfo *abilityInfo);
54     uint8_t (*GetBundleInfo)(const char *bundleName, int32_t flags, BundleInfo *bundleInfo);
55     uint8_t (*GetBundleInfos)(int32_t flags, BundleInfo **bundleInfos, int32_t *len);
56     bool (*GetInstallState)(const char *bundleName, InstallState *installState, uint8_t *installProcess);
57     uint32_t (*GetBundleSize)(const char *bundleName);
58     bool (*RegisterInstallerCallback)(InstallerCallback installerCallback);
59     void (*UpdateBundleInfoList)();
60     uint8_t (*GetBundleInfosNoReplication)(const int flags, BundleInfo **bundleInfos, int32_t *len);
61     uint8_t (*QueryAbilityInfos)(const Want *want, AbilityInfo **abilityInfo, int32_t *len);
62     bool (*RegisterEvent)(InstallerCallback installerCallback);
63     bool (*UnregisterEvent)(InstallerCallback installerCallback);
64     PreAppList *(*InitPreAppInfo)(void);
65     void (*InsertPreAppInfo)(const char *filePath, PreAppList *list);
66     void (*SetPreAppInfo)(PreAppList *list);
67 };
68 #ifdef __cplusplus
69 #if __cplusplus
70 }
71 #endif
72 #endif /* __cplusplus */
73 #endif // OHOS_BMS_INTERFACE_H
74