已开启
cellualrdata获取default slotId接口修改 #1311
wmyao_mm创建于 10 天前
cellualrdata获取default slotId接口修改 #1311
已开启
共 1 个文件变更+10-20
| @@ -103,8 +103,7 @@ int32_t CellularDataService::GetIntelligenceSwitchState(bool &switchState) | |||
| 103 | return TELEPHONY_ERR_ILLEGAL_USE_OF_SYSTEM_API; | 103 | return TELEPHONY_ERR_ILLEGAL_USE_OF_SYSTEM_API; |
| 104 | } | 104 | } |
| 105 | if (!TelephonyPermission::CheckPermission(Permission::GET_TELEPHONY_STATE)) { | 105 | if (!TelephonyPermission::CheckPermission(Permission::GET_TELEPHONY_STATE)) { |
| 106 | - int32_t slotId; | 106 | + int32_t slotId = CoreManagerInner::GetInstance().GetDefaultCellularDataSlotId(); |
| 107 | - CellularDataService::GetDefaultCellularDataSlotId(slotId); | ||
| 108 | CellularDataHiSysEvent::WriteDataActivateFaultEvent( | 107 | CellularDataHiSysEvent::WriteDataActivateFaultEvent( |
| 109 | slotId, switchState, CellularDataErrorCode::DATA_ERROR_PERMISSION_ERROR, Permission::SET_TELEPHONY_STATE); | 108 | slotId, switchState, CellularDataErrorCode::DATA_ERROR_PERMISSION_ERROR, Permission::SET_TELEPHONY_STATE); |
| 110 | return TELEPHONY_ERR_PERMISSION_ERR; | 109 | return TELEPHONY_ERR_PERMISSION_ERR; |
| @@ -166,8 +165,7 @@ int32_t CellularDataService::EnableCellularData(bool enable) | |||
| 166 | return TELEPHONY_ERR_ILLEGAL_USE_OF_SYSTEM_API; | 165 | return TELEPHONY_ERR_ILLEGAL_USE_OF_SYSTEM_API; |
| 167 | } | 166 | } |
| 168 | if (!TelephonyPermission::CheckPermission(Permission::SET_TELEPHONY_STATE)) { | 167 | if (!TelephonyPermission::CheckPermission(Permission::SET_TELEPHONY_STATE)) { |
| 169 | - int32_t slotId; | 168 | + int32_t slotId = CoreManagerInner::GetInstance().GetDefaultCellularDataSlotId(); |
| 170 | - CellularDataService::GetDefaultCellularDataSlotId(slotId); | ||
| 171 | CellularDataHiSysEvent::WriteDataActivateFaultEvent( | 169 | CellularDataHiSysEvent::WriteDataActivateFaultEvent( |
| 172 | slotId, enable, CellularDataErrorCode::DATA_ERROR_PERMISSION_ERROR, Permission::SET_TELEPHONY_STATE); | 170 | slotId, enable, CellularDataErrorCode::DATA_ERROR_PERMISSION_ERROR, Permission::SET_TELEPHONY_STATE); |
| 173 | return TELEPHONY_ERR_PERMISSION_ERR; | 171 | return TELEPHONY_ERR_PERMISSION_ERR; |
| @@ -196,8 +194,7 @@ int32_t CellularDataService::EnableIntelligenceSwitch(bool enable) | |||
| 196 | return TELEPHONY_ERR_ILLEGAL_USE_OF_SYSTEM_API; | 194 | return TELEPHONY_ERR_ILLEGAL_USE_OF_SYSTEM_API; |
| 197 | } | 195 | } |
| 198 | if (!TelephonyPermission::CheckPermission(Permission::SET_TELEPHONY_STATE)) { | 196 | if (!TelephonyPermission::CheckPermission(Permission::SET_TELEPHONY_STATE)) { |
| 199 | - int32_t slotId; | 197 | + int32_t slotId = CoreManagerInner::GetInstance().GetDefaultCellularDataSlotId(); |
| 200 | - CellularDataService::GetDefaultCellularDataSlotId(slotId); | ||
| 201 | CellularDataHiSysEvent::WriteDataActivateFaultEvent( | 198 | CellularDataHiSysEvent::WriteDataActivateFaultEvent( |
| 202 | slotId, enable, CellularDataErrorCode::DATA_ERROR_PERMISSION_ERROR, Permission::SET_TELEPHONY_STATE); | 199 | slotId, enable, CellularDataErrorCode::DATA_ERROR_PERMISSION_ERROR, Permission::SET_TELEPHONY_STATE); |
| 203 | return TELEPHONY_ERR_PERMISSION_ERR; | 200 | return TELEPHONY_ERR_PERMISSION_ERR; |
| @@ -215,8 +212,7 @@ int32_t CellularDataService::GetCellularDataState(int32_t &state) | |||
| 215 | if (!TelephonyPermission::CheckPermission(Permission::GET_NETWORK_INFO)) { | 212 | if (!TelephonyPermission::CheckPermission(Permission::GET_NETWORK_INFO)) { |
| 216 | return TELEPHONY_ERR_PERMISSION_ERR; | 213 | return TELEPHONY_ERR_PERMISSION_ERR; |
| 217 | } | 214 | } |
| 218 | - int32_t slotId; | 215 | + int32_t slotId = CoreManagerInner::GetInstance().GetDefaultCellularDataSlotId(); |
| 219 | - CellularDataService::GetDefaultCellularDataSlotId(slotId); | ||
| 220 | 216 | ||
| 221 | if (TELEPHONY_EXT_WRAPPER.isVSimEnabled_ && TELEPHONY_EXT_WRAPPER.isVSimEnabled_()) { | 217 | if (TELEPHONY_EXT_WRAPPER.isVSimEnabled_ && TELEPHONY_EXT_WRAPPER.isVSimEnabled_()) { |
| 222 | TELEPHONY_LOGI("VSimEnabled slotId: %{public}d => %{public}d", slotId, CELLULAR_DATA_VSIM_SLOT_ID); | 218 | TELEPHONY_LOGI("VSimEnabled slotId: %{public}d => %{public}d", slotId, CELLULAR_DATA_VSIM_SLOT_ID); |
| @@ -506,8 +502,7 @@ int32_t CellularDataService::SetDefaultCellularDataSlotId(const int32_t slotId) | |||
| 506 | TELEPHONY_LOGE("sim is not active!"); | 502 | TELEPHONY_LOGE("sim is not active!"); |
| 507 | return TELEPHONY_ERR_SLOTID_INVALID; | 503 | return TELEPHONY_ERR_SLOTID_INVALID; |
| 508 | } | 504 | } |
| 509 | - int32_t formerSlotId; | 505 | + int32_t formerSlotId = CoreManagerInner::GetInstance().GetDefaultCellularDataSlotId(); |
| 510 | - GetDefaultCellularDataSlotId(formerSlotId); | ||
| 511 | if (formerSlotId < 0) { | 506 | if (formerSlotId < 0) { |
| 512 | TELEPHONY_LOGI("No old card slot id."); | 507 | TELEPHONY_LOGI("No old card slot id."); |
| 513 | } | 508 | } |
| @@ -525,8 +520,7 @@ int32_t CellularDataService::GetCellularDataFlowType(int32_t &type) | |||
| 525 | if (!TelephonyPermission::CheckPermission(Permission::GET_NETWORK_INFO)) { | 520 | if (!TelephonyPermission::CheckPermission(Permission::GET_NETWORK_INFO)) { |
| 526 | return TELEPHONY_ERR_PERMISSION_ERR; | 521 | return TELEPHONY_ERR_PERMISSION_ERR; |
| 527 | } | 522 | } |
| 528 | - int32_t slotId; | 523 | + int32_t slotId = CoreManagerInner::GetInstance().GetDefaultCellularDataSlotId(); |
| 529 | - CellularDataService::GetDefaultCellularDataSlotId(slotId); | ||
| 530 | std::shared_ptr<CellularDataController> cellularDataController = GetCellularDataController(slotId); | 524 | std::shared_ptr<CellularDataController> cellularDataController = GetCellularDataController(slotId); |
| 531 | if (cellularDataController == nullptr) { | 525 | if (cellularDataController == nullptr) { |
| 532 | TELEPHONY_LOGE("cellularDataControllers is null, slotId=%{public}d", slotId); | 526 | TELEPHONY_LOGE("cellularDataControllers is null, slotId=%{public}d", slotId); |
| @@ -559,8 +553,7 @@ std::string CellularDataService::GetEndTime() | |||
| 559 | std::string CellularDataService::GetCellularDataSlotIdDump() | 553 | std::string CellularDataService::GetCellularDataSlotIdDump() |
| 560 | { | 554 | { |
| 561 | std::ostringstream oss; | 555 | std::ostringstream oss; |
| 562 | - int32_t slotId; | 556 | + int32_t slotId = CoreManagerInner::GetInstance().GetDefaultCellularDataSlotId(); |
| 563 | - GetDefaultCellularDataSlotId(slotId); | ||
| 564 | oss << "slotId:" << slotId; | 557 | oss << "slotId:" << slotId; |
| 565 | return oss.str(); | 558 | return oss.str(); |
| 566 | } | 559 | } |
| @@ -568,8 +561,7 @@ std::string CellularDataService::GetCellularDataSlotIdDump() | |||
| 568 | std::string CellularDataService::GetStateMachineCurrentStatusDump() | 561 | std::string CellularDataService::GetStateMachineCurrentStatusDump() |
| 569 | { | 562 | { |
| 570 | std::ostringstream oss; | 563 | std::ostringstream oss; |
| 571 | - int32_t slotId; | 564 | + int32_t slotId = CoreManagerInner::GetInstance().GetDefaultCellularDataSlotId(); |
| 572 | - GetDefaultCellularDataSlotId(slotId); | ||
| 573 | std::shared_ptr<CellularDataController> cellularDataController = GetCellularDataController(slotId); | 565 | std::shared_ptr<CellularDataController> cellularDataController = GetCellularDataController(slotId); |
| 574 | if (cellularDataController == nullptr) { | 566 | if (cellularDataController == nullptr) { |
| 575 | oss << "default slotId: " << slotId; | 567 | oss << "default slotId: " << slotId; |
| @@ -585,8 +577,7 @@ std::string CellularDataService::GetStateMachineCurrentStatusDump() | |||
| 585 | std::string CellularDataService::GetFlowDataInfoDump() | 577 | std::string CellularDataService::GetFlowDataInfoDump() |
| 586 | { | 578 | { |
| 587 | std::ostringstream oss; | 579 | std::ostringstream oss; |
| 588 | - int32_t slotId; | 580 | + int32_t slotId = CoreManagerInner::GetInstance().GetDefaultCellularDataSlotId(); |
| 589 | - GetDefaultCellularDataSlotId(slotId); | ||
| 590 | std::shared_ptr<CellularDataController> cellularDataController = GetCellularDataController(slotId); | 581 | std::shared_ptr<CellularDataController> cellularDataController = GetCellularDataController(slotId); |
| 591 | if (cellularDataController == nullptr) { | 582 | if (cellularDataController == nullptr) { |
| 592 | oss << "default slotId: " << slotId; | 583 | oss << "default slotId: " << slotId; |
| @@ -817,8 +808,7 @@ int32_t CellularDataService::GetIfSupportDunApn(bool &isSupportDun) | |||
| 817 | TELEPHONY_LOGE("Permission denied!"); | 808 | TELEPHONY_LOGE("Permission denied!"); |
| 818 | return TELEPHONY_ERR_PERMISSION_ERR; | 809 | return TELEPHONY_ERR_PERMISSION_ERR; |
| 819 | } | 810 | } |
| 820 | - int32_t slotId; | 811 | + int32_t slotId = CoreManagerInner::GetInstance().GetDefaultCellularDataSlotId(); |
| 821 | - CellularDataService::GetDefaultCellularDataSlotId(slotId); | ||
| 822 | auto cellularDataController = GetCellularDataController(slotId); | 812 | auto cellularDataController = GetCellularDataController(slotId); |
| 823 | if (cellularDataController == nullptr) { | 813 | if (cellularDataController == nullptr) { |
| 824 | TELEPHONY_LOGE("cellularDataControllers is null, slotId=%{public}d", slotId); | 814 | TELEPHONY_LOGE("cellularDataControllers is null, slotId=%{public}d", slotId); |