• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "os_account_manager.h"
16 
17 #include "mock_other_method.h"
18 
19 namespace OHOS {
20 namespace AccountSA {
21 /**
22  * Interfaces for ohos account subsystem.
23  */
24 class OhosAccountKitsImpl : public OhosAccountKits {
25 public:
QueryOhosAccountInfo()26     std::pair<bool, OhosAccountInfo> QueryOhosAccountInfo()
27     {
28         return {};
29     }
30 
31     ErrCode GetOhosAccountInfo(OhosAccountInfo &accountInfo);
32 
GetOsAccountDistributedInfo(int32_t localId,OhosAccountInfo & accountInfo)33     ErrCode GetOsAccountDistributedInfo(int32_t localId, OhosAccountInfo &accountInfo)
34     {
35         return 0;
36     }
37 
QueryOsAccountDistributedInfo(std::int32_t localId)38     std::pair<bool, OhosAccountInfo> QueryOsAccountDistributedInfo(std::int32_t localId)
39     {
40         return {};
41     }
42 
UpdateOhosAccountInfo(const std::string & accountName,const std::string & uid,const std::string & eventStr)43     ErrCode UpdateOhosAccountInfo(const std::string& accountName, const std::string& uid,
44         const std::string& eventStr)
45     {
46         return 0;
47     }
48 
SetOhosAccountInfo(const OhosAccountInfo & ohosAccountInfo,const std::string & eventStr)49     ErrCode SetOhosAccountInfo(const OhosAccountInfo &ohosAccountInfo,
50         const std::string &eventStr)
51     {
52         return 0;
53     }
54 
SetOsAccountDistributedInfo(const int32_t localId,const OhosAccountInfo & ohosAccountInfo,const std::string & eventStr)55     ErrCode SetOsAccountDistributedInfo(
56         const int32_t localId, const OhosAccountInfo& ohosAccountInfo, const std::string& eventStr)
57     {
58         return 0;
59     }
60 
QueryDeviceAccountId(std::int32_t & accountId)61     ErrCode QueryDeviceAccountId(std::int32_t& accountId)
62     {
63         return 0;
64     }
65 
GetDeviceAccountIdByUID(std::int32_t & uid)66     std::int32_t GetDeviceAccountIdByUID(std::int32_t& uid)
67     {
68         return 0;
69     }
70 
SubscribeDistributedAccountEvent(const DISTRIBUTED_ACCOUNT_SUBSCRIBE_TYPE type,const std::shared_ptr<DistributedAccountSubscribeCallback> & callback)71     ErrCode SubscribeDistributedAccountEvent(const DISTRIBUTED_ACCOUNT_SUBSCRIBE_TYPE type,
72         const std::shared_ptr<DistributedAccountSubscribeCallback> &callback)
73     {
74         return 0;
75     }
76 
UnsubscribeDistributedAccountEvent(const DISTRIBUTED_ACCOUNT_SUBSCRIBE_TYPE type,const std::shared_ptr<DistributedAccountSubscribeCallback> & callback)77     ErrCode UnsubscribeDistributedAccountEvent(const DISTRIBUTED_ACCOUNT_SUBSCRIBE_TYPE type,
78         const std::shared_ptr<DistributedAccountSubscribeCallback> &callback)
79     {
80         return 0;
81     }
82 };
83 
QueryActiveOsAccountIds(std::vector<int32_t> & ids)84 ErrCode OsAccountManager::QueryActiveOsAccountIds(std::vector<int32_t>& ids)
85 {
86     return OHOS::DistributedHardware::DeviceOtherMethod::otherMethod->QueryActiveOsAccountIds(ids);
87 }
88 
GetOhosAccountInfo(AccountSA::OhosAccountInfo & accountInfo)89 ErrCode OhosAccountKitsImpl::GetOhosAccountInfo(AccountSA::OhosAccountInfo &accountInfo)
90 {
91     return OHOS::DistributedHardware::DeviceOtherMethod::otherMethod->GetOhosAccountInfo(accountInfo);
92 }
93 
GetInstance()94 OhosAccountKits &OhosAccountKits::GetInstance()
95 {
96     static OhosAccountKitsImpl test;
97     return test;
98 }
99 }  // namespace AccountSA
100 }  // namespace OHOS
101