diff options
author | Sarah Chin <sarahchin@google.com> | 2023-02-05 14:48:01 -0800 |
---|---|---|
committer | Sarah Chin <sarahchin@google.com> | 2023-02-05 16:07:24 -0800 |
commit | b9e264533c7776c879421a2bf2675c8bb4307a1c (patch) | |
tree | 9f7961f43816d2cec2229f13fdf9c831dbc79e3e | |
parent | 8d36657af03b91933c34e9c85b283794b7c44d5b (diff) | |
download | telephony-b9e264533c7776c879421a2bf2675c8bb4307a1c.tar.gz |
Update IRadio module AIDL versions
Convert IRadioService#getInterfaceVersion into the corresponding
HalVersion for each service/module.
Test: atest RILTest, RILE2eTests
Bug: 267940733
Change-Id: I4c7c4bf5f2def3b148d85fb1367a5b1d6ba004bb
9 files changed, 75 insertions, 156 deletions
diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java index 1c5b82f929..e6546149b2 100644 --- a/src/java/com/android/internal/telephony/RIL.java +++ b/src/java/com/android/internal/telephony/RIL.java @@ -7216,6 +7216,19 @@ public class RIL extends BaseCommands implements CommandsInterface { return halVersion; } + /** + * Get the HAL version corresponding to the interface version of a IRadioService module. + * @param interfaceVersion The interface version, from IRadioService#getInterfaceVersion(). + * @return The corresponding HalVersion. + */ + public static HalVersion getServiceHalVersion(int interfaceVersion) { + switch (interfaceVersion) { + case 1: return RADIO_HAL_VERSION_2_0; + case 2: return RADIO_HAL_VERSION_2_1; + default: return RADIO_HAL_VERSION_UNKNOWN; + } + } + private static String serviceToString(@HalService int service) { switch (service) { case HAL_SERVICE_RADIO: diff --git a/src/java/com/android/internal/telephony/RadioDataProxy.java b/src/java/com/android/internal/telephony/RadioDataProxy.java index f1105458e1..9671077b0f 100644 --- a/src/java/com/android/internal/telephony/RadioDataProxy.java +++ b/src/java/com/android/internal/telephony/RadioDataProxy.java @@ -49,26 +49,15 @@ public class RadioDataProxy extends RadioServiceProxy { * @return updated HAL version */ public HalVersion setAidl(HalVersion halVersion, android.hardware.radio.data.IRadioData data) { - mHalVersion = halVersion; - mDataProxy = data; - mIsAidl = true; - + HalVersion version = halVersion; try { - HalVersion newHalVersion; - int version = data.getInterfaceVersion(); - switch(version) { - default: - newHalVersion = RIL.RADIO_HAL_VERSION_2_0; - break; - } - Rlog.d(TAG, "AIDL version=" + version + ", halVersion=" + newHalVersion); - - if (mHalVersion.less(newHalVersion)) { - mHalVersion = newHalVersion; - } + version = RIL.getServiceHalVersion(data.getInterfaceVersion()); } catch (RemoteException e) { Rlog.e(TAG, "setAidl: " + e); } + mHalVersion = version; + mDataProxy = data; + mIsAidl = true; Rlog.d(TAG, "AIDL initialized mHalVersion=" + mHalVersion); return mHalVersion; diff --git a/src/java/com/android/internal/telephony/RadioImsProxy.java b/src/java/com/android/internal/telephony/RadioImsProxy.java index 3ad1b946f2..cde2e06859 100644 --- a/src/java/com/android/internal/telephony/RadioImsProxy.java +++ b/src/java/com/android/internal/telephony/RadioImsProxy.java @@ -35,26 +35,15 @@ public class RadioImsProxy extends RadioServiceProxy { * @return updated HAL version. */ public HalVersion setAidl(HalVersion halVersion, android.hardware.radio.ims.IRadioIms ims) { - mHalVersion = halVersion; - mImsProxy = ims; - mIsAidl = true; - + HalVersion version = halVersion; try { - HalVersion newHalVersion; - int version = ims.getInterfaceVersion(); - switch(version) { - default: - newHalVersion = RIL.RADIO_HAL_VERSION_2_0; - break; - } - Rlog.d(TAG, "AIDL version=" + version + ", halVersion=" + newHalVersion); - - if (mHalVersion.less(newHalVersion)) { - mHalVersion = newHalVersion; - } + version = RIL.getServiceHalVersion(ims.getInterfaceVersion()); } catch (RemoteException e) { Rlog.e(TAG, "setAidl: " + e); } + mHalVersion = version; + mImsProxy = ims; + mIsAidl = true; Rlog.d(TAG, "AIDL initialized mHalVersion=" + mHalVersion); return mHalVersion; diff --git a/src/java/com/android/internal/telephony/RadioMessagingProxy.java b/src/java/com/android/internal/telephony/RadioMessagingProxy.java index 4e9bc8c073..69ccf3612a 100644 --- a/src/java/com/android/internal/telephony/RadioMessagingProxy.java +++ b/src/java/com/android/internal/telephony/RadioMessagingProxy.java @@ -41,26 +41,15 @@ public class RadioMessagingProxy extends RadioServiceProxy { */ public HalVersion setAidl(HalVersion halVersion, android.hardware.radio.messaging.IRadioMessaging messaging) { - mHalVersion = halVersion; - mMessagingProxy = messaging; - mIsAidl = true; - + HalVersion version = halVersion; try { - HalVersion newHalVersion; - int version = messaging.getInterfaceVersion(); - switch(version) { - default: - newHalVersion = RIL.RADIO_HAL_VERSION_2_0; - break; - } - Rlog.d(TAG, "AIDL version=" + version + ", halVersion=" + newHalVersion); - - if (mHalVersion.less(newHalVersion)) { - mHalVersion = newHalVersion; - } + version = RIL.getServiceHalVersion(messaging.getInterfaceVersion()); } catch (RemoteException e) { Rlog.e(TAG, "setAidl: " + e); } + mHalVersion = version; + mMessagingProxy = messaging; + mIsAidl = true; Rlog.d(TAG, "AIDL initialized mHalVersion=" + mHalVersion); return mHalVersion; diff --git a/src/java/com/android/internal/telephony/RadioModemProxy.java b/src/java/com/android/internal/telephony/RadioModemProxy.java index 26287510b7..4178293d06 100644 --- a/src/java/com/android/internal/telephony/RadioModemProxy.java +++ b/src/java/com/android/internal/telephony/RadioModemProxy.java @@ -36,26 +36,15 @@ public class RadioModemProxy extends RadioServiceProxy { */ public HalVersion setAidl(HalVersion halVersion, android.hardware.radio.modem.IRadioModem modem) { - mHalVersion = halVersion; - mModemProxy = modem; - mIsAidl = true; - + HalVersion version = halVersion; try { - HalVersion newHalVersion; - int version = modem.getInterfaceVersion(); - switch(version) { - default: - newHalVersion = RIL.RADIO_HAL_VERSION_2_0; - break; - } - Rlog.d(TAG, "AIDL version=" + version + ", halVersion=" + newHalVersion); - - if (mHalVersion.less(newHalVersion)) { - mHalVersion = newHalVersion; - } + version = RIL.getServiceHalVersion(modem.getInterfaceVersion()); } catch (RemoteException e) { Rlog.e(TAG, "setAidl: " + e); } + mHalVersion = version; + mModemProxy = modem; + mIsAidl = true; Rlog.d(TAG, "AIDL initialized mHalVersion=" + mHalVersion); return mHalVersion; diff --git a/src/java/com/android/internal/telephony/RadioNetworkProxy.java b/src/java/com/android/internal/telephony/RadioNetworkProxy.java index 4717ad60d0..246c2e0204 100644 --- a/src/java/com/android/internal/telephony/RadioNetworkProxy.java +++ b/src/java/com/android/internal/telephony/RadioNetworkProxy.java @@ -70,29 +70,15 @@ public class RadioNetworkProxy extends RadioServiceProxy { */ public HalVersion setAidl(HalVersion halVersion, android.hardware.radio.network.IRadioNetwork network) { - mHalVersion = halVersion; - mNetworkProxy = network; - mIsAidl = true; - + HalVersion version = halVersion; try { - HalVersion newHalVersion; - int version = network.getInterfaceVersion(); - switch(version) { - case 2: - newHalVersion = RIL.RADIO_HAL_VERSION_2_1; - break; - default: - newHalVersion = RIL.RADIO_HAL_VERSION_2_0; - break; - } - Rlog.d(TAG, "AIDL version=" + version + ", halVersion=" + newHalVersion); - - if (mHalVersion.less(newHalVersion)) { - mHalVersion = newHalVersion; - } + version = RIL.getServiceHalVersion(network.getInterfaceVersion()); } catch (RemoteException e) { Rlog.e(TAG, "setAidl: " + e); } + mHalVersion = version; + mNetworkProxy = network; + mIsAidl = true; Rlog.d(TAG, "AIDL initialized mHalVersion=" + mHalVersion); return mHalVersion; diff --git a/src/java/com/android/internal/telephony/RadioSatelliteProxy.java b/src/java/com/android/internal/telephony/RadioSatelliteProxy.java index 1530c1a2ca..6101f3fc6a 100644 --- a/src/java/com/android/internal/telephony/RadioSatelliteProxy.java +++ b/src/java/com/android/internal/telephony/RadioSatelliteProxy.java @@ -25,37 +25,26 @@ import android.telephony.Rlog; */ public class RadioSatelliteProxy extends RadioServiceProxy { private static final String TAG = "RadioSatelliteProxy"; - private volatile android.hardware.radio.satellite.IRadioSatellite mRadioSatelliteProxy = null; + private volatile android.hardware.radio.satellite.IRadioSatellite mSatelliteProxy = null; /** - * Sets IRadioSatellite as the AIDL implementation for RadioSatelliteProxy. + * Sets IRadioSatellite as the AIDL implementation for RadioServiceProxy. * @param halVersion Radio HAL version. - * @param radioSatellite IRadioSatellite implementation. + * @param satellite IRadioSatellite implementation. * * @return updated HAL version. */ public HalVersion setAidl(HalVersion halVersion, - android.hardware.radio.satellite.IRadioSatellite radioSatellite) { - mHalVersion = halVersion; - mRadioSatelliteProxy = radioSatellite; - mIsAidl = true; - + android.hardware.radio.satellite.IRadioSatellite satellite) { + HalVersion version = halVersion; try { - HalVersion newHalVersion; - int version = radioSatellite.getInterfaceVersion(); - switch(version) { - default: - newHalVersion = RIL.RADIO_HAL_VERSION_2_0; - break; - } - Rlog.d(TAG, "AIDL version=" + version + ", halVersion=" + newHalVersion); - - if (mHalVersion.less(newHalVersion)) { - mHalVersion = newHalVersion; - } + version = RIL.getServiceHalVersion(satellite.getInterfaceVersion()); } catch (RemoteException e) { Rlog.e(TAG, "setAidl: " + e); } + mHalVersion = version; + mSatelliteProxy = satellite; + mIsAidl = true; Rlog.d(TAG, "AIDL initialized mHalVersion=" + mHalVersion); return mHalVersion; @@ -66,7 +55,7 @@ public class RadioSatelliteProxy extends RadioServiceProxy { * @return IRadioSatellite implementation. */ public android.hardware.radio.satellite.IRadioSatellite getAidl() { - return mRadioSatelliteProxy; + return mSatelliteProxy; } /** @@ -75,7 +64,7 @@ public class RadioSatelliteProxy extends RadioServiceProxy { @Override public void clear() { super.clear(); - mRadioSatelliteProxy = null; + mSatelliteProxy = null; } /** @@ -84,7 +73,7 @@ public class RadioSatelliteProxy extends RadioServiceProxy { */ @Override public boolean isEmpty() { - return mRadioProxy == null && mRadioSatelliteProxy == null; + return mRadioProxy == null && mSatelliteProxy == null; } /** @@ -95,7 +84,7 @@ public class RadioSatelliteProxy extends RadioServiceProxy { public void responseAcknowledgement() throws RemoteException { if (isEmpty()) return; if (isAidl()) { - mRadioSatelliteProxy.responseAcknowledgement(); + mSatelliteProxy.responseAcknowledgement(); } } @@ -107,7 +96,7 @@ public class RadioSatelliteProxy extends RadioServiceProxy { public void getCapabilities(int serial) throws RemoteException { if (isEmpty()) return; if (isAidl()) { - mRadioSatelliteProxy.getCapabilities(serial); + mSatelliteProxy.getCapabilities(serial); } } @@ -121,7 +110,7 @@ public class RadioSatelliteProxy extends RadioServiceProxy { public void setPower(int serial, boolean on) throws RemoteException { if (isEmpty()) return; if (isAidl()) { - mRadioSatelliteProxy.setPower(serial, on); + mSatelliteProxy.setPower(serial, on); } } @@ -133,7 +122,7 @@ public class RadioSatelliteProxy extends RadioServiceProxy { public void getPowerState(int serial) throws RemoteException { if (isEmpty()) return; if (isAidl()) { - mRadioSatelliteProxy.getPowerState(serial); + mSatelliteProxy.getPowerState(serial); } } @@ -154,7 +143,7 @@ public class RadioSatelliteProxy extends RadioServiceProxy { int[] features) throws RemoteException { if (isEmpty()) return; if (isAidl()) { - mRadioSatelliteProxy.provisionService(serial, imei, msisdn, imsi, features); + mSatelliteProxy.provisionService(serial, imei, msisdn, imsi, features); } } @@ -167,7 +156,7 @@ public class RadioSatelliteProxy extends RadioServiceProxy { public void addAllowedSatelliteContacts(int serial, String[] contacts) throws RemoteException { if (isEmpty()) return; if (isAidl()) { - mRadioSatelliteProxy.addAllowedSatelliteContacts(serial, contacts); + mSatelliteProxy.addAllowedSatelliteContacts(serial, contacts); } } @@ -181,7 +170,7 @@ public class RadioSatelliteProxy extends RadioServiceProxy { throws RemoteException { if (isEmpty()) return; if (isAidl()) { - mRadioSatelliteProxy.removeAllowedSatelliteContacts(serial, contacts); + mSatelliteProxy.removeAllowedSatelliteContacts(serial, contacts); } } @@ -198,7 +187,7 @@ public class RadioSatelliteProxy extends RadioServiceProxy { double longitude) throws RemoteException { if (isEmpty()) return; if (isAidl()) { - mRadioSatelliteProxy.sendMessages(serial, messages, destination, latitude, longitude); + mSatelliteProxy.sendMessages(serial, messages, destination, latitude, longitude); } } @@ -210,7 +199,7 @@ public class RadioSatelliteProxy extends RadioServiceProxy { public void getPendingMessages(int serial) throws RemoteException { if (isEmpty()) return; if (isAidl()) { - mRadioSatelliteProxy.getPendingMessages(serial); + mSatelliteProxy.getPendingMessages(serial); } } @@ -222,7 +211,7 @@ public class RadioSatelliteProxy extends RadioServiceProxy { public void getSatelliteMode(int serial) throws RemoteException { if (isEmpty()) return; if (isAidl()) { - mRadioSatelliteProxy.getSatelliteMode(serial); + mSatelliteProxy.getSatelliteMode(serial); } } @@ -236,7 +225,7 @@ public class RadioSatelliteProxy extends RadioServiceProxy { public void setIndicationFilter(int serial, int filterBitmask) throws RemoteException { if (isEmpty()) return; if (isAidl()) { - mRadioSatelliteProxy.setIndicationFilter(serial, filterBitmask); + mSatelliteProxy.setIndicationFilter(serial, filterBitmask); } } @@ -248,7 +237,7 @@ public class RadioSatelliteProxy extends RadioServiceProxy { public void startSendingSatellitePointingInfo(int serial) throws RemoteException { if (isEmpty()) return; if (isAidl()) { - mRadioSatelliteProxy.startSendingSatellitePointingInfo(serial); + mSatelliteProxy.startSendingSatellitePointingInfo(serial); } } @@ -260,7 +249,7 @@ public class RadioSatelliteProxy extends RadioServiceProxy { public void stopSendingSatellitePointingInfo(int serial) throws RemoteException { if (isEmpty()) return; if (isAidl()) { - mRadioSatelliteProxy.stopSendingSatellitePointingInfo(serial); + mSatelliteProxy.stopSendingSatellitePointingInfo(serial); } } @@ -272,7 +261,7 @@ public class RadioSatelliteProxy extends RadioServiceProxy { public void getMaxCharactersPerTextMessage(int serial) throws RemoteException { if (isEmpty()) return; if (isAidl()) { - mRadioSatelliteProxy.getMaxCharactersPerTextMessage(serial); + mSatelliteProxy.getMaxCharactersPerTextMessage(serial); } } @@ -284,7 +273,7 @@ public class RadioSatelliteProxy extends RadioServiceProxy { public void getTimeForNextSatelliteVisibility(int serial) throws RemoteException { if (isEmpty()) return; if (isAidl()) { - mRadioSatelliteProxy.getTimeForNextSatelliteVisibility(serial); + mSatelliteProxy.getTimeForNextSatelliteVisibility(serial); } } } diff --git a/src/java/com/android/internal/telephony/RadioSimProxy.java b/src/java/com/android/internal/telephony/RadioSimProxy.java index a305de96af..d945ad3115 100644 --- a/src/java/com/android/internal/telephony/RadioSimProxy.java +++ b/src/java/com/android/internal/telephony/RadioSimProxy.java @@ -45,29 +45,15 @@ public class RadioSimProxy extends RadioServiceProxy { * @return updated HAL version */ public HalVersion setAidl(HalVersion halVersion, android.hardware.radio.sim.IRadioSim sim) { - mHalVersion = halVersion; - mSimProxy = sim; - mIsAidl = true; - + HalVersion version = halVersion; try { - HalVersion newHalVersion; - int version = sim.getInterfaceVersion(); - switch(version) { - case 2: - newHalVersion = RIL.RADIO_HAL_VERSION_2_1; - break; - default: - newHalVersion = RIL.RADIO_HAL_VERSION_2_0; - break; - } - Rlog.d(TAG, "AIDL version=" + version + ", halVersion=" + newHalVersion); - - if (mHalVersion.less(newHalVersion)) { - mHalVersion = newHalVersion; - } + version = RIL.getServiceHalVersion(sim.getInterfaceVersion()); } catch (RemoteException e) { Rlog.e(TAG, "setAidl: " + e); } + mHalVersion = version; + mSimProxy = sim; + mIsAidl = true; Rlog.d(TAG, "AIDL initialized mHalVersion=" + mHalVersion); return mHalVersion; diff --git a/src/java/com/android/internal/telephony/RadioVoiceProxy.java b/src/java/com/android/internal/telephony/RadioVoiceProxy.java index 07afaad30e..7f46424485 100644 --- a/src/java/com/android/internal/telephony/RadioVoiceProxy.java +++ b/src/java/com/android/internal/telephony/RadioVoiceProxy.java @@ -40,26 +40,15 @@ public class RadioVoiceProxy extends RadioServiceProxy { */ public HalVersion setAidl(HalVersion halVersion, android.hardware.radio.voice.IRadioVoice voice) { - mHalVersion = halVersion; - mVoiceProxy = voice; - mIsAidl = true; - + HalVersion version = halVersion; try { - HalVersion newHalVersion; - int version = voice.getInterfaceVersion(); - switch(version) { - default: - newHalVersion = RIL.RADIO_HAL_VERSION_2_0; - break; - } - Rlog.d(TAG, "AIDL version=" + version + ", halVersion=" + newHalVersion); - - if (mHalVersion.less(newHalVersion)) { - mHalVersion = newHalVersion; - } + version = RIL.getServiceHalVersion(voice.getInterfaceVersion()); } catch (RemoteException e) { Rlog.e(TAG, "setAidl: " + e); } + mHalVersion = version; + mVoiceProxy = voice; + mIsAidl = true; Rlog.d(TAG, "AIDL initialized mHalVersion=" + mHalVersion); return mHalVersion; |