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 OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_STUB_H 17 #define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_STUB_H 18 19 #include "iaccount.h" 20 #include "iaccount_context.h" 21 #include <iremote_broker.h> 22 #include <iremote_object.h> 23 #include <iremote_stub.h> 24 #include <map> 25 26 namespace OHOS { 27 namespace AccountSA { 28 class AccountStub; 29 using AccountStubFunc = std::int32_t (AccountStub::*)(MessageParcel &data, MessageParcel &reply); 30 class AccountStub : public IRemoteStub<IAccount>, public IAccountContext { 31 public: 32 virtual std::int32_t OnRemoteRequest( 33 std::uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 34 35 private: 36 std::int32_t InnerUpdateOhosAccountInfo(MessageParcel &data, MessageParcel &reply); 37 std::int32_t CmdUpdateOhosAccountInfo(MessageParcel &data, MessageParcel &reply); 38 std::int32_t InnerSetOhosAccountInfo(MessageParcel &data, MessageParcel &reply); 39 std::int32_t CmdSetOhosAccountInfo(MessageParcel &data, MessageParcel &reply); 40 41 std::int32_t InnerGetOhosAccountInfo(MessageParcel &data, MessageParcel &reply); 42 std::int32_t CmdGetOhosAccountInfo(MessageParcel &data, MessageParcel &reply); 43 std::int32_t CmdGetOhosAccountInfoByUserId(MessageParcel &data, MessageParcel &reply); 44 std::int32_t InnerQueryOhosAccountInfo(MessageParcel &data, MessageParcel &reply); 45 std::int32_t CmdQueryOhosAccountInfo(MessageParcel &data, MessageParcel &reply); 46 47 std::int32_t CmdQueryOhosQuitTips(MessageParcel &data, MessageParcel &reply); 48 std::int32_t CmdQueryOhosAccountInfoByUserId(MessageParcel &data, MessageParcel &reply); 49 std::int32_t CmdQueryDeviceAccountId(MessageParcel &data, MessageParcel &reply); 50 std::int32_t CmdGetAppAccountService(MessageParcel &data, MessageParcel &reply); 51 std::int32_t CmdGetOsAccountService(MessageParcel &data, MessageParcel &reply); 52 std::int32_t CmdGetAccountIAMService(MessageParcel &data, MessageParcel &reply); 53 std::int32_t CmdGetDomainAccountService(MessageParcel &data, MessageParcel &reply); 54 bool HasAccountRequestPermission(const std::string &permissionName); 55 bool CheckCallerForTrustList(); 56 57 private: 58 static const std::map<std::uint32_t, AccountStubFunc> stubFuncMap_; 59 }; 60 } // namespace AccountSA 61 } // namespace OHOS 62 63 #endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_STUB_H 64