1 /*
2  * Copyright (c) 2020 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_BUNDLE_INNER_INTERFACE_H
17 #define OHOS_BUNDLE_INNER_INTERFACE_H
18 
19 #include "ability_info.h"
20 #include "bundle_info.h"
21 #include "iproxy_server.h"
22 #include "want.h"
23 
24 #ifdef __cplusplus
25 #if __cplusplus
26 extern "C" {
27 #endif
28 #endif /* __cplusplus */
29 
30 const char BMS_SERVICE[] = "bundlems";
31 const char BMS_FEATURE[] = "BmsFeature";
32 const char BMS_INNER_FEATURE[] = "BmsInnerFeature";
33 
34 enum BmsCmd {
35     QUERY_ABILITY_INFO = 0,
36     GET_BUNDLE_INFO,
37     CHANGE_CALLBACK_SERVICE_IDENTITY,
38     GET_BUNDLENAME_FOR_UID,
39     GET_BUNDLE_INFOS,
40     QUERY_KEEPALIVE_BUNDLE_INFOS,
41     GET_BUNDLE_INFOS_BY_METADATA,
42     CHECK_SYS_CAP,
43     GET_BUNDLE_SIZE,
44     GET_BUNDLE_INFO_LENGTH,
45     GET_BUNDLE_INFO_BY_INDEX,
46     GET_SYS_CAP,
47     BMS_INNER_BEGIN,
48     INSTALL = BMS_INNER_BEGIN, // bms install application
49     UNINSTALL,
50 #ifdef OHOS_DEBUG
51     SET_EXTERNAL_INSTALL_MODE,
52     SET_SIGN_DEBUG_MODE,
53     SET_SIGN_MODE,
54 #endif
55     BMS_CMD_END
56 };
57 
58 struct BmsServerProxy {
59     INHERIT_SERVER_IPROXY;
60     uint8_t (*QueryAbilityInfo)(const Want *want, AbilityInfo *abilityInfo);
61     uint8_t (*GetBundleInfo)(const char *bundleName, int32_t flags, BundleInfo *bundleInfo);
62     uint8_t (*GetBundleInfos)(int flags, BundleInfo **bundleInfos, int32_t *len);
63     uint8_t (*QueryKeepAliveBundleInfos)(BundleInfo **bundleInfos, int32_t *len);
64     uint8_t (*GetBundleNameForUid)(int32_t uid,  char **bundleName);
65     uint32_t (*GetBundleSize)(const char *bundleName);
66 };
67 
68 struct BmsInnerServerProxy {
69     INHERIT_SERVER_IPROXY;
70 };
71 
72 #ifdef __cplusplus
73 #if __cplusplus
74 }
75 #endif
76 #endif /* __cplusplus */
77 #endif /* OHOS_BUNDLE_INNER_INTERFACE_H */