/* * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef BASE_NOTIFICATION_ANS_STANDARD_SERVICES_ANS_INCLUDE_BUNDLE_MANAGER_HELPER_H #define BASE_NOTIFICATION_ANS_STANDARD_SERVICES_ANS_INCLUDE_BUNDLE_MANAGER_HELPER_H #include #include #include #include "bundle_mgr_interface.h" #include "ipc_skeleton.h" #include "iremote_object.h" #include "notification_bundle_option.h" #include "refbase.h" #include "remote_death_recipient.h" #include "singleton.h" namespace OHOS { namespace Notification { class BundleManagerHelper : public DelayedSingleton { public: std::string GetBundleNameByUid(int uid); bool IsSystemApp(int uid); bool CheckApiCompatibility(const sptr &bundleOption); int GetDefaultUidByBundleName(const std::string &bundle, const int32_t userId); bool GetBundleInfoByBundleName(const std::string bundle, const int32_t userId, AppExecFwk::BundleInfo &bundleInfo); #ifdef DISTRIBUTED_NOTIFICATION_SUPPORTED bool GetDistributedNotificationEnabled(const std::string &bundleName, const int userId); #endif private: void Connect(); void Disconnect(); void OnRemoteDied(const wptr &object); private: sptr bundleMgr_ = nullptr; std::mutex connectionMutex_; sptr deathRecipient_ = nullptr; DECLARE_DELAYED_SINGLETON(BundleManagerHelper) }; } // namespace Notification } // namespace OHOS #endif // BASE_NOTIFICATION_ANS_STANDARD_SERVICES_ANS_INCLUDE_BUNDLE_MANAGER_HELPER_H