• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 #include "account_info.h"
17 #include "account_log_wrapper.h"
18 #include "account_permission_manager.h"
19 #include "os_account.h"
20 
21 namespace OHOS {
22 namespace AccountSA {
23 
CreateOsAccount(const std::string & name,const OsAccountType & type,OsAccountInfo & osAccountInfo)24 ErrCode OsAccountManager::CreateOsAccount(
25     const std::string &name, const OsAccountType &type, OsAccountInfo &osAccountInfo)
26 {
27     return OsAccount::GetInstance().CreateOsAccount(name, type, osAccountInfo);
28 }
29 
CreateOsAccount(const std::string & localName,const std::string & shortName,const OsAccountType & type,OsAccountInfo & osAccountInfo)30 ErrCode OsAccountManager::CreateOsAccount(
31     const std::string &localName, const std::string &shortName, const OsAccountType &type, OsAccountInfo &osAccountInfo)
32 {
33     return OsAccount::GetInstance().CreateOsAccount(localName, shortName, type, osAccountInfo);
34 }
35 
CreateOsAccount(const std::string & localName,const std::string & shortName,const OsAccountType & type,const CreateOsAccountOptions & options,OsAccountInfo & osAccountInfo)36 ErrCode OsAccountManager::CreateOsAccount(const std::string& localName, const std::string& shortName,
37     const OsAccountType& type, const CreateOsAccountOptions& options, OsAccountInfo& osAccountInfo)
38 {
39     return OsAccount::GetInstance().CreateOsAccount(localName, shortName, type, osAccountInfo, options);
40 }
41 
CreateOsAccountWithFullInfo(OsAccountInfo & osAccountInfo,const CreateOsAccountOptions & options)42 ErrCode OsAccountManager::CreateOsAccountWithFullInfo(OsAccountInfo &osAccountInfo,
43     const CreateOsAccountOptions& options)
44 {
45     return OsAccount::GetInstance().CreateOsAccountWithFullInfo(osAccountInfo, options);
46 }
47 
UpdateOsAccountWithFullInfo(OsAccountInfo & osAccountInfo)48 ErrCode OsAccountManager::UpdateOsAccountWithFullInfo(OsAccountInfo &osAccountInfo)
49 {
50     return OsAccount::GetInstance().UpdateOsAccountWithFullInfo(osAccountInfo);
51 }
52 
CreateOsAccountForDomain(const OsAccountType & type,const DomainAccountInfo & domainInfo,const std::shared_ptr<DomainAccountCallback> & callback,const CreateOsAccountForDomainOptions & options)53 ErrCode OsAccountManager::CreateOsAccountForDomain(const OsAccountType &type, const DomainAccountInfo &domainInfo,
54     const std::shared_ptr<DomainAccountCallback> &callback, const CreateOsAccountForDomainOptions &options)
55 {
56     return OsAccount::GetInstance().CreateOsAccountForDomain(type, domainInfo, callback, options);
57 }
58 
RemoveOsAccount(const int id)59 ErrCode OsAccountManager::RemoveOsAccount(const int id)
60 {
61     return OsAccount::GetInstance().RemoveOsAccount(id);
62 }
63 
IsOsAccountExists(const int id,bool & isOsAccountExists)64 ErrCode OsAccountManager::IsOsAccountExists(const int id, bool &isOsAccountExists)
65 {
66     return OsAccount::GetInstance().IsOsAccountExists(id, isOsAccountExists);
67 }
68 
IsOsAccountActived(const int id,bool & isOsAccountActived)69 ErrCode OsAccountManager::IsOsAccountActived(const int id, bool &isOsAccountActived)
70 {
71     return OsAccount::GetInstance().IsOsAccountActived(id, isOsAccountActived);
72 }
73 
IsOsAccountConstraintEnable(const int id,const std::string & constraint,bool & isConstraintEnable)74 ErrCode OsAccountManager::IsOsAccountConstraintEnable(
75     const int id, const std::string &constraint, bool &isConstraintEnable)
76 {
77     return OsAccount::GetInstance().IsOsAccountConstraintEnable(id, constraint, isConstraintEnable);
78 }
79 
CheckOsAccountConstraintEnabled(const int id,const std::string & constraint,bool & isEnabled)80 ErrCode OsAccountManager::CheckOsAccountConstraintEnabled(
81     const int id, const std::string &constraint, bool &isEnabled)
82 {
83     return OsAccount::GetInstance().CheckOsAccountConstraintEnabled(id, constraint, isEnabled);
84 }
85 
IsOsAccountVerified(const int id,bool & isVerified)86 ErrCode OsAccountManager::IsOsAccountVerified(const int id, bool &isVerified)
87 {
88     return OsAccount::GetInstance().IsOsAccountVerified(id, isVerified);
89 }
90 
IsOsAccountDeactivating(const int id,bool & isDeactivating)91 ErrCode OsAccountManager::IsOsAccountDeactivating(const int id, bool &isDeactivating)
92 {
93     return OsAccount::GetInstance().IsOsAccountDeactivating(id, isDeactivating);
94 }
95 
GetCreatedOsAccountsCount(unsigned int & osAccountsCount)96 ErrCode OsAccountManager::GetCreatedOsAccountsCount(unsigned int &osAccountsCount)
97 {
98     return OsAccount::GetInstance().GetCreatedOsAccountsCount(osAccountsCount);
99 }
100 
GetOsAccountLocalIdFromProcess(int & id)101 ErrCode OsAccountManager::GetOsAccountLocalIdFromProcess(int &id)
102 {
103     return OsAccount::GetInstance().GetOsAccountLocalIdFromProcess(id);
104 }
105 
IsMainOsAccount(bool & isMainOsAccount)106 ErrCode OsAccountManager::IsMainOsAccount(bool &isMainOsAccount)
107 {
108     return OsAccount::GetInstance().IsMainOsAccount(isMainOsAccount);
109 }
110 
GetOsAccountLocalIdFromUid(const int uid,int & id)111 ErrCode OsAccountManager::GetOsAccountLocalIdFromUid(const int uid, int &id)
112 {
113     if (uid < 0) {
114         ACCOUNT_LOGE("invalid uid %{public}d.", uid);
115         NativeErrMsg() = "Invalid uid. The uid must be greater than or equal to 0";
116         return ERR_ACCOUNT_COMMON_INVALID_PARAMETER;
117     }
118     id = uid / UID_TRANSFORM_DIVISOR;
119     return ERR_OK;
120 }
121 
GetBundleIdFromUid(const int uid,int & bundleId)122 ErrCode OsAccountManager::GetBundleIdFromUid(const int uid, int &bundleId)
123 {
124     ErrCode result = AccountPermissionManager::CheckSystemApp(false);
125     if (result != ERR_OK) {
126         ACCOUNT_LOGE("is not system application, result = %{public}u.", result);
127         return result;
128     }
129     if (uid < 0) {
130         ACCOUNT_LOGE("invalid uid %{public}d.", uid);
131         NativeErrMsg() = "Invalid uid. The uid must be greater than or equal to 0";
132         return ERR_ACCOUNT_COMMON_INVALID_PARAMETER;
133     }
134     bundleId = uid % UID_TRANSFORM_DIVISOR;
135     return ERR_OK;
136 }
137 
GetOsAccountLocalIdFromDomain(const DomainAccountInfo & domainInfo,int & id)138 ErrCode OsAccountManager::GetOsAccountLocalIdFromDomain(const DomainAccountInfo &domainInfo, int &id)
139 {
140     return OsAccount::GetInstance().GetOsAccountLocalIdFromDomain(domainInfo, id);
141 }
142 
QueryMaxOsAccountNumber(uint32_t & maxOsAccountNumber)143 ErrCode OsAccountManager::QueryMaxOsAccountNumber(uint32_t &maxOsAccountNumber)
144 {
145     return OsAccount::GetInstance().QueryMaxOsAccountNumber(maxOsAccountNumber);
146 }
147 
QueryMaxLoggedInOsAccountNumber(uint32_t & maxNum)148 ErrCode OsAccountManager::QueryMaxLoggedInOsAccountNumber(uint32_t &maxNum)
149 {
150     return OsAccount::GetInstance().QueryMaxLoggedInOsAccountNumber(maxNum);
151 }
152 
GetOsAccountAllConstraints(const int id,std::vector<std::string> & constraints)153 ErrCode OsAccountManager::GetOsAccountAllConstraints(const int id, std::vector<std::string> &constraints)
154 {
155     return OsAccount::GetInstance().GetOsAccountAllConstraints(id, constraints);
156 }
157 
QueryAllCreatedOsAccounts(std::vector<OsAccountInfo> & osAccountInfos)158 ErrCode OsAccountManager::QueryAllCreatedOsAccounts(std::vector<OsAccountInfo> &osAccountInfos)
159 {
160     return OsAccount::GetInstance().QueryAllCreatedOsAccounts(osAccountInfos);
161 }
162 
QueryCurrentOsAccount(OsAccountInfo & osAccountInfo)163 ErrCode OsAccountManager::QueryCurrentOsAccount(OsAccountInfo &osAccountInfo)
164 {
165     return OsAccount::GetInstance().QueryCurrentOsAccount(osAccountInfo);
166 }
167 
QueryOsAccountById(const int id,OsAccountInfo & osAccountInfo)168 ErrCode OsAccountManager::QueryOsAccountById(const int id, OsAccountInfo &osAccountInfo)
169 {
170     return OsAccount::GetInstance().QueryOsAccountById(id, osAccountInfo);
171 }
172 
GetOsAccountTypeFromProcess(OsAccountType & type)173 ErrCode OsAccountManager::GetOsAccountTypeFromProcess(OsAccountType &type)
174 {
175     return OsAccount::GetInstance().GetOsAccountTypeFromProcess(type);
176 }
177 
GetOsAccountType(const int id,OsAccountType & type)178 ErrCode OsAccountManager::GetOsAccountType(const int id, OsAccountType& type)
179 {
180     return OsAccount::GetInstance().GetOsAccountType(id, type);
181 }
182 
GetOsAccountProfilePhoto(const int id,std::string & photo)183 ErrCode OsAccountManager::GetOsAccountProfilePhoto(const int id, std::string &photo)
184 {
185     return OsAccount::GetInstance().GetOsAccountProfilePhoto(id, photo);
186 }
187 
IsMultiOsAccountEnable(bool & isMultiOsAccountEnable)188 ErrCode OsAccountManager::IsMultiOsAccountEnable(bool &isMultiOsAccountEnable)
189 {
190     return OsAccount::GetInstance().IsMultiOsAccountEnable(isMultiOsAccountEnable);
191 }
192 
SetOsAccountName(const int id,const std::string & localName)193 ErrCode OsAccountManager::SetOsAccountName(const int id, const std::string &localName)
194 {
195     return OsAccount::GetInstance().SetOsAccountName(id, localName);
196 }
197 
SetOsAccountConstraints(const int id,const std::vector<std::string> & constraints,const bool enable)198 ErrCode OsAccountManager::SetOsAccountConstraints(
199     const int id, const std::vector<std::string> &constraints, const bool enable)
200 {
201     return OsAccount::GetInstance().SetOsAccountConstraints(id, constraints, enable);
202 }
203 
SetOsAccountProfilePhoto(const int id,const std::string & photo)204 ErrCode OsAccountManager::SetOsAccountProfilePhoto(const int id, const std::string &photo)
205 {
206     return OsAccount::GetInstance().SetOsAccountProfilePhoto(id, photo);
207 }
208 
GetDistributedVirtualDeviceId(std::string & dvid)209 ErrCode OsAccountManager::GetDistributedVirtualDeviceId(std::string &dvid)
210 {
211     return OsAccount::GetInstance().GetDistributedVirtualDeviceId(dvid);
212 }
213 
QueryDistributedVirtualDeviceId(const std::string & bundleName,int32_t localId,std::string & dvid)214 ErrCode OsAccountManager::QueryDistributedVirtualDeviceId(const std::string &bundleName, int32_t localId,
215     std::string &dvid)
216 {
217     return OsAccount::GetInstance().QueryDistributedVirtualDeviceId(bundleName, localId, dvid);
218 }
219 
ActivateOsAccount(const int id)220 ErrCode OsAccountManager::ActivateOsAccount(const int id)
221 {
222     return OsAccount::GetInstance().ActivateOsAccount(id);
223 }
224 
DeactivateOsAccount(const int id)225 ErrCode OsAccountManager::DeactivateOsAccount(const int id)
226 {
227     return OsAccount::GetInstance().DeactivateOsAccount(id);
228 }
229 
DeactivateAllOsAccounts()230 ErrCode OsAccountManager::DeactivateAllOsAccounts()
231 {
232     return OsAccount::GetInstance().DeactivateAllOsAccounts();
233 }
234 
StartOsAccount(const int id)235 ErrCode OsAccountManager::StartOsAccount(const int id)
236 {
237     return OsAccount::GetInstance().StartOsAccount(id);
238 }
239 
GetOsAccountLocalIdBySerialNumber(const int64_t serialNumber,int & id)240 ErrCode OsAccountManager::GetOsAccountLocalIdBySerialNumber(const int64_t serialNumber, int &id)
241 {
242     return OsAccount::GetInstance().GetOsAccountLocalIdBySerialNumber(serialNumber, id);
243 }
244 
GetSerialNumberByOsAccountLocalId(const int & id,int64_t & serialNumber)245 ErrCode OsAccountManager::GetSerialNumberByOsAccountLocalId(const int &id, int64_t &serialNumber)
246 {
247     return OsAccount::GetInstance().GetSerialNumberByOsAccountLocalId(id, serialNumber);
248 }
249 
SubscribeOsAccount(const std::shared_ptr<OsAccountSubscriber> & subscriber)250 ErrCode OsAccountManager::SubscribeOsAccount(const std::shared_ptr<OsAccountSubscriber> &subscriber)
251 {
252     return OsAccount::GetInstance().SubscribeOsAccount(subscriber);
253 }
254 
UnsubscribeOsAccount(const std::shared_ptr<OsAccountSubscriber> & subscriber)255 ErrCode OsAccountManager::UnsubscribeOsAccount(const std::shared_ptr<OsAccountSubscriber> &subscriber)
256 {
257     return OsAccount::GetInstance().UnsubscribeOsAccount(subscriber);
258 }
GetOsAccountSwitchMod()259 OS_ACCOUNT_SWITCH_MOD OsAccountManager::GetOsAccountSwitchMod()
260 {
261     return OsAccount::GetInstance().GetOsAccountSwitchMod();
262 }
263 
IsCurrentOsAccountVerified(bool & isVerified)264 ErrCode OsAccountManager::IsCurrentOsAccountVerified(bool &isVerified)
265 {
266     return OsAccount::GetInstance().IsCurrentOsAccountVerified(isVerified);
267 }
268 
IsOsAccountCompleted(const int id,bool & isOsAccountCompleted)269 ErrCode OsAccountManager::IsOsAccountCompleted(const int id, bool &isOsAccountCompleted)
270 {
271     return OsAccount::GetInstance().IsOsAccountCompleted(id, isOsAccountCompleted);
272 }
273 
SetCurrentOsAccountIsVerified(const bool isVerified)274 ErrCode OsAccountManager::SetCurrentOsAccountIsVerified(const bool isVerified)
275 {
276     return OsAccount::GetInstance().SetCurrentOsAccountIsVerified(isVerified);
277 }
278 
SetOsAccountIsVerified(const int id,const bool isVerified)279 ErrCode OsAccountManager::SetOsAccountIsVerified(const int id, const bool isVerified)
280 {
281     return OsAccount::GetInstance().SetOsAccountIsVerified(id, isVerified);
282 }
283 
GetCreatedOsAccountNumFromDatabase(const std::string & storeID,int & createdOsAccountNum)284 ErrCode OsAccountManager::GetCreatedOsAccountNumFromDatabase(const std::string& storeID, int &createdOsAccountNum)
285 {
286     return OsAccount::GetInstance().GetCreatedOsAccountNumFromDatabase(
287         storeID, createdOsAccountNum);
288 }
289 
GetSerialNumberFromDatabase(const std::string & storeID,int64_t & serialNumber)290 ErrCode OsAccountManager::GetSerialNumberFromDatabase(const std::string& storeID, int64_t &serialNumber)
291 {
292     return OsAccount::GetInstance().GetSerialNumberFromDatabase(storeID, serialNumber);
293 }
294 
GetMaxAllowCreateIdFromDatabase(const std::string & storeID,int & id)295 ErrCode OsAccountManager::GetMaxAllowCreateIdFromDatabase(const std::string& storeID, int &id)
296 {
297     return OsAccount::GetInstance().GetMaxAllowCreateIdFromDatabase(storeID, id);
298 }
299 
GetOsAccountFromDatabase(const std::string & storeID,const int id,OsAccountInfo & osAccountInfo)300 ErrCode OsAccountManager::GetOsAccountFromDatabase(const std::string& storeID,
301                                                    const int id,
302                                                    OsAccountInfo &osAccountInfo)
303 {
304     return OsAccount::GetInstance().GetOsAccountFromDatabase(storeID, id, osAccountInfo);
305 }
306 
GetOsAccountListFromDatabase(const std::string & storeID,std::vector<OsAccountInfo> & osAccountList)307 ErrCode OsAccountManager::GetOsAccountListFromDatabase(const std::string& storeID,
308                                                        std::vector<OsAccountInfo> &osAccountList)
309 {
310     return OsAccount::GetInstance().GetOsAccountListFromDatabase(storeID, osAccountList);
311 }
312 
QueryActiveOsAccountIds(std::vector<int32_t> & ids)313 ErrCode OsAccountManager::QueryActiveOsAccountIds(std::vector<int32_t>& ids)
314 {
315     return OsAccount::GetInstance().QueryActiveOsAccountIds(ids);
316 }
317 
QueryOsAccountConstraintSourceTypes(const int32_t id,const std::string constraint,std::vector<ConstraintSourceTypeInfo> & constraintSourceTypeInfos)318 ErrCode OsAccountManager::QueryOsAccountConstraintSourceTypes(const int32_t id, const std::string constraint,
319     std::vector<ConstraintSourceTypeInfo> &constraintSourceTypeInfos)
320 {
321     return OsAccount::GetInstance().
322         QueryOsAccountConstraintSourceTypes(id, constraint, constraintSourceTypeInfos);
323 }
324 
SetGlobalOsAccountConstraints(const std::vector<std::string> & constraints,const bool enable,const int32_t enforcerId,const bool isDeviceOwner)325 ErrCode OsAccountManager::SetGlobalOsAccountConstraints(const std::vector<std::string> &constraints,
326     const bool enable, const int32_t enforcerId, const bool isDeviceOwner)
327 {
328     return OsAccount::GetInstance().
329         SetGlobalOsAccountConstraints(constraints, enable, enforcerId, isDeviceOwner);
330 }
331 
SetSpecificOsAccountConstraints(const std::vector<std::string> & constraints,const bool enable,const int32_t targetId,const int32_t enforcerId,const bool isDeviceOwner)332 ErrCode OsAccountManager::SetSpecificOsAccountConstraints(const std::vector<std::string> &constraints,
333     const bool enable, const int32_t targetId, const int32_t enforcerId, const bool isDeviceOwner)
334 {
335     return OsAccount::GetInstance().
336         SetSpecificOsAccountConstraints(constraints, enable, targetId, enforcerId, isDeviceOwner);
337 }
338 
SubscribeOsAccountConstraints(const std::shared_ptr<OsAccountConstraintSubscriber> & subscriber)339 ErrCode OsAccountManager::SubscribeOsAccountConstraints(
340     const std::shared_ptr<OsAccountConstraintSubscriber> &subscriber)
341 {
342     return OsAccount::GetInstance().SubscribeOsAccountConstraints(subscriber);
343 }
344 
UnsubscribeOsAccountConstraints(const std::shared_ptr<OsAccountConstraintSubscriber> & subscriber)345 ErrCode OsAccountManager::UnsubscribeOsAccountConstraints(
346     const std::shared_ptr<OsAccountConstraintSubscriber> &subscriber)
347 {
348     return OsAccount::GetInstance().UnsubscribeOsAccountConstraints(subscriber);
349 }
350 
SetDefaultActivatedOsAccount(const int32_t id)351 ErrCode OsAccountManager::SetDefaultActivatedOsAccount(const int32_t id)
352 {
353     return OsAccount::GetInstance().SetDefaultActivatedOsAccount(id);
354 }
355 
GetDefaultActivatedOsAccount(int32_t & id)356 ErrCode OsAccountManager::GetDefaultActivatedOsAccount(int32_t &id)
357 {
358     return OsAccount::GetInstance().GetDefaultActivatedOsAccount(id);
359 }
360 
GetOsAccountShortName(std::string & shortName)361 ErrCode OsAccountManager::GetOsAccountShortName(std::string &shortName)
362 {
363     return OsAccount::GetInstance().GetOsAccountShortName(shortName);
364 }
365 
GetOsAccountShortName(const int32_t id,std::string & shortName)366 ErrCode OsAccountManager::GetOsAccountShortName(const int32_t id, std::string &shortName)
367 {
368     return OsAccount::GetInstance().GetOsAccountShortNameById(id, shortName);
369 }
370 
GetOsAccountName(std::string & name)371 ErrCode OsAccountManager::GetOsAccountName(std::string &name)
372 {
373     return OsAccount::GetInstance().GetOsAccountName(name);
374 }
375 
GetOsAccountNameById(int32_t id,std::string & name)376 ErrCode OsAccountManager::GetOsAccountNameById(int32_t id, std::string &name)
377 {
378     return OsAccount::GetInstance().GetOsAccountNameById(id, name);
379 }
380 
IsOsAccountForeground(bool & isForeground)381 ErrCode OsAccountManager::IsOsAccountForeground(bool &isForeground)
382 {
383     return OsAccount::GetInstance().IsOsAccountForeground(isForeground);
384 }
385 
IsOsAccountForeground(const int32_t localId,bool & isForeground)386 ErrCode OsAccountManager::IsOsAccountForeground(const int32_t localId, bool &isForeground)
387 {
388     return OsAccount::GetInstance().IsOsAccountForeground(localId, isForeground);
389 }
390 
IsOsAccountForeground(const int32_t localId,const uint64_t displayId,bool & isForeground)391 ErrCode OsAccountManager::IsOsAccountForeground(const int32_t localId, const uint64_t displayId, bool &isForeground)
392 {
393     return OsAccount::GetInstance().IsOsAccountForeground(localId, displayId, isForeground);
394 }
395 
GetForegroundOsAccountLocalId(int32_t & localId)396 ErrCode OsAccountManager::GetForegroundOsAccountLocalId(int32_t &localId)
397 {
398     return OsAccount::GetInstance().GetForegroundOsAccountLocalId(localId);
399 }
400 
GetForegroundOsAccountLocalId(const uint64_t displayId,int32_t & localId)401 ErrCode OsAccountManager::GetForegroundOsAccountLocalId(const uint64_t displayId, int32_t &localId)
402 {
403     return OsAccount::GetInstance().GetForegroundOsAccountLocalId(displayId, localId);
404 }
405 
GetForegroundOsAccounts(std::vector<ForegroundOsAccount> & accounts)406 ErrCode OsAccountManager::GetForegroundOsAccounts(std::vector<ForegroundOsAccount> &accounts)
407 {
408     return OsAccount::GetInstance().GetForegroundOsAccounts(accounts);
409 }
410 
GetBackgroundOsAccountLocalIds(std::vector<int32_t> & localIds)411 ErrCode OsAccountManager::GetBackgroundOsAccountLocalIds(std::vector<int32_t> &localIds)
412 {
413     return OsAccount::GetInstance().GetBackgroundOsAccountLocalIds(localIds);
414 }
415 
SetOsAccountToBeRemoved(int32_t localId,bool toBeRemoved)416 ErrCode OsAccountManager::SetOsAccountToBeRemoved(int32_t localId, bool toBeRemoved)
417 {
418     return OsAccount::GetInstance().SetOsAccountToBeRemoved(localId, toBeRemoved);
419 }
420 
GetOsAccountDomainInfo(const int32_t localId,DomainAccountInfo & domainInfo)421 ErrCode OsAccountManager::GetOsAccountDomainInfo(const int32_t localId, DomainAccountInfo &domainInfo)
422 {
423     return OsAccount::GetInstance().GetOsAccountDomainInfo(localId, domainInfo);
424 }
425 
PublishOsAccountLockEvent(const int32_t localId,bool isLocking)426 ErrCode OsAccountManager::PublishOsAccountLockEvent(const int32_t localId, bool isLocking)
427 {
428 #ifdef SUPPORT_LOCK_OS_ACCOUNT
429     return OsAccount::GetInstance().PublishOsAccountLockEvent(localId, isLocking);
430 #else
431     return ERR_ACCOUNT_COMMON_INTERFACE_NOT_SUPPORT_ERROR;
432 #endif
433 }
434 
LockOsAccount(int32_t localId)435 ErrCode OsAccountManager::LockOsAccount(int32_t localId)
436 {
437 #ifdef SUPPORT_LOCK_OS_ACCOUNT
438     return OsAccount::GetInstance().LockOsAccount(localId);
439 #else
440     return ERR_ACCOUNT_COMMON_INTERFACE_NOT_SUPPORT_ERROR;
441 #endif
442 }
443 
BindDomainAccount(const int32_t localId,const DomainAccountInfo & domainInfo,const std::shared_ptr<DomainAccountCallback> & callback)444 ErrCode OsAccountManager::BindDomainAccount(
445     const int32_t localId, const DomainAccountInfo &domainInfo, const std::shared_ptr<DomainAccountCallback> &callback)
446 {
447     return OsAccount::GetInstance().BindDomainAccount(localId, domainInfo, callback);
448 }
449 }  // namespace AccountSA
450 }  // namespace OHOS
451