Implement RadioNetwork for AIDL-HIDL Telephony HAL translator
Bug: 203699028
Test: Boot and grep logcat against radiocompat
Change-Id: Ic44227c9e2cd38ead97d3f3dda2e028052876568
diff --git a/radio/aidl/compat/libradiocompat/Android.bp b/radio/aidl/compat/libradiocompat/Android.bp
index 0e6496a..fdee336 100644
--- a/radio/aidl/compat/libradiocompat/Android.bp
+++ b/radio/aidl/compat/libradiocompat/Android.bp
@@ -39,6 +39,7 @@
"android.hardware.radio.config@1.3",
"android.hardware.radio.data-V1-ndk",
"android.hardware.radio.messaging-V1-ndk",
+ "android.hardware.radio.network-V1-ndk",
"android.hardware.radio.sim-V1-ndk",
"android.hardware.radio@1.0",
"android.hardware.radio@1.1",
@@ -69,6 +70,11 @@
"messaging/RadioMessaging.cpp",
"messaging/RadioResponse-messaging.cpp",
"messaging/structs.cpp",
+ "network/RadioIndication-network.cpp",
+ "network/RadioNetwork.cpp",
+ "network/RadioResponse-network.cpp",
+ "network/structs.cpp",
+ "network/utils.cpp",
"sim/RadioIndication-sim.cpp",
"sim/RadioResponse-sim.cpp",
"sim/RadioSim.cpp",
diff --git a/radio/aidl/compat/libradiocompat/RadioIndication.cpp b/radio/aidl/compat/libradiocompat/RadioIndication.cpp
index b6a7e72..90b9e75 100644
--- a/radio/aidl/compat/libradiocompat/RadioIndication.cpp
+++ b/radio/aidl/compat/libradiocompat/RadioIndication.cpp
@@ -30,25 +30,6 @@
return {};
}
-Return<void> RadioIndication::networkStateChanged(V1_0::RadioIndicationType type) {
- return {};
-}
-
-Return<void> RadioIndication::nitzTimeReceived(V1_0::RadioIndicationType type,
- const hidl_string& nitzTime, uint64_t receivedTime) {
- return {};
-}
-
-Return<void> RadioIndication::currentSignalStrength(V1_0::RadioIndicationType type,
- const V1_0::SignalStrength& signalStrength) {
- return {};
-}
-
-Return<void> RadioIndication::suppSvcNotify(V1_0::RadioIndicationType type,
- const V1_0::SuppSvcNotification& suppSvc) {
- return {};
-}
-
Return<void> RadioIndication::stkCallSetup(V1_0::RadioIndicationType type, int64_t timeout) {
return {};
}
@@ -58,11 +39,6 @@
return {};
}
-Return<void> RadioIndication::restrictedStateChanged(V1_0::RadioIndicationType type,
- V1_0::PhoneRestrictedState state) {
- return {};
-}
-
Return<void> RadioIndication::enterEmergencyCallbackMode(V1_0::RadioIndicationType type) {
return {};
}
@@ -90,10 +66,6 @@
return {};
}
-Return<void> RadioIndication::cdmaPrlChanged(V1_0::RadioIndicationType type, int32_t version) {
- return {};
-}
-
Return<void> RadioIndication::exitEmergencyCallbackMode(V1_0::RadioIndicationType type) {
return {};
}
@@ -102,20 +74,6 @@
return {};
}
-Return<void> RadioIndication::voiceRadioTechChanged(V1_0::RadioIndicationType type,
- V1_0::RadioTechnology rat) {
- return {};
-}
-
-Return<void> RadioIndication::cellInfoList(V1_0::RadioIndicationType type,
- const hidl_vec<V1_0::CellInfo>& records) {
- return {};
-}
-
-Return<void> RadioIndication::imsNetworkStateChanged(V1_0::RadioIndicationType type) {
- return {};
-}
-
Return<void> RadioIndication::srvccStateNotify(V1_0::RadioIndicationType type,
V1_0::SrvccState state) {
return {};
@@ -141,117 +99,14 @@
return {};
}
-Return<void> RadioIndication::lceData(V1_0::RadioIndicationType type,
- const V1_0::LceDataInfo& lce) {
- return {};
-}
-
Return<void> RadioIndication::modemReset(V1_0::RadioIndicationType type,
const hidl_string& reason) {
return {};
}
-Return<void> RadioIndication::networkScanResult(V1_0::RadioIndicationType type,
- const V1_1::NetworkScanResult& result) {
- return {};
-}
-
-Return<void> RadioIndication::networkScanResult_1_2(V1_0::RadioIndicationType type,
- const V1_2::NetworkScanResult& result) {
- return {};
-}
-
-Return<void> RadioIndication::cellInfoList_1_2(V1_0::RadioIndicationType type,
- const hidl_vec<V1_2::CellInfo>& records) {
- return {};
-}
-
-Return<void> RadioIndication::currentLinkCapacityEstimate(V1_0::RadioIndicationType type,
- const V1_2::LinkCapacityEstimate& lce) {
- return {};
-}
-
-Return<void> RadioIndication::currentPhysicalChannelConfigs(
- V1_0::RadioIndicationType type, const hidl_vec<V1_2::PhysicalChannelConfig>& configs) {
- return {};
-}
-
-Return<void> RadioIndication::currentSignalStrength_1_2(
- V1_0::RadioIndicationType type, const V1_2::SignalStrength& signalStrength) {
- return {};
-}
-
Return<void> RadioIndication::currentEmergencyNumberList(
V1_0::RadioIndicationType type, const hidl_vec<V1_4::EmergencyNumber>& emergencyNumbers) {
return {};
}
-Return<void> RadioIndication::cellInfoList_1_4(V1_0::RadioIndicationType type,
- const hidl_vec<V1_4::CellInfo>& records) {
- return {};
-}
-
-Return<void> RadioIndication::networkScanResult_1_4(V1_0::RadioIndicationType type,
- const V1_4::NetworkScanResult& result) {
- return {};
-}
-
-Return<void> RadioIndication::currentPhysicalChannelConfigs_1_4(
- V1_0::RadioIndicationType type, const hidl_vec<V1_4::PhysicalChannelConfig>& configs) {
- return {};
-}
-
-Return<void> RadioIndication::currentSignalStrength_1_4(
- V1_0::RadioIndicationType type, const V1_4::SignalStrength& signalStrength) {
- return {};
-}
-
-Return<void> RadioIndication::registrationFailed( //
- V1_0::RadioIndicationType type, const V1_5::CellIdentity& cellIdentity,
- const hidl_string& chosenPlmn, hidl_bitfield<V1_5::Domain> domain, int32_t causeCode,
- int32_t additionalCauseCode) {
- return {};
-}
-
-Return<void> RadioIndication::barringInfoChanged(V1_0::RadioIndicationType type,
- const V1_5::CellIdentity& cellIdentity,
- const hidl_vec<V1_5::BarringInfo>& barringInfos) {
- return {};
-}
-
-Return<void> RadioIndication::cellInfoList_1_5(V1_0::RadioIndicationType type,
- const hidl_vec<V1_5::CellInfo>& records) {
- return {};
-}
-
-Return<void> RadioIndication::networkScanResult_1_5(V1_0::RadioIndicationType type,
- const V1_5::NetworkScanResult& result) {
- return {};
-}
-
-Return<void> RadioIndication::currentLinkCapacityEstimate_1_6(
- V1_0::RadioIndicationType type, const V1_6::LinkCapacityEstimate& lce) {
- return {};
-}
-
-Return<void> RadioIndication::currentSignalStrength_1_6(
- V1_0::RadioIndicationType type, const V1_6::SignalStrength& signalStrength) {
- return {};
-}
-
-Return<void> RadioIndication::cellInfoList_1_6(V1_0::RadioIndicationType type,
- const hidl_vec<V1_6::CellInfo>& records) {
- return {};
-}
-
-Return<void> RadioIndication::networkScanResult_1_6(V1_0::RadioIndicationType type,
- const V1_6::NetworkScanResult& result) {
- return {};
-}
-
-Return<void> RadioIndication::currentPhysicalChannelConfigs_1_6(
- V1_0::RadioIndicationType type, const hidl_vec<V1_6::PhysicalChannelConfig>& configs) {
- return {};
-}
-
} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/libradiocompat/RadioResponse.cpp b/radio/aidl/compat/libradiocompat/RadioResponse.cpp
index 0a38d8c..001330f 100644
--- a/radio/aidl/compat/libradiocompat/RadioResponse.cpp
+++ b/radio/aidl/compat/libradiocompat/RadioResponse.cpp
@@ -30,15 +30,11 @@
// TODO(b/203699028): send to correct requestor or confirm if spam is not a problem
if (mDataCb) mDataCb->acknowledgeRequest(serial);
if (mMessagingCb) mMessagingCb->acknowledgeRequest(serial);
+ if (mNetworkCb) mNetworkCb->acknowledgeRequest(serial);
if (mSimCb) mSimCb->acknowledgeRequest(serial);
return {};
}
-Return<void> RadioResponse::supplyNetworkDepersonalizationResponse(
- const V1_0::RadioResponseInfo& info, int32_t remainingRetries) {
- return {};
-}
-
Return<void> RadioResponse::getCurrentCallsResponse(const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_0::Call>& calls) {
return {};
@@ -79,27 +75,6 @@
return {};
}
-Return<void> RadioResponse::getSignalStrengthResponse(const V1_0::RadioResponseInfo& info,
- const V1_0::SignalStrength& sigStrength) {
- return {};
-}
-
-Return<void> RadioResponse::getVoiceRegistrationStateResponse(
- const V1_0::RadioResponseInfo& info, const V1_0::VoiceRegStateResult& voiceRegResponse) {
- return {};
-}
-
-Return<void> RadioResponse::getDataRegistrationStateResponse(
- const V1_0::RadioResponseInfo& info, const V1_0::DataRegStateResult& dataRegResponse) {
- return {};
-}
-
-Return<void> RadioResponse::getOperatorResponse( //
- const V1_0::RadioResponseInfo& info, const hidl_string& longName,
- const hidl_string& shortName, const hidl_string& numeric) {
- return {};
-}
-
Return<void> RadioResponse::setRadioPowerResponse(const V1_0::RadioResponseInfo& info) {
return {};
}
@@ -139,30 +114,6 @@
return {};
}
-Return<void> RadioResponse::setBarringPasswordResponse(const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::getNetworkSelectionModeResponse(const V1_0::RadioResponseInfo& info,
- bool manual) {
- return {};
-}
-
-Return<void> RadioResponse::setNetworkSelectionModeAutomaticResponse(
- const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::setNetworkSelectionModeManualResponse(
- const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::getAvailableNetworksResponse(
- const V1_0::RadioResponseInfo& info, const hidl_vec<V1_0::OperatorInfo>& networkInfos) {
- return {};
-}
-
Return<void> RadioResponse::startDtmfResponse(const V1_0::RadioResponseInfo& info) {
return {};
}
@@ -193,20 +144,6 @@
return {};
}
-Return<void> RadioResponse::setSuppServiceNotificationsResponse(
- const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::setBandModeResponse(const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::getAvailableBandModesResponse(
- const V1_0::RadioResponseInfo& info, const hidl_vec<V1_0::RadioBandMode>& bandModes) {
- return {};
-}
-
Return<void> RadioResponse::handleStkCallSetupRequestFromSimResponse(
const V1_0::RadioResponseInfo& info) {
return {};
@@ -216,33 +153,6 @@
return {};
}
-Return<void> RadioResponse::setPreferredNetworkTypeResponse(const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::getPreferredNetworkTypeResponse(const V1_0::RadioResponseInfo& info,
- V1_0::PreferredNetworkType nwType) {
- return {};
-}
-
-Return<void> RadioResponse::getNeighboringCidsResponse(
- const V1_0::RadioResponseInfo& info, const hidl_vec<V1_0::NeighboringCell>& cells) {
- return {};
-}
-
-Return<void> RadioResponse::setLocationUpdatesResponse(const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::setCdmaRoamingPreferenceResponse(const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::getCdmaRoamingPreferenceResponse(const V1_0::RadioResponseInfo& info,
- V1_0::CdmaRoamingType type) {
- return {};
-}
-
Return<void> RadioResponse::setTTYModeResponse(const V1_0::RadioResponseInfo& info) {
return {};
}
@@ -279,25 +189,6 @@
return {};
}
-Return<void> RadioResponse::getVoiceRadioTechnologyResponse(const V1_0::RadioResponseInfo& info,
- V1_0::RadioTechnology rat) {
- return {};
-}
-
-Return<void> RadioResponse::getCellInfoListResponse(const V1_0::RadioResponseInfo& info,
- const hidl_vec<V1_0::CellInfo>& cellInfo) {
- return {};
-}
-
-Return<void> RadioResponse::setCellInfoListRateResponse(const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::getImsRegistrationStateResponse( //
- const V1_0::RadioResponseInfo& info, bool isRegd, V1_0::RadioTechnologyFamily ratFamily) {
- return {};
-}
-
Return<void> RadioResponse::nvReadItemResponse(const V1_0::RadioResponseInfo& info,
const hidl_string& result) {
return {};
@@ -334,21 +225,6 @@
return {};
}
-Return<void> RadioResponse::startLceServiceResponse(const V1_0::RadioResponseInfo& info,
- const V1_0::LceStatusInfo& statusInfo) {
- return {};
-}
-
-Return<void> RadioResponse::stopLceServiceResponse(const V1_0::RadioResponseInfo& info,
- const V1_0::LceStatusInfo& statusInfo) {
- return {};
-}
-
-Return<void> RadioResponse::pullLceDataResponse(const V1_0::RadioResponseInfo& info,
- const V1_0::LceDataInfo& lceInfo) {
- return {};
-}
-
Return<void> RadioResponse::getModemActivityInfoResponse(
const V1_0::RadioResponseInfo& info, const V1_0::ActivityStatsInfo& activityInfo) {
return {};
@@ -358,58 +234,11 @@
return {};
}
-Return<void> RadioResponse::setIndicationFilterResponse(const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::startNetworkScanResponse(const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::stopNetworkScanResponse(const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::getCellInfoListResponse_1_2(const V1_0::RadioResponseInfo& info,
- const hidl_vec<V1_2::CellInfo>& cellInfo) {
- return {};
-}
-
-Return<void> RadioResponse::setSignalStrengthReportingCriteriaResponse(
- const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::setLinkCapacityReportingCriteriaResponse(
- const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
Return<void> RadioResponse::getCurrentCallsResponse_1_2(const V1_0::RadioResponseInfo& info,
const hidl_vec<V1_2::Call>& calls) {
return {};
}
-Return<void> RadioResponse::getSignalStrengthResponse_1_2(
- const V1_0::RadioResponseInfo& info, const V1_2::SignalStrength& signalStrength) {
- return {};
-}
-
-Return<void> RadioResponse::getVoiceRegistrationStateResponse_1_2(
- const V1_0::RadioResponseInfo& info, const V1_2::VoiceRegStateResult& voiceRegResponse) {
- return {};
-}
-
-Return<void> RadioResponse::getDataRegistrationStateResponse_1_2(
- const V1_0::RadioResponseInfo& info, const V1_2::DataRegStateResult& dataRegResponse) {
- return {};
-}
-
-Return<void> RadioResponse::setSystemSelectionChannelsResponse(
- const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
Return<void> RadioResponse::enableModemResponse(const V1_0::RadioResponseInfo& info) {
return {};
}
@@ -423,140 +252,14 @@
return {};
}
-Return<void> RadioResponse::startNetworkScanResponse_1_4(const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::getCellInfoListResponse_1_4(const V1_0::RadioResponseInfo& info,
- const hidl_vec<V1_4::CellInfo>& cellInfo) {
- return {};
-}
-
-Return<void> RadioResponse::getDataRegistrationStateResponse_1_4(
- const V1_0::RadioResponseInfo& info, const V1_4::DataRegStateResult& dataRegResponse) {
- return {};
-}
-
-Return<void> RadioResponse::getPreferredNetworkTypeBitmapResponse(
- const V1_0::RadioResponseInfo& info,
- hidl_bitfield<V1_4::RadioAccessFamily> networkTypeBitmap) {
- return {};
-}
-
-Return<void> RadioResponse::setPreferredNetworkTypeBitmapResponse(
- const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::getSignalStrengthResponse_1_4(
- const V1_0::RadioResponseInfo& info, const V1_4::SignalStrength& signalStrength) {
- return {};
-}
-
-Return<void> RadioResponse::setSignalStrengthReportingCriteriaResponse_1_5(
- const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::setLinkCapacityReportingCriteriaResponse_1_5(
- const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::setSystemSelectionChannelsResponse_1_5(
- const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::startNetworkScanResponse_1_5(const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
Return<void> RadioResponse::setRadioPowerResponse_1_5(const V1_0::RadioResponseInfo& info) {
return {};
}
-Return<void> RadioResponse::setIndicationFilterResponse_1_5(const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::getBarringInfoResponse(
- const V1_0::RadioResponseInfo& info, const V1_5::CellIdentity& cellIdentity,
- const hidl_vec<V1_5::BarringInfo>& barringInfos) {
- return {};
-}
-
-Return<void> RadioResponse::getVoiceRegistrationStateResponse_1_5(
- const V1_0::RadioResponseInfo& info, const V1_5::RegStateResult& voiceRegResponse) {
- return {};
-}
-
-Return<void> RadioResponse::getDataRegistrationStateResponse_1_5(
- const V1_0::RadioResponseInfo& info, const V1_5::RegStateResult& dataRegResponse) {
- return {};
-}
-
-Return<void> RadioResponse::getCellInfoListResponse_1_5(const V1_0::RadioResponseInfo& info,
- const hidl_vec<V1_5::CellInfo>& cellInfo) {
- return {};
-}
-
-Return<void> RadioResponse::setNetworkSelectionModeManualResponse_1_5(
- const V1_0::RadioResponseInfo& info) {
- return {};
-}
-
Return<void> RadioResponse::setRadioPowerResponse_1_6(const V1_6::RadioResponseInfo& info) {
return {};
}
-Return<void> RadioResponse::setNrDualConnectivityStateResponse(
- const V1_6::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::isNrDualConnectivityEnabledResponse(const V1_6::RadioResponseInfo& info,
- bool isEnabled) {
- return {};
-}
-
-Return<void> RadioResponse::setAllowedNetworkTypesBitmapResponse(
- const V1_6::RadioResponseInfo& info) {
- return {};
-}
-
-Return<void> RadioResponse::getAllowedNetworkTypesBitmapResponse(
- const V1_6::RadioResponseInfo& info,
- hidl_bitfield<V1_4::RadioAccessFamily> networkTypeBitmap) {
- return {};
-}
-
-Return<void> RadioResponse::getSystemSelectionChannelsResponse(
- const V1_6::RadioResponseInfo& info,
- const hidl_vec<V1_5::RadioAccessSpecifier>& specifiers) {
- return {};
-}
-
-Return<void> RadioResponse::getCellInfoListResponse_1_6(const V1_6::RadioResponseInfo& info,
- const hidl_vec<V1_6::CellInfo>& cellInfo) {
- return {};
-}
-
-Return<void> RadioResponse::getSignalStrengthResponse_1_6(
- const V1_6::RadioResponseInfo& info, const V1_6::SignalStrength& signalStrength) {
- return {};
-}
-
-Return<void> RadioResponse::getVoiceRegistrationStateResponse_1_6(
- const V1_6::RadioResponseInfo& info, const V1_6::RegStateResult& voiceRegResponse) {
- return {};
-}
-
-Return<void> RadioResponse::getDataRegistrationStateResponse_1_6(
- const V1_6::RadioResponseInfo& info, const V1_6::RegStateResult& dataRegResponse) {
- return {};
-}
-
Return<void> RadioResponse::getCurrentCallsResponse_1_6(const V1_6::RadioResponseInfo& info,
const hidl_vec<V1_6::Call>& calls) {
return {};
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h
index 63142d6..c7a2629 100644
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h
@@ -17,6 +17,7 @@
#include <aidl/android/hardware/radio/data/IRadioDataIndication.h>
#include <aidl/android/hardware/radio/messaging/IRadioMessagingIndication.h>
+#include <aidl/android/hardware/radio/network/IRadioNetworkIndication.h>
#include <aidl/android/hardware/radio/sim/IRadioSimIndication.h>
#include <android/hardware/radio/1.6/IRadioIndication.h>
@@ -26,6 +27,7 @@
std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataIndication> mDataCb;
std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingIndication>
mMessagingCb;
+ std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkIndication> mNetworkCb;
std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimIndication> mSimCb;
// IRadioIndication @ 1.0
@@ -181,6 +183,8 @@
std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingIndication>
radioMessagingIndication);
void setResponseFunction(
+ std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkIndication> ni);
+ void setResponseFunction(
std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimIndication> simCb);
};
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h
new file mode 100644
index 0000000..c776fd1
--- /dev/null
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include "RadioCompatBase.h"
+
+#include <aidl/android/hardware/radio/network/BnRadioNetwork.h>
+
+namespace android::hardware::radio::compat {
+
+class RadioNetwork : public RadioCompatBase,
+ public aidl::android::hardware::radio::network::BnRadioNetwork {
+ ::ndk::ScopedAStatus getAllowedNetworkTypesBitmap(int32_t serial) override;
+ ::ndk::ScopedAStatus getAvailableBandModes(int32_t serial) override;
+ ::ndk::ScopedAStatus getAvailableNetworks(int32_t serial) override;
+ ::ndk::ScopedAStatus getBarringInfo(int32_t serial) override;
+ ::ndk::ScopedAStatus getCdmaRoamingPreference(int32_t serial) override;
+ ::ndk::ScopedAStatus getCellInfoList(int32_t serial) override;
+ ::ndk::ScopedAStatus getDataRegistrationState(int32_t serial) override;
+ ::ndk::ScopedAStatus getImsRegistrationState(int32_t serial) override;
+ ::ndk::ScopedAStatus getNetworkSelectionMode(int32_t serial) override;
+ ::ndk::ScopedAStatus getOperator(int32_t serial) override;
+ ::ndk::ScopedAStatus getSignalStrength(int32_t serial) override;
+ ::ndk::ScopedAStatus getSystemSelectionChannels(int32_t serial) override;
+ ::ndk::ScopedAStatus getVoiceRadioTechnology(int32_t serial) override;
+ ::ndk::ScopedAStatus getVoiceRegistrationState(int32_t serial) override;
+ ::ndk::ScopedAStatus isNrDualConnectivityEnabled(int32_t serial) override;
+ ::ndk::ScopedAStatus responseAcknowledgement() override;
+ ::ndk::ScopedAStatus setAllowedNetworkTypesBitmap(
+ int32_t serial,
+ ::aidl::android::hardware::radio::RadioAccessFamily networkTypeBitmap) override;
+ ::ndk::ScopedAStatus setBandMode(
+ int32_t serial, ::aidl::android::hardware::radio::network::RadioBandMode mode) override;
+ ::ndk::ScopedAStatus setBarringPassword(int32_t serial, const std::string& facility,
+ const std::string& oldPassword,
+ const std::string& newPassword) override;
+ ::ndk::ScopedAStatus setCdmaRoamingPreference(
+ int32_t serial,
+ ::aidl::android::hardware::radio::network::CdmaRoamingType type) override;
+ ::ndk::ScopedAStatus setCellInfoListRate(int32_t serial, int32_t rate) override;
+ ::ndk::ScopedAStatus setIndicationFilter(
+ int32_t serial,
+ ::aidl::android::hardware::radio::network::IndicationFilter indicationFilter) override;
+ ::ndk::ScopedAStatus setLinkCapacityReportingCriteria(
+ int32_t serial, int32_t hysteresisMs, int32_t hysteresisDlKbps,
+ int32_t hysteresisUlKbps, const std::vector<int32_t>& thresholdsDownlinkKbps,
+ const std::vector<int32_t>& thresholdsUplinkKbps,
+ ::aidl::android::hardware::radio::AccessNetwork accessNetwork) override;
+ ::ndk::ScopedAStatus setLocationUpdates(int32_t serial, bool enable) override;
+ ::ndk::ScopedAStatus setNetworkSelectionModeAutomatic(int32_t serial) override;
+ ::ndk::ScopedAStatus setNetworkSelectionModeManual(
+ int32_t serial, const std::string& operatorNumeric,
+ ::aidl::android::hardware::radio::AccessNetwork ran) override;
+ ::ndk::ScopedAStatus setNrDualConnectivityState(
+ int32_t serial,
+ ::aidl::android::hardware::radio::network::NrDualConnectivityState nrSt) override;
+ ::ndk::ScopedAStatus setResponseFunctions(
+ const std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse>&
+ radioNetworkResponse,
+ const std::shared_ptr<
+ ::aidl::android::hardware::radio::network::IRadioNetworkIndication>&
+ radioNetworkIndication) override;
+ ::ndk::ScopedAStatus setSignalStrengthReportingCriteria(
+ int32_t serial,
+ const std::vector<::aidl::android::hardware::radio::network::SignalThresholdInfo>&
+ signalThresholdInfos) override;
+ ::ndk::ScopedAStatus setSuppServiceNotifications(int32_t serial, bool enable) override;
+ ::ndk::ScopedAStatus setSystemSelectionChannels(
+ int32_t serial, bool specifyChannels,
+ const std::vector<::aidl::android::hardware::radio::network::RadioAccessSpecifier>&
+ specifiers) override;
+ ::ndk::ScopedAStatus startNetworkScan(
+ int32_t serial,
+ const ::aidl::android::hardware::radio::network::NetworkScanRequest& request) override;
+ ::ndk::ScopedAStatus stopNetworkScan(int32_t serial) override;
+ ::ndk::ScopedAStatus supplyNetworkDepersonalization(int32_t serial,
+ const std::string& netPin) override;
+
+ public:
+ using RadioCompatBase::RadioCompatBase;
+};
+
+} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h
index d06abb9..b87ca6e 100644
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h
@@ -17,6 +17,7 @@
#include <aidl/android/hardware/radio/data/IRadioDataResponse.h>
#include <aidl/android/hardware/radio/messaging/IRadioMessagingResponse.h>
+#include <aidl/android/hardware/radio/network/IRadioNetworkResponse.h>
#include <aidl/android/hardware/radio/sim/IRadioSimResponse.h>
#include <android/hardware/radio/1.6/IRadioResponse.h>
@@ -26,6 +27,7 @@
std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataResponse> mDataCb;
std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingResponse>
mMessagingCb;
+ std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> mNetworkCb;
std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> mSimCb;
// IRadioResponse @ 1.0
@@ -409,6 +411,8 @@
std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingResponse>
radioMessagingResponse);
void setResponseFunction(
+ std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> nwCb);
+ void setResponseFunction(
std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> simCb);
};
diff --git a/radio/aidl/compat/libradiocompat/network/RadioIndication-network.cpp b/radio/aidl/compat/libradiocompat/network/RadioIndication-network.cpp
new file mode 100644
index 0000000..899b133
--- /dev/null
+++ b/radio/aidl/compat/libradiocompat/network/RadioIndication-network.cpp
@@ -0,0 +1,259 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <libradiocompat/RadioIndication.h>
+
+#include "commonStructs.h"
+#include "debug.h"
+#include "structs.h"
+
+#include "collections.h"
+
+#define RADIO_MODULE "NetworkIndication"
+
+namespace android::hardware::radio::compat {
+
+using ::aidl::android::hardware::radio::RadioTechnology;
+namespace aidl = ::aidl::android::hardware::radio::network;
+
+void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioNetworkIndication> netCb) {
+ CHECK(netCb);
+ mNetworkCb = netCb;
+}
+
+Return<void> RadioIndication::barringInfoChanged(V1_0::RadioIndicationType type,
+ const V1_5::CellIdentity& cellIdentity,
+ const hidl_vec<V1_5::BarringInfo>& barringInfos) {
+ LOG_CALL << type;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->barringInfoChanged(toAidl(type), toAidl(cellIdentity), toAidl(barringInfos));
+ return {};
+}
+
+Return<void> RadioIndication::cdmaPrlChanged(V1_0::RadioIndicationType type, int32_t version) {
+ LOG_CALL << type;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->cdmaPrlChanged(toAidl(type), version);
+ return {};
+}
+
+Return<void> RadioIndication::cellInfoList(V1_0::RadioIndicationType type,
+ const hidl_vec<V1_0::CellInfo>&) {
+ LOG_CALL << type;
+ LOG(ERROR) << "IRadio HAL 1.0 not supported";
+ return {};
+}
+
+Return<void> RadioIndication::cellInfoList_1_2(V1_0::RadioIndicationType type,
+ const hidl_vec<V1_2::CellInfo>&) {
+ LOG_CALL << type;
+ LOG(ERROR) << "IRadio HAL 1.2 not supported";
+ return {};
+}
+
+Return<void> RadioIndication::cellInfoList_1_4(V1_0::RadioIndicationType type,
+ const hidl_vec<V1_4::CellInfo>&) {
+ LOG_CALL << type;
+ LOG(ERROR) << "IRadio HAL 1.4 not supported";
+ return {};
+}
+
+Return<void> RadioIndication::cellInfoList_1_5(V1_0::RadioIndicationType type,
+ const hidl_vec<V1_5::CellInfo>& records) {
+ LOG_CALL << type;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->cellInfoList(toAidl(type), toAidl(records));
+ return {};
+}
+
+Return<void> RadioIndication::cellInfoList_1_6(V1_0::RadioIndicationType type,
+ const hidl_vec<V1_6::CellInfo>& records) {
+ LOG_CALL << type;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->cellInfoList(toAidl(type), toAidl(records));
+ return {};
+}
+
+Return<void> RadioIndication::currentLinkCapacityEstimate(V1_0::RadioIndicationType type,
+ const V1_2::LinkCapacityEstimate& lce) {
+ LOG_CALL << type;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->currentLinkCapacityEstimate(toAidl(type), toAidl(lce));
+ return {};
+}
+
+Return<void> RadioIndication::currentLinkCapacityEstimate_1_6(
+ V1_0::RadioIndicationType type, const V1_6::LinkCapacityEstimate& lce) {
+ LOG_CALL << type;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->currentLinkCapacityEstimate(toAidl(type), toAidl(lce));
+ return {};
+}
+
+Return<void> RadioIndication::currentPhysicalChannelConfigs(
+ V1_0::RadioIndicationType type, const hidl_vec<V1_2::PhysicalChannelConfig>&) {
+ LOG_CALL << type;
+ LOG(ERROR) << "IRadio HAL 1.0 not supported";
+ return {};
+}
+
+Return<void> RadioIndication::currentPhysicalChannelConfigs_1_4(
+ V1_0::RadioIndicationType type, const hidl_vec<V1_4::PhysicalChannelConfig>& configs) {
+ LOG_CALL << type;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->currentPhysicalChannelConfigs(toAidl(type), toAidl(configs));
+ return {};
+}
+
+Return<void> RadioIndication::currentPhysicalChannelConfigs_1_6(
+ V1_0::RadioIndicationType type, const hidl_vec<V1_6::PhysicalChannelConfig>& configs) {
+ LOG_CALL << type;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->currentPhysicalChannelConfigs(toAidl(type), toAidl(configs));
+ return {};
+}
+
+Return<void> RadioIndication::currentSignalStrength(V1_0::RadioIndicationType type,
+ const V1_0::SignalStrength&) {
+ LOG_CALL << type;
+ LOG(ERROR) << "IRadio HAL 1.0 not supported";
+ return {};
+}
+
+Return<void> RadioIndication::currentSignalStrength_1_2(V1_0::RadioIndicationType type,
+ const V1_2::SignalStrength&) {
+ LOG_CALL << type;
+ LOG(ERROR) << "IRadio HAL 1.2 not supported";
+ return {};
+}
+
+Return<void> RadioIndication::currentSignalStrength_1_4(
+ V1_0::RadioIndicationType type, const V1_4::SignalStrength& signalStrength) {
+ LOG_CALL << type;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->currentSignalStrength(toAidl(type), toAidl(signalStrength));
+ return {};
+}
+
+Return<void> RadioIndication::currentSignalStrength_1_6(
+ V1_0::RadioIndicationType type, const V1_6::SignalStrength& signalStrength) {
+ LOG_CALL << type;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->currentSignalStrength(toAidl(type), toAidl(signalStrength));
+ return {};
+}
+
+Return<void> RadioIndication::imsNetworkStateChanged(V1_0::RadioIndicationType type) {
+ LOG_CALL << type;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->imsNetworkStateChanged(toAidl(type));
+ return {};
+}
+
+Return<void> RadioIndication::networkScanResult(V1_0::RadioIndicationType type,
+ const V1_1::NetworkScanResult&) {
+ LOG_CALL << type;
+ LOG(ERROR) << "IRadio HAL 1.0 not supported";
+ return {};
+}
+
+Return<void> RadioIndication::networkScanResult_1_2(V1_0::RadioIndicationType type,
+ const V1_2::NetworkScanResult&) {
+ LOG_CALL << type;
+ LOG(ERROR) << "IRadio HAL 1.2 not supported";
+ return {};
+}
+
+Return<void> RadioIndication::networkScanResult_1_4(V1_0::RadioIndicationType type,
+ const V1_4::NetworkScanResult&) {
+ LOG_CALL << type;
+ LOG(ERROR) << "IRadio HAL 1.4 not supported";
+ return {};
+}
+
+Return<void> RadioIndication::networkScanResult_1_5(V1_0::RadioIndicationType type,
+ const V1_5::NetworkScanResult& result) {
+ LOG_CALL << type;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->networkScanResult(toAidl(type), toAidl(result));
+ return {};
+}
+
+Return<void> RadioIndication::networkScanResult_1_6(V1_0::RadioIndicationType type,
+ const V1_6::NetworkScanResult& result) {
+ LOG_CALL << type;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->networkScanResult(toAidl(type), toAidl(result));
+ return {};
+}
+
+Return<void> RadioIndication::networkStateChanged(V1_0::RadioIndicationType type) {
+ LOG_CALL << type;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->networkStateChanged(toAidl(type));
+ return {};
+}
+
+Return<void> RadioIndication::nitzTimeReceived(V1_0::RadioIndicationType type,
+ const hidl_string& nitzTime, uint64_t receivedTime) {
+ LOG_CALL << type;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->nitzTimeReceived(toAidl(type), nitzTime, receivedTime, 0);
+ return {};
+}
+
+Return<void> RadioIndication::registrationFailed( //
+ V1_0::RadioIndicationType type, const V1_5::CellIdentity& cellIdentity,
+ const hidl_string& chosenPlmn, hidl_bitfield<V1_5::Domain> domain, int32_t causeCode,
+ int32_t additionalCauseCode) {
+ LOG_CALL << type;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->registrationFailed(toAidl(type), toAidl(cellIdentity), chosenPlmn,
+ aidl::Domain(domain), causeCode, additionalCauseCode);
+ return {};
+}
+
+Return<void> RadioIndication::restrictedStateChanged(V1_0::RadioIndicationType type,
+ V1_0::PhoneRestrictedState state) {
+ LOG_CALL << type;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->restrictedStateChanged(toAidl(type), aidl::PhoneRestrictedState(state));
+ return {};
+}
+
+Return<void> RadioIndication::suppSvcNotify(V1_0::RadioIndicationType type,
+ const V1_0::SuppSvcNotification& suppSvc) {
+ LOG_CALL << type;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->suppSvcNotify(toAidl(type), toAidl(suppSvc));
+ return {};
+}
+
+Return<void> RadioIndication::voiceRadioTechChanged(V1_0::RadioIndicationType type,
+ V1_0::RadioTechnology rat) {
+ LOG_CALL << type;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->voiceRadioTechChanged(toAidl(type), RadioTechnology(rat));
+ return {};
+}
+
+Return<void> RadioIndication::lceData(V1_0::RadioIndicationType type, const V1_0::LceDataInfo&) {
+ LOG_CALL << type;
+ LOG(WARNING) << "lceData indication is deprecated";
+ return {};
+}
+
+} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp
new file mode 100644
index 0000000..af0bc46
--- /dev/null
+++ b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp
@@ -0,0 +1,281 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <libradiocompat/RadioNetwork.h>
+
+#include "commonStructs.h"
+#include "debug.h"
+#include "structs.h"
+#include "utils.h"
+
+#include "collections.h"
+
+#define RADIO_MODULE "Network"
+
+namespace android::hardware::radio::compat {
+
+using ::aidl::android::hardware::radio::AccessNetwork;
+using ::aidl::android::hardware::radio::RadioAccessFamily;
+using ::ndk::ScopedAStatus;
+namespace aidl = ::aidl::android::hardware::radio::network;
+constexpr auto ok = &ScopedAStatus::ok;
+
+ScopedAStatus RadioNetwork::getAllowedNetworkTypesBitmap(int32_t serial) {
+ LOG_CALL << serial;
+ if (mHal1_6) {
+ mHal1_6->getAllowedNetworkTypesBitmap(serial);
+ } else {
+ mHal1_5->getPreferredNetworkType(serial);
+ }
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::getAvailableBandModes(int32_t serial) {
+ LOG_CALL << serial;
+ mHal1_5->getAvailableBandModes(serial);
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::getAvailableNetworks(int32_t serial) {
+ LOG_CALL << serial;
+ mHal1_5->getAvailableNetworks(serial);
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::getBarringInfo(int32_t serial) {
+ LOG_CALL << serial;
+ mHal1_5->getBarringInfo(serial);
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::getCdmaRoamingPreference(int32_t serial) {
+ LOG_CALL << serial;
+ mHal1_5->getCdmaRoamingPreference(serial);
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::getCellInfoList(int32_t serial) {
+ LOG_CALL << serial;
+ mHal1_5->getCellInfoList(serial);
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::getDataRegistrationState(int32_t serial) {
+ LOG_CALL << serial;
+ mHal1_5->getDataRegistrationState(serial);
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::getImsRegistrationState(int32_t serial) {
+ LOG_CALL << serial;
+ mHal1_5->getImsRegistrationState(serial);
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::getNetworkSelectionMode(int32_t serial) {
+ LOG_CALL << serial;
+ mHal1_5->getNetworkSelectionMode(serial);
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::getOperator(int32_t serial) {
+ LOG_CALL << serial;
+ mHal1_5->getOperator(serial);
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::getSignalStrength(int32_t serial) {
+ LOG_CALL << serial;
+ mHal1_5->getSignalStrength(serial);
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::getSystemSelectionChannels(int32_t serial) {
+ LOG_CALL << serial;
+ if (mHal1_6) {
+ mHal1_6->getSystemSelectionChannels(serial);
+ } else {
+ respond().getSystemSelectionChannelsResponse(notSupported(serial), {});
+ }
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::getVoiceRadioTechnology(int32_t serial) {
+ LOG_CALL << serial;
+ mHal1_5->getVoiceRadioTechnology(serial);
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::getVoiceRegistrationState(int32_t serial) {
+ LOG_CALL << serial;
+ mHal1_5->getVoiceRegistrationState(serial);
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::isNrDualConnectivityEnabled(int32_t serial) {
+ LOG_CALL << serial;
+ if (mHal1_6) {
+ mHal1_6->isNrDualConnectivityEnabled(serial);
+ } else {
+ respond().isNrDualConnectivityEnabledResponse(notSupported(serial), false);
+ }
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::responseAcknowledgement() {
+ LOG_CALL;
+ mHal1_5->responseAcknowledgement();
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::setAllowedNetworkTypesBitmap(int32_t serial, RadioAccessFamily ntype) {
+ LOG_CALL << serial;
+ const auto raf = toHidlBitfield<V1_4::RadioAccessFamily>(ntype);
+ if (mHal1_6) {
+ mHal1_6->setAllowedNetworkTypesBitmap(serial, raf);
+ } else {
+ mHal1_5->setPreferredNetworkType(serial, getNetworkTypeFromRaf(raf));
+ }
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::setBandMode(int32_t serial, aidl::RadioBandMode mode) {
+ LOG_CALL << serial;
+ mHal1_5->setBandMode(serial, V1_0::RadioBandMode(mode));
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::setBarringPassword(int32_t serial, const std::string& facility,
+ const std::string& oldPw, const std::string& newPw) {
+ LOG_CALL << serial;
+ mHal1_5->setBarringPassword(serial, facility, oldPw, newPw);
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::setCdmaRoamingPreference(int32_t serial, aidl::CdmaRoamingType type) {
+ LOG_CALL << serial;
+ mHal1_5->setCdmaRoamingPreference(serial, V1_0::CdmaRoamingType(type));
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::setCellInfoListRate(int32_t serial, int32_t rate) {
+ LOG_CALL << serial;
+ mHal1_5->setCellInfoListRate(serial, rate);
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::setIndicationFilter(int32_t serial, aidl::IndicationFilter indFilter) {
+ LOG_CALL << serial;
+ mHal1_5->setIndicationFilter(serial, toHidlBitfield<V1_0::IndicationFilter>(indFilter));
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::setLinkCapacityReportingCriteria( //
+ int32_t serial, int32_t hysteresisMs, int32_t hysteresisDlKbps, int32_t hysteresisUlKbps,
+ const std::vector<int32_t>& thrDownlinkKbps, const std::vector<int32_t>& thrUplinkKbps,
+ AccessNetwork accessNetwork) {
+ LOG_CALL << serial;
+ mHal1_5->setLinkCapacityReportingCriteria( //
+ serial, hysteresisMs, hysteresisDlKbps, hysteresisUlKbps, thrDownlinkKbps,
+ thrUplinkKbps, V1_2::AccessNetwork(accessNetwork));
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::setLocationUpdates(int32_t serial, bool enable) {
+ LOG_CALL << serial;
+ mHal1_5->setLocationUpdates(serial, enable);
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::setNetworkSelectionModeAutomatic(int32_t serial) {
+ LOG_CALL << serial;
+ mHal1_5->setNetworkSelectionModeAutomatic(serial);
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::setNetworkSelectionModeManual( //
+ int32_t serial, const std::string& opNumeric, AccessNetwork ran) {
+ LOG_CALL << serial;
+ mHal1_5->setNetworkSelectionModeManual_1_5(serial, opNumeric, V1_5::RadioAccessNetworks(ran));
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::setNrDualConnectivityState(int32_t serial,
+ aidl::NrDualConnectivityState st) {
+ LOG_CALL << serial;
+ if (mHal1_6) {
+ mHal1_6->setNrDualConnectivityState(serial, V1_6::NrDualConnectivityState(st));
+ } else {
+ respond().setNrDualConnectivityStateResponse(notSupported(serial));
+ }
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::setResponseFunctions(
+ const std::shared_ptr<aidl::IRadioNetworkResponse>& networkResponse,
+ const std::shared_ptr<aidl::IRadioNetworkIndication>& networkIndication) {
+ LOG_CALL << networkResponse << ' ' << networkIndication;
+
+ CHECK(networkResponse);
+ CHECK(networkIndication);
+
+ mRadioResponse->setResponseFunction(networkResponse);
+ mRadioIndication->setResponseFunction(networkIndication);
+
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::setSignalStrengthReportingCriteria(
+ int32_t serial, const std::vector<aidl::SignalThresholdInfo>& infos) {
+ LOG_CALL << serial;
+ // TODO(b/203699028): how about other infos?
+ mHal1_5->setSignalStrengthReportingCriteria_1_5(serial, toHidl(infos[0]),
+ V1_5::AccessNetwork(infos[0].ran));
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::setSuppServiceNotifications(int32_t serial, bool enable) {
+ LOG_CALL << serial;
+ mHal1_5->setSuppServiceNotifications(serial, enable);
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::setSystemSelectionChannels( //
+ int32_t serial, bool specifyCh, const std::vector<aidl::RadioAccessSpecifier>& specifiers) {
+ LOG_CALL << serial;
+ mHal1_5->setSystemSelectionChannels_1_5(serial, specifyCh, toHidl(specifiers));
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::startNetworkScan(int32_t serial, const aidl::NetworkScanRequest& req) {
+ LOG_CALL << serial;
+ mHal1_5->startNetworkScan_1_5(serial, toHidl(req));
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::stopNetworkScan(int32_t serial) {
+ LOG_CALL << serial;
+ mHal1_5->stopNetworkScan(serial);
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::supplyNetworkDepersonalization(int32_t ser, const std::string& nPin) {
+ LOG_CALL << ser;
+ mHal1_5->supplyNetworkDepersonalization(ser, nPin);
+ return ok();
+}
+
+} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/libradiocompat/network/RadioResponse-network.cpp b/radio/aidl/compat/libradiocompat/network/RadioResponse-network.cpp
new file mode 100644
index 0000000..81f7775
--- /dev/null
+++ b/radio/aidl/compat/libradiocompat/network/RadioResponse-network.cpp
@@ -0,0 +1,506 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <libradiocompat/RadioResponse.h>
+
+#include "commonStructs.h"
+#include "debug.h"
+#include "structs.h"
+#include "utils.h"
+
+#include "collections.h"
+
+#define RADIO_MODULE "NetworkResponse"
+
+namespace android::hardware::radio::compat {
+
+using ::aidl::android::hardware::radio::RadioAccessFamily;
+using ::aidl::android::hardware::radio::RadioTechnology;
+using ::aidl::android::hardware::radio::RadioTechnologyFamily;
+namespace aidl = ::aidl::android::hardware::radio::network;
+
+void RadioResponse::setResponseFunction(std::shared_ptr<aidl::IRadioNetworkResponse> netCb) {
+ CHECK(netCb);
+ mNetworkCb = netCb;
+}
+
+Return<void> RadioResponse::getAllowedNetworkTypesBitmapResponse(
+ const V1_6::RadioResponseInfo& info,
+ hidl_bitfield<V1_4::RadioAccessFamily> networkTypeBitmap) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->getAllowedNetworkTypesBitmapResponse(toAidl(info),
+ RadioAccessFamily(networkTypeBitmap));
+ return {};
+}
+
+Return<void> RadioResponse::getPreferredNetworkTypeResponse(const V1_0::RadioResponseInfo& info,
+ V1_0::PreferredNetworkType nwType) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->getAllowedNetworkTypesBitmapResponse( //
+ toAidl(info), RadioAccessFamily(getRafFromNetworkType(nwType)));
+ return {};
+}
+
+Return<void> RadioResponse::getPreferredNetworkTypeBitmapResponse(
+ const V1_0::RadioResponseInfo& info, hidl_bitfield<V1_4::RadioAccessFamily>) {
+ LOG_CALL << info.serial;
+ LOG(ERROR) << "IRadio HAL 1.4 not supported";
+ return {};
+}
+
+Return<void> RadioResponse::getAvailableBandModesResponse(
+ const V1_0::RadioResponseInfo& info, const hidl_vec<V1_0::RadioBandMode>& bandModes) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->getAvailableBandModesResponse(toAidl(info), toAidl(bandModes));
+ return {};
+}
+
+Return<void> RadioResponse::getAvailableNetworksResponse(
+ const V1_0::RadioResponseInfo& info, const hidl_vec<V1_0::OperatorInfo>& networkInfos) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->getAvailableNetworksResponse(toAidl(info), toAidl(networkInfos));
+ return {};
+}
+
+Return<void> RadioResponse::getBarringInfoResponse(
+ const V1_0::RadioResponseInfo& info, const V1_5::CellIdentity& cellIdentity,
+ const hidl_vec<V1_5::BarringInfo>& barringInfos) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->getBarringInfoResponse(toAidl(info), toAidl(cellIdentity), toAidl(barringInfos));
+ return {};
+}
+
+Return<void> RadioResponse::getCdmaRoamingPreferenceResponse(const V1_0::RadioResponseInfo& info,
+ V1_0::CdmaRoamingType type) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->getCdmaRoamingPreferenceResponse(toAidl(info), aidl::CdmaRoamingType(type));
+ return {};
+}
+
+Return<void> RadioResponse::getCellInfoListResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_0::CellInfo>&) {
+ LOG_CALL << info.serial;
+ LOG(ERROR) << "IRadio HAL 1.0 not supported";
+ return {};
+}
+
+Return<void> RadioResponse::getCellInfoListResponse_1_2(const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_2::CellInfo>&) {
+ LOG_CALL << info.serial;
+ LOG(ERROR) << "IRadio HAL 1.2 not supported";
+ return {};
+}
+
+Return<void> RadioResponse::getCellInfoListResponse_1_4(const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_4::CellInfo>&) {
+ LOG_CALL << info.serial;
+ LOG(ERROR) << "IRadio HAL 1.4 not supported";
+ return {};
+}
+
+Return<void> RadioResponse::getCellInfoListResponse_1_5(const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_5::CellInfo>& cellInfo) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->getCellInfoListResponse(toAidl(info), toAidl(cellInfo));
+ return {};
+}
+
+Return<void> RadioResponse::getCellInfoListResponse_1_6(const V1_6::RadioResponseInfo& info,
+ const hidl_vec<V1_6::CellInfo>& cellInfo) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->getCellInfoListResponse(toAidl(info), toAidl(cellInfo));
+ return {};
+}
+
+Return<void> RadioResponse::getDataRegistrationStateResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::DataRegStateResult&) {
+ LOG_CALL << info.serial;
+ LOG(ERROR) << "IRadio HAL 1.0 not supported";
+ return {};
+}
+
+Return<void> RadioResponse::getDataRegistrationStateResponse_1_2(
+ const V1_0::RadioResponseInfo& info, const V1_2::DataRegStateResult&) {
+ LOG_CALL << info.serial;
+ LOG(ERROR) << "IRadio HAL 1.2 not supported";
+ return {};
+}
+
+Return<void> RadioResponse::getDataRegistrationStateResponse_1_4(
+ const V1_0::RadioResponseInfo& info, const V1_4::DataRegStateResult&) {
+ LOG_CALL << info.serial;
+ LOG(ERROR) << "IRadio HAL 1.4 not supported";
+ return {};
+}
+
+Return<void> RadioResponse::getDataRegistrationStateResponse_1_5(
+ const V1_0::RadioResponseInfo& info, const V1_5::RegStateResult& dataRegResponse) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->getDataRegistrationStateResponse(toAidl(info), toAidl(dataRegResponse));
+ return {};
+}
+
+Return<void> RadioResponse::getDataRegistrationStateResponse_1_6(
+ const V1_6::RadioResponseInfo& info, const V1_6::RegStateResult& dataRegResponse) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->getDataRegistrationStateResponse(toAidl(info), toAidl(dataRegResponse));
+ return {};
+}
+
+Return<void> RadioResponse::getImsRegistrationStateResponse( //
+ const V1_0::RadioResponseInfo& info, bool isRegd, V1_0::RadioTechnologyFamily ratFamily) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->getImsRegistrationStateResponse(toAidl(info), isRegd,
+ RadioTechnologyFamily(ratFamily));
+ return {};
+}
+
+Return<void> RadioResponse::getNeighboringCidsResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_0::NeighboringCell>&) {
+ LOG_CALL << info.serial;
+ LOG(ERROR) << "getNeighboringCidsResponse is not supposed to be called";
+ return {};
+}
+
+Return<void> RadioResponse::getNetworkSelectionModeResponse(const V1_0::RadioResponseInfo& info,
+ bool manual) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->getNetworkSelectionModeResponse(toAidl(info), manual);
+ return {};
+}
+
+Return<void> RadioResponse::getOperatorResponse( //
+ const V1_0::RadioResponseInfo& info, const hidl_string& longName,
+ const hidl_string& shortName, const hidl_string& numeric) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->getOperatorResponse(toAidl(info), longName, shortName, numeric);
+ return {};
+}
+
+Return<void> RadioResponse::getSignalStrengthResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::SignalStrength&) {
+ LOG_CALL << info.serial;
+ LOG(ERROR) << "IRadio HAL 1.0 not supported";
+ return {};
+}
+
+Return<void> RadioResponse::getSignalStrengthResponse_1_2(const V1_0::RadioResponseInfo& info,
+ const V1_2::SignalStrength&) {
+ LOG_CALL << info.serial;
+ LOG(ERROR) << "IRadio HAL 1.2 not supported";
+ return {};
+}
+
+Return<void> RadioResponse::getSignalStrengthResponse_1_4(
+ const V1_0::RadioResponseInfo& info, const V1_4::SignalStrength& signalStrength) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->getSignalStrengthResponse(toAidl(info), toAidl(signalStrength));
+ return {};
+}
+
+Return<void> RadioResponse::getSignalStrengthResponse_1_6(
+ const V1_6::RadioResponseInfo& info, const V1_6::SignalStrength& signalStrength) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->getSignalStrengthResponse(toAidl(info), toAidl(signalStrength));
+ return {};
+}
+
+Return<void> RadioResponse::getSystemSelectionChannelsResponse(
+ const V1_6::RadioResponseInfo& info,
+ const hidl_vec<V1_5::RadioAccessSpecifier>& specifiers) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->getSystemSelectionChannelsResponse(toAidl(info), toAidl(specifiers));
+ return {};
+}
+
+Return<void> RadioResponse::getVoiceRadioTechnologyResponse(const V1_0::RadioResponseInfo& info,
+ V1_0::RadioTechnology rat) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->getVoiceRadioTechnologyResponse(toAidl(info), RadioTechnology(rat));
+ return {};
+}
+
+Return<void> RadioResponse::getVoiceRegistrationStateResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::VoiceRegStateResult&) {
+ LOG_CALL << info.serial;
+ LOG(ERROR) << "IRadio HAL 1.0 not supported";
+ return {};
+}
+
+Return<void> RadioResponse::getVoiceRegistrationStateResponse_1_2(
+ const V1_0::RadioResponseInfo& info, const V1_2::VoiceRegStateResult&) {
+ LOG_CALL << info.serial;
+ LOG(ERROR) << "IRadio HAL 1.2 not supported";
+ return {};
+}
+
+Return<void> RadioResponse::getVoiceRegistrationStateResponse_1_5(
+ const V1_0::RadioResponseInfo& info, const V1_5::RegStateResult& voiceRegResponse) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->getVoiceRegistrationStateResponse(toAidl(info), toAidl(voiceRegResponse));
+ return {};
+}
+
+Return<void> RadioResponse::getVoiceRegistrationStateResponse_1_6(
+ const V1_6::RadioResponseInfo& info, const V1_6::RegStateResult& voiceRegResponse) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->getVoiceRegistrationStateResponse(toAidl(info), toAidl(voiceRegResponse));
+ return {};
+}
+
+Return<void> RadioResponse::isNrDualConnectivityEnabledResponse(const V1_6::RadioResponseInfo& info,
+ bool isEnabled) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->isNrDualConnectivityEnabledResponse(toAidl(info), isEnabled);
+ return {};
+}
+
+Return<void> RadioResponse::pullLceDataResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::LceDataInfo&) {
+ LOG_CALL << info.serial;
+ LOG(ERROR) << "pullLceDataResponse is not supposed to be called";
+ return {};
+}
+
+Return<void> RadioResponse::setAllowedNetworkTypesBitmapResponse(const V1_6::RadioResponseInfo& i) {
+ LOG_CALL << i.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->setAllowedNetworkTypesBitmapResponse(toAidl(i));
+ return {};
+}
+
+Return<void> RadioResponse::setPreferredNetworkTypeResponse(const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->setAllowedNetworkTypesBitmapResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::setPreferredNetworkTypeBitmapResponse(
+ const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ LOG(ERROR) << "IRadio HAL 1.4 not supported";
+ return {};
+}
+
+Return<void> RadioResponse::setBandModeResponse(const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->setBandModeResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::setBarringPasswordResponse(const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->setBarringPasswordResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::setCdmaRoamingPreferenceResponse(const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->setCdmaRoamingPreferenceResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::setCellInfoListRateResponse(const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->setCellInfoListRateResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::setIndicationFilterResponse(const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->setIndicationFilterResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::setIndicationFilterResponse_1_5(const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->setIndicationFilterResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::setLinkCapacityReportingCriteriaResponse(
+ const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->setLinkCapacityReportingCriteriaResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::setLinkCapacityReportingCriteriaResponse_1_5(
+ const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->setLinkCapacityReportingCriteriaResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::setLocationUpdatesResponse(const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->setLocationUpdatesResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::setNetworkSelectionModeAutomaticResponse(
+ const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->setNetworkSelectionModeAutomaticResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::setNetworkSelectionModeManualResponse(
+ const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->setNetworkSelectionModeManualResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::setNetworkSelectionModeManualResponse_1_5(
+ const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->setNetworkSelectionModeManualResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::setNrDualConnectivityStateResponse(
+ const V1_6::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->setNrDualConnectivityStateResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::setSignalStrengthReportingCriteriaResponse(
+ const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->setSignalStrengthReportingCriteriaResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::setSignalStrengthReportingCriteriaResponse_1_5(
+ const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->setSignalStrengthReportingCriteriaResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::setSuppServiceNotificationsResponse(
+ const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->setSuppServiceNotificationsResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::setSystemSelectionChannelsResponse(
+ const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->setSystemSelectionChannelsResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::setSystemSelectionChannelsResponse_1_5(
+ const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->setSystemSelectionChannelsResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::startNetworkScanResponse(const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->startNetworkScanResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::startNetworkScanResponse_1_4(const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->startNetworkScanResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::startNetworkScanResponse_1_5(const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->startNetworkScanResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::stopNetworkScanResponse(const V1_0::RadioResponseInfo& info) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->stopNetworkScanResponse(toAidl(info));
+ return {};
+}
+
+Return<void> RadioResponse::supplyNetworkDepersonalizationResponse(
+ const V1_0::RadioResponseInfo& info, int32_t remainingRetries) {
+ LOG_CALL << info.serial;
+ CHECK_CB(mNetworkCb);
+ mNetworkCb->supplyNetworkDepersonalizationResponse(toAidl(info), remainingRetries);
+ return {};
+}
+
+Return<void> RadioResponse::startLceServiceResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::LceStatusInfo&) {
+ LOG_CALL << info.serial;
+ LOG(WARNING) << "startLceServiceResponse is deprecated";
+ return {};
+}
+
+Return<void> RadioResponse::stopLceServiceResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::LceStatusInfo&) {
+ LOG_CALL << info.serial;
+ LOG(WARNING) << "stopLceServiceResponse is deprecated";
+ return {};
+}
+
+} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/libradiocompat/network/structs.cpp b/radio/aidl/compat/libradiocompat/network/structs.cpp
new file mode 100644
index 0000000..87a021f
--- /dev/null
+++ b/radio/aidl/compat/libradiocompat/network/structs.cpp
@@ -0,0 +1,668 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "structs.h"
+
+#include "commonStructs.h"
+
+#include "collections.h"
+
+#include <android-base/logging.h>
+
+namespace android::hardware::radio::compat {
+
+namespace aidl = ::aidl::android::hardware::radio::network;
+using ::aidl::android::hardware::radio::AccessNetwork;
+using ::aidl::android::hardware::radio::RadioTechnology;
+
+aidl::RadioBandMode toAidl(V1_0::RadioBandMode mode) {
+ return aidl::RadioBandMode(mode);
+}
+
+aidl::GeranBands toAidl(V1_1::GeranBands band) {
+ return aidl::GeranBands(band);
+}
+
+V1_1::GeranBands toHidl(aidl::GeranBands band) {
+ return V1_1::GeranBands(band);
+}
+
+aidl::UtranBands toAidl(V1_5::UtranBands band) {
+ return aidl::UtranBands(band);
+}
+
+V1_5::UtranBands toHidl(aidl::UtranBands band) {
+ return V1_5::UtranBands(band);
+}
+
+aidl::EutranBands toAidl(V1_5::EutranBands band) {
+ return aidl::EutranBands(band);
+}
+
+V1_5::EutranBands toHidl(aidl::EutranBands band) {
+ return V1_5::EutranBands(band);
+}
+
+aidl::NgranBands toAidl(V1_5::NgranBands band) {
+ return aidl::NgranBands(band);
+}
+
+V1_5::NgranBands toHidl(aidl::NgranBands band) {
+ return V1_5::NgranBands(band);
+}
+
+V1_5::SignalThresholdInfo toHidl(const aidl::SignalThresholdInfo& info) {
+ return {
+ .signalMeasurement = V1_5::SignalMeasurementType{info.signalMeasurement},
+ .hysteresisMs = info.hysteresisMs,
+ .hysteresisDb = info.hysteresisDb,
+ .thresholds = info.thresholds,
+ .isEnabled = info.isEnabled,
+ };
+}
+
+static aidl::RadioAccessSpecifierBands toAidl(const V1_5::RadioAccessSpecifier::Bands& bands) {
+ using Discr = V1_5::RadioAccessSpecifier::Bands::hidl_discriminator;
+ const auto discr = bands.getDiscriminator();
+
+ if (discr == Discr::geranBands) return toAidl(bands.geranBands());
+ if (discr == Discr::utranBands) return toAidl(bands.utranBands());
+ if (discr == Discr::eutranBands) return toAidl(bands.eutranBands());
+ if (discr == Discr::ngranBands) return toAidl(bands.ngranBands());
+
+ return {};
+}
+
+static V1_5::RadioAccessSpecifier::Bands toHidl(const aidl::RadioAccessSpecifierBands& bands) {
+ V1_5::RadioAccessSpecifier::Bands hidl;
+ using Tag = aidl::RadioAccessSpecifierBands::Tag;
+
+ if (bands.getTag() == Tag::geranBands) hidl.geranBands(toHidl(bands.get<Tag::geranBands>()));
+ if (bands.getTag() == Tag::utranBands) hidl.utranBands(toHidl(bands.get<Tag::utranBands>()));
+ if (bands.getTag() == Tag::eutranBands) hidl.eutranBands(toHidl(bands.get<Tag::eutranBands>()));
+ if (bands.getTag() == Tag::ngranBands) hidl.ngranBands(toHidl(bands.get<Tag::ngranBands>()));
+
+ return hidl;
+}
+
+aidl::RadioAccessSpecifier toAidl(const V1_5::RadioAccessSpecifier& spec) {
+ return {
+ .accessNetwork = AccessNetwork(spec.radioAccessNetwork),
+ .bands = toAidl(spec.bands),
+ .channels = spec.channels,
+ };
+}
+
+V1_5::RadioAccessSpecifier toHidl(const aidl::RadioAccessSpecifier& spec) {
+ return {
+ .radioAccessNetwork = V1_5::RadioAccessNetworks{spec.accessNetwork},
+ .bands = toHidl(spec.bands),
+ .channels = spec.channels,
+ };
+}
+
+V1_5::NetworkScanRequest toHidl(const aidl::NetworkScanRequest& req) {
+ return {
+ .type = V1_1::ScanType{req.type},
+ .interval = req.interval,
+ .specifiers = toHidl(req.specifiers),
+ .maxSearchTime = req.maxSearchTime,
+ .incrementalResults = req.incrementalResults,
+ .incrementalResultsPeriodicity = req.incrementalResultsPeriodicity,
+ .mccMncs = toHidl(req.mccMncs),
+ };
+}
+
+static aidl::OperatorInfo toAidl(const V1_2::CellIdentityOperatorNames& names) {
+ return {
+ .alphaLong = names.alphaLong,
+ .alphaShort = names.alphaShort,
+ .operatorNumeric = "",
+ .status = aidl::OperatorInfo::STATUS_UNKNOWN,
+ };
+}
+
+static aidl::CellIdentityGsm toAidl(const V1_5::CellIdentityGsm& ci) {
+ return {
+ .mcc = ci.base.base.mcc,
+ .mnc = ci.base.base.mnc,
+ .lac = ci.base.base.lac,
+ .cid = ci.base.base.cid,
+ .arfcn = ci.base.base.arfcn,
+ .bsic = static_cast<int8_t>(ci.base.base.bsic),
+ .operatorNames = toAidl(ci.base.operatorNames),
+ .additionalPlmns = toAidl(ci.additionalPlmns),
+ };
+}
+
+aidl::ClosedSubscriberGroupInfo toAidl(const V1_5::ClosedSubscriberGroupInfo& info) {
+ return {
+ .csgIndication = info.csgIndication,
+ .homeNodebName = info.homeNodebName,
+ .csgIdentity = info.csgIdentity,
+ };
+}
+
+static std::optional<aidl::ClosedSubscriberGroupInfo> toAidl(const V1_5::OptionalCsgInfo& opt) {
+ using descr = V1_5::OptionalCsgInfo::hidl_discriminator;
+ if (opt.getDiscriminator() == descr::noinit) return std::nullopt;
+ return toAidl(opt.csgInfo());
+}
+
+static aidl::CellIdentityWcdma toAidl(const V1_5::CellIdentityWcdma& ci) {
+ return {
+ .mcc = ci.base.base.mcc,
+ .mnc = ci.base.base.mnc,
+ .lac = ci.base.base.lac,
+ .cid = ci.base.base.cid,
+ .psc = ci.base.base.psc,
+ .uarfcn = ci.base.base.uarfcn,
+ .operatorNames = toAidl(ci.base.operatorNames),
+ .additionalPlmns = toAidl(ci.additionalPlmns),
+ .csgInfo = toAidl(ci.optionalCsgInfo),
+ };
+}
+
+static aidl::CellIdentityTdscdma toAidl(const V1_5::CellIdentityTdscdma& ci) {
+ return {
+ .mcc = ci.base.base.mcc,
+ .mnc = ci.base.base.mnc,
+ .lac = ci.base.base.lac,
+ .cid = ci.base.base.cid,
+ .cpid = ci.base.base.cpid,
+ .uarfcn = ci.base.uarfcn,
+ .operatorNames = toAidl(ci.base.operatorNames),
+ .additionalPlmns = toAidl(ci.additionalPlmns),
+ .csgInfo = toAidl(ci.optionalCsgInfo),
+ };
+}
+
+static aidl::CellIdentityCdma toAidl(const V1_2::CellIdentityCdma& ci) {
+ return {
+ .networkId = ci.base.networkId,
+ .systemId = ci.base.systemId,
+ .baseStationId = ci.base.baseStationId,
+ .longitude = ci.base.longitude,
+ .latitude = ci.base.latitude,
+ .operatorNames = toAidl(ci.operatorNames),
+ };
+}
+
+static aidl::CellIdentityLte toAidl(const V1_5::CellIdentityLte& ci) {
+ return {
+ .mcc = ci.base.base.mcc,
+ .mnc = ci.base.base.mnc,
+ .ci = ci.base.base.ci,
+ .pci = ci.base.base.pci,
+ .tac = ci.base.base.tac,
+ .earfcn = ci.base.base.earfcn,
+ .operatorNames = toAidl(ci.base.operatorNames),
+ .bandwidth = ci.base.bandwidth,
+ .additionalPlmns = toAidl(ci.additionalPlmns),
+ .csgInfo = toAidl(ci.optionalCsgInfo),
+ .bands = toAidl(ci.bands),
+ };
+}
+
+static aidl::CellIdentityNr toAidl(const V1_5::CellIdentityNr& ci) {
+ return {
+ .mcc = ci.base.mcc,
+ .mnc = ci.base.mnc,
+ .nci = static_cast<int64_t>(ci.base.nci),
+ .pci = static_cast<int32_t>(ci.base.pci),
+ .tac = ci.base.tac,
+ .nrarfcn = ci.base.nrarfcn,
+ .operatorNames = toAidl(ci.base.operatorNames),
+ .additionalPlmns = toAidl(ci.additionalPlmns),
+ .bands = toAidl(ci.bands),
+ };
+}
+
+aidl::CellIdentity toAidl(const V1_5::CellIdentity& ci) {
+ using Discr = V1_5::CellIdentity::hidl_discriminator;
+ const auto discr = ci.getDiscriminator();
+
+ if (discr == Discr::gsm) return toAidl(ci.gsm());
+ if (discr == Discr::wcdma) return toAidl(ci.wcdma());
+ if (discr == Discr::tdscdma) return toAidl(ci.tdscdma());
+ if (discr == Discr::cdma) return toAidl(ci.cdma());
+ if (discr == Discr::lte) return toAidl(ci.lte());
+ if (discr == Discr::nr) return toAidl(ci.nr());
+
+ return {};
+}
+
+static std::optional<aidl::BarringTypeSpecificInfo> //
+toAidl(const V1_5::BarringInfo::BarringTypeSpecificInfo& opt) {
+ using discr = V1_5::BarringInfo::BarringTypeSpecificInfo::hidl_discriminator;
+ if (opt.getDiscriminator() == discr::noinit) return std::nullopt;
+
+ const auto& info = opt.conditional();
+ return aidl::BarringTypeSpecificInfo{
+ .factor = info.factor,
+ .timeSeconds = info.timeSeconds,
+ .isBarred = info.isBarred,
+ };
+}
+
+aidl::BarringInfo toAidl(const V1_5::BarringInfo& info) {
+ return {
+ .serviceType = static_cast<int32_t>(info.serviceType),
+ .barringType = static_cast<int32_t>(info.barringType),
+ .barringTypeSpecificInfo = toAidl(info.barringTypeSpecificInfo),
+ };
+}
+
+static aidl::GsmSignalStrength toAidl(const V1_0::GsmSignalStrength& sig) {
+ return {
+ .signalStrength = static_cast<int32_t>(sig.signalStrength),
+ .bitErrorRate = static_cast<int32_t>(sig.bitErrorRate),
+ .timingAdvance = sig.timingAdvance,
+ };
+}
+
+static aidl::CellInfoGsm toAidl(const V1_5::CellInfoGsm& info) {
+ return {
+ .cellIdentityGsm = toAidl(info.cellIdentityGsm),
+ .signalStrengthGsm = toAidl(info.signalStrengthGsm),
+ };
+}
+
+static aidl::WcdmaSignalStrength toAidl(const V1_2::WcdmaSignalStrength& sig) {
+ return {
+ .signalStrength = sig.base.signalStrength,
+ .bitErrorRate = sig.base.bitErrorRate,
+ .rscp = static_cast<int32_t>(sig.rscp),
+ .ecno = static_cast<int32_t>(sig.ecno),
+ };
+}
+
+static aidl::CellInfoWcdma toAidl(const V1_5::CellInfoWcdma& info) {
+ return {
+ .cellIdentityWcdma = toAidl(info.cellIdentityWcdma),
+ .signalStrengthWcdma = toAidl(info.signalStrengthWcdma),
+ };
+}
+
+static aidl::TdscdmaSignalStrength toAidl(const V1_2::TdscdmaSignalStrength& sig) {
+ return {
+ .signalStrength = static_cast<int32_t>(sig.signalStrength),
+ .bitErrorRate = static_cast<int32_t>(sig.bitErrorRate),
+ .rscp = static_cast<int32_t>(sig.rscp),
+ };
+}
+
+static aidl::CellInfoTdscdma toAidl(const V1_5::CellInfoTdscdma& info) {
+ return {
+ .cellIdentityTdscdma = toAidl(info.cellIdentityTdscdma),
+ .signalStrengthTdscdma = toAidl(info.signalStrengthTdscdma),
+ };
+}
+
+static aidl::LteSignalStrength toAidl(const V1_6::LteSignalStrength& sig) {
+ return {
+ .signalStrength = static_cast<int32_t>(sig.base.signalStrength),
+ .rsrp = static_cast<int32_t>(sig.base.rsrp),
+ .rsrq = static_cast<int32_t>(sig.base.rsrq),
+ .rssnr = sig.base.rssnr,
+ .cqi = static_cast<int32_t>(sig.base.cqi),
+ .timingAdvance = static_cast<int32_t>(sig.base.timingAdvance),
+ .cqiTableIndex = static_cast<int32_t>(sig.cqiTableIndex),
+ };
+}
+
+static aidl::LteSignalStrength toAidl(const V1_0::LteSignalStrength& sig) {
+ return toAidl({sig, 0});
+}
+
+static aidl::CellInfoLte toAidl(const V1_5::CellInfoLte& info) {
+ return {
+ .cellIdentityLte = toAidl(info.cellIdentityLte),
+ .signalStrengthLte = toAidl(info.signalStrengthLte),
+ };
+}
+
+static aidl::CellInfoLte toAidl(const V1_6::CellInfoLte& info) {
+ return {
+ .cellIdentityLte = toAidl(info.cellIdentityLte),
+ .signalStrengthLte = toAidl(info.signalStrengthLte),
+ };
+}
+
+static aidl::NrSignalStrength toAidl(const V1_6::NrSignalStrength& sig) {
+ return {
+ .ssRsrp = sig.base.ssRsrp,
+ .ssRsrq = sig.base.ssRsrq,
+ .ssSinr = sig.base.ssSinr,
+ .csiRsrp = sig.base.csiRsrp,
+ .csiRsrq = sig.base.csiRsrq,
+ .csiSinr = sig.base.csiSinr,
+ .csiCqiTableIndex = static_cast<int32_t>(sig.csiCqiTableIndex),
+ .csiCqiReport = sig.csiCqiReport,
+ };
+}
+
+static aidl::NrSignalStrength toAidl(const V1_4::NrSignalStrength& sig) {
+ return toAidl({sig, 0, 0});
+}
+
+static aidl::CellInfoNr toAidl(const V1_5::CellInfoNr& info) {
+ return {
+ .cellIdentityNr = toAidl(info.cellIdentityNr),
+ .signalStrengthNr = toAidl(info.signalStrengthNr),
+ };
+}
+
+static aidl::CellInfoNr toAidl(const V1_6::CellInfoNr& info) {
+ return {
+ .cellIdentityNr = toAidl(info.cellIdentityNr),
+ .signalStrengthNr = toAidl(info.signalStrengthNr),
+ };
+}
+
+static aidl::CdmaSignalStrength toAidl(const V1_0::CdmaSignalStrength& sig) {
+ return {
+ .dbm = static_cast<int32_t>(sig.dbm),
+ .ecio = static_cast<int32_t>(sig.ecio),
+ };
+}
+
+static aidl::EvdoSignalStrength toAidl(const V1_0::EvdoSignalStrength& sig) {
+ return {
+ .dbm = static_cast<int32_t>(sig.dbm),
+ .ecio = static_cast<int32_t>(sig.ecio),
+ .signalNoiseRatio = static_cast<int32_t>(sig.signalNoiseRatio),
+ };
+}
+
+static aidl::CellInfoCdma toAidl(const V1_2::CellInfoCdma& info) {
+ return {
+ .cellIdentityCdma = toAidl(info.cellIdentityCdma),
+ .signalStrengthCdma = toAidl(info.signalStrengthCdma),
+ .signalStrengthEvdo = toAidl(info.signalStrengthEvdo),
+ };
+}
+
+static aidl::CellInfoRatSpecificInfo toAidl(const V1_5::CellInfo::CellInfoRatSpecificInfo& ci) {
+ using Discr = V1_5::CellInfo::CellInfoRatSpecificInfo::hidl_discriminator;
+ const auto discr = ci.getDiscriminator();
+
+ if (discr == Discr::gsm) return toAidl(ci.gsm());
+ if (discr == Discr::wcdma) return toAidl(ci.wcdma());
+ if (discr == Discr::tdscdma) return toAidl(ci.tdscdma());
+ if (discr == Discr::lte) return toAidl(ci.lte());
+ if (discr == Discr::nr) return toAidl(ci.nr());
+ if (discr == Discr::cdma) return toAidl(ci.cdma());
+
+ return {};
+}
+
+static aidl::CellInfoRatSpecificInfo toAidl(const V1_6::CellInfo::CellInfoRatSpecificInfo& ci) {
+ using Discr = V1_6::CellInfo::CellInfoRatSpecificInfo::hidl_discriminator;
+ const auto discr = ci.getDiscriminator();
+
+ if (discr == Discr::gsm) return toAidl(ci.gsm());
+ if (discr == Discr::wcdma) return toAidl(ci.wcdma());
+ if (discr == Discr::tdscdma) return toAidl(ci.tdscdma());
+ if (discr == Discr::lte) return toAidl(ci.lte());
+ if (discr == Discr::nr) return toAidl(ci.nr());
+ if (discr == Discr::cdma) return toAidl(ci.cdma());
+
+ return {};
+}
+
+aidl::CellInfo toAidl(const V1_5::CellInfo& info) {
+ return {
+ .registered = info.registered,
+ // ignored: timeStampType and timeStamp
+ .connectionStatus = aidl::CellConnectionStatus(info.connectionStatus),
+ .ratSpecificInfo = toAidl(info.ratSpecificInfo),
+ };
+}
+
+aidl::CellInfo toAidl(const V1_6::CellInfo& info) {
+ return {
+ .registered = info.registered,
+ .connectionStatus = aidl::CellConnectionStatus(info.connectionStatus),
+ .ratSpecificInfo = toAidl(info.ratSpecificInfo),
+ };
+}
+
+aidl::LinkCapacityEstimate toAidl(const V1_2::LinkCapacityEstimate& e) {
+ return {
+ .downlinkCapacityKbps = static_cast<int32_t>(e.downlinkCapacityKbps),
+ .uplinkCapacityKbps = static_cast<int32_t>(e.uplinkCapacityKbps),
+ };
+}
+
+aidl::LinkCapacityEstimate toAidl(const V1_6::LinkCapacityEstimate& e) {
+ return {
+ .downlinkCapacityKbps = static_cast<int32_t>(e.downlinkCapacityKbps),
+ .uplinkCapacityKbps = static_cast<int32_t>(e.uplinkCapacityKbps),
+ .secondaryDownlinkCapacityKbps = static_cast<int32_t>(e.secondaryDownlinkCapacityKbps),
+ .secondaryUplinkCapacityKbps = static_cast<int32_t>(e.secondaryUplinkCapacityKbps),
+ };
+}
+
+static aidl::PhysicalChannelConfigBand toAidl(const V1_6::PhysicalChannelConfig::Band& band) {
+ using Discr = V1_6::PhysicalChannelConfig::Band::hidl_discriminator;
+ const auto discr = band.getDiscriminator();
+
+ if (discr == Discr::geranBand) return aidl::GeranBands(band.geranBand());
+ if (discr == Discr::utranBand) return aidl::UtranBands(band.utranBand());
+ if (discr == Discr::eutranBand) return aidl::EutranBands(band.eutranBand());
+ if (discr == Discr::ngranBand) return aidl::NgranBands(band.ngranBand());
+
+ return {};
+}
+
+aidl::PhysicalChannelConfig toAidl(const V1_4::PhysicalChannelConfig& cfg) {
+ int32_t downlinkChannelNumber = 0;
+ // ignored rfInfo.range
+ using Discr = V1_4::RadioFrequencyInfo::hidl_discriminator;
+ if (cfg.rfInfo.getDiscriminator() == Discr::channelNumber) {
+ downlinkChannelNumber = cfg.rfInfo.channelNumber();
+ }
+
+ return {
+ .status = aidl::CellConnectionStatus(cfg.base.status),
+ .rat = RadioTechnology(cfg.rat),
+ .downlinkChannelNumber = downlinkChannelNumber,
+ .cellBandwidthDownlinkKhz = cfg.base.cellBandwidthDownlink,
+ .contextIds = cfg.contextIds,
+ .physicalCellId = static_cast<int32_t>(cfg.physicalCellId),
+ };
+}
+
+aidl::PhysicalChannelConfig toAidl(const V1_6::PhysicalChannelConfig& cfg) {
+ return {
+ .status = aidl::CellConnectionStatus(cfg.status),
+ .rat = RadioTechnology(cfg.rat),
+ .downlinkChannelNumber = cfg.downlinkChannelNumber,
+ .uplinkChannelNumber = cfg.uplinkChannelNumber,
+ .cellBandwidthDownlinkKhz = cfg.cellBandwidthDownlinkKhz,
+ .cellBandwidthUplinkKhz = cfg.cellBandwidthUplinkKhz,
+ .contextIds = cfg.contextIds,
+ .physicalCellId = static_cast<int32_t>(cfg.physicalCellId),
+ .band = toAidl(cfg.band),
+ };
+}
+
+aidl::SignalStrength toAidl(const V1_4::SignalStrength& sig) {
+ return {
+ .gsm = toAidl(sig.gsm),
+ .cdma = toAidl(sig.cdma),
+ .evdo = toAidl(sig.evdo),
+ .lte = toAidl(sig.lte),
+ .tdscdma = toAidl(sig.tdscdma),
+ .wcdma = toAidl(sig.wcdma),
+ .nr = toAidl(sig.nr),
+ };
+}
+
+aidl::SignalStrength toAidl(const V1_6::SignalStrength& sig) {
+ return {
+ .gsm = toAidl(sig.gsm),
+ .cdma = toAidl(sig.cdma),
+ .evdo = toAidl(sig.evdo),
+ .lte = toAidl(sig.lte),
+ .tdscdma = toAidl(sig.tdscdma),
+ .wcdma = toAidl(sig.wcdma),
+ .nr = toAidl(sig.nr),
+ };
+}
+
+aidl::NetworkScanResult toAidl(const V1_5::NetworkScanResult& res) {
+ return {
+ .status = static_cast<int32_t>(res.status),
+ .error = toAidl(res.error),
+ .networkInfos = toAidl(res.networkInfos),
+ };
+}
+
+aidl::NetworkScanResult toAidl(const V1_6::NetworkScanResult& res) {
+ return {
+ .status = static_cast<int32_t>(res.status),
+ .error = toAidl(res.error),
+ .networkInfos = toAidl(res.networkInfos),
+ };
+}
+
+aidl::SuppSvcNotification toAidl(const V1_0::SuppSvcNotification& svc) {
+ return {
+ .isMT = svc.isMT,
+ .code = svc.code,
+ .index = svc.index,
+ .type = svc.type,
+ .number = svc.number,
+ };
+}
+
+aidl::OperatorInfo toAidl(const V1_0::OperatorInfo& info) {
+ return {
+ .alphaLong = info.alphaLong,
+ .alphaShort = info.alphaShort,
+ .operatorNumeric = info.operatorNumeric,
+ .status = static_cast<int32_t>(info.status),
+ };
+}
+
+static aidl::Cdma2000RegistrationInfo //
+toAidl(const V1_5::RegStateResult::AccessTechnologySpecificInfo::Cdma2000RegistrationInfo& info) {
+ return {
+ .cssSupported = info.cssSupported,
+ .roamingIndicator = info.roamingIndicator,
+ .systemIsInPrl = static_cast<int32_t>(info.systemIsInPrl),
+ .defaultRoamingIndicator = info.defaultRoamingIndicator,
+ };
+}
+
+static aidl::LteVopsInfo toAidl(const V1_4::LteVopsInfo& info) {
+ return {
+ .isVopsSupported = info.isVopsSupported,
+ .isEmcBearerSupported = info.isEmcBearerSupported,
+ };
+}
+
+static aidl::NrIndicators toAidl(const V1_4::NrIndicators& info) {
+ return {
+ .isEndcAvailable = info.isEndcAvailable,
+ .isDcNrRestricted = info.isDcNrRestricted,
+ .isNrAvailable = info.isNrAvailable,
+ };
+}
+
+static aidl::EutranRegistrationInfo //
+toAidl(const V1_5::RegStateResult::AccessTechnologySpecificInfo::EutranRegistrationInfo& info) {
+ return {
+ .lteVopsInfo = toAidl(info.lteVopsInfo),
+ .nrIndicators = toAidl(info.nrIndicators),
+ };
+}
+
+static aidl::NrVopsInfo toAidl(const V1_6::NrVopsInfo& info) {
+ return {
+ .vopsSupported = static_cast<int8_t>(info.vopsSupported),
+ .emcSupported = static_cast<int8_t>(info.emcSupported),
+ .emfSupported = static_cast<int8_t>(info.emfSupported),
+ };
+}
+
+static aidl::AccessTechnologySpecificInfo //
+toAidl(const V1_5::RegStateResult::AccessTechnologySpecificInfo& info) {
+ using Discr = V1_5::RegStateResult::AccessTechnologySpecificInfo::hidl_discriminator;
+ const auto discr = info.getDiscriminator();
+
+ if (discr == Discr::cdmaInfo) return toAidl(info.cdmaInfo());
+ if (discr == Discr::eutranInfo) return toAidl(info.eutranInfo());
+
+ return {};
+}
+
+static aidl::AccessTechnologySpecificInfo //
+toAidl(const V1_6::RegStateResult::AccessTechnologySpecificInfo& info) {
+ using Discr = V1_6::RegStateResult::AccessTechnologySpecificInfo::hidl_discriminator;
+ const auto discr = info.getDiscriminator();
+
+ if (discr == Discr::cdmaInfo) return toAidl(info.cdmaInfo());
+ if (discr == Discr::eutranInfo) return toAidl(info.eutranInfo());
+ if (discr == Discr::ngranNrVopsInfo) return toAidl(info.ngranNrVopsInfo());
+ if (discr == Discr::geranDtmSupported) {
+ using T = aidl::AccessTechnologySpecificInfo;
+ return T::make<T::Tag::geranDtmSupported>(info.geranDtmSupported());
+ }
+
+ return {};
+}
+
+aidl::RegStateResult toAidl(const V1_5::RegStateResult& res) {
+ return {
+ .regState = aidl::RegState(res.regState),
+ .rat = RadioTechnology(res.rat),
+ .reasonForDenial = aidl::RegistrationFailCause(res.reasonForDenial),
+ .cellIdentity = toAidl(res.cellIdentity),
+ .registeredPlmn = res.registeredPlmn,
+ .accessTechnologySpecificInfo = toAidl(res.accessTechnologySpecificInfo),
+ };
+}
+
+aidl::RegStateResult toAidl(const V1_6::RegStateResult& res) {
+ return {
+ .regState = aidl::RegState(res.regState),
+ .rat = RadioTechnology(res.rat),
+ .reasonForDenial = aidl::RegistrationFailCause(res.reasonForDenial),
+ .cellIdentity = toAidl(res.cellIdentity),
+ .registeredPlmn = res.registeredPlmn,
+ .accessTechnologySpecificInfo = toAidl(res.accessTechnologySpecificInfo),
+ };
+}
+
+aidl::NeighboringCell toAidl(const V1_0::NeighboringCell& cell) {
+ return {
+ .cid = cell.cid,
+ .rssi = cell.rssi,
+ };
+}
+
+aidl::LceDataInfo toAidl(const V1_0::LceDataInfo& info) {
+ return {
+ .lastHopCapacityKbps = static_cast<int32_t>(info.lastHopCapacityKbps),
+ .confidenceLevel = static_cast<int8_t>(info.confidenceLevel),
+ .lceSuspended = info.lceSuspended,
+ };
+}
+
+} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/libradiocompat/network/structs.h b/radio/aidl/compat/libradiocompat/network/structs.h
new file mode 100644
index 0000000..854cb38
--- /dev/null
+++ b/radio/aidl/compat/libradiocompat/network/structs.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <aidl/android/hardware/radio/network/BarringInfo.h>
+#include <aidl/android/hardware/radio/network/CellIdentity.h>
+#include <aidl/android/hardware/radio/network/CellInfo.h>
+#include <aidl/android/hardware/radio/network/LceDataInfo.h>
+#include <aidl/android/hardware/radio/network/LinkCapacityEstimate.h>
+#include <aidl/android/hardware/radio/network/NeighboringCell.h>
+#include <aidl/android/hardware/radio/network/NetworkScanRequest.h>
+#include <aidl/android/hardware/radio/network/NetworkScanResult.h>
+#include <aidl/android/hardware/radio/network/OperatorInfo.h>
+#include <aidl/android/hardware/radio/network/PhysicalChannelConfig.h>
+#include <aidl/android/hardware/radio/network/RadioAccessSpecifier.h>
+#include <aidl/android/hardware/radio/network/RadioBandMode.h>
+#include <aidl/android/hardware/radio/network/RegStateResult.h>
+#include <aidl/android/hardware/radio/network/SignalStrength.h>
+#include <aidl/android/hardware/radio/network/SignalThresholdInfo.h>
+#include <aidl/android/hardware/radio/network/SuppSvcNotification.h>
+#include <android/hardware/radio/1.6/types.h>
+
+namespace android::hardware::radio::compat {
+
+::aidl::android::hardware::radio::network::RadioBandMode toAidl(V1_0::RadioBandMode mode);
+::aidl::android::hardware::radio::network::GeranBands toAidl(V1_1::GeranBands band);
+V1_1::GeranBands toHidl(::aidl::android::hardware::radio::network::GeranBands band);
+::aidl::android::hardware::radio::network::UtranBands toAidl(V1_5::UtranBands band);
+V1_5::UtranBands toHidl(::aidl::android::hardware::radio::network::UtranBands band);
+::aidl::android::hardware::radio::network::EutranBands toAidl(V1_5::EutranBands band);
+V1_5::EutranBands toHidl(::aidl::android::hardware::radio::network::EutranBands band);
+::aidl::android::hardware::radio::network::NgranBands toAidl(V1_5::NgranBands band);
+V1_5::NgranBands toHidl(::aidl::android::hardware::radio::network::NgranBands band);
+
+V1_5::SignalThresholdInfo //
+toHidl(const ::aidl::android::hardware::radio::network::SignalThresholdInfo& info);
+
+::aidl::android::hardware::radio::network::RadioAccessSpecifier //
+toAidl(const V1_5::RadioAccessSpecifier& spec);
+V1_5::RadioAccessSpecifier //
+toHidl(const ::aidl::android::hardware::radio::network::RadioAccessSpecifier& spec);
+
+V1_5::NetworkScanRequest //
+toHidl(const ::aidl::android::hardware::radio::network::NetworkScanRequest& req);
+
+::aidl::android::hardware::radio::network::CellIdentity toAidl(const V1_5::CellIdentity& ci);
+
+::aidl::android::hardware::radio::network::BarringInfo toAidl(const V1_5::BarringInfo& info);
+
+::aidl::android::hardware::radio::network::ClosedSubscriberGroupInfo //
+toAidl(const V1_5::ClosedSubscriberGroupInfo& info);
+
+::aidl::android::hardware::radio::network::CellInfo toAidl(const V1_5::CellInfo& info);
+::aidl::android::hardware::radio::network::CellInfo toAidl(const V1_6::CellInfo& info);
+
+::aidl::android::hardware::radio::network::LinkCapacityEstimate //
+toAidl(const V1_2::LinkCapacityEstimate& lce);
+::aidl::android::hardware::radio::network::LinkCapacityEstimate //
+toAidl(const V1_6::LinkCapacityEstimate& lce);
+
+::aidl::android::hardware::radio::network::PhysicalChannelConfig //
+toAidl(const V1_4::PhysicalChannelConfig& cfg);
+::aidl::android::hardware::radio::network::PhysicalChannelConfig //
+toAidl(const V1_6::PhysicalChannelConfig& cfg);
+
+::aidl::android::hardware::radio::network::SignalStrength toAidl(const V1_4::SignalStrength& sig);
+::aidl::android::hardware::radio::network::SignalStrength toAidl(const V1_6::SignalStrength& sig);
+
+::aidl::android::hardware::radio::network::NetworkScanResult //
+toAidl(const V1_5::NetworkScanResult& res);
+::aidl::android::hardware::radio::network::NetworkScanResult //
+toAidl(const V1_6::NetworkScanResult& res);
+
+::aidl::android::hardware::radio::network::SuppSvcNotification //
+toAidl(const V1_0::SuppSvcNotification& svc);
+
+::aidl::android::hardware::radio::network::OperatorInfo toAidl(const V1_0::OperatorInfo& info);
+
+::aidl::android::hardware::radio::network::RegStateResult toAidl(const V1_5::RegStateResult& res);
+::aidl::android::hardware::radio::network::RegStateResult toAidl(const V1_6::RegStateResult& res);
+
+::aidl::android::hardware::radio::network::NeighboringCell toAidl(const V1_0::NeighboringCell& c);
+
+::aidl::android::hardware::radio::network::LceDataInfo toAidl(const V1_0::LceDataInfo& info);
+
+} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/libradiocompat/network/utils.cpp b/radio/aidl/compat/libradiocompat/network/utils.cpp
new file mode 100644
index 0000000..6fe3e6e
--- /dev/null
+++ b/radio/aidl/compat/libradiocompat/network/utils.cpp
@@ -0,0 +1,196 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "utils.h"
+
+namespace android::hardware::radio::compat {
+
+namespace RAF {
+using E = V1_4::RadioAccessFamily;
+constexpr auto GSM = E::GSM | E::GPRS;
+constexpr auto CDMA = E::IS95A | E::IS95B | E::ONE_X_RTT;
+constexpr auto EVDO = E::EVDO_0 | E::EVDO_A | E::EVDO_B | E::EHRPD;
+constexpr auto HS = E::HSUPA | E::HSDPA | E::HSPA | E::HSPAP;
+constexpr auto WCDMA = HS | E::UMTS;
+constexpr auto LTE = E::LTE | E::LTE_CA;
+constexpr auto NR = E::NR;
+} // namespace RAF
+
+static hidl_bitfield<V1_4::RadioAccessFamily> //
+getAdjustedRaf(hidl_bitfield<V1_4::RadioAccessFamily> raf) {
+ if (raf & RAF::GSM) raf |= RAF::GSM;
+ if (raf & RAF::WCDMA) raf |= RAF::WCDMA;
+ if (raf & RAF::CDMA) raf |= RAF::CDMA;
+ if (raf & RAF::EVDO) raf |= RAF::EVDO;
+ if (raf & RAF::LTE) raf |= RAF::LTE;
+ if (raf & RAF::NR) raf |= RAF::NR;
+
+ return raf;
+}
+
+V1_0::PreferredNetworkType getNetworkTypeFromRaf(hidl_bitfield<V1_4::RadioAccessFamily> raf) {
+ raf = getAdjustedRaf(raf);
+ switch (raf) {
+ case RAF::GSM | RAF::WCDMA:
+ return V1_0::PreferredNetworkType::GSM_WCDMA_AUTO;
+ case RAF::GSM:
+ return V1_0::PreferredNetworkType::GSM_ONLY;
+ case RAF::WCDMA:
+ return V1_0::PreferredNetworkType::WCDMA;
+ case (RAF::CDMA | RAF::EVDO):
+ return V1_0::PreferredNetworkType::CDMA_EVDO_AUTO;
+ case (RAF::LTE | RAF::CDMA | RAF::EVDO):
+ return V1_0::PreferredNetworkType::LTE_CDMA_EVDO;
+ case (RAF::LTE | RAF::GSM | RAF::WCDMA):
+ return V1_0::PreferredNetworkType::LTE_GSM_WCDMA;
+ case (RAF::LTE | RAF::CDMA | RAF::EVDO | RAF::GSM | RAF::WCDMA):
+ return V1_0::PreferredNetworkType::LTE_CMDA_EVDO_GSM_WCDMA; // CDMA typo
+ case RAF::LTE:
+ return V1_0::PreferredNetworkType::LTE_ONLY;
+ case (RAF::LTE | RAF::WCDMA):
+ return V1_0::PreferredNetworkType::LTE_WCDMA;
+ case RAF::CDMA:
+ return V1_0::PreferredNetworkType::CDMA_ONLY;
+ case RAF::EVDO:
+ return V1_0::PreferredNetworkType::EVDO_ONLY;
+ case (RAF::GSM | RAF::WCDMA | RAF::CDMA | RAF::EVDO):
+ return V1_0::PreferredNetworkType::GSM_WCDMA_CDMA_EVDO_AUTO;
+ case static_cast<int>(RAF::E::TD_SCDMA):
+ return V1_0::PreferredNetworkType::TD_SCDMA_ONLY;
+ case (RAF::E::TD_SCDMA | RAF::WCDMA):
+ return V1_0::PreferredNetworkType::TD_SCDMA_WCDMA;
+ case (RAF::LTE | RAF::E::TD_SCDMA):
+ return V1_0::PreferredNetworkType::TD_SCDMA_LTE;
+ case (RAF::E::TD_SCDMA | RAF::GSM):
+ return V1_0::PreferredNetworkType::TD_SCDMA_GSM;
+ case (RAF::LTE | RAF::E::TD_SCDMA | RAF::GSM):
+ return V1_0::PreferredNetworkType::TD_SCDMA_GSM_LTE;
+ case (RAF::E::TD_SCDMA | RAF::GSM | RAF::WCDMA):
+ return V1_0::PreferredNetworkType::TD_SCDMA_GSM_WCDMA;
+ case (RAF::LTE | RAF::E::TD_SCDMA | RAF::WCDMA):
+ return V1_0::PreferredNetworkType::TD_SCDMA_WCDMA_LTE;
+ case (RAF::LTE | RAF::E::TD_SCDMA | RAF::GSM | RAF::WCDMA):
+ return V1_0::PreferredNetworkType::TD_SCDMA_GSM_WCDMA_LTE;
+ case (RAF::E::TD_SCDMA | RAF::CDMA | RAF::EVDO | RAF::GSM | RAF::WCDMA):
+ return V1_0::PreferredNetworkType::TD_SCDMA_GSM_WCDMA_CDMA_EVDO_AUTO;
+ case (RAF::LTE | RAF::E::TD_SCDMA | RAF::CDMA | RAF::EVDO | RAF::GSM | RAF::WCDMA):
+ return V1_0::PreferredNetworkType::TD_SCDMA_LTE_CDMA_EVDO_GSM_WCDMA;
+ case static_cast<int>(RAF::NR):
+ return V1_0::PreferredNetworkType(23); // NR_ONLY
+ case (RAF::NR | RAF::LTE):
+ return V1_0::PreferredNetworkType(24); // NR_LTE
+ case (RAF::NR | RAF::LTE | RAF::CDMA | RAF::EVDO):
+ return V1_0::PreferredNetworkType(25); // NR_LTE_CDMA_EVDO
+ case (RAF::NR | RAF::LTE | RAF::GSM | RAF::WCDMA):
+ return V1_0::PreferredNetworkType(26); // NR_LTE_GSM_WCDMA
+ case (RAF::NR | RAF::LTE | RAF::CDMA | RAF::EVDO | RAF::GSM | RAF::WCDMA):
+ return V1_0::PreferredNetworkType(27); // NR_LTE_CDMA_EVDO_GSM_WCDMA
+ case (RAF::NR | RAF::LTE | RAF::WCDMA):
+ return V1_0::PreferredNetworkType(28); // NR_LTE_WCDMA
+ case (RAF::NR | RAF::LTE | RAF::E::TD_SCDMA):
+ return V1_0::PreferredNetworkType(29); // NR_LTE_TDSCDMA
+ case (RAF::NR | RAF::LTE | RAF::E::TD_SCDMA | RAF::GSM):
+ return V1_0::PreferredNetworkType(30); // NR_LTE_TDSCDMA_GSM
+ case (RAF::NR | RAF::LTE | RAF::E::TD_SCDMA | RAF::WCDMA):
+ return V1_0::PreferredNetworkType(31); // NR_LTE_TDSCDMA_WCDMA
+ case (RAF::NR | RAF::LTE | RAF::E::TD_SCDMA | RAF::GSM | RAF::WCDMA):
+ return V1_0::PreferredNetworkType(32); // NR_LTE_TDSCDMA_GSM_WCDMA
+ case (RAF::NR | RAF::LTE | RAF::E::TD_SCDMA | RAF::CDMA | RAF::EVDO | RAF::GSM |
+ RAF::WCDMA):
+ return V1_0::PreferredNetworkType(33); // NR_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA
+ default:
+ return V1_0::PreferredNetworkType::WCDMA;
+ }
+}
+
+hidl_bitfield<V1_4::RadioAccessFamily> getRafFromNetworkType(V1_0::PreferredNetworkType type) {
+ switch (type) {
+ case V1_0::PreferredNetworkType::GSM_WCDMA_AUTO:
+ return RAF::GSM | RAF::WCDMA;
+ case V1_0::PreferredNetworkType::GSM_ONLY:
+ return RAF::GSM;
+ case V1_0::PreferredNetworkType::WCDMA:
+ return RAF::WCDMA;
+ case V1_0::PreferredNetworkType::CDMA_EVDO_AUTO:
+ return (RAF::CDMA | RAF::EVDO);
+ case V1_0::PreferredNetworkType::LTE_CDMA_EVDO:
+ return (RAF::LTE | RAF::CDMA | RAF::EVDO);
+ case V1_0::PreferredNetworkType::LTE_GSM_WCDMA:
+ return (RAF::LTE | RAF::GSM | RAF::WCDMA);
+ case V1_0::PreferredNetworkType::LTE_CMDA_EVDO_GSM_WCDMA:
+ return (RAF::LTE | RAF::CDMA | RAF::EVDO | RAF::GSM | RAF::WCDMA);
+ case V1_0::PreferredNetworkType::LTE_ONLY:
+ return RAF::LTE;
+ case V1_0::PreferredNetworkType::LTE_WCDMA:
+ return (RAF::LTE | RAF::WCDMA);
+ case V1_0::PreferredNetworkType::CDMA_ONLY:
+ return RAF::CDMA;
+ case V1_0::PreferredNetworkType::EVDO_ONLY:
+ return RAF::EVDO;
+ case V1_0::PreferredNetworkType::GSM_WCDMA_CDMA_EVDO_AUTO:
+ return (RAF::GSM | RAF::WCDMA | RAF::CDMA | RAF::EVDO);
+ case V1_0::PreferredNetworkType::TD_SCDMA_ONLY:
+ return static_cast<int>(RAF::E::TD_SCDMA);
+ case V1_0::PreferredNetworkType::TD_SCDMA_WCDMA:
+ return (RAF::E::TD_SCDMA | RAF::WCDMA);
+ case V1_0::PreferredNetworkType::TD_SCDMA_LTE:
+ return (RAF::LTE | RAF::E::TD_SCDMA);
+ case V1_0::PreferredNetworkType::TD_SCDMA_GSM:
+ return (RAF::E::TD_SCDMA | RAF::GSM);
+ case V1_0::PreferredNetworkType::TD_SCDMA_GSM_LTE:
+ return (RAF::LTE | RAF::E::TD_SCDMA | RAF::GSM);
+ case V1_0::PreferredNetworkType::TD_SCDMA_GSM_WCDMA:
+ return (RAF::E::TD_SCDMA | RAF::GSM | RAF::WCDMA);
+ case V1_0::PreferredNetworkType::TD_SCDMA_WCDMA_LTE:
+ return (RAF::LTE | RAF::E::TD_SCDMA | RAF::WCDMA);
+ case V1_0::PreferredNetworkType::TD_SCDMA_GSM_WCDMA_LTE:
+ return (RAF::LTE | RAF::E::TD_SCDMA | RAF::GSM | RAF::WCDMA);
+ case V1_0::PreferredNetworkType::TD_SCDMA_GSM_WCDMA_CDMA_EVDO_AUTO:
+ return (RAF::E::TD_SCDMA | RAF::CDMA | RAF::EVDO | RAF::GSM | RAF::WCDMA);
+ case V1_0::PreferredNetworkType::TD_SCDMA_LTE_CDMA_EVDO_GSM_WCDMA:
+ return (RAF::LTE | RAF::E::TD_SCDMA | RAF::CDMA | RAF::EVDO | RAF::GSM | RAF::WCDMA);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wswitch"
+ case V1_0::PreferredNetworkType(23): // NR_ONLY
+ return static_cast<int>(RAF::NR);
+ case V1_0::PreferredNetworkType(24): // NR_LTE
+ return (RAF::NR | RAF::LTE);
+ case V1_0::PreferredNetworkType(25): // NR_LTE_CDMA_EVDO
+ return (RAF::NR | RAF::LTE | RAF::CDMA | RAF::EVDO);
+ case V1_0::PreferredNetworkType(26): // NR_LTE_GSM_WCDMA
+ return (RAF::NR | RAF::LTE | RAF::GSM | RAF::WCDMA);
+ case V1_0::PreferredNetworkType(27): // NR_LTE_CDMA_EVDO_GSM_WCDMA
+ return (RAF::NR | RAF::LTE | RAF::CDMA | RAF::EVDO | RAF::GSM | RAF::WCDMA);
+ case V1_0::PreferredNetworkType(28): // NR_LTE_WCDMA
+ return (RAF::NR | RAF::LTE | RAF::WCDMA);
+ case V1_0::PreferredNetworkType(29): // NR_LTE_TDSCDMA
+ return (RAF::NR | RAF::LTE | RAF::E::TD_SCDMA);
+ case V1_0::PreferredNetworkType(30): // NR_LTE_TDSCDMA_GSM
+ return (RAF::NR | RAF::LTE | RAF::E::TD_SCDMA | RAF::GSM);
+ case V1_0::PreferredNetworkType(31): // NR_LTE_TDSCDMA_WCDMA
+ return (RAF::NR | RAF::LTE | RAF::E::TD_SCDMA | RAF::WCDMA);
+ case V1_0::PreferredNetworkType(32): // NR_LTE_TDSCDMA_GSM_WCDMA
+ return (RAF::NR | RAF::LTE | RAF::E::TD_SCDMA | RAF::GSM | RAF::WCDMA);
+ case V1_0::PreferredNetworkType(33): // NR_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA
+ return (RAF::NR | RAF::LTE | RAF::E::TD_SCDMA | RAF::CDMA | RAF::EVDO | RAF::GSM |
+ RAF::WCDMA);
+#pragma GCC diagnostic pop
+ default:
+ return {}; // unknown
+ }
+}
+
+} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/libradiocompat/network/utils.h b/radio/aidl/compat/libradiocompat/network/utils.h
new file mode 100644
index 0000000..10714be
--- /dev/null
+++ b/radio/aidl/compat/libradiocompat/network/utils.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <android/hardware/radio/1.4/types.h>
+
+namespace android::hardware::radio::compat {
+
+V1_0::PreferredNetworkType getNetworkTypeFromRaf(hidl_bitfield<V1_4::RadioAccessFamily> raf);
+hidl_bitfield<V1_4::RadioAccessFamily> getRafFromNetworkType(V1_0::PreferredNetworkType type);
+
+} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/service/Android.bp b/radio/aidl/compat/service/Android.bp
index e97e2db..3c543f7 100644
--- a/radio/aidl/compat/service/Android.bp
+++ b/radio/aidl/compat/service/Android.bp
@@ -41,6 +41,7 @@
"android.hardware.radio.config@1.3",
"android.hardware.radio.data-V1-ndk",
"android.hardware.radio.messaging-V1-ndk",
+ "android.hardware.radio.network-V1-ndk",
"android.hardware.radio.sim-V1-ndk",
"android.hardware.radio@1.0",
"android.hardware.radio@1.1",
diff --git a/radio/aidl/compat/service/radio-compat.xml b/radio/aidl/compat/service/radio-compat.xml
index ac812fb..e035cac 100644
--- a/radio/aidl/compat/service/radio-compat.xml
+++ b/radio/aidl/compat/service/radio-compat.xml
@@ -18,6 +18,10 @@
<fqname>IRadioMessaging/slot1</fqname>
</hal>
<hal format="aidl">
+ <name>android.hardware.radio.network</name>
+ <fqname>IRadioNetwork/slot1</fqname>
+ </hal>
+ <hal format="aidl">
<name>android.hardware.radio.sim</name>
<fqname>IRadioSim/slot1</fqname>
</hal>
diff --git a/radio/aidl/compat/service/service.cpp b/radio/aidl/compat/service/service.cpp
index c97b47a..82d234f 100644
--- a/radio/aidl/compat/service/service.cpp
+++ b/radio/aidl/compat/service/service.cpp
@@ -23,6 +23,7 @@
#include <libradiocompat/RadioData.h>
#include <libradiocompat/RadioIndication.h>
#include <libradiocompat/RadioMessaging.h>
+#include <libradiocompat/RadioNetwork.h>
#include <libradiocompat/RadioResponse.h>
#include <libradiocompat/RadioSim.h>
@@ -60,6 +61,7 @@
publishRadioHal<compat::RadioData>(radioHidl, responseCb, indicationCb, slot);
publishRadioHal<compat::RadioMessaging>(radioHidl, responseCb, indicationCb, slot);
+ publishRadioHal<compat::RadioNetwork>(radioHidl, responseCb, indicationCb, slot);
publishRadioHal<compat::RadioSim>(radioHidl, responseCb, indicationCb, slot);
}