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 OS_ACCOUNT_CONSTRAINT_MANAGER_H 17 #define OS_ACCOUNT_CONSTRAINT_MANAGER_H 18 19 #include "os_account_constraint_subscribe_info.h" 20 #include "iinner_os_account.h" 21 #include "ios_account_control.h" 22 #include "ios_account_subscribe.h" 23 #include "os_account_constraint_subscribe_manager.h" 24 #include "os_account_control_file_manager.h" 25 26 namespace OHOS { 27 namespace AccountSA { 28 class OsAccountConstraintManager { 29 public: 30 static OsAccountConstraintManager &GetInstance(); 31 ErrCode SubscribeOsAccountConstraints(const OsAccountConstraintSubscribeInfo &subscribeInfo, 32 const sptr<IRemoteObject> &eventListener); 33 ErrCode UnsubscribeOsAccountConstraints(const OsAccountConstraintSubscribeInfo &subscribeInfo, 34 const sptr<IRemoteObject> &eventListener); 35 void Publish(int32_t localId, const std::set<std::string> &constraints, const bool isEnabled); 36 37 private: 38 OsAccountConstraintManager(); 39 ~OsAccountConstraintManager() = default; 40 DISALLOW_COPY_AND_MOVE(OsAccountConstraintManager); 41 42 private: 43 std::shared_ptr<IOsAccountControl> osAccountControl_; 44 OsAccountConstraintSubscribeManager &subscribeManager_; 45 }; 46 } // AccountSA 47 } // OHOS 48 #endif //OS_ACCOUNT_CONSTRAINT_MANAGER_H