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_DISTRIBUTED_BUNDLE_MANANGER_INTERNAL_H 17 #define OHOS_DISTRIBUTED_BUNDLE_MANANGER_INTERNAL_H 18 19 #include <string> 20 21 #include "bundlemgr/bundle_mgr_interface.h" 22 #include "bundlemgr/bundle_mgr_proxy.h" 23 #include "single_instance.h" 24 25 namespace OHOS { 26 namespace DistributedSchedule { 27 class BundleManagerInternal { 28 DECLARE_SINGLE_INSTANCE(BundleManagerInternal); 29 30 public: 31 static bool GetCallerAppIdFromBms(int32_t callingUid, std::string& appId); 32 static bool GetCallerAppIdFromBms(const std::string& bundleName, std::string& appId); 33 static bool GetBundleNameListFromBms(int32_t callingUid, std::vector<std::string>& bundleNameList); 34 static bool GetBundleNameListFromBms(int32_t callingUid, std::vector<std::u16string>& u16BundleNameList); 35 static bool QueryAbilityInfo(const AAFwk::Want& want, AppExecFwk::AbilityInfo& abilityInfo); 36 static bool QueryExtensionAbilityInfo(const AAFwk::Want& want, AppExecFwk::ExtensionAbilityInfo& extensionInfo); 37 static void InitAbilityInfoFromExtension(const AppExecFwk::ExtensionAbilityInfo &extensionAbilityInfo, 38 AppExecFwk::AbilityInfo &abilityInfo); 39 static bool IsSameAppId(const std::string& callerAppId, const std::string& targetBundleName); 40 static int32_t GetLocalBundleInfo(const std::string& bundleName, AppExecFwk::BundleInfo &localBundleInfo); 41 static int32_t CheckRemoteBundleInfoForContinuation(const std::string& dstDeviceId, 42 const std::string& bundleName, AppExecFwk::DistributedBundleInfo& remoteBundleInfo); 43 static sptr<AppExecFwk::IBundleMgr> GetBundleManager(); 44 static int32_t GetUidFromBms(const std::string& bundleName); 45 static bool CheckIfRemoteCanInstall(const AAFwk::Want& want, int32_t missionId); 46 }; 47 } // namespace DistributedSchedule 48 } // namespace OHOS 49 #endif /* OHOS_DISTRIBUTED_BUNDLE_MANANGER_INTERNAL_H */ 50