1 /*
2  * Copyright (c) 2021-2024 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_OSACCOUNT_OS_ACCOUNT_INTERFACE_H
17 #define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_OS_ACCOUNT_INTERFACE_H
18 
19 #include <chrono>
20 #include <vector>
21 #include "account_error_no.h"
22 #include <mutex>
23 #include "os_account_info.h"
24 #include "os_account_user_callback.h"
25 #ifdef HAS_THEME_SERVICE_PART
26 #include "theme_manager_client.h"
27 #endif
28 
29 namespace OHOS {
30 namespace AccountSA {
31 class OsAccountInterface {
32 public:
33     static ErrCode SendToAMSAccountStart(OsAccountInfo &osAccountInfo,
34         const OsAccountStartCallbackFunc &callbackFunc);
35     static ErrCode SendToAMSAccountStop(OsAccountInfo &osAccountInfo);
36     static ErrCode SendToAMSAccountDeactivate(OsAccountInfo &osAccountInfo);
37     static ErrCode SendToBMSAccountCreate(
38         OsAccountInfo &osAccountInfo, const std::vector<std::string> &disallowedHapList = {});
39 #ifdef HAS_THEME_SERVICE_PART
40     static void InitThemeResource(int32_t localId);
41 #endif
42     static ErrCode SendToBMSAccountDelete(OsAccountInfo &osAccountInfo);
43 #ifdef HAS_USER_IDM_PART
44     static ErrCode SendToIDMAccountDelete(OsAccountInfo &osAccountInfo);
45 #endif // HAS_USER_IDM_PART
46     static void SendToCESAccountCreate(OsAccountInfo &osAccountInfo);
47     static void SendToCESAccountDelete(OsAccountInfo &osAccountInfo);
48     static void SendToCESAccountSwitched(int newId, int oldId);
49     static ErrCode SendToStorageAccountCreateComplete(int32_t localId);
50     static ErrCode SendToStorageAccountCreate(OsAccountInfo &osAccountInfo);
51     static ErrCode SendToStorageAccountRemove(OsAccountInfo &osAccountInfo);
52     static ErrCode SendToStorageAccountStart(OsAccountInfo &osAccountInfo);
53     static ErrCode SendToStorageAccountStop(OsAccountInfo &osAccountInfo);
54     static void PublishCommonEvent(
55         const OsAccountInfo &osAccountInfo, const std::string &commonEvent, const std::string &operation);
56 
57 private:
58     static ErrCode InnerSendToStorageAccountCreateComplete(int32_t localId);
59     static ErrCode InnerSendToStorageAccountCreate(OsAccountInfo &osAccountInfo);
60 };
61 }  // namespace AccountSA
62 }  // namespace OHOS
63 
64 #endif  // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_OS_ACCOUNT_INTERFACE_H
65