1 /* 2 * Copyright (C) 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_OPERATOR_CONF_H 17 #define OHOS_OPERATOR_CONF_H 18 19 #include <libxml/parser.h> 20 #include <libxml/xmlmemory.h> 21 #include <vector> 22 23 #include "abs_shared_result_set.h" 24 #include "common_event.h" 25 #include "common_event_manager.h" 26 #include "config_policy_utils.h" 27 #include "data_ability_helper.h" 28 #include "data_ability_predicates.h" 29 #include "event_handler.h" 30 #include "inner_event.h" 31 #include "iremote_broker.h" 32 #include "iservice_registry.h" 33 #include "operator_config_cache.h" 34 #include "sim_constant.h" 35 #include "sim_file_manager.h" 36 #include "system_ability_definition.h" 37 #include "telephony_log_wrapper.h" 38 #include "uri.h" 39 #include "values_bucket.h" 40 #include "want.h" 41 42 namespace OHOS { 43 namespace Telephony { 44 static const std::string OPKEY_URI = "dataability:///com.ohos.opkeyability"; 45 const std::string OPKEY_INFO_URI = "dataability:///com.ohos.opkeyability/opkey/opkey_info"; 46 47 class OperatorConfigLoader { 48 public: 49 explicit OperatorConfigLoader( 50 std::shared_ptr<SimFileManager> simFileManager, std::shared_ptr<OperatorConfigCache> operatorConfigCache); 51 virtual ~OperatorConfigLoader(); 52 OperatorConfig LoadOperatorConfig(int32_t slotId); 53 54 private: 55 std::string LoadOpKeyOnMccMnc(int32_t slotId); 56 std::shared_ptr<AppExecFwk::DataAbilityHelper> CreateDataAHelper( 57 int32_t systemAbilityId, std::shared_ptr<Uri> dataAbilityUri) const; 58 std::shared_ptr<AppExecFwk::DataAbilityHelper> CreateOpKeyHelper(); 59 std::string GetOpKey(std::shared_ptr<NativeRdb::AbsSharedResultSet> resultSet, int32_t slotId); 60 bool MatchOperatorRule(std::shared_ptr<NativeRdb::AbsSharedResultSet> &resultSet, int row); 61 62 private: 63 std::shared_ptr<SimFileManager> simFileManager_ = nullptr; 64 std::shared_ptr<OperatorConfigCache> operatorConfigCache_ = nullptr; 65 std::shared_ptr<AppExecFwk::DataAbilityHelper> opKeyDataAbilityHelper_ = nullptr; 66 std::string iccidFromSim_; 67 std::string imsiFromSim_; 68 std::string spnFromSim_; 69 std::string gid1FromSim_; 70 std::string gid2FromSim_; 71 }; 72 } // namespace Telephony 73 } // namespace OHOS 74 #endif // OHOS_OPERATOR_CONF_H 75