1 /* 2 * Copyright (C) 2025 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 #ifndef ACCESSIBILITY_RESOURCE_BUNDLE_MANAGER_H 16 #define ACCESSIBILITY_RESOURCE_BUNDLE_MANAGER_H 17 18 #include "singleton.h" 19 #include "resource_manager.h" 20 #include "res_config.h" 21 #include "bundle_info.h" 22 #include "locale_config.h" 23 #include "locale_info.h" 24 #include "bundlemgr/bundle_mgr_interface.h" 25 #include "i_accessible_ability_manager_service.h" 26 #include "iremote_object.h" 27 #include "ffrt.h" 28 29 namespace OHOS { 30 namespace Accessibility { 31 32 class AccessibilityResourceBundleManager { 33 public: 34 AccessibilityResourceBundleManager(); 35 ~AccessibilityResourceBundleManager(); 36 37 ErrCode GetBundleInfoV9(const std::string& bundleName, int32_t flags, 38 AppExecFwk::BundleInfo& bundleInfo, int32_t userId); 39 40 int GetUidByBundleName(const std::string &bundleName, const std::string &abilityName, const int userId); 41 42 bool QueryExtensionAbilityInfos(const AppExecFwk::ExtensionAbilityType &extensionType, const int32_t &userId, 43 std::vector<AppExecFwk::ExtensionAbilityInfo> &extensionInfos); 44 45 public: 46 ffrt::mutex bundleMutex_; 47 48 private: 49 class BundleManagerDeathRecipient final : public IRemoteObject::DeathRecipient { 50 public: 51 BundleManagerDeathRecipient() = default; 52 ~BundleManagerDeathRecipient() final = default; 53 DISALLOW_COPY_AND_MOVE(BundleManagerDeathRecipient); 54 55 void OnRemoteDied(const wptr<IRemoteObject> &remote) final; 56 }; 57 58 void OnBundleManagerDied(const wptr<IRemoteObject> &remote); 59 sptr<AppExecFwk::IBundleMgr> GetBundleMgrProxy(); 60 61 sptr<AppExecFwk::IBundleMgr> bundleManager_ = nullptr; 62 sptr<IRemoteObject::DeathRecipient> bundleManagerDeathRecipient_ = nullptr; 63 }; 64 65 } // namespace Accessibility 66 } // namespace OHOS 67 68 #endif // ACCESSIBILITY_RESOURCE_BUNDLE_MANAGER_H