• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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_INSTALL_MSG_H
17 #define OHOS_BUNDLE_INSTALL_MSG_H
18 
19 #include <stdint.h>
20 
21 #include "bundle_manager.h"
22 
23 #ifdef __cplusplus
24 #if __cplusplus
25 extern "C" {
26 #endif
27 #endif /* __cplusplus */
28 
29 typedef enum {
30     BUNDLE_INSTALL_DOING = 0,
31     BUNDLE_INSTALL_OK = 1,
32     BUNDLE_INSTALL_FAIL = 2,
33     BUNDLE_UNINSTALL_DOING = 3,
34     BUNDLE_UNINSTALL_OK = 4,
35     BUNDLE_UNINSTALL_FAIL = 5
36 } InstallState;
37 
38 typedef struct {
39     char *bundleName;
40     char *label;
41     char *smallIconPath;
42     char *bigIconPath;
43     InstallState installState;
44     uint8_t installProcess;
45 } BundleInstallMsg;
46 
47 /**
48  * @brief Get the install state and install process of the bundle.
49  *
50  * @param bundleName Indicates the name of the bundle.
51  * @param installState Obtains install state.
52  * @param installProcess Obtains install process.
53  * @return Returns success or not.
54  *
55  * @since 4.0
56  * @version 4.0
57  */
58 bool GetInstallState(const char *bundleName, InstallState *installState, uint8_t *installProcess);
59 
60 /**
61  * @brief Get the bundle size.
62  *
63  * @param bundleName Indicates the name of the bundle.
64  * @return Returns bundle size or returns 0 if get bundle size failed.
65  *
66  */
67 uint32_t GetBundleSize(const char *bundleName);
68 
69 /**
70  * @brief Register installer callback.
71  *
72  * @param installerCallback Indicates the installer callback.
73  * @return Returns success or failure.
74  *
75  */
76 bool RegisterInstallerCallback(InstallerCallback installerCallback);
77 
78 /**
79  * @brief Update bundleInfo when system language has been changed.
80  *
81  */
82 void UpdateBundleInfoList(void);
83 
84  /**
85  * @brief Obtains the {@link BundleInfo} of all bundles with no replication in the system.
86  *
87  * @param flags Specifies whether each of the obtained {@link BundleInfo} objects can contain {@link AbilityInfo}.
88  *               The value <b>1</b> indicates that it can contain {@link AbilityInfo}, and <b>0</b> indicates that
89  *              it cannot.
90  * @param bundleInfos Indicates the double pointer to the obtained {@link BundleInfo} objects.
91  * @param len Indicates the pointer to the number of {@link BundleInfo} objects obtained.
92  * @return Returns {@link ERR_OK} if this function is successfully called; returns another error code defined in
93  *         {@link AppexecfwkErrors} otherwise.
94  *
95  */
96 uint8_t GetBundleInfosNoReplication(const int flags, BundleInfo **bundleInfos, int32_t *len);
97 
98 #ifdef __cplusplus
99 #if __cplusplus
100 }
101 #endif
102 #endif /* __cplusplus */
103 #endif /* OHOS_BUNDLE_INSTALL_MSG_H */
104 /** @} */