• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 OHOS_SIM_ACCOUNT_MANAGER_H
17 #define OHOS_SIM_ACCOUNT_MANAGER_H
18 
19 #include "i_tel_ril_manager.h"
20 #include "icc_operator_privilege_controller.h"
21 #include "operator_config_cache.h"
22 #include "sim_file_manager.h"
23 #include "sim_state_manager.h"
24 #include "sim_state_tracker.h"
25 
26 namespace OHOS {
27 namespace Telephony {
28 class SimAccountManager {
29 public:
30     SimAccountManager(std::shared_ptr<Telephony::ITelRilManager> telRilManager,
31         std::shared_ptr<SimStateManager> simStateManager, std::shared_ptr<SimFileManager> simFileManager);
32     ~SimAccountManager();
33 
34     void Init(int32_t slotId);
35     int32_t GetOperatorConfigs(int slotId, OperatorConfig &poc);
36     int32_t HasOperatorPrivileges(const int32_t slotId, bool &hasOperatorPrivileges);
37 
38 private:
39     bool IsValidSlotId(int32_t);
40     bool IsValidSlotIdForDefault(int32_t);
41 
42 private:
43     std::shared_ptr<Telephony::ITelRilManager> telRilManager_ = nullptr;
44     std::shared_ptr<SimStateManager> simStateManager_ = nullptr;
45     std::shared_ptr<SimFileManager> simFileManager_ = nullptr;
46     std::shared_ptr<SimStateTracker> simStateTracker_ = nullptr;
47     std::shared_ptr<OperatorConfigCache> operatorConfigCache_ = nullptr;
48     std::shared_ptr<IccOperatorPrivilegeController> privilegeController_ = nullptr;
49     std::shared_ptr<AppExecFwk::EventRunner> operatorConfigCacheRunner_;
50     std::shared_ptr<AppExecFwk::EventRunner> simStateTrackerRunner_;
51     std::shared_ptr<AppExecFwk::EventRunner> privilegesRunner_;
52 };
53 } // namespace Telephony
54 } // namespace OHOS
55 #endif // OHOS_SIM_ACCOUNT_MANAGER_H
56