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 ErrCode UpdateOhosAccountInfo( 36 const std::string &accountName, const std::string &uid, const std::string &eventStr) = 0; 37 virtual ErrCode SetOhosAccountInfo(const OhosAccountInfo &ohosAccountInfo, 38 const std::string &eventStr) = 0; 39 virtual std::int32_t SetOsAccountDistributedInfo( 40 const int32_t localId, const OhosAccountInfo &ohosAccountInfo, const std::string &eventStr) = 0; 41 virtual ErrCode QueryOhosAccountInfo(OhosAccountInfo &accountInfo) = 0; 42 virtual ErrCode QueryDistributedVirtualDeviceId(std::string &dvid) = 0; 43 virtual ErrCode QueryDistributedVirtualDeviceId(const std::string &bundleName, int32_t localId, 44 std::string &dvid) = 0; 45 virtual ErrCode QueryOsAccountDistributedInfo(std::int32_t localId, OhosAccountInfo &info) = 0; 46 virtual ErrCode GetOhosAccountInfo(OhosAccountInfo &accountInfo) = 0; 47 virtual ErrCode GetOsAccountDistributedInfo(int32_t localId, OhosAccountInfo &info) = 0; 48 virtual std::int32_t QueryDeviceAccountId(std::int32_t &accountId) = 0; 49 virtual ErrCode SubscribeDistributedAccountEvent(const DISTRIBUTED_ACCOUNT_SUBSCRIBE_TYPE type, 50 const sptr<IRemoteObject> &eventListener) = 0; 51 virtual ErrCode UnsubscribeDistributedAccountEvent(const DISTRIBUTED_ACCOUNT_SUBSCRIBE_TYPE type, 52 const sptr<IRemoteObject> &eventListener) = 0; 53 virtual sptr<IRemoteObject> GetAppAccountService() = 0; 54 virtual sptr<IRemoteObject> GetOsAccountService() = 0; 55 virtual sptr<IRemoteObject> GetAccountIAMService() = 0; 56 virtual sptr<IRemoteObject> GetDomainAccountService() = 0; 57 }; 58 } // namespace AccountSA 59 } // namespace OHOS 60 61 #endif // BASE_ACCOUNT_IACCOUNT_H 62