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_BUNDLEMANAGERSERVICE_SLITE_FEATURE_H 17 #define OHOS_BUNDLEMANAGERSERVICE_SLITE_FEATURE_H 18 19 #include "gt_bundle_manager_service.h" 20 #include "bundle_service_interface.h" 21 #include "feature.h" 22 #include "iproxy_client.h" 23 #include "iunknown.h" 24 #include "nocopyable.h" 25 26 namespace OHOS { 27 const unsigned int BMS_INSTALL_MSG = 100; 28 typedef int32 (*InvokeFunc)(const void *origin, IpcIo *req); 29 30 class BundleMgrSliteFeature : public Feature { 31 public: 32 static bool Install(const char *hapPath, const InstallParam *installParam, InstallerCallback installerCallback); 33 static bool Uninstall(const char *bundleName, const InstallParam *installParam, 34 InstallerCallback installerCallback); 35 static uint8_t QueryAbilityInfo(const Want *want, AbilityInfo *abilityInfo); 36 static uint8_t GetBundleInfo(const char *bundleName, int32_t flags, BundleInfo *bundleInfo); 37 static uint8_t GetBundleInfos(int32_t flags, BundleInfo **bundleInfos, int32_t *len); 38 static bool GetInstallState(const char *bundleName, InstallState *installState, uint8_t *installProcess); 39 static uint32_t GetBundleSize (const char *bundleName); 40 static bool RegisterInstallerCallback(InstallerCallback installerCallback); 41 GetInstance()42 static BundleMgrSliteFeature *GetInstance() 43 { 44 static BundleMgrSliteFeature instance; 45 return &instance; 46 } 47 ~BundleMgrSliteFeature() = default; 48 Identity *GetIdentity(); 49 50 private: 51 BundleMgrSliteFeature(); 52 static const char *GetFeatureName(Feature *feature); 53 static void OnFeatureInitialize(Feature *feature, Service *parent, Identity identity); 54 static void OnFeatureStop(Feature *feature, Identity identity); 55 static BOOL OnFeatureMessage(Feature *feature, Request *request); 56 57 private: 58 Identity identity_; 59 GtManagerService *gtManagerService_; 60 DISALLOW_COPY_AND_MOVE(BundleMgrSliteFeature); 61 }; 62 63 typedef struct { 64 INHERIT_IUNKNOWNENTRY(BmsSliteInterface); 65 BundleMgrSliteFeature *bms; 66 } BundleMgrSliteFeatureImpl; 67 } // namespace OHOS 68 #endif // OHOS_BUNDLEMANAGERSERVICE_SLITE_FEATURE_H 69