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_APPACCOUNT_APP_ACCOUNT_STUB_H 17 #define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_STUB_H 18 19 #include "iapp_account.h" 20 #include "iremote_stub.h" 21 22 namespace OHOS { 23 namespace AccountSA { 24 class AppAccountStub : public IRemoteStub<IAppAccount> { 25 public: 26 using MessageProcFunction = ErrCode (AppAccountStub::*)(uint32_t code, MessageParcel &data, MessageParcel &reply); 27 28 AppAccountStub(); 29 ~AppAccountStub() override; 30 int OnRemoteRequest( 31 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 32 33 public: 34 template<typename T> 35 bool WriteParcelableVector(const std::vector<T> &parcelableVector, MessageParcel &data); 36 template<typename T> 37 bool ReadParcelableVector(std::vector<T> &parcelableInfos, MessageParcel &data); 38 39 ErrCode ProcAddAccount(uint32_t code, MessageParcel &data, MessageParcel &reply); 40 ErrCode ProcAddAccountImplicitly(uint32_t code, MessageParcel &data, MessageParcel &reply); 41 ErrCode ProcCreateAccount(uint32_t code, MessageParcel &data, MessageParcel &reply); 42 ErrCode ProcCreateAccountImplicitly(uint32_t code, MessageParcel &data, MessageParcel &reply); 43 ErrCode ProcDeleteAccount(uint32_t code, MessageParcel &data, MessageParcel &reply); 44 ErrCode ProcGetAccountExtraInfo(uint32_t code, MessageParcel &data, MessageParcel &reply); 45 ErrCode ProcSetAccountExtraInfo(uint32_t code, MessageParcel &data, MessageParcel &reply); 46 ErrCode ProcSetAppAccess(uint32_t code, MessageParcel &data, MessageParcel &reply); 47 ErrCode ProcCheckAppAccess(uint32_t code, MessageParcel &data, MessageParcel &reply); 48 ErrCode ProcCheckAppAccountSyncEnable(uint32_t code, MessageParcel &data, MessageParcel &reply); 49 ErrCode ProcSetAppAccountSyncEnable(uint32_t code, MessageParcel &data, MessageParcel &reply); 50 ErrCode ProcGetAssociatedData(uint32_t code, MessageParcel &data, MessageParcel &reply); 51 ErrCode ProcSetAssociatedData(uint32_t code, MessageParcel &data, MessageParcel &reply); 52 ErrCode ProcGetAccountCredential(uint32_t code, MessageParcel &data, MessageParcel &reply); 53 ErrCode ProcSetAccountCredential(uint32_t code, MessageParcel &data, MessageParcel &reply); 54 ErrCode ProcDeleteAccountCredential(uint32_t code, MessageParcel &data, MessageParcel &reply); 55 ErrCode ProcAuthenticate(uint32_t code, MessageParcel &data, MessageParcel &reply); 56 ErrCode ProcGetAuthToken(uint32_t code, MessageParcel &data, MessageParcel &reply); 57 ErrCode ProcSetOAuthToken(uint32_t code, MessageParcel &data, MessageParcel &reply); 58 ErrCode ProcDeleteAuthToken(uint32_t code, MessageParcel &data, MessageParcel &reply); 59 ErrCode ProcSetAuthTokenVisibility(uint32_t code, MessageParcel &data, MessageParcel &reply); 60 ErrCode ProcCheckAuthTokenVisibility(uint32_t code, MessageParcel &data, MessageParcel &reply); 61 ErrCode ProcGetAuthenticatorInfo(uint32_t code, MessageParcel &data, MessageParcel &reply); 62 ErrCode ProcGetAllOAuthTokens(uint32_t code, MessageParcel &data, MessageParcel &reply); 63 ErrCode ProcGetAuthList(uint32_t code, MessageParcel &data, MessageParcel &reply); 64 ErrCode ProcGetAuthenticatorCallback(uint32_t code, MessageParcel &data, MessageParcel &reply); 65 ErrCode ProcGetAllAccounts(uint32_t code, MessageParcel &data, MessageParcel &reply); 66 ErrCode ProcGetAllAccessibleAccounts(uint32_t code, MessageParcel &data, MessageParcel &reply); 67 ErrCode ProcSubscribeAccount(uint32_t code, MessageParcel &data, MessageParcel &reply); 68 ErrCode ProcUnsubscribeAccount(uint32_t code, MessageParcel &data, MessageParcel &reply); 69 ErrCode ProcSelectAccountsByOptions(uint32_t code, MessageParcel &data, MessageParcel &reply); 70 ErrCode ProcVerifyCredential(uint32_t code, MessageParcel &data, MessageParcel &reply); 71 ErrCode ProcCheckAccountLabels(uint32_t code, MessageParcel &data, MessageParcel &reply); 72 ErrCode ProcSetAuthenticatorProperties(uint32_t code, MessageParcel &data, MessageParcel &reply); 73 ErrCode ProcExecuteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply); 74 75 private: 76 std::map<uint32_t, MessageProcFunction> messageProcMap_; 77 78 DISALLOW_COPY_AND_MOVE(AppAccountStub); 79 }; 80 } // namespace AccountSA 81 } // namespace OHOS 82 83 #endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_APPACCOUNT_APP_ACCOUNT_STUB_H 84