Migration of IRadio 1.3 types to 1.4.

To better test CBRS, we want IRadio 1.3 to be Android P plus CBRS
HAL interfaces, while 1.4 will be 1.3 plus all other Android Q
interfaces. So we are moving everything currently defined in
android.hardware.radio.V1_3 to android.hardware.radio.V1_4.

Bug: 117805040
Test: build and telephony unittest
Change-Id: Ifa3d302a4fd64ec244cee2a0eccb3f55622d5532
Merged-In: Ifa3d302a4fd64ec244cee2a0eccb3f55622d5532
diff --git a/Android.bp b/Android.bp
index 4efe367..f082190 100644
--- a/Android.bp
+++ b/Android.bp
@@ -51,6 +51,7 @@
         "android.hardware.radio-V1.1-java",
         "android.hardware.radio-V1.2-java",
         "android.hardware.radio-V1.3-java",
+        "android.hardware.radio-V1.4-java",
         "android.hardware.radio.config-V1.0-java",
         "android.hardware.radio.config-V1.1-java",
         "android.hardware.radio.deprecated-V1.0-java",
diff --git a/src/java/com/android/internal/telephony/CellularNetworkService.java b/src/java/com/android/internal/telephony/CellularNetworkService.java
index d259285..194ea8e 100644
--- a/src/java/com/android/internal/telephony/CellularNetworkService.java
+++ b/src/java/com/android/internal/telephony/CellularNetworkService.java
@@ -294,9 +294,9 @@
                         accessNetworkTechnology, reasonForDenial, emergencyOnly, availableServices,
                         cellIdentity, maxDataCalls, false /* isDcNrRestricted */,
                         false /* isNrAvailable */);
-            } else if (result instanceof android.hardware.radio.V1_3.DataRegStateResult) {
-                android.hardware.radio.V1_3.DataRegStateResult dataRegState =
-                        (android.hardware.radio.V1_3.DataRegStateResult) result;
+            } else if (result instanceof android.hardware.radio.V1_4.DataRegStateResult) {
+                android.hardware.radio.V1_4.DataRegStateResult dataRegState =
+                        (android.hardware.radio.V1_4.DataRegStateResult) result;
                 int regState = getRegStateFromHalRegState(dataRegState.base.regState);
                 int accessNetworkTechnology = getAccessNetworkTechnologyFromRat(
                         dataRegState.base.rat);
diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java
index cb5a70c..9181e98 100644
--- a/src/java/com/android/internal/telephony/RIL.java
+++ b/src/java/com/android/internal/telephony/RIL.java
@@ -165,6 +165,8 @@
 
     private static final HalVersion RADIO_HAL_VERSION_1_3 = new HalVersion(1, 3);
 
+    private static final HalVersion RADIO_HAL_VERSION_1_4 = new HalVersion(1, 4);
+
     // IRadio version
     private HalVersion mRadioVersion = RADIO_HAL_VERSION_UNKNOWN;
 
@@ -401,14 +403,23 @@
                         + " is disabled");
             } else {
                 try {
-                    mRadioProxy = android.hardware.radio.V1_3.IRadio.getService(
+                    mRadioProxy = android.hardware.radio.V1_4.IRadio.getService(
                             HIDL_SERVICE_NAME[mPhoneId], true);
-                    mRadioVersion = RADIO_HAL_VERSION_1_3;
+                    mRadioVersion = RADIO_HAL_VERSION_1_4;
                 } catch (NoSuchElementException e) {
                 }
 
                 if (mRadioProxy == null) {
                     try {
+                        mRadioProxy = android.hardware.radio.V1_3.IRadio.getService(
+                                HIDL_SERVICE_NAME[mPhoneId], true);
+                        mRadioVersion = RADIO_HAL_VERSION_1_3;
+                    } catch (NoSuchElementException e) {
+                    }
+                }
+
+                if (mRadioProxy == null) {
+                    try {
                         mRadioProxy = android.hardware.radio.V1_2.IRadio.getService(
                                 HIDL_SERVICE_NAME[mPhoneId], true);
                         mRadioVersion = RADIO_HAL_VERSION_1_2;
@@ -1235,14 +1246,14 @@
     }
 
     /**
-     * Convert to DataProfileInfo defined in radio/1.3/types.hal
+     * Convert to DataProfileInfo defined in radio/1.4/types.hal
      * @param dp Data profile
      * @return A converted data profile
      */
-    private static android.hardware.radio.V1_3.DataProfileInfo convertToHalDataProfile13(
+    private static android.hardware.radio.V1_4.DataProfileInfo convertToHalDataProfile14(
             DataProfile dp) {
-        android.hardware.radio.V1_3.DataProfileInfo dpi =
-                new android.hardware.radio.V1_3.DataProfileInfo();
+        android.hardware.radio.V1_4.DataProfileInfo dpi =
+                new android.hardware.radio.V1_4.DataProfileInfo();
 
         dpi.apn = dp.getApn();
         dpi.protocol = dp.getProtocol();
@@ -1311,14 +1322,14 @@
             }
 
             try {
-                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_3)) {
-                    // IRadio V1.3
-                    android.hardware.radio.V1_3.IRadio radioProxy13 =
-                            (android.hardware.radio.V1_3.IRadio) radioProxy;
+                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_4)) {
+                    // IRadio V1.4
+                    android.hardware.radio.V1_4.IRadio radioProxy14 =
+                            (android.hardware.radio.V1_4.IRadio) radioProxy;
 
                     // Convert to HAL data profile
-                    android.hardware.radio.V1_3.DataProfileInfo dpi =
-                            convertToHalDataProfile13(dataProfile);
+                    android.hardware.radio.V1_4.DataProfileInfo dpi =
+                            convertToHalDataProfile14(dataProfile);
 
                     if (RILJ_LOGD) {
                         riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)
@@ -1327,10 +1338,10 @@
                                 + ",addresses=" + addresses + ",dnses=" + dnses);
                     }
 
-                    radioProxy13.setupDataCall_1_3(rr.mSerial, accessNetworkType, dpi, allowRoaming,
+                    radioProxy14.setupDataCall_1_4(rr.mSerial, accessNetworkType, dpi, allowRoaming,
                             reason, addresses, dnses);
                 } else if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_2)) {
-                    // IRadio V1.2
+                    // IRadio V1.2 and IRadio V1.3
                     android.hardware.radio.V1_2.IRadio radioProxy12 =
                             (android.hardware.radio.V1_2.IRadio) radioProxy;
 
@@ -3144,14 +3155,14 @@
             }
 
             try {
-                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_3)) {
-                    // v1.3
-                    android.hardware.radio.V1_3.IRadio radioProxy13 =
-                            (android.hardware.radio.V1_3.IRadio) radioProxy;
-                    radioProxy13.setInitialAttachApn_1_3(rr.mSerial,
-                            convertToHalDataProfile13(dataProfile));
+                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_4)) {
+                    // v1.4
+                    android.hardware.radio.V1_4.IRadio radioProxy14 =
+                            (android.hardware.radio.V1_4.IRadio) radioProxy;
+                    radioProxy14.setInitialAttachApn_1_4(rr.mSerial,
+                            convertToHalDataProfile14(dataProfile));
                 } else {
-                    // v1.2, v1.1, and v1.0
+                    // v1.3, v1.2, v1.1, and v1.0
                     radioProxy.setInitialAttachApn(rr.mSerial,
                             convertToHalDataProfile10(dataProfile), dataProfile.isPersistent(),
                             isRoaming);
@@ -3544,17 +3555,17 @@
 
             RILRequest rr = null;
             try {
-                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_3)) {
-                    // V1.3
-                    android.hardware.radio.V1_3.IRadio radioProxy13 =
-                            (android.hardware.radio.V1_3.IRadio) radioProxy;
+                if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_4)) {
+                    // V1.4
+                    android.hardware.radio.V1_4.IRadio radioProxy14 =
+                            (android.hardware.radio.V1_4.IRadio) radioProxy;
 
                     rr = obtainRequest(RIL_REQUEST_SET_DATA_PROFILE, result,
                             mRILDefaultWorkSource);
 
-                    ArrayList<android.hardware.radio.V1_3.DataProfileInfo> dpis = new ArrayList<>();
+                    ArrayList<android.hardware.radio.V1_4.DataProfileInfo> dpis = new ArrayList<>();
                     for (DataProfile dp : dps) {
-                        dpis.add(convertToHalDataProfile13(dp));
+                        dpis.add(convertToHalDataProfile14(dp));
                     }
 
                     if (RILJ_LOGD) {
@@ -3565,9 +3576,9 @@
                         }
                     }
 
-                    radioProxy13.setDataProfile_1_3(rr.mSerial, dpis);
+                    radioProxy14.setDataProfile_1_4(rr.mSerial, dpis);
                 } else {
-                    // V1.0, 1.1, and 1.2
+                    // V1.0, 1.1, 1,2 and 1.3
                     ArrayList<android.hardware.radio.V1_0.DataProfileInfo> dpis = new ArrayList<>();
                     for (DataProfile dp : dps) {
                         // For v1.0 to v1.2, we only send data profiles that has the persistent
@@ -5806,10 +5817,10 @@
                 TransportManager.IWLAN_OPERATION_MODE_DEFAULT);
 
         // If the operation mode is default, then we use the HAL version to determine it.
-        // On 1.3 or later version of IRadio, it is expected the device to support
+        // On 1.4 or later version of IRadio, it is expected the device to support
         // IWLAN AP-assisted mode.
         if (mode == TransportManager.IWLAN_OPERATION_MODE_DEFAULT) {
-            if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_3)) {
+            if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_4)) {
                 return TransportManager.IWLAN_OPERATION_MODE_AP_ASSISTED;
             } else {
                 return TransportManager.IWLAN_OPERATION_MODE_LEGACY;
diff --git a/src/java/com/android/internal/telephony/RadioResponse.java b/src/java/com/android/internal/telephony/RadioResponse.java
index 5b0932d..af6dcc3 100644
--- a/src/java/com/android/internal/telephony/RadioResponse.java
+++ b/src/java/com/android/internal/telephony/RadioResponse.java
@@ -113,11 +113,11 @@
 
     /**
      * @param responseInfo Response info struct containing response type, serial no. and error
-     * @param cardStatus ICC card status as defined by CardStatus in 1.3/types.hal
+     * @param cardStatus ICC card status as defined by CardStatus in 1.4/types.hal
      */
-    public void getIccCardStatusResponse_1_3(RadioResponseInfo responseInfo,
-                                             android.hardware.radio.V1_3.CardStatus cardStatus) {
-        responseIccCardStatus_1_3(responseInfo, cardStatus);
+    public void getIccCardStatusResponse_1_4(RadioResponseInfo responseInfo,
+                                             android.hardware.radio.V1_4.CardStatus cardStatus) {
+        responseIccCardStatus_1_4(responseInfo, cardStatus);
     }
 
     /**
@@ -1450,8 +1450,8 @@
         }
     }
 
-    private void responseIccCardStatus_1_3(RadioResponseInfo responseInfo,
-                                           android.hardware.radio.V1_3.CardStatus cardStatus) {
+    private void responseIccCardStatus_1_4(RadioResponseInfo responseInfo,
+                                           android.hardware.radio.V1_4.CardStatus cardStatus) {
         RILRequest rr = mRil.processResponse(responseInfo);
 
         if (rr != null) {