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 BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_ABILITY_MANAGER_HELPER_H 17 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_ABILITY_MANAGER_HELPER_H 18 19 #include "ability_manager_client.h" 20 #include "ability_manager_errors.h" 21 #include "ans_log_wrapper.h" 22 #include "distributed_operation_connection.h" 23 #include "ffrt.h" 24 25 namespace OHOS { 26 namespace Notification { 27 28 class AbilityManagerHelper { 29 public: 30 AbilityManagerHelper(); 31 ~AbilityManagerHelper() = default; 32 /** 33 * @brief Get NotificationPreferences instance object. 34 */ 35 static AbilityManagerHelper& GetInstance(); 36 37 int ConnectAbility(const std::string &eventId, const AAFwk::Want &want, 38 const std::string& userInputKey, const std::string& userInput); 39 void DisconnectServiceAbility(const std::string &eventId, const AppExecFwk::ElementName& element); 40 41 private: 42 ffrt::mutex connectionLock_; 43 std::shared_ptr<ffrt::queue> operationQueue_ = nullptr; 44 std::map<std::string, sptr<DistributedOperationConnection>> operationConnection_; 45 }; 46 } 47 } 48 #endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_ABILITY_MANAGER_HELPER_H 49