• 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_BUNDLEMS_SLITE_CLIENT_H
17 #define OHOS_BUNDLEMS_SLITE_CLIENT_H
18 
19 #include "iproxy_client.h"
20 #include "nocopyable.h"
21 #include "want.h"
22 #include "bundle_install_msg.h"
23 #include "bundle_service_interface.h"
24 
25 namespace OHOS {
26 class BundleMsClient {
27 public:
GetInstance()28     static BundleMsClient &GetInstance()
29     {
30         static BundleMsClient instance;
31         return instance;
32     }
33 
34     ~BundleMsClient() = default;
35 
36     bool Initialize() const;
37 
38     bool Install(const char *hapPath, const InstallParam *installParam, InstallerCallback installerCallback) const;
39 
40     bool Uninstall(const char *bundleName, const InstallParam *installParam, InstallerCallback installerCallback) const;
41 
42     uint8_t QueryAbilityInfo(const Want *want, AbilityInfo *abilityInfo) const;
43 
44     uint8_t GetBundleInfo(const char *bundleName, int32_t flags, BundleInfo *bundleInfo) const;
45 
46     uint8_t GetBundleInfos(int32_t flags, BundleInfo **bundleInfos, int32_t *len) const;
47 
48     bool GetInstallState(const char *bundleName, InstallState *installState, uint8_t *installProcess) const;
49 
50     uint32_t GetBundleSize(const char *bundleName) const;
51 
52     bool RegisterInstallerCallback(InstallerCallback installerCallback) const;
53 
54 private:
55     BundleMsClient() = default;
56 
57     BmsSliteInterface *bmsProxy_ { nullptr };
58 
59     DISALLOW_COPY_AND_MOVE(BundleMsClient);
60 };
61 } // namespace OHOS
62 
63 #endif // OHOS_BUNDLEMS_SLITE_CLIENT_H