Convert hidl_bitfield and bitfield to int

The previous API surface replaced bitfields of enums with the enum,
which only allows one value at a time. Instead of using the enum,
replace with int instead.

Test: build
Bug: 210712359
Change-Id: I2963200311494718ae89af8deade0b1dd41354f8
diff --git a/radio/aidl/vts/radio_data_test.cpp b/radio/aidl/vts/radio_data_test.cpp
index dbf0eb7..87521cc 100644
--- a/radio/aidl/vts/radio_data_test.cpp
+++ b/radio/aidl/vts/radio_data_test.cpp
@@ -14,10 +14,11 @@
  * limitations under the License.
  */
 
+#include <aidl/android/hardware/radio/RadioAccessFamily.h>
 #include <aidl/android/hardware/radio/config/IRadioConfig.h>
+#include <aidl/android/hardware/radio/data/ApnTypes.h>
 #include <android-base/logging.h>
 #include <android/binder_manager.h>
-#include <algorithm>
 
 #include "radio_data_utils.h"
 
@@ -82,10 +83,18 @@
     dataProfileInfo.maxConns = 20;
     dataProfileInfo.waitTime = 0;
     dataProfileInfo.enabled = true;
-    // TODO(b/210712359): 320 was the previous value; need to support bitmaps
-    dataProfileInfo.supportedApnTypesBitmap = ApnTypes::DEFAULT;
-    // TODO(b/210712359): 161543 was the previous value; need to support bitmaps
-    dataProfileInfo.bearerBitmap = RadioAccessFamily::LTE;
+    dataProfileInfo.supportedApnTypesBitmap =
+            static_cast<int32_t>(ApnTypes::IMS) | static_cast<int32_t>(ApnTypes::IA);
+    dataProfileInfo.bearerBitmap = static_cast<int32_t>(RadioAccessFamily::GPRS) |
+                                   static_cast<int32_t>(RadioAccessFamily::EDGE) |
+                                   static_cast<int32_t>(RadioAccessFamily::UMTS) |
+                                   static_cast<int32_t>(RadioAccessFamily::HSDPA) |
+                                   static_cast<int32_t>(RadioAccessFamily::HSUPA) |
+                                   static_cast<int32_t>(RadioAccessFamily::HSPA) |
+                                   static_cast<int32_t>(RadioAccessFamily::EHRPD) |
+                                   static_cast<int32_t>(RadioAccessFamily::LTE) |
+                                   static_cast<int32_t>(RadioAccessFamily::HSPAP) |
+                                   static_cast<int32_t>(RadioAccessFamily::IWLAN);
     dataProfileInfo.mtuV4 = 0;
     dataProfileInfo.mtuV6 = 0;
     dataProfileInfo.preferred = true;
@@ -130,11 +139,8 @@
     TrafficDescriptor trafficDescriptor;
     OsAppId osAppId;
     std::string osAppIdString("osAppId");
-    // TODO(b/210712359): there should be a cleaner way to convert this
-    std::vector<unsigned char> output(osAppIdString.length());
-    std::transform(osAppIdString.begin(), osAppIdString.end(), output.begin(),
-                   [](char c) { return static_cast<unsigned char>(c); });
-    osAppId.osAppId = output;
+    std::vector<unsigned char> osAppIdVec(osAppIdString.begin(), osAppIdString.end());
+    osAppId.osAppId = osAppIdVec;
     trafficDescriptor.osAppId = osAppId;
 
     DataProfileInfo dataProfileInfo;
@@ -151,10 +157,18 @@
     dataProfileInfo.maxConns = 20;
     dataProfileInfo.waitTime = 0;
     dataProfileInfo.enabled = true;
-    // TODO(b/210712359): 320 was the previous value; need to support bitmaps
-    dataProfileInfo.supportedApnTypesBitmap = ApnTypes::DEFAULT;
-    // TODO(b/210712359): 161543 was the previous value; need to support bitmaps
-    dataProfileInfo.bearerBitmap = RadioAccessFamily::LTE;
+    dataProfileInfo.supportedApnTypesBitmap =
+            static_cast<int32_t>(ApnTypes::IMS) | static_cast<int32_t>(ApnTypes::IA);
+    dataProfileInfo.bearerBitmap = static_cast<int32_t>(RadioAccessFamily::GPRS) |
+                                   static_cast<int32_t>(RadioAccessFamily::EDGE) |
+                                   static_cast<int32_t>(RadioAccessFamily::UMTS) |
+                                   static_cast<int32_t>(RadioAccessFamily::HSDPA) |
+                                   static_cast<int32_t>(RadioAccessFamily::HSUPA) |
+                                   static_cast<int32_t>(RadioAccessFamily::HSPA) |
+                                   static_cast<int32_t>(RadioAccessFamily::EHRPD) |
+                                   static_cast<int32_t>(RadioAccessFamily::LTE) |
+                                   static_cast<int32_t>(RadioAccessFamily::HSPAP) |
+                                   static_cast<int32_t>(RadioAccessFamily::IWLAN);
     dataProfileInfo.mtuV4 = 0;
     dataProfileInfo.mtuV6 = 0;
     dataProfileInfo.preferred = true;
diff --git a/radio/aidl/vts/radio_network_indication.cpp b/radio/aidl/vts/radio_network_indication.cpp
index 7bed759..03caf3b 100644
--- a/radio/aidl/vts/radio_network_indication.cpp
+++ b/radio/aidl/vts/radio_network_indication.cpp
@@ -72,7 +72,7 @@
 ndk::ScopedAStatus RadioNetworkIndication::registrationFailed(RadioIndicationType /*type*/,
                                                               const CellIdentity& /*cellIdentity*/,
                                                               const std::string& /*chosenPlmn*/,
-                                                              Domain /*domain*/,
+                                                              int32_t /*domain*/,
                                                               int32_t /*causeCode*/,
                                                               int32_t /*additionalCauseCode*/) {
     return ndk::ScopedAStatus::ok();
diff --git a/radio/aidl/vts/radio_network_response.cpp b/radio/aidl/vts/radio_network_response.cpp
index b242341..dc40e6f 100644
--- a/radio/aidl/vts/radio_network_response.cpp
+++ b/radio/aidl/vts/radio_network_response.cpp
@@ -23,7 +23,7 @@
 }
 
 ndk::ScopedAStatus RadioNetworkResponse::getAllowedNetworkTypesBitmapResponse(
-        const RadioResponseInfo& info, const RadioAccessFamily networkTypeBitmap) {
+        const RadioResponseInfo& info, const int32_t networkTypeBitmap) {
     rspInfo = info;
     networkTypeBitmapResponse = networkTypeBitmap;
     parent_network.notify(info.serial);
diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp
index 1cdbb6d..08af636 100644
--- a/radio/aidl/vts/radio_network_test.cpp
+++ b/radio/aidl/vts/radio_network_test.cpp
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 
+#include <aidl/android/hardware/radio/RadioAccessFamily.h>
 #include <aidl/android/hardware/radio/config/IRadioConfig.h>
 #include <android-base/logging.h>
 #include <android/binder_manager.h>
@@ -57,7 +58,7 @@
  */
 TEST_P(RadioNetworkTest, setAllowedNetworkTypesBitmap) {
     serial = GetRandomSerialNumber();
-    RadioAccessFamily allowedNetworkTypesBitmap = RadioAccessFamily::LTE;
+    int32_t allowedNetworkTypesBitmap = static_cast<int32_t>(RadioAccessFamily::LTE);
 
     radio_network->setAllowedNetworkTypesBitmap(serial, allowedNetworkTypesBitmap);
 
@@ -77,7 +78,7 @@
  */
 TEST_P(RadioNetworkTest, getAllowedNetworkTypesBitmap) {
     serial = GetRandomSerialNumber();
-    RadioAccessFamily allowedNetworkTypesBitmap = RadioAccessFamily::LTE;
+    int32_t allowedNetworkTypesBitmap = static_cast<int32_t>(RadioAccessFamily::LTE);
 
     radio_network->setAllowedNetworkTypesBitmap(serial, allowedNetworkTypesBitmap);
 
diff --git a/radio/aidl/vts/radio_network_utils.h b/radio/aidl/vts/radio_network_utils.h
index caa1ecc..7936721 100644
--- a/radio/aidl/vts/radio_network_utils.h
+++ b/radio/aidl/vts/radio_network_utils.h
@@ -39,7 +39,7 @@
     std::vector<RadioBandMode> radioBandModes;
     std::vector<OperatorInfo> networkInfos;
     bool isNrDualConnectivityEnabled;
-    RadioAccessFamily networkTypeBitmapResponse;
+    int networkTypeBitmapResponse;
     RegStateResult regStateResp;
     CellIdentity barringCellIdentity;
     std::vector<BarringInfo> barringInfos;
@@ -48,7 +48,7 @@
     virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
 
     virtual ndk::ScopedAStatus getAllowedNetworkTypesBitmapResponse(
-            const RadioResponseInfo& info, const RadioAccessFamily networkTypeBitmap) override;
+            const RadioResponseInfo& info, const int32_t networkTypeBitmap) override;
 
     virtual ndk::ScopedAStatus getAvailableBandModesResponse(
             const RadioResponseInfo& info, const std::vector<RadioBandMode>& bandModes) override;
@@ -187,7 +187,7 @@
 
     virtual ndk::ScopedAStatus registrationFailed(RadioIndicationType type,
                                                   const CellIdentity& cellIdentity,
-                                                  const std::string& chosenPlmn, Domain domain,
+                                                  const std::string& chosenPlmn, int32_t domain,
                                                   int32_t causeCode,
                                                   int32_t additionalCauseCode) override;
 
diff --git a/radio/aidl/vts/radio_voice_test.cpp b/radio/aidl/vts/radio_voice_test.cpp
index 201f14c..7a0bedd 100644
--- a/radio/aidl/vts/radio_voice_test.cpp
+++ b/radio/aidl/vts/radio_voice_test.cpp
@@ -15,6 +15,7 @@
  */
 
 #include <aidl/android/hardware/radio/config/IRadioConfig.h>
+#include <aidl/android/hardware/radio/voice/EmergencyServiceCategory.h>
 #include <android-base/logging.h>
 #include <android/binder_manager.h>
 
@@ -95,7 +96,7 @@
 
     Dial dialInfo;
     dialInfo.address = std::string("911");
-    EmergencyServiceCategory categories = EmergencyServiceCategory::UNSPECIFIED;
+    int32_t categories = static_cast<int32_t>(EmergencyServiceCategory::UNSPECIFIED);
     std::vector<std::string> urns = {""};
     EmergencyCallRouting routing = EmergencyCallRouting::UNKNOWN;
 
@@ -152,7 +153,7 @@
 
     Dial dialInfo;
     dialInfo.address = std::string("911");
-    EmergencyServiceCategory categories = EmergencyServiceCategory::AMBULANCE;
+    int32_t categories = static_cast<int32_t>(EmergencyServiceCategory::AMBULANCE);
     std::vector<std::string> urns = {"urn:service:sos.ambulance"};
     EmergencyCallRouting routing = EmergencyCallRouting::UNKNOWN;
 
@@ -209,7 +210,7 @@
 
     Dial dialInfo;
     dialInfo.address = std::string("911");
-    EmergencyServiceCategory categories = EmergencyServiceCategory::UNSPECIFIED;
+    int32_t categories = static_cast<int32_t>(EmergencyServiceCategory::UNSPECIFIED);
     std::vector<std::string> urns = {""};
     EmergencyCallRouting routing = EmergencyCallRouting::EMERGENCY;