1 /* 2 * Copyright (c) 2021-2022 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_ACCOUNT_IACCOUNT_H 17 #define BASE_ACCOUNT_IACCOUNT_H 18 19 #include <cstdint> 20 #include <string> 21 #include <iremote_broker.h> 22 #include "accountmgr_service_ipc_interface_code.h" 23 #include "account_info.h" 24 #include "device_account_info.h" 25 #include "distributed_account_subscribe_callback.h" 26 27 namespace OHOS { 28 namespace AccountSA { 29 const char ACCOUNT_SERVICE_NAME[] = "AccountService"; 30 31 class IAccount : public IRemoteBroker { 32 public: 33 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.accountfwk.IAccount"); 34 35 virtual bool UpdateOhosAccountInfo( 36 const std::string &accountName, const std::string &uid, const std::string &eventStr) = 0; 37 virtual std::int32_t SetOhosAccountInfo(const OhosAccountInfo &ohosAccountInfo, 38 const std::string &eventStr) = 0; 39 virtual std::int32_t SetOhosAccountInfoByUserId( 40 const int32_t userId, const OhosAccountInfo &ohosAccountInfo, const std::string &eventStr) = 0; 41 virtual std::pair<bool, OhosAccountInfo> QueryOhosAccountInfo(void) = 0; 42 virtual std::pair<bool, OhosAccountInfo> QueryOhosAccountInfoByUserId(std::int32_t userId) = 0; 43 virtual ErrCode GetOhosAccountInfo(OhosAccountInfo &accountInfo) = 0; 44 virtual ErrCode GetOhosAccountInfoByUserId(int32_t userId, OhosAccountInfo &info) = 0; 45 virtual std::int32_t QueryDeviceAccountId(std::int32_t &accountId) = 0; 46 virtual ErrCode SubscribeDistributedAccountEvent(const DISTRIBUTED_ACCOUNT_SUBSCRIBE_TYPE type, 47 const sptr<IRemoteObject> &eventListener) = 0; 48 virtual ErrCode UnsubscribeDistributedAccountEvent(const DISTRIBUTED_ACCOUNT_SUBSCRIBE_TYPE type, 49 const sptr<IRemoteObject> &eventListener) = 0; 50 virtual sptr<IRemoteObject> GetAppAccountService() = 0; 51 virtual sptr<IRemoteObject> GetOsAccountService() = 0; 52 virtual sptr<IRemoteObject> GetAccountIAMService() = 0; 53 virtual sptr<IRemoteObject> GetDomainAccountService() = 0; 54 }; 55 } // namespace AccountSA 56 } // namespace OHOS 57 58 #endif // BASE_ACCOUNT_IACCOUNT_H 59