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 16 #ifndef FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_BUNDLEMGR_BUNDLE_MGR_EXT_CLIENT_H 17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_BUNDLEMGR_BUNDLE_MGR_EXT_CLIENT_H 18 19 #include <mutex> 20 21 #include "appexecfwk_errors.h" 22 #include "bundle_mgr_interface.h" 23 24 namespace OHOS { 25 namespace AppExecFwk { 26 27 class BundleMgrExtClient { 28 public: 29 static BundleMgrExtClient &GetInstance(); 30 ErrCode GetBundleNamesForUidExt(const int32_t uid, std::vector<std::string> &bundleNames); 31 32 private: 33 class BundleMgrExtDeathRecipient : public IRemoteObject::DeathRecipient { 34 public: 35 BundleMgrExtDeathRecipient() = default; 36 ~BundleMgrExtDeathRecipient() override = default; 37 void OnRemoteDied(const wptr<IRemoteObject>& remote) override; 38 39 private: 40 DISALLOW_COPY_AND_MOVE(BundleMgrExtDeathRecipient); 41 }; 42 sptr<IBundleMgrExt> GetBundleMgrExtProxy(); 43 void ResetBundleMgrExtProxy(const wptr<IRemoteObject> &remote); 44 45 BundleMgrExtClient() = default; 46 ~BundleMgrExtClient() = default; 47 DISALLOW_COPY_AND_MOVE(BundleMgrExtClient); 48 49 std::mutex mutex_; 50 sptr<IBundleMgrExt> bundleMgrExtProxy_; 51 sptr<IRemoteObject::DeathRecipient> deathRecipient_; 52 }; 53 } // namespace AppExecFwk 54 } // namespace OHOS 55 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_BUNDLEMGR_BUNDLE_MGR_EXT_CLIENT_H