Merge "Feature support for SMS to misscall notification" into udc-dev am: f1be526489 am: 44b3095b96
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/22503991
Change-Id: If19af5300b75e3a7cac61d2390c2863f548c7aa6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/Android.bp b/Android.bp
index 4097571..5027635 100644
--- a/Android.bp
+++ b/Android.bp
@@ -90,6 +90,7 @@
"android.hardware.radio.modem-V2-java",
"android.hardware.radio.network-V2-java",
"android.hardware.radio.sim-V2-java",
+ "android.hardware.radio.satellite-V1-java",
"android.hardware.radio.voice-V2-java",
"voip-common",
"ims-common",
diff --git a/proto/src/persist_atoms.proto b/proto/src/persist_atoms.proto
index aa784dd..304d3b0 100644
--- a/proto/src/persist_atoms.proto
+++ b/proto/src/persist_atoms.proto
@@ -190,6 +190,12 @@
/* Number of time the user toggled the data switch feature since the last collection. */
optional int32 auto_data_switch_toggle_count = 55;
+ /* Consolidated emergency numbers list information. */
+ repeated EmergencyNumbersInfo emergency_numbers_info = 56;
+
+ /* Timestamp of last emergency number pull. */
+ optional int64 emergency_number_pull_timestamp_millis = 57;
+
/** Snapshot of satellite controller. */
repeated SatelliteController satellite_controller = 58;
@@ -225,12 +231,6 @@
/* Timestamp of last satellite_sos_message_recommender pull. */
optional int64 satellite_sos_message_recommender_pull_timestamp_millis = 69;
-
- /* Consolidated emergency numbers list information. */
- repeated EmergencyNumbersInfo emergency_numbers_info = 56;
-
- /* Timestamp of last emergency number pull. */
- optional int64 emergency_number_pull_timestamp_millis = 57;
}
// The canonical versions of the following enums live in:
@@ -581,6 +581,41 @@
optional int32 short_code_sms_count = 3;
}
+message EmergencyNumbersInfo {
+ enum ServiceCategory {
+ EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED = 0;
+ EMERGENCY_SERVICE_CATEGORY_POLICE = 1;
+ EMERGENCY_SERVICE_CATEGORY_AMBULANCE = 2;
+ EMERGENCY_SERVICE_CATEGORY_FIRE_BRIGADE = 3;
+ EMERGENCY_SERVICE_CATEGORY_MARINE_GUARD = 4;
+ EMERGENCY_SERVICE_CATEGORY_MOUNTAIN_RESCUE = 5;
+ EMERGENCY_SERVICE_CATEGORY_MIEC = 6;
+ EMERGENCY_SERVICE_CATEGORY_AIEC = 7;
+ }
+ enum Source {
+ EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING = 0;
+ EMERGENCY_NUMBER_SOURCE_SIM = 1;
+ EMERGENCY_NUMBER_SOURCE_DATABASE = 2;
+ EMERGENCY_NUMBER_SOURCE_MODEM_CONFIG = 3;
+ EMERGENCY_NUMBER_SOURCE_DEFAULT = 4;
+ }
+ enum CallRoute {
+ EMERGENCY_CALL_ROUTE_UNKNOWN = 0;
+ EMERGENCY_CALL_ROUTE_EMERGENCY = 1;
+ EMERGENCY_CALL_ROUTE_NORMAL = 2;
+ }
+ optional bool is_db_version_ignored = 1;
+ optional int32 asset_version = 2;
+ optional int32 ota_version = 3;
+ optional string number = 4;
+ optional string country_iso = 5;
+ optional string mnc = 6;
+ optional CallRoute route = 7;
+ repeated string urns = 8;
+ repeated ServiceCategory service_categories = 9;
+ repeated Source sources = 10;
+}
+
message SatelliteController {
optional int32 count_of_satellite_service_enablements_success = 1;
optional int32 count_of_satellite_service_enablements_fail = 2;
@@ -634,38 +669,3 @@
optional int32 cellular_service_state = 4;
optional int32 count = 5;
}
-
-message EmergencyNumbersInfo {
- enum ServiceCategory {
- EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED = 0;
- EMERGENCY_SERVICE_CATEGORY_POLICE = 1;
- EMERGENCY_SERVICE_CATEGORY_AMBULANCE = 2;
- EMERGENCY_SERVICE_CATEGORY_FIRE_BRIGADE = 3;
- EMERGENCY_SERVICE_CATEGORY_MARINE_GUARD = 4;
- EMERGENCY_SERVICE_CATEGORY_MOUNTAIN_RESCUE = 5;
- EMERGENCY_SERVICE_CATEGORY_MIEC = 6;
- EMERGENCY_SERVICE_CATEGORY_AIEC = 7;
- }
- enum Source {
- EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING = 0;
- EMERGENCY_NUMBER_SOURCE_SIM = 1;
- EMERGENCY_NUMBER_SOURCE_DATABASE = 2;
- EMERGENCY_NUMBER_SOURCE_MODEM_CONFIG = 3;
- EMERGENCY_NUMBER_SOURCE_DEFAULT = 4;
- }
- enum CallRoute {
- EMERGENCY_CALL_ROUTE_UNKNOWN = 0;
- EMERGENCY_CALL_ROUTE_EMERGENCY = 1;
- EMERGENCY_CALL_ROUTE_NORMAL = 2;
- }
- optional bool is_db_version_ignored = 1;
- optional int32 asset_version = 2;
- optional int32 ota_version = 3;
- optional string number = 4;
- optional string country_iso = 5;
- optional string mnc = 6;
- optional CallRoute route = 7;
- repeated string urns = 8;
- repeated ServiceCategory service_categories = 9;
- repeated Source sources = 10;
-}
diff --git a/src/java/com/android/internal/telephony/CommandException.java b/src/java/com/android/internal/telephony/CommandException.java
index e068c1c..6b6d84f 100644
--- a/src/java/com/android/internal/telephony/CommandException.java
+++ b/src/java/com/android/internal/telephony/CommandException.java
@@ -131,6 +131,17 @@
BLOCKED_DUE_TO_CALL,
RF_HARDWARE_ISSUE,
NO_RF_CALIBRATION_INFO,
+ ENCODING_NOT_SUPPORTED,
+ FEATURE_NOT_SUPPORTED,
+ INVALID_CONTACT,
+ MODEM_INCOMPATIBLE,
+ NETWORK_TIMEOUT,
+ NO_SATELLITE_SIGNAL,
+ NOT_SUFFICIENT_ACCOUNT_BALANCE,
+ RADIO_TECHNOLOGY_NOT_SUPPORTED,
+ SUBSCRIBER_NOT_AUTHORIZED,
+ SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL,
+ UNIDENTIFIED_SUBSCRIBER
}
@UnsupportedAppUsage
@@ -341,6 +352,28 @@
return new CommandException(Error.RF_HARDWARE_ISSUE);
case RILConstants.NO_RF_CALIBRATION_INFO:
return new CommandException(Error.NO_RF_CALIBRATION_INFO);
+ case RILConstants.ENCODING_NOT_SUPPORTED:
+ return new CommandException(Error.ENCODING_NOT_SUPPORTED);
+ case RILConstants.FEATURE_NOT_SUPPORTED:
+ return new CommandException(Error.FEATURE_NOT_SUPPORTED);
+ case RILConstants.INVALID_CONTACT:
+ return new CommandException(Error.INVALID_CONTACT);
+ case RILConstants.MODEM_INCOMPATIBLE:
+ return new CommandException(Error.MODEM_INCOMPATIBLE);
+ case RILConstants.NETWORK_TIMEOUT:
+ return new CommandException(Error.NETWORK_TIMEOUT);
+ case RILConstants.NO_SATELLITE_SIGNAL:
+ return new CommandException(Error.NO_SATELLITE_SIGNAL);
+ case RILConstants.NOT_SUFFICIENT_ACCOUNT_BALANCE:
+ return new CommandException(Error.NOT_SUFFICIENT_ACCOUNT_BALANCE);
+ case RILConstants.RADIO_TECHNOLOGY_NOT_SUPPORTED:
+ return new CommandException(Error.RADIO_TECHNOLOGY_NOT_SUPPORTED);
+ case RILConstants.SUBSCRIBER_NOT_AUTHORIZED:
+ return new CommandException(Error.SUBSCRIBER_NOT_AUTHORIZED);
+ case RILConstants.SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL:
+ return new CommandException(Error.SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL);
+ case RILConstants.UNIDENTIFIED_SUBSCRIBER:
+ return new CommandException(Error.UNIDENTIFIED_SUBSCRIBER);
default:
Rlog.e("GSM", "Unrecognized RIL errno " + ril_errno);
return new CommandException(Error.INVALID_RESPONSE);
diff --git a/src/java/com/android/internal/telephony/MockModem.java b/src/java/com/android/internal/telephony/MockModem.java
index a20e748..83417c5 100644
--- a/src/java/com/android/internal/telephony/MockModem.java
+++ b/src/java/com/android/internal/telephony/MockModem.java
@@ -21,6 +21,7 @@
import static android.telephony.TelephonyManager.HAL_SERVICE_MESSAGING;
import static android.telephony.TelephonyManager.HAL_SERVICE_MODEM;
import static android.telephony.TelephonyManager.HAL_SERVICE_NETWORK;
+import static android.telephony.TelephonyManager.HAL_SERVICE_SATELLITE;
import static android.telephony.TelephonyManager.HAL_SERVICE_SIM;
import static android.telephony.TelephonyManager.HAL_SERVICE_VOICE;
@@ -44,6 +45,8 @@
private static final String BIND_IRADIOVOICE = "android.telephony.mockmodem.iradiovoice";
private static final String BIND_IRADIOIMS = "android.telephony.mockmodem.iradioims";
private static final String BIND_IRADIOCONFIG = "android.telephony.mockmodem.iradioconfig";
+ private static final String BIND_IRADIOSATELLITE =
+ "android.telephony.mockmodem.iradiosatellite";
private static final String PHONE_ID = "phone_id";
private static final byte DEFAULT_PHONE_ID = 0x00;
@@ -65,6 +68,7 @@
private IBinder mVoiceBinder;
private IBinder mImsBinder;
private IBinder mConfigBinder;
+ private IBinder mSatelliteBinder;
private ServiceConnection mModemServiceConnection;
private ServiceConnection mSimServiceConnection;
private ServiceConnection mMessagingServiceConnection;
@@ -73,6 +77,7 @@
private ServiceConnection mVoiceServiceConnection;
private ServiceConnection mImsServiceConnection;
private ServiceConnection mConfigServiceConnection;
+ private ServiceConnection mSatelliteServiceConnection;
private byte mPhoneId;
private String mTag;
@@ -115,6 +120,8 @@
mVoiceBinder = binder;
} else if (mService == HAL_SERVICE_IMS) {
mImsBinder = binder;
+ } else if (mService == HAL_SERVICE_SATELLITE) {
+ mSatelliteBinder = binder;
} else if (mService == RADIOCONFIG_SERVICE) {
mConfigBinder = binder;
}
@@ -138,6 +145,8 @@
mVoiceBinder = null;
} else if (mService == HAL_SERVICE_IMS) {
mImsBinder = null;
+ } else if (mService == HAL_SERVICE_SATELLITE) {
+ mSatelliteBinder = null;
} else if (mService == RADIOCONFIG_SERVICE) {
mConfigBinder = null;
}
@@ -179,6 +188,8 @@
return mVoiceBinder;
case HAL_SERVICE_IMS:
return mImsBinder;
+ case HAL_SERVICE_SATELLITE:
+ return mSatelliteBinder;
case RADIOCONFIG_SERVICE:
return mConfigBinder;
default:
@@ -306,6 +317,20 @@
} else {
Rlog.d(TAG, "IRadio Ims is bound");
}
+ } else if (service == HAL_SERVICE_SATELLITE) {
+ if (mSatelliteBinder == null) {
+ mSatelliteServiceConnection = new MockModemConnection(HAL_SERVICE_SATELLITE);
+
+ boolean status =
+ bindModuleToMockModemService(
+ mPhoneId, BIND_IRADIOSATELLITE, mSatelliteServiceConnection);
+ if (!status) {
+ Rlog.d(TAG, "IRadio Satellite bind fail");
+ mSatelliteServiceConnection = null;
+ }
+ } else {
+ Rlog.d(TAG, "IRadio Satellite is bound");
+ }
}
}
@@ -368,6 +393,13 @@
mImsBinder = null;
Rlog.d(TAG, "unbind IRadio Ims");
}
+ } else if (service == HAL_SERVICE_SATELLITE) {
+ if (mSatelliteServiceConnection != null) {
+ mContext.unbindService(mSatelliteServiceConnection);
+ mSatelliteServiceConnection = null;
+ mSatelliteBinder = null;
+ Rlog.d(TAG, "unbind IRadio Satellite");
+ }
}
}
@@ -391,6 +423,8 @@
return "voice";
case HAL_SERVICE_IMS:
return "ims";
+ case HAL_SERVICE_SATELLITE:
+ return "satellite";
case RADIOCONFIG_SERVICE:
return "config";
default:
diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java
index dbf3b12..c3b9fbc 100644
--- a/src/java/com/android/internal/telephony/RIL.java
+++ b/src/java/com/android/internal/telephony/RIL.java
@@ -22,6 +22,7 @@
import static android.telephony.TelephonyManager.HAL_SERVICE_MODEM;
import static android.telephony.TelephonyManager.HAL_SERVICE_NETWORK;
import static android.telephony.TelephonyManager.HAL_SERVICE_RADIO;
+import static android.telephony.TelephonyManager.HAL_SERVICE_SATELLITE;
import static android.telephony.TelephonyManager.HAL_SERVICE_SIM;
import static android.telephony.TelephonyManager.HAL_SERVICE_VOICE;
@@ -104,6 +105,7 @@
import com.android.internal.telephony.uicc.IccUtils;
import com.android.internal.telephony.uicc.SimPhonebookRecord;
import com.android.internal.telephony.util.TelephonyUtils;
+import com.android.internal.util.FunctionalUtils;
import com.android.telephony.Rlog;
import java.io.FileDescriptor;
@@ -226,7 +228,7 @@
public static final int MIN_SERVICE_IDX = HAL_SERVICE_RADIO;
- public static final int MAX_SERVICE_IDX = HAL_SERVICE_IMS;
+ public static final int MAX_SERVICE_IDX = HAL_SERVICE_SATELLITE;
/**
* An array of sets that records if services are disabled in the HAL for a specific phone ID
@@ -261,6 +263,8 @@
private ModemIndication mModemIndication;
private NetworkResponse mNetworkResponse;
private NetworkIndication mNetworkIndication;
+ private SatelliteResponse mSatelliteResponse;
+ private SatelliteIndication mSatelliteIndication;
private SimResponse mSimResponse;
private SimIndication mSimIndication;
private VoiceResponse mVoiceResponse;
@@ -507,7 +511,7 @@
clearRequestList(RADIO_NOT_AVAILABLE, false);
if (service == HAL_SERVICE_RADIO) {
- getRadioProxy(null);
+ getRadioProxy();
} else {
for (int i = MIN_SERVICE_IDX; i <= MAX_SERVICE_IDX; i++) {
if (i == HAL_SERVICE_RADIO) continue;
@@ -516,7 +520,7 @@
riljLoge("Null service proxy for service " + serviceToString(i));
continue;
}
- getRadioServiceProxy(i, null);
+ getRadioServiceProxy(i);
}
}
}
@@ -644,7 +648,7 @@
/** Returns a {@link IRadio} instance or null if the service is not available. */
@VisibleForTesting
- public synchronized IRadio getRadioProxy(Message result) {
+ public synchronized IRadio getRadioProxy() {
if (mHalVersion.containsKey(HAL_SERVICE_RADIO)
&& mHalVersion.get(HAL_SERVICE_RADIO).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
return null;
@@ -652,11 +656,6 @@
if (!SubscriptionManager.isValidPhoneId(mPhoneId)) return null;
if (!mIsCellularSupported) {
if (RILJ_LOGV) riljLog("getRadioProxy: Not calling getService(): wifi-only");
- if (result != null) {
- AsyncResult.forMessage(result, null,
- CommandException.fromRilErrno(RADIO_NOT_AVAILABLE));
- result.sendToTarget();
- }
return null;
}
@@ -751,11 +750,6 @@
if (mRadioProxy == null) {
// getService() is a blocking call, so this should never happen
riljLoge("getRadioProxy: mRadioProxy == null");
- if (result != null) {
- AsyncResult.forMessage(result, null,
- CommandException.fromRilErrno(RADIO_NOT_AVAILABLE));
- result.sendToTarget();
- }
}
return mRadioProxy;
@@ -764,31 +758,33 @@
/**
* Returns a {@link RadioDataProxy}, {@link RadioMessagingProxy}, {@link RadioModemProxy},
* {@link RadioNetworkProxy}, {@link RadioSimProxy}, {@link RadioVoiceProxy},
- * {@link RadioImsProxy}, or null if the service is not available.
+ * {@link RadioImsProxy}, {@link RadioSatelliteProxy}, or null if the service is not available.
*/
@NonNull
- public <T extends RadioServiceProxy> T getRadioServiceProxy(Class<T> serviceClass,
- Message result) {
+ public <T extends RadioServiceProxy> T getRadioServiceProxy(Class<T> serviceClass) {
if (serviceClass == RadioDataProxy.class) {
- return (T) getRadioServiceProxy(HAL_SERVICE_DATA, result);
+ return (T) getRadioServiceProxy(HAL_SERVICE_DATA);
}
if (serviceClass == RadioMessagingProxy.class) {
- return (T) getRadioServiceProxy(HAL_SERVICE_MESSAGING, result);
+ return (T) getRadioServiceProxy(HAL_SERVICE_MESSAGING);
}
if (serviceClass == RadioModemProxy.class) {
- return (T) getRadioServiceProxy(HAL_SERVICE_MODEM, result);
+ return (T) getRadioServiceProxy(HAL_SERVICE_MODEM);
}
if (serviceClass == RadioNetworkProxy.class) {
- return (T) getRadioServiceProxy(HAL_SERVICE_NETWORK, result);
+ return (T) getRadioServiceProxy(HAL_SERVICE_NETWORK);
}
if (serviceClass == RadioSimProxy.class) {
- return (T) getRadioServiceProxy(HAL_SERVICE_SIM, result);
+ return (T) getRadioServiceProxy(HAL_SERVICE_SIM);
}
if (serviceClass == RadioVoiceProxy.class) {
- return (T) getRadioServiceProxy(HAL_SERVICE_VOICE, result);
+ return (T) getRadioServiceProxy(HAL_SERVICE_VOICE);
}
if (serviceClass == RadioImsProxy.class) {
- return (T) getRadioServiceProxy(HAL_SERVICE_IMS, result);
+ return (T) getRadioServiceProxy(HAL_SERVICE_IMS);
+ }
+ if (serviceClass == RadioSatelliteProxy.class) {
+ return (T) getRadioServiceProxy(HAL_SERVICE_SATELLITE);
}
riljLoge("getRadioServiceProxy: unrecognized " + serviceClass);
return null;
@@ -800,18 +796,13 @@
*/
@VisibleForTesting
@NonNull
- public synchronized RadioServiceProxy getRadioServiceProxy(int service, Message result) {
+ public synchronized RadioServiceProxy getRadioServiceProxy(int service) {
if (!SubscriptionManager.isValidPhoneId(mPhoneId)) return mServiceProxies.get(service);
if ((service >= HAL_SERVICE_IMS) && !isRadioServiceSupported(service)) {
return mServiceProxies.get(service);
}
if (!mIsCellularSupported) {
if (RILJ_LOGV) riljLog("getRadioServiceProxy: Not calling getService(): wifi-only");
- if (result != null) {
- AsyncResult.forMessage(result, null,
- CommandException.fromRilErrno(RADIO_NOT_AVAILABLE));
- result.sendToTarget();
- }
return mServiceProxies.get(service);
}
@@ -932,6 +923,21 @@
.asInterface(binder)));
}
break;
+ case HAL_SERVICE_SATELLITE:
+ if (mMockModem == null) {
+ binder = ServiceManager.waitForDeclaredService(
+ android.hardware.radio.satellite.IRadioSatellite.DESCRIPTOR
+ + "/" + HIDL_SERVICE_NAME[mPhoneId]);
+ } else {
+ binder = mMockModem.getServiceBinder(HAL_SERVICE_SATELLITE);
+ }
+ if (binder != null) {
+ mHalVersion.put(service, ((RadioSatelliteProxy) serviceProxy).setAidl(
+ mHalVersion.get(service),
+ android.hardware.radio.satellite.IRadioSatellite.Stub
+ .asInterface(binder)));
+ }
+ break;
}
if (serviceProxy.isEmpty()
@@ -1056,6 +1062,12 @@
((RadioImsProxy) serviceProxy).getAidl().setResponseFunctions(
mImsResponse, mImsIndication);
break;
+ case HAL_SERVICE_SATELLITE:
+ mDeathRecipients.get(service).linkToDeath(
+ ((RadioSatelliteProxy) serviceProxy).getAidl().asBinder());
+ ((RadioSatelliteProxy) serviceProxy).getAidl().setResponseFunctions(
+ mSatelliteResponse, mSatelliteIndication);
+ break;
}
} else {
if (mHalVersion.get(service)
@@ -1085,11 +1097,6 @@
if (serviceProxy.isEmpty()) {
// getService() is a blocking call, so this should never happen
riljLoge("getRadioServiceProxy: serviceProxy == null");
- if (result != null) {
- AsyncResult.forMessage(result, null,
- CommandException.fromRilErrno(RADIO_NOT_AVAILABLE));
- result.sendToTarget();
- }
}
return serviceProxy;
@@ -1102,9 +1109,9 @@
if (active) {
// Try to connect to RIL services and set response functions.
if (service == HAL_SERVICE_RADIO) {
- getRadioProxy(null);
+ getRadioProxy();
} else {
- getRadioServiceProxy(service, null);
+ getRadioServiceProxy(service);
}
} else {
resetProxyAndRequestList(service);
@@ -1170,6 +1177,8 @@
mModemIndication = new ModemIndication(this);
mNetworkResponse = new NetworkResponse(this);
mNetworkIndication = new NetworkIndication(this);
+ mSatelliteResponse = new SatelliteResponse(this);
+ mSatelliteIndication = new SatelliteIndication(this);
mSimResponse = new SimResponse(this);
mSimIndication = new SimIndication(this);
mVoiceResponse = new VoiceResponse(this);
@@ -1204,6 +1213,7 @@
mServiceProxies.put(HAL_SERVICE_SIM, new RadioSimProxy());
mServiceProxies.put(HAL_SERVICE_VOICE, new RadioVoiceProxy());
mServiceProxies.put(HAL_SERVICE_IMS, new RadioImsProxy());
+ mServiceProxies.put(HAL_SERVICE_SATELLITE, new RadioSatelliteProxy());
} else {
mServiceProxies = proxies;
}
@@ -1233,11 +1243,11 @@
// wakelock stuff is initialized above as callbacks are received on separate binder threads)
for (int service = MIN_SERVICE_IDX; service <= MAX_SERVICE_IDX; service++) {
if (service == HAL_SERVICE_RADIO) {
- getRadioProxy(null);
+ getRadioProxy();
} else {
if (proxies == null) {
// Prevent telephony tests from calling the service
- getRadioServiceProxy(service, null);
+ getRadioServiceProxy(service);
}
}
@@ -1286,6 +1296,9 @@
case HAL_SERVICE_IMS:
serviceName = android.hardware.radio.ims.IRadioIms.DESCRIPTOR;
break;
+ case HAL_SERVICE_SATELLITE:
+ serviceName = android.hardware.radio.satellite.IRadioSatellite.DESCRIPTOR;
+ break;
}
if (!serviceName.equals("")
@@ -1341,23 +1354,57 @@
resetProxyAndRequestList(service);
}
+ private void radioServiceInvokeHelper(int service, RILRequest rr, String methodName,
+ FunctionalUtils.ThrowingRunnable helper) {
+ try {
+ helper.runOrThrow();
+ } catch (RuntimeException e) {
+ riljLoge(methodName + " RuntimeException: " + e);
+ int error = RadioError.SYSTEM_ERR;
+ int responseType = RadioResponseType.SOLICITED;
+ processResponseInternal(service, rr.mSerial, error, responseType);
+ processResponseDoneInternal(rr, error, responseType, null);
+ } catch (Exception e) {
+ handleRadioProxyExceptionForRR(service, methodName, e);
+ }
+ }
+
+ private void handleRadioServiceNotAvailable(RadioServiceProxy proxy, Message result) {
+ if (result != null) {
+ riljLoge("RadioService is not available, " + proxy);
+ AsyncResult.forMessage(result, null,
+ CommandException.fromRilErrno(RADIO_NOT_AVAILABLE));
+ result.sendToTarget();
+ }
+ }
+
+ private void handleRadioProxyNotAvailable(Message result) {
+ if (result != null) {
+ riljLoge("RadioProxy is not available");
+ AsyncResult.forMessage(result, null,
+ CommandException.fromRilErrno(RADIO_NOT_AVAILABLE));
+ result.sendToTarget();
+ }
+ }
+
@Override
public void getIccCardStatus(Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_GET_SIM_STATUS, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- simProxy.getIccCardStatus(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "getIccCardStatus", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_GET_SIM_STATUS, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "getIccCardStatus", () -> {
+ simProxy.getIccCardStatus(rr.mSerial);
+ });
}
@Override
@@ -1389,22 +1436,23 @@
@Override
public void supplyIccPinForApp(String pin, String aid, Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_ENTER_SIM_PIN, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " aid = " + aid);
- }
-
- try {
- simProxy.supplyIccPinForApp(rr.mSerial, RILUtils.convertNullToEmptyString(pin),
- RILUtils.convertNullToEmptyString(aid));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "supplyIccPinForApp", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_ENTER_SIM_PIN, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " aid = " + aid);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "supplyIccPinForApp", () -> {
+ simProxy.supplyIccPinForApp(rr.mSerial, RILUtils.convertNullToEmptyString(pin),
+ RILUtils.convertNullToEmptyString(aid));
+ });
}
@Override
@@ -1414,24 +1462,25 @@
@Override
public void supplyIccPukForApp(String puk, String newPin, String aid, Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_ENTER_SIM_PUK, result, mRILDefaultWorkSource);
-
- String pukStr = RILUtils.convertNullToEmptyString(puk);
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " isPukEmpty = " + pukStr.isEmpty() + " aid = " + aid);
- }
-
- try {
- simProxy.supplyIccPukForApp(rr.mSerial, pukStr,
- RILUtils.convertNullToEmptyString(newPin),
- RILUtils.convertNullToEmptyString(aid));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "supplyIccPukForApp", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_ENTER_SIM_PUK, result, mRILDefaultWorkSource);
+
+ String pukStr = RILUtils.convertNullToEmptyString(puk);
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " isPukEmpty = " + pukStr.isEmpty() + " aid = " + aid);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "supplyIccPukForApp", () -> {
+ simProxy.supplyIccPukForApp(rr.mSerial, pukStr,
+ RILUtils.convertNullToEmptyString(newPin),
+ RILUtils.convertNullToEmptyString(aid));
+ });
}
@Override
@@ -1441,23 +1490,23 @@
@Override
public void supplyIccPin2ForApp(String pin, String aid, Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_ENTER_SIM_PIN2, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " aid = " + aid);
- }
-
- try {
- simProxy.supplyIccPin2ForApp(rr.mSerial, RILUtils.convertNullToEmptyString(pin),
- RILUtils.convertNullToEmptyString(aid));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "supplyIccPin2ForApp", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_ENTER_SIM_PIN2, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " aid = " + aid);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "supplyIccPin2ForApp", () -> {
+ simProxy.supplyIccPin2ForApp(rr.mSerial, RILUtils.convertNullToEmptyString(pin),
+ RILUtils.convertNullToEmptyString(aid));
+ });
}
@Override
@@ -1467,24 +1516,24 @@
@Override
public void supplyIccPuk2ForApp(String puk, String newPin2, String aid, Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_ENTER_SIM_PUK2, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " aid = " + aid);
- }
-
- try {
- simProxy.supplyIccPuk2ForApp(rr.mSerial, RILUtils.convertNullToEmptyString(puk),
- RILUtils.convertNullToEmptyString(newPin2),
- RILUtils.convertNullToEmptyString(aid));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "supplyIccPuk2ForApp", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_ENTER_SIM_PUK2, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " aid = " + aid);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "supplyIccPuk2ForApp", () -> {
+ simProxy.supplyIccPuk2ForApp(rr.mSerial, RILUtils.convertNullToEmptyString(puk),
+ RILUtils.convertNullToEmptyString(newPin2),
+ RILUtils.convertNullToEmptyString(aid));
+ });
}
@Override
@@ -1494,25 +1543,25 @@
@Override
public void changeIccPinForApp(String oldPin, String newPin, String aid, Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CHANGE_SIM_PIN, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " oldPin = " + oldPin + " newPin = " + newPin + " aid = " + aid);
- }
-
- try {
- simProxy.changeIccPinForApp(rr.mSerial,
- RILUtils.convertNullToEmptyString(oldPin),
- RILUtils.convertNullToEmptyString(newPin),
- RILUtils.convertNullToEmptyString(aid));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "changeIccPinForApp", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_CHANGE_SIM_PIN, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " oldPin = " + oldPin + " newPin = " + newPin + " aid = " + aid);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "changeIccPinForApp", () -> {
+ simProxy.changeIccPinForApp(rr.mSerial,
+ RILUtils.convertNullToEmptyString(oldPin),
+ RILUtils.convertNullToEmptyString(newPin),
+ RILUtils.convertNullToEmptyString(aid));
+ });
}
@Override
@@ -1522,54 +1571,57 @@
@Override
public void changeIccPin2ForApp(String oldPin2, String newPin2, String aid, Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CHANGE_SIM_PIN2, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " oldPin = " + oldPin2 + " newPin = " + newPin2 + " aid = " + aid);
- }
-
- try {
- simProxy.changeIccPin2ForApp(rr.mSerial,
- RILUtils.convertNullToEmptyString(oldPin2),
- RILUtils.convertNullToEmptyString(newPin2),
- RILUtils.convertNullToEmptyString(aid));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "changeIccPin2ForApp", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_CHANGE_SIM_PIN2, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " oldPin = " + oldPin2 + " newPin = " + newPin2 + " aid = " + aid);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "changeIccPin2ForApp", () -> {
+ simProxy.changeIccPin2ForApp(rr.mSerial,
+ RILUtils.convertNullToEmptyString(oldPin2),
+ RILUtils.convertNullToEmptyString(newPin2),
+ RILUtils.convertNullToEmptyString(aid));
+ });
}
@Override
public void supplyNetworkDepersonalization(String netpin, Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " netpin = " + netpin);
- }
-
- try {
- networkProxy.supplyNetworkDepersonalization(rr.mSerial,
- RILUtils.convertNullToEmptyString(netpin));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(
- HAL_SERVICE_NETWORK, "supplyNetworkDepersonalization", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " netpin = " + netpin);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "supplyNetworkDepersonalization", () -> {
+ networkProxy.supplyNetworkDepersonalization(rr.mSerial,
+ RILUtils.convertNullToEmptyString(netpin));
+ });
}
@Override
public void supplySimDepersonalization(PersoSubState persoType, String controlKey,
Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (simProxy.isEmpty()) return;
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_SIM).greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
RILRequest rr = obtainRequest(RIL_REQUEST_ENTER_SIM_DEPERSONALIZATION, result,
mRILDefaultWorkSource);
@@ -1579,12 +1631,10 @@
+ " controlKey = " + controlKey + " persoType" + persoType);
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "supplySimDepersonalization", () -> {
simProxy.supplySimDepersonalization(rr.mSerial, persoType,
RILUtils.convertNullToEmptyString(controlKey));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "supplySimDepersonalization", e);
- }
+ });
} else {
if (PersoSubState.PERSOSUBSTATE_SIM_NETWORK == persoType) {
supplyNetworkDepersonalization(controlKey, result);
@@ -1603,21 +1653,21 @@
@Override
public void getCurrentCalls(Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_GET_CURRENT_CALLS, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.getCurrentCalls(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "getCurrentCalls", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_GET_CURRENT_CALLS, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "getCurrentCalls", () -> {
+ voiceProxy.getCurrentCalls(rr.mSerial);
+ });
}
@Override
@@ -1629,8 +1679,11 @@
@Override
public void enableModem(boolean enable, Message result) {
- RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class, result);
- if (modemProxy.isEmpty()) return;
+ RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class);
+ if (modemProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(modemProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_MODEM).greaterOrEqual(RADIO_HAL_VERSION_1_3)) {
RILRequest rr = obtainRequest(RIL_REQUEST_ENABLE_MODEM, result, mRILDefaultWorkSource);
@@ -1639,12 +1692,9 @@
+ " enable = " + enable);
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_MODEM, rr, "enableModem", () -> {
modemProxy.enableModem(rr.mSerial, enable);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MODEM,
- "enableModem", e);
- }
+ });
} else {
if (RILJ_LOGV) riljLog("enableModem: not supported.");
if (result != null) {
@@ -1658,8 +1708,11 @@
@Override
public void setSystemSelectionChannels(@NonNull List<RadioAccessSpecifier> specifiers,
Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (networkProxy.isEmpty()) return;
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_NETWORK).greaterOrEqual(RADIO_HAL_VERSION_1_3)) {
RILRequest rr = obtainRequest(RIL_REQUEST_SET_SYSTEM_SELECTION_CHANNELS, result,
mRILDefaultWorkSource);
@@ -1669,12 +1722,9 @@
+ " setSystemSelectionChannels_1.3= " + specifiers);
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "setSystemSelectionChannels", () -> {
networkProxy.setSystemSelectionChannels(rr.mSerial, specifiers);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK,
- "setSystemSelectionChannels", e);
- }
+ });
} else {
if (RILJ_LOGV) riljLog("setSystemSelectionChannels: not supported.");
if (result != null) {
@@ -1687,8 +1737,11 @@
@Override
public void getSystemSelectionChannels(Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (networkProxy.isEmpty()) return;
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_NETWORK).greaterOrEqual(RADIO_HAL_VERSION_1_6)) {
RILRequest rr = obtainRequest(RIL_REQUEST_GET_SYSTEM_SELECTION_CHANNELS, result,
mRILDefaultWorkSource);
@@ -1698,12 +1751,9 @@
+ " getSystemSelectionChannels");
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "getSystemSelectionChannels", () -> {
networkProxy.getSystemSelectionChannels(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK,
- "getSystemSelectionChannels", e);
- }
+ });
} else {
if (RILJ_LOGV) riljLog("getSystemSelectionChannels: not supported.");
if (result != null) {
@@ -1716,8 +1766,11 @@
@Override
public void getModemStatus(Message result) {
- RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class, result);
- if (modemProxy.isEmpty()) return;
+ RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class);
+ if (modemProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(modemProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_MODEM).greaterOrEqual(RADIO_HAL_VERSION_1_3)) {
RILRequest rr = obtainRequest(RIL_REQUEST_GET_MODEM_STATUS, result,
mRILDefaultWorkSource);
@@ -1726,11 +1779,9 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_MODEM, rr, "getModemStatus", () -> {
modemProxy.getModemStackStatus(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MODEM, "getModemStatus", e);
- }
+ });
} else {
if (RILJ_LOGV) riljLog("getModemStatus: not supported.");
if (result != null) {
@@ -1751,27 +1802,31 @@
uusInfo, result);
return;
}
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_DIAL, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- // Do not log function arg for privacy
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.dial(rr.mSerial, address, clirMode, uusInfo);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "dial", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_DIAL, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ // Do not log function arg for privacy
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "dial", () -> {
+ voiceProxy.dial(rr.mSerial, address, clirMode, uusInfo);
+ });
}
private void emergencyDial(String address, EmergencyNumber emergencyNumberInfo,
boolean hasKnownUserIntentEmergency, int clirMode, UUSInfo uusInfo, Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (voiceProxy.isEmpty()) return;
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_VOICE).greaterOrEqual(RADIO_HAL_VERSION_1_4)) {
RILRequest rr = obtainRequest(RIL_REQUEST_EMERGENCY_DIAL, result,
mRILDefaultWorkSource);
@@ -1781,12 +1836,10 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "emergencyDial", () -> {
voiceProxy.emergencyDial(rr.mSerial, RILUtils.convertNullToEmptyString(address),
emergencyNumberInfo, hasKnownUserIntentEmergency, clirMode, uusInfo);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "emergencyDial", e);
- }
+ });
} else {
riljLoge("emergencyDial is not supported with 1.4 below IRadio");
}
@@ -1799,304 +1852,314 @@
@Override
public void getIMSIForApp(String aid, Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_GET_IMSI, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + ">" + RILUtils.requestToString(rr.mRequest)
- + " aid = " + aid);
- }
- try {
- simProxy.getImsiForApp(rr.mSerial, RILUtils.convertNullToEmptyString(aid));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "getImsiForApp", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_GET_IMSI, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + ">" + RILUtils.requestToString(rr.mRequest)
+ + " aid = " + aid);
+ }
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "getIMSIForApp", () -> {
+ simProxy.getImsiForApp(rr.mSerial, RILUtils.convertNullToEmptyString(aid));
+ });
}
@Override
public void hangupConnection(int gsmIndex, Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_HANGUP, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " gsmIndex = " + gsmIndex);
- }
-
- try {
- voiceProxy.hangup(rr.mSerial, gsmIndex);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "hangup", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_HANGUP, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " gsmIndex = " + gsmIndex);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "hangupConnection", () -> {
+ voiceProxy.hangup(rr.mSerial, gsmIndex);
+ });
}
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@Override
public void hangupWaitingOrBackground(Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.hangupWaitingOrBackground(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "hangupWaitingOrBackground", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+ RILRequest rr = obtainRequest(RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "hangupWaitingOrBackground", () -> {
+ voiceProxy.hangupWaitingOrBackground(rr.mSerial);
+ });
}
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
@Override
public void hangupForegroundResumeBackground(Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.hangupForegroundResumeBackground(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(
- HAL_SERVICE_VOICE, "hangupForegroundResumeBackground", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "hangupForegroundResumeBackground", () -> {
+ voiceProxy.hangupForegroundResumeBackground(rr.mSerial);
+ });
}
@Override
public void switchWaitingOrHoldingAndActive(Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.switchWaitingOrHoldingAndActive(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE,
- "switchWaitingOrHoldingAndActive", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "switchWaitingOrHoldingAndActive", () -> {
+ voiceProxy.switchWaitingOrHoldingAndActive(rr.mSerial);
+ });
}
@Override
public void conference(Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CONFERENCE, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.conference(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "conference", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+ RILRequest rr = obtainRequest(RIL_REQUEST_CONFERENCE, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "conference", () -> {
+ voiceProxy.conference(rr.mSerial);
+ });
}
@Override
public void rejectCall(Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_UDUB, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.rejectCall(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "rejectCall", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_UDUB, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "rejectCall", () -> {
+ voiceProxy.rejectCall(rr.mSerial);
+ });
}
@Override
public void getLastCallFailCause(Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_LAST_CALL_FAIL_CAUSE, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.getLastCallFailCause(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "getLastCallFailCause", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_LAST_CALL_FAIL_CAUSE, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "getLastCallFailCause", () -> {
+ voiceProxy.getLastCallFailCause(rr.mSerial);
+ });
}
@Override
public void getSignalStrength(Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SIGNAL_STRENGTH, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- networkProxy.getSignalStrength(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "getSignalStrength", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SIGNAL_STRENGTH, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "getSignalStrength", () -> {
+ networkProxy.getSignalStrength(rr.mSerial);
+ });
}
@Override
public void getVoiceRegistrationState(Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_VOICE_REGISTRATION_STATE, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- HalVersion overrideHalVersion = getCompatVersion(RIL_REQUEST_VOICE_REGISTRATION_STATE);
- if (RILJ_LOGD) {
- riljLog("getVoiceRegistrationState: overrideHalVersion=" + overrideHalVersion);
- }
-
- try {
- networkProxy.getVoiceRegistrationState(rr.mSerial, overrideHalVersion);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "getVoiceRegistrationState", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_VOICE_REGISTRATION_STATE, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ HalVersion overrideHalVersion = getCompatVersion(RIL_REQUEST_VOICE_REGISTRATION_STATE);
+ if (RILJ_LOGD) {
+ riljLog("getVoiceRegistrationState: overrideHalVersion=" + overrideHalVersion);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "getVoiceRegistrationState", () -> {
+ networkProxy.getVoiceRegistrationState(rr.mSerial, overrideHalVersion);
+ });
}
@Override
public void getDataRegistrationState(Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_DATA_REGISTRATION_STATE, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- HalVersion overrideHalVersion = getCompatVersion(RIL_REQUEST_DATA_REGISTRATION_STATE);
- if (RILJ_LOGD) {
- riljLog("getDataRegistrationState: overrideHalVersion=" + overrideHalVersion);
- }
-
- try {
- networkProxy.getDataRegistrationState(rr.mSerial, overrideHalVersion);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "getDataRegistrationState", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_DATA_REGISTRATION_STATE, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ HalVersion overrideHalVersion = getCompatVersion(RIL_REQUEST_DATA_REGISTRATION_STATE);
+ if (RILJ_LOGD) {
+ riljLog("getDataRegistrationState: overrideHalVersion=" + overrideHalVersion);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "getDataRegistrationState", () -> {
+ networkProxy.getDataRegistrationState(rr.mSerial, overrideHalVersion);
+ });
}
@Override
public void getOperator(Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_OPERATOR, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- networkProxy.getOperator(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "getOperator", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_OPERATOR, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "getOperator", () -> {
+ networkProxy.getOperator(rr.mSerial);
+ });
}
@UnsupportedAppUsage
@Override
public void setRadioPower(boolean on, boolean forEmergencyCall,
boolean preferredForEmergencyCall, Message result) {
- RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class, result);
- if (!modemProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_RADIO_POWER, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " on = " + on + " forEmergencyCall= " + forEmergencyCall
- + " preferredForEmergencyCall=" + preferredForEmergencyCall);
- }
-
- try {
- modemProxy.setRadioPower(rr.mSerial, on, forEmergencyCall,
- preferredForEmergencyCall);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MODEM, "setRadioPower", e);
- }
+ RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class);
+ if (modemProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(modemProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_RADIO_POWER, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " on = " + on + " forEmergencyCall= " + forEmergencyCall
+ + " preferredForEmergencyCall=" + preferredForEmergencyCall);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MODEM, rr, "setRadioPower", () -> {
+ modemProxy.setRadioPower(rr.mSerial, on, forEmergencyCall,
+ preferredForEmergencyCall);
+ });
}
@Override
public void sendDtmf(char c, Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_DTMF, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- // Do not log function arg for privacy
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.sendDtmf(rr.mSerial, c + "");
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "sendDtmf", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_DTMF, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ // Do not log function arg for privacy
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "sendDtmf", () -> {
+ voiceProxy.sendDtmf(rr.mSerial, c + "");
+ });
}
@Override
public void sendSMS(String smscPdu, String pdu, Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SEND_SMS, result, mRILDefaultWorkSource);
-
- // Do not log function args for privacy
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- messagingProxy.sendSms(rr.mSerial, smscPdu, pdu);
- mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_GSM,
- SmsSession.Event.Format.SMS_FORMAT_3GPP, getOutgoingSmsMessageId(result));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING, "sendSMS", e);
- }
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SEND_SMS, result, mRILDefaultWorkSource);
+
+ // Do not log function args for privacy
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MESSAGING, rr, "sendSMS", () -> {
+ messagingProxy.sendSms(rr.mSerial, smscPdu, pdu);
+ mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_GSM,
+ SmsSession.Event.Format.SMS_FORMAT_3GPP, getOutgoingSmsMessageId(result));
+ });
}
/**
@@ -2120,24 +2183,25 @@
@Override
public void sendSMSExpectMore(String smscPdu, String pdu, Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SEND_SMS_EXPECT_MORE, result,
- mRILDefaultWorkSource);
-
- // Do not log function arg for privacy
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- messagingProxy.sendSmsExpectMore(rr.mSerial, smscPdu, pdu);
- mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_GSM,
- SmsSession.Event.Format.SMS_FORMAT_3GPP, getOutgoingSmsMessageId(result));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING, "sendSMSExpectMore", e);
- }
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SEND_SMS_EXPECT_MORE, result,
+ mRILDefaultWorkSource);
+
+ // Do not log function arg for privacy
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MESSAGING, rr, "sendSMSExpectMore", () -> {
+ messagingProxy.sendSmsExpectMore(rr.mSerial, smscPdu, pdu);
+ mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_GSM,
+ SmsSession.Event.Format.SMS_FORMAT_3GPP, getOutgoingSmsMessageId(result));
+ });
}
@Override
@@ -2145,43 +2209,30 @@
boolean allowRoaming, int reason, LinkProperties linkProperties, int pduSessionId,
NetworkSliceInfo sliceInfo, TrafficDescriptor trafficDescriptor,
boolean matchAllRuleAllowed, Message result) {
- RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class, result);
- if (!dataProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SETUP_DATA_CALL, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + ",reason=" + RILUtils.setupDataReasonToString(reason)
- + ",accessNetworkType=" + AccessNetworkType.toString(accessNetworkType)
- + ",dataProfile=" + dataProfile + ",isRoaming=" + isRoaming
- + ",allowRoaming=" + allowRoaming
- + ",linkProperties=" + linkProperties + ",pduSessionId=" + pduSessionId
- + ",sliceInfo=" + sliceInfo + ",trafficDescriptor=" + trafficDescriptor
- + ",matchAllRuleAllowed=" + matchAllRuleAllowed);
- }
-
- try {
- dataProxy.setupDataCall(rr.mSerial, mPhoneId, accessNetworkType, dataProfile,
- isRoaming, allowRoaming, reason, linkProperties, pduSessionId, sliceInfo,
- trafficDescriptor, matchAllRuleAllowed);
- } catch (RemoteException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_DATA, "setupDataCall", e);
- } catch (RuntimeException e) {
- riljLoge("setupDataCall RuntimeException: " + e);
- int error = RadioError.SYSTEM_ERR;
- int responseType = RadioResponseType.SOLICITED;
- processResponseInternal(HAL_SERVICE_DATA, rr.mSerial, error, responseType);
- processResponseDoneInternal(rr, error, responseType, null);
- }
- } else {
- riljLoge("setupDataCall: DataProxy is empty");
- if (result != null) {
- AsyncResult.forMessage(result, null,
- CommandException.fromRilErrno(RADIO_NOT_AVAILABLE));
- result.sendToTarget();
- }
+ RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class);
+ if (dataProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(dataProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SETUP_DATA_CALL, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + ",reason=" + RILUtils.setupDataReasonToString(reason)
+ + ",accessNetworkType=" + AccessNetworkType.toString(accessNetworkType)
+ + ",dataProfile=" + dataProfile + ",isRoaming=" + isRoaming
+ + ",allowRoaming=" + allowRoaming
+ + ",linkProperties=" + linkProperties + ",pduSessionId=" + pduSessionId
+ + ",sliceInfo=" + sliceInfo + ",trafficDescriptor=" + trafficDescriptor
+ + ",matchAllRuleAllowed=" + matchAllRuleAllowed);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_DATA, rr, "setupDataCall", () -> {
+ dataProxy.setupDataCall(rr.mSerial, mPhoneId, accessNetworkType, dataProfile,
+ isRoaming, allowRoaming, reason, linkProperties, pduSessionId, sliceInfo,
+ trafficDescriptor, matchAllRuleAllowed);
+ });
}
@Override
@@ -2193,257 +2244,266 @@
@Override
public void iccIOForApp(int command, int fileId, String path, int p1, int p2, int p3,
String data, String pin2, String aid, Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SIM_IO, result, mRILDefaultWorkSource);
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
+ }
- if (RILJ_LOGD) {
- if (TelephonyUtils.IS_DEBUGGABLE) {
- riljLog(rr.serialString() + "> iccIO: " + RILUtils.requestToString(rr.mRequest)
- + " command = 0x" + Integer.toHexString(command) + " fileId = 0x"
- + Integer.toHexString(fileId) + " path = " + path + " p1 = " + p1
- + " p2 = " + p2 + " p3 = " + " data = " + data + " aid = " + aid);
- } else {
- riljLog(rr.serialString() + "> iccIO: "
- + RILUtils.requestToString(rr.mRequest));
- }
- }
+ RILRequest rr = obtainRequest(RIL_REQUEST_SIM_IO, result, mRILDefaultWorkSource);
- try {
- simProxy.iccIoForApp(rr.mSerial, command, fileId,
- RILUtils.convertNullToEmptyString(path), p1, p2, p3,
- RILUtils.convertNullToEmptyString(data),
- RILUtils.convertNullToEmptyString(pin2),
- RILUtils.convertNullToEmptyString(aid));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "iccIoForApp", e);
+ if (RILJ_LOGD) {
+ if (TelephonyUtils.IS_DEBUGGABLE) {
+ riljLog(rr.serialString() + "> iccIO: " + RILUtils.requestToString(rr.mRequest)
+ + " command = 0x" + Integer.toHexString(command) + " fileId = 0x"
+ + Integer.toHexString(fileId) + " path = " + path + " p1 = " + p1
+ + " p2 = " + p2 + " p3 = " + " data = " + data + " aid = " + aid);
+ } else {
+ riljLog(rr.serialString() + "> iccIO: "
+ + RILUtils.requestToString(rr.mRequest));
}
}
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "iccIOForApp", () -> {
+ simProxy.iccIoForApp(rr.mSerial, command, fileId,
+ RILUtils.convertNullToEmptyString(path), p1, p2, p3,
+ RILUtils.convertNullToEmptyString(data),
+ RILUtils.convertNullToEmptyString(pin2),
+ RILUtils.convertNullToEmptyString(aid));
+ });
}
@Override
public void sendUSSD(String ussd, Message result) {
RadioVoiceProxy voiceProxy =
- getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SEND_USSD, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- String logUssd = "*******";
- if (RILJ_LOGV) logUssd = ussd;
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " ussd = " + logUssd);
- }
-
- try {
- voiceProxy.sendUssd(rr.mSerial, RILUtils.convertNullToEmptyString(ussd));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "sendUssd", e);
- }
+ getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SEND_USSD, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ String logUssd = "*******";
+ if (RILJ_LOGV) logUssd = ussd;
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " ussd = " + logUssd);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "sendUSSD", () -> {
+ voiceProxy.sendUssd(rr.mSerial, RILUtils.convertNullToEmptyString(ussd));
+ });
}
@Override
public void cancelPendingUssd(Message result) {
RadioVoiceProxy voiceProxy =
- getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CANCEL_USSD, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.cancelPendingUssd(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "cancelPendingUssd", e);
- }
+ getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_CANCEL_USSD, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "cancelPendingUssd", () -> {
+ voiceProxy.cancelPendingUssd(rr.mSerial);
+ });
}
@Override
public void getCLIR(Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_GET_CLIR, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.getClir(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "getClir", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_GET_CLIR, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "getCLIR", () -> {
+ voiceProxy.getClir(rr.mSerial);
+ });
}
@Override
public void setCLIR(int clirMode, Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_CLIR, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " clirMode = " + clirMode);
- }
-
- try {
- voiceProxy.setClir(rr.mSerial, clirMode);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "setClir", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_CLIR, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " clirMode = " + clirMode);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "setCLIR", () -> {
+ voiceProxy.setClir(rr.mSerial, clirMode);
+ });
}
@Override
public void queryCallForwardStatus(int cfReason, int serviceClass, String number,
Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_QUERY_CALL_FORWARD_STATUS, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " cfreason = " + cfReason + " serviceClass = " + serviceClass);
- }
-
- try {
- voiceProxy.getCallForwardStatus(rr.mSerial, cfReason, serviceClass, number);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "getCallForwardStatus", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_QUERY_CALL_FORWARD_STATUS, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " cfreason = " + cfReason + " serviceClass = " + serviceClass);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "queryCallForwardStatus", () -> {
+ voiceProxy.getCallForwardStatus(rr.mSerial, cfReason, serviceClass, number);
+ });
}
@Override
public void setCallForward(int action, int cfReason, int serviceClass, String number,
int timeSeconds, Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_CALL_FORWARD, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " action = " + action + " cfReason = " + cfReason + " serviceClass = "
- + serviceClass + " timeSeconds = " + timeSeconds);
- }
-
- try {
- voiceProxy.setCallForward(
- rr.mSerial, action, cfReason, serviceClass, number, timeSeconds);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "setCallForward", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_CALL_FORWARD, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " action = " + action + " cfReason = " + cfReason + " serviceClass = "
+ + serviceClass + " timeSeconds = " + timeSeconds);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "setCallForward", () -> {
+ voiceProxy.setCallForward(
+ rr.mSerial, action, cfReason, serviceClass, number, timeSeconds);
+ });
}
@Override
public void queryCallWaiting(int serviceClass, Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_QUERY_CALL_WAITING, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " serviceClass = " + serviceClass);
- }
-
- try {
- voiceProxy.getCallWaiting(rr.mSerial, serviceClass);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "getCallWaiting", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_QUERY_CALL_WAITING, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " serviceClass = " + serviceClass);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "queryCallWaiting", () -> {
+ voiceProxy.getCallWaiting(rr.mSerial, serviceClass);
+ });
}
@Override
public void setCallWaiting(boolean enable, int serviceClass, Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_CALL_WAITING, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " enable = " + enable + " serviceClass = " + serviceClass);
- }
-
- try {
- voiceProxy.setCallWaiting(rr.mSerial, enable, serviceClass);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "setCallWaiting", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_CALL_WAITING, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " enable = " + enable + " serviceClass = " + serviceClass);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "setCallWaiting", () -> {
+ voiceProxy.setCallWaiting(rr.mSerial, enable, serviceClass);
+ });
}
@Override
public void acknowledgeLastIncomingGsmSms(boolean success, int cause, Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SMS_ACKNOWLEDGE, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " success = " + success + " cause = " + cause);
- }
-
- try {
- messagingProxy.acknowledgeLastIncomingGsmSms(rr.mSerial, success, cause);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING,
- "acknowledgeLastIncomingGsmSms", e);
- }
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SMS_ACKNOWLEDGE, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " success = " + success + " cause = " + cause);
+ }
+
+ radioServiceInvokeHelper(
+ HAL_SERVICE_MESSAGING, rr, "acknowledgeLastIncomingGsmSms", () -> {
+ messagingProxy.acknowledgeLastIncomingGsmSms(rr.mSerial, success, cause);
+ });
}
@Override
public void acceptCall(Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_ANSWER, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.acceptCall(rr.mSerial);
- mMetrics.writeRilAnswer(mPhoneId, rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "acceptCall", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_ANSWER, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "acceptCall", () -> {
+ voiceProxy.acceptCall(rr.mSerial);
+ mMetrics.writeRilAnswer(mPhoneId, rr.mSerial);
+ });
}
@Override
public void deactivateDataCall(int cid, int reason, Message result) {
- RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class, result);
- if (!dataProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_DEACTIVATE_DATA_CALL, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " cid = " + cid + " reason = "
- + RILUtils.deactivateDataReasonToString(reason));
- }
-
- try {
- dataProxy.deactivateDataCall(rr.mSerial, cid, reason);
- mMetrics.writeRilDeactivateDataCall(mPhoneId, rr.mSerial, cid, reason);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_DATA, "deactivateDataCall", e);
- }
+ RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class);
+ if (dataProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(dataProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_DEACTIVATE_DATA_CALL, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " cid = " + cid + " reason = "
+ + RILUtils.deactivateDataReasonToString(reason));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_DATA, rr, "deactivateDataCall", () -> {
+ dataProxy.deactivateDataCall(rr.mSerial, cid, reason);
+ mMetrics.writeRilDeactivateDataCall(mPhoneId, rr.mSerial, cid, reason);
+ });
}
@Override
@@ -2455,26 +2515,28 @@
@Override
public void queryFacilityLockForApp(String facility, String password, int serviceClass,
String appId, Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_QUERY_FACILITY_LOCK, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " facility = " + facility + " serviceClass = " + serviceClass
- + " appId = " + appId);
- }
-
- try {
- simProxy.getFacilityLockForApp(rr.mSerial,
- RILUtils.convertNullToEmptyString(facility),
- RILUtils.convertNullToEmptyString(password),
- serviceClass, RILUtils.convertNullToEmptyString(appId));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "getFacilityLockForApp", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_QUERY_FACILITY_LOCK, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " facility = " + facility + " serviceClass = " + serviceClass
+ + " appId = " + appId);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "queryFacilityLockForApp", () -> {
+ simProxy.getFacilityLockForApp(rr.mSerial,
+ RILUtils.convertNullToEmptyString(facility),
+ RILUtils.convertNullToEmptyString(password),
+ serviceClass, RILUtils.convertNullToEmptyString(appId));
+ });
+
}
@Override
@@ -2486,131 +2548,135 @@
@Override
public void setFacilityLockForApp(String facility, boolean lockState, String password,
int serviceClass, String appId, Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_FACILITY_LOCK, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " facility = " + facility + " lockstate = " + lockState
- + " serviceClass = " + serviceClass + " appId = " + appId);
- }
-
- try {
- simProxy.setFacilityLockForApp(rr.mSerial,
- RILUtils.convertNullToEmptyString(facility), lockState,
- RILUtils.convertNullToEmptyString(password), serviceClass,
- RILUtils.convertNullToEmptyString(appId));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "setFacilityLockForApp", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_FACILITY_LOCK, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " facility = " + facility + " lockstate = " + lockState
+ + " serviceClass = " + serviceClass + " appId = " + appId);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "setFacilityLockForApp", () -> {
+ simProxy.setFacilityLockForApp(rr.mSerial,
+ RILUtils.convertNullToEmptyString(facility), lockState,
+ RILUtils.convertNullToEmptyString(password), serviceClass,
+ RILUtils.convertNullToEmptyString(appId));
+ });
}
@Override
public void changeBarringPassword(String facility, String oldPwd, String newPwd,
Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CHANGE_BARRING_PASSWORD, result,
- mRILDefaultWorkSource);
-
- // Do not log all function args for privacy
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + "facility = " + facility);
- }
-
- try {
- networkProxy.setBarringPassword(rr.mSerial,
- RILUtils.convertNullToEmptyString(facility),
- RILUtils.convertNullToEmptyString(oldPwd),
- RILUtils.convertNullToEmptyString(newPwd));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "changeBarringPassword", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_CHANGE_BARRING_PASSWORD, result,
+ mRILDefaultWorkSource);
+
+ // Do not log all function args for privacy
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + "facility = " + facility);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "changeBarringPassword", () -> {
+ networkProxy.setBarringPassword(rr.mSerial,
+ RILUtils.convertNullToEmptyString(facility),
+ RILUtils.convertNullToEmptyString(oldPwd),
+ RILUtils.convertNullToEmptyString(newPwd));
+ });
}
@Override
public void getNetworkSelectionMode(Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- networkProxy.getNetworkSelectionMode(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "getNetworkSelectionMode", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "getNetworkSelectionMode", () -> {
+ networkProxy.getNetworkSelectionMode(rr.mSerial);
+ });
}
@Override
public void setNetworkSelectionModeAutomatic(Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- networkProxy.setNetworkSelectionModeAutomatic(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(
- HAL_SERVICE_NETWORK, "setNetworkSelectionModeAutomatic", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(
+ HAL_SERVICE_NETWORK, rr, "setNetworkSelectionModeAutomatic", () -> {
+ networkProxy.setNetworkSelectionModeAutomatic(rr.mSerial);
+ });
}
@Override
public void setNetworkSelectionModeManual(String operatorNumeric, int ran, Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " operatorNumeric = " + operatorNumeric + ", ran = " + ran);
- }
-
- try {
- networkProxy.setNetworkSelectionModeManual(rr.mSerial,
- RILUtils.convertNullToEmptyString(operatorNumeric), ran);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK,
- "setNetworkSelectionModeManual", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " operatorNumeric = " + operatorNumeric + ", ran = " + ran);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "setNetworkSelectionModeManual", () -> {
+ networkProxy.setNetworkSelectionModeManual(rr.mSerial,
+ RILUtils.convertNullToEmptyString(operatorNumeric), ran);
+ });
}
@Override
public void getAvailableNetworks(Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_QUERY_AVAILABLE_NETWORKS, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- networkProxy.getAvailableNetworks(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "getAvailableNetworks", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_QUERY_AVAILABLE_NETWORKS, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "getAvailableNetworks", () -> {
+ networkProxy.getAvailableNetworks(rr.mSerial);
+ });
}
/**
@@ -2621,8 +2687,11 @@
*/
@Override
public void startNetworkScan(NetworkScanRequest networkScanRequest, Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (networkProxy.isEmpty()) return;
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_NETWORK).greaterOrEqual(RADIO_HAL_VERSION_1_1)) {
HalVersion overrideHalVersion = getCompatVersion(RIL_REQUEST_START_NETWORK_SCAN);
if (RILJ_LOGD) {
@@ -2636,12 +2705,10 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "startNetworkScan", () -> {
networkProxy.startNetworkScan(rr.mSerial, networkScanRequest, overrideHalVersion,
result);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "startNetworkScan", e);
- }
+ });
} else {
if (RILJ_LOGD) Rlog.d(RILJ_LOG_TAG, "startNetworkScan: REQUEST_NOT_SUPPORTED");
if (result != null) {
@@ -2654,8 +2721,11 @@
@Override
public void stopNetworkScan(Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (networkProxy.isEmpty()) return;
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_NETWORK).greaterOrEqual(RADIO_HAL_VERSION_1_1)) {
RILRequest rr = obtainRequest(RIL_REQUEST_STOP_NETWORK_SCAN, result,
mRILDefaultWorkSource);
@@ -2664,11 +2734,9 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "stopNetworkScan", () -> {
networkProxy.stopNetworkScan(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "stopNetworkScan", e);
- }
+ });
} else {
if (RILJ_LOGD) Rlog.d(RILJ_LOG_TAG, "stopNetworkScan: REQUEST_NOT_SUPPORTED");
if (result != null) {
@@ -2681,133 +2749,139 @@
@Override
public void startDtmf(char c, Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_DTMF_START, result, mRILDefaultWorkSource);
-
- // Do not log function arg for privacy
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.startDtmf(rr.mSerial, c + "");
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "startDtmf", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_DTMF_START, result, mRILDefaultWorkSource);
+
+ // Do not log function arg for privacy
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "startDtmf", () -> {
+ voiceProxy.startDtmf(rr.mSerial, c + "");
+ });
}
@Override
public void stopDtmf(Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_DTMF_STOP, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.stopDtmf(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "stopDtmf", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_DTMF_STOP, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "stopDtmf", () -> {
+ voiceProxy.stopDtmf(rr.mSerial);
+ });
}
@Override
public void separateConnection(int gsmIndex, Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SEPARATE_CONNECTION, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " gsmIndex = " + gsmIndex);
- }
-
- try {
- voiceProxy.separateConnection(rr.mSerial, gsmIndex);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "separateConnection", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SEPARATE_CONNECTION, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " gsmIndex = " + gsmIndex);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "separateConnection", () -> {
+ voiceProxy.separateConnection(rr.mSerial, gsmIndex);
+ });
}
@Override
public void getBasebandVersion(Message result) {
- RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class, result);
- if (!modemProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_BASEBAND_VERSION, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- modemProxy.getBasebandVersion(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MODEM, "getBasebandVersion", e);
- }
+ RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class);
+ if (modemProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(modemProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_BASEBAND_VERSION, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MODEM, rr, "getBasebandVersion", () -> {
+ modemProxy.getBasebandVersion(rr.mSerial);
+ });
}
@Override
public void setMute(boolean enableMute, Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_MUTE, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " enableMute = " + enableMute);
- }
-
- try {
- voiceProxy.setMute(rr.mSerial, enableMute);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "setMute", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_MUTE, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " enableMute = " + enableMute);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "setMute", () -> {
+ voiceProxy.setMute(rr.mSerial, enableMute);
+ });
}
@Override
public void getMute(Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_GET_MUTE, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.getMute(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "getMute", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_GET_MUTE, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "getMute", () -> {
+ voiceProxy.getMute(rr.mSerial);
+ });
}
@Override
public void queryCLIP(Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_QUERY_CLIP, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.getClip(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "getClip", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_QUERY_CLIP, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "queryCLIP", () -> {
+ voiceProxy.getClip(rr.mSerial);
+ });
}
/**
@@ -2821,21 +2895,21 @@
@Override
public void getDataCallList(Message result) {
- RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class, result);
- if (!dataProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_DATA_CALL_LIST, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- dataProxy.getDataCallList(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_DATA, "getDataCallList", e);
- }
+ RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class);
+ if (dataProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(dataProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_DATA_CALL_LIST, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_DATA, rr, "getDataCallList", () -> {
+ dataProxy.getDataCallList(rr.mSerial);
+ });
}
// TODO(b/171260715) Remove when HAL definition is removed
@@ -2851,296 +2925,304 @@
@Override
public void setSuppServiceNotifications(boolean enable, Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " enable = " + enable);
- }
-
- try {
- networkProxy.setSuppServiceNotifications(rr.mSerial, enable);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK,
- "setSuppServiceNotifications", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " enable = " + enable);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "setSuppServiceNotifications", () -> {
+ networkProxy.setSuppServiceNotifications(rr.mSerial, enable);
+ });
}
@Override
public void writeSmsToSim(int status, String smsc, String pdu, Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_WRITE_SMS_TO_SIM, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGV) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " " + status);
- }
-
- try {
- messagingProxy.writeSmsToSim(rr.mSerial, status,
- RILUtils.convertNullToEmptyString(smsc),
- RILUtils.convertNullToEmptyString(pdu));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING, "writeSmsToSim", e);
- }
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_WRITE_SMS_TO_SIM, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGV) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " " + status);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MESSAGING, rr, "writeSmsToSim", () -> {
+ messagingProxy.writeSmsToSim(rr.mSerial, status,
+ RILUtils.convertNullToEmptyString(smsc),
+ RILUtils.convertNullToEmptyString(pdu));
+ });
}
@Override
public void deleteSmsOnSim(int index, Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_DELETE_SMS_ON_SIM, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGV) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " index = " + index);
- }
-
- try {
- messagingProxy.deleteSmsOnSim(rr.mSerial, index);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING, "deleteSmsOnSim", e);
- }
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_DELETE_SMS_ON_SIM, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGV) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " index = " + index);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MESSAGING, rr, "deleteSmsOnSim", () -> {
+ messagingProxy.deleteSmsOnSim(rr.mSerial, index);
+ });
}
@Override
public void setBandMode(int bandMode, Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_BAND_MODE, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " bandMode = " + bandMode);
- }
-
- try {
- networkProxy.setBandMode(rr.mSerial, bandMode);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "setBandMode", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_BAND_MODE, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " bandMode = " + bandMode);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "setBandMode", () -> {
+ networkProxy.setBandMode(rr.mSerial, bandMode);
+ });
}
@Override
public void queryAvailableBandMode(Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- networkProxy.getAvailableBandModes(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "queryAvailableBandMode", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "queryAvailableBandMode", () -> {
+ networkProxy.getAvailableBandModes(rr.mSerial);
+ });
}
@Override
public void sendEnvelope(String contents, Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " contents = " + contents);
- }
-
- try {
- simProxy.sendEnvelope(rr.mSerial, RILUtils.convertNullToEmptyString(contents));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "sendEnvelope", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " contents = " + contents);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "sendEnvelope", () -> {
+ simProxy.sendEnvelope(rr.mSerial, RILUtils.convertNullToEmptyString(contents));
+ });
}
@Override
public void sendTerminalResponse(String contents, Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " contents = " + (TelephonyUtils.IS_DEBUGGABLE
- ? contents : RILUtils.convertToCensoredTerminalResponse(contents)));
- }
-
- try {
- simProxy.sendTerminalResponseToSim(rr.mSerial,
- RILUtils.convertNullToEmptyString(contents));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "sendTerminalResponse", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " contents = " + (TelephonyUtils.IS_DEBUGGABLE
+ ? contents : RILUtils.convertToCensoredTerminalResponse(contents)));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "sendTerminalResponse", () -> {
+ simProxy.sendTerminalResponseToSim(rr.mSerial,
+ RILUtils.convertNullToEmptyString(contents));
+ });
}
@Override
public void sendEnvelopeWithStatus(String contents, Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " contents = " + contents);
- }
-
- try {
- simProxy.sendEnvelopeWithStatus(rr.mSerial,
- RILUtils.convertNullToEmptyString(contents));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "sendEnvelopeWithStatus", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " contents = " + contents);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "sendEnvelopeWithStatus", () -> {
+ simProxy.sendEnvelopeWithStatus(rr.mSerial,
+ RILUtils.convertNullToEmptyString(contents));
+ });
}
@Override
public void explicitCallTransfer(Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_EXPLICIT_CALL_TRANSFER, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.explicitCallTransfer(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "explicitCallTransfer", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_EXPLICIT_CALL_TRANSFER, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "explicitCallTransfer", () -> {
+ voiceProxy.explicitCallTransfer(rr.mSerial);
+ });
}
@Override
public void setPreferredNetworkType(@PrefNetworkMode int networkType , Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " networkType = " + networkType);
- }
- mAllowedNetworkTypesBitmask = RadioAccessFamily.getRafFromNetworkType(networkType);
- mMetrics.writeSetPreferredNetworkType(mPhoneId, networkType);
-
- try {
- networkProxy.setPreferredNetworkTypeBitmap(rr.mSerial, mAllowedNetworkTypesBitmask);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "setPreferredNetworkType", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " networkType = " + networkType);
+ }
+ mAllowedNetworkTypesBitmask = RadioAccessFamily.getRafFromNetworkType(networkType);
+ mMetrics.writeSetPreferredNetworkType(mPhoneId, networkType);
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "setPreferredNetworkType", () -> {
+ networkProxy.setPreferredNetworkTypeBitmap(rr.mSerial, mAllowedNetworkTypesBitmask);
+ });
}
@Override
public void getPreferredNetworkType(Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- networkProxy.getAllowedNetworkTypesBitmap(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "getPreferredNetworkType", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "getPreferredNetworkType", () -> {
+ networkProxy.getAllowedNetworkTypesBitmap(rr.mSerial);
+ });
}
@Override
public void setAllowedNetworkTypesBitmap(
@TelephonyManager.NetworkTypeBitMask int networkTypeBitmask, Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- if (mHalVersion.get(HAL_SERVICE_NETWORK).less(RADIO_HAL_VERSION_1_6)) {
- // For older HAL, redirects the call to setPreferredNetworkType.
- setPreferredNetworkType(
- RadioAccessFamily.getNetworkTypeFromRaf(networkTypeBitmask), result);
- return;
- }
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_ALLOWED_NETWORK_TYPES_BITMAP, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
- mAllowedNetworkTypesBitmask = networkTypeBitmask;
-
- try {
- networkProxy.setAllowedNetworkTypesBitmap(rr.mSerial, mAllowedNetworkTypesBitmask);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK,
- "setAllowedNetworkTypeBitmask", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+ if (mHalVersion.get(HAL_SERVICE_NETWORK).less(RADIO_HAL_VERSION_1_6)) {
+ // For older HAL, redirects the call to setPreferredNetworkType.
+ setPreferredNetworkType(
+ RadioAccessFamily.getNetworkTypeFromRaf(networkTypeBitmask), result);
+ return;
+ }
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_ALLOWED_NETWORK_TYPES_BITMAP, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+ mAllowedNetworkTypesBitmask = networkTypeBitmask;
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "setAllowedNetworkTypesBitmap", () -> {
+ networkProxy.setAllowedNetworkTypesBitmap(rr.mSerial, mAllowedNetworkTypesBitmask);
+ });
}
@Override
public void getAllowedNetworkTypesBitmap(Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_GET_ALLOWED_NETWORK_TYPES_BITMAP, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- networkProxy.getAllowedNetworkTypesBitmap(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK,
- "getAllowedNetworkTypeBitmask", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_GET_ALLOWED_NETWORK_TYPES_BITMAP, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "getAllowedNetworkTypesBitmap", () -> {
+ networkProxy.getAllowedNetworkTypesBitmap(rr.mSerial);
+ });
}
@Override
public void setLocationUpdates(boolean enable, WorkSource workSource, Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_LOCATION_UPDATES, result,
- getDefaultWorkSourceIfInvalid(workSource));
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " enable = " + enable);
- }
-
- try {
- networkProxy.setLocationUpdates(rr.mSerial, enable);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "setLocationUpdates", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_LOCATION_UPDATES, result,
+ getDefaultWorkSourceIfInvalid(workSource));
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " enable = " + enable);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "setLocationUpdates", () -> {
+ networkProxy.setLocationUpdates(rr.mSerial, enable);
+ });
}
/**
@@ -3148,8 +3230,11 @@
*/
@Override
public void isNrDualConnectivityEnabled(Message result, WorkSource workSource) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (networkProxy.isEmpty()) return;
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_NETWORK).greaterOrEqual(RADIO_HAL_VERSION_1_6)) {
RILRequest rr = obtainRequest(RIL_REQUEST_IS_NR_DUAL_CONNECTIVITY_ENABLED, result,
getDefaultWorkSourceIfInvalid(workSource));
@@ -3158,12 +3243,9 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "isNrDualConnectivityEnabled", () -> {
networkProxy.isNrDualConnectivityEnabled(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK,
- "isNrDualConnectivityEnabled", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "isNrDualConnectivityEnabled: REQUEST_NOT_SUPPORTED");
@@ -3190,8 +3272,11 @@
@Override
public void setNrDualConnectivityState(int nrDualConnectivityState, Message result,
WorkSource workSource) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (networkProxy.isEmpty()) return;
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_NETWORK).greaterOrEqual(RADIO_HAL_VERSION_1_6)) {
RILRequest rr = obtainRequest(RIL_REQUEST_ENABLE_NR_DUAL_CONNECTIVITY, result,
getDefaultWorkSourceIfInvalid(workSource));
@@ -3201,11 +3286,9 @@
+ " enable = " + nrDualConnectivityState);
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "setNrDualConnectivityState", () -> {
networkProxy.setNrDualConnectivityState(rr.mSerial, (byte) nrDualConnectivityState);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "enableNrDualConnectivity", e);
- }
+ });
} else {
if (RILJ_LOGD) Rlog.d(RILJ_LOG_TAG, "enableNrDualConnectivity: REQUEST_NOT_SUPPORTED");
if (result != null) {
@@ -3229,23 +3312,22 @@
*/
@Override
public void isVoNrEnabled(Message result, WorkSource workSource) {
-
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_VOICE).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_IS_VONR_ENABLED , result,
- getDefaultWorkSourceIfInvalid(workSource));
+ RILRequest rr = obtainRequest(RIL_REQUEST_IS_VONR_ENABLED, result,
+ getDefaultWorkSourceIfInvalid(workSource));
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.isVoNrEnabled(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "isVoNrEnabled", e);
- }
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "isVoNrEnabled", () -> {
+ voiceProxy.isVoNrEnabled(rr.mSerial);
+ });
} else {
boolean isEnabled = isVoNrEnabled();
if (result != null) {
@@ -3262,23 +3344,22 @@
@Override
public void setVoNrEnabled(boolean enabled, Message result, WorkSource workSource) {
setVoNrEnabled(enabled);
-
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_VOICE).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_ENABLE_VONR, result,
- getDefaultWorkSourceIfInvalid(workSource));
+ RILRequest rr = obtainRequest(RIL_REQUEST_ENABLE_VONR, result,
+ getDefaultWorkSourceIfInvalid(workSource));
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.setVoNrEnabled(rr.mSerial, enabled);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "setVoNrEnabled", e);
- }
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "setVoNrEnabled", () -> {
+ voiceProxy.setVoNrEnabled(rr.mSerial, enabled);
+ });
} else {
/* calling a query api to let HAL know that VoNREnabled state is updated.
This is a work around as new AIDL API is not allowed for older HAL version devices.
@@ -3295,469 +3376,488 @@
@Override
public void setCdmaSubscriptionSource(int cdmaSubscription, Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " cdmaSubscription = " + cdmaSubscription);
- }
-
- try {
- simProxy.setCdmaSubscriptionSource(rr.mSerial, cdmaSubscription);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "setCdmaSubscriptionSource", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " cdmaSubscription = " + cdmaSubscription);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "setCdmaSubscriptionSource", () -> {
+ simProxy.setCdmaSubscriptionSource(rr.mSerial, cdmaSubscription);
+ });
}
@Override
public void queryCdmaRoamingPreference(Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- networkProxy.getCdmaRoamingPreference(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK,
- "queryCdmaRoamingPreference", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "queryCdmaRoamingPreference", () -> {
+ networkProxy.getCdmaRoamingPreference(rr.mSerial);
+ });
}
@Override
public void setCdmaRoamingPreference(int cdmaRoamingType, Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " cdmaRoamingType = " + cdmaRoamingType);
- }
-
- try {
- networkProxy.setCdmaRoamingPreference(rr.mSerial, cdmaRoamingType);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "setCdmaRoamingPreference", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " cdmaRoamingType = " + cdmaRoamingType);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "setCdmaRoamingPreference", () -> {
+ networkProxy.setCdmaRoamingPreference(rr.mSerial, cdmaRoamingType);
+ });
}
@Override
public void queryTTYMode(Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_QUERY_TTY_MODE, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.getTtyMode(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "getTtyMode", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_QUERY_TTY_MODE, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "queryTTYMode", () -> {
+ voiceProxy.getTtyMode(rr.mSerial);
+ });
}
@Override
public void setTTYMode(int ttyMode, Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_TTY_MODE, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " ttyMode = " + ttyMode);
- }
-
- try {
- voiceProxy.setTtyMode(rr.mSerial, ttyMode);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "setTtyMode", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_TTY_MODE, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " ttyMode = " + ttyMode);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "setTTYMode", () -> {
+ voiceProxy.setTtyMode(rr.mSerial, ttyMode);
+ });
}
@Override
public void setPreferredVoicePrivacy(boolean enable, Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " enable = " + enable);
- }
-
- try {
- voiceProxy.setPreferredVoicePrivacy(rr.mSerial, enable);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "setPreferredVoicePrivacy", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " enable = " + enable);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "setPreferredVoicePrivacy", () -> {
+ voiceProxy.setPreferredVoicePrivacy(rr.mSerial, enable);
+ });
}
@Override
public void getPreferredVoicePrivacy(Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE,
- result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.getPreferredVoicePrivacy(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "getPreferredVoicePrivacy", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE,
+ result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "getPreferredVoicePrivacy", () -> {
+ voiceProxy.getPreferredVoicePrivacy(rr.mSerial);
+ });
}
@Override
public void sendCDMAFeatureCode(String featureCode, Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_FLASH, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " featureCode = " + Rlog.pii(RILJ_LOG_TAG, featureCode));
- }
-
- try {
- voiceProxy.sendCdmaFeatureCode(rr.mSerial,
- RILUtils.convertNullToEmptyString(featureCode));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "sendCdmaFeatureCode", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_FLASH, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " featureCode = " + Rlog.pii(RILJ_LOG_TAG, featureCode));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "sendCDMAFeatureCode", () -> {
+ voiceProxy.sendCdmaFeatureCode(rr.mSerial,
+ RILUtils.convertNullToEmptyString(featureCode));
+ });
}
@Override
public void sendBurstDtmf(String dtmfString, int on, int off, Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_BURST_DTMF, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " dtmfString = " + dtmfString + " on = " + on + " off = " + off);
- }
-
- try {
- voiceProxy.sendBurstDtmf(rr.mSerial, RILUtils.convertNullToEmptyString(dtmfString),
- on, off);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "sendBurstDtmf", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_BURST_DTMF, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " dtmfString = " + dtmfString + " on = " + on + " off = " + off);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "sendBurstDtmf", () -> {
+ voiceProxy.sendBurstDtmf(rr.mSerial, RILUtils.convertNullToEmptyString(dtmfString),
+ on, off);
+ });
}
@Override
public void sendCdmaSMSExpectMore(byte[] pdu, Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_SEND_SMS_EXPECT_MORE, result,
- mRILDefaultWorkSource);
-
- // Do not log function arg for privacy
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- messagingProxy.sendCdmaSmsExpectMore(rr.mSerial, pdu);
- if (mHalVersion.get(HAL_SERVICE_MESSAGING).greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
- mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_CDMA,
- SmsSession.Event.Format.SMS_FORMAT_3GPP2,
- getOutgoingSmsMessageId(result));
- }
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING, "sendCdmaSMSExpectMore", e);
- }
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_SEND_SMS_EXPECT_MORE, result,
+ mRILDefaultWorkSource);
+
+ // Do not log function arg for privacy
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MESSAGING, rr, "sendCdmaSMSExpectMore", () -> {
+ messagingProxy.sendCdmaSmsExpectMore(rr.mSerial, pdu);
+ if (mHalVersion.get(HAL_SERVICE_MESSAGING).greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
+ mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_CDMA,
+ SmsSession.Event.Format.SMS_FORMAT_3GPP2,
+ getOutgoingSmsMessageId(result));
+ }
+ });
}
@Override
public void sendCdmaSms(byte[] pdu, Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_SEND_SMS, result, mRILDefaultWorkSource);
-
- // Do not log function arg for privacy
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- messagingProxy.sendCdmaSms(rr.mSerial, pdu);
- mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_CDMA,
- SmsSession.Event.Format.SMS_FORMAT_3GPP2, getOutgoingSmsMessageId(result));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING, "sendCdmaSms", e);
- }
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_SEND_SMS, result, mRILDefaultWorkSource);
+
+ // Do not log function arg for privacy
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MESSAGING, rr, "sendCdmaSms", () -> {
+ messagingProxy.sendCdmaSms(rr.mSerial, pdu);
+ mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_CDMA,
+ SmsSession.Event.Format.SMS_FORMAT_3GPP2, getOutgoingSmsMessageId(result));
+ });
}
@Override
public void acknowledgeLastIncomingCdmaSms(boolean success, int cause, Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " success = " + success + " cause = " + cause);
- }
-
- try {
- messagingProxy.acknowledgeLastIncomingCdmaSms(rr.mSerial, success, cause);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING,
- "acknowledgeLastIncomingCdmaSms", e);
- }
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " success = " + success + " cause = " + cause);
+ }
+
+ radioServiceInvokeHelper(
+ HAL_SERVICE_MESSAGING, rr, "acknowledgeLastIncomingCdmaSms", () -> {
+ messagingProxy.acknowledgeLastIncomingCdmaSms(rr.mSerial, success, cause);
+ });
}
@Override
public void getGsmBroadcastConfig(Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_GSM_GET_BROADCAST_CONFIG, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- messagingProxy.getGsmBroadcastConfig(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING, "getGsmBroadcastConfig", e);
- }
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_GSM_GET_BROADCAST_CONFIG, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MESSAGING, rr, "getGsmBroadcastConfig", () -> {
+ messagingProxy.getGsmBroadcastConfig(rr.mSerial);
+ });
}
@Override
public void setGsmBroadcastConfig(SmsBroadcastConfigInfo[] config, Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_GSM_SET_BROADCAST_CONFIG, result,
- mRILDefaultWorkSource);
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
+ }
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " with " + config.length + " configs : ");
- for (int i = 0; i < config.length; i++) {
- riljLog(config[i].toString());
- }
- }
+ RILRequest rr = obtainRequest(RIL_REQUEST_GSM_SET_BROADCAST_CONFIG, result,
+ mRILDefaultWorkSource);
- try {
- messagingProxy.setGsmBroadcastConfig(rr.mSerial, config);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING, "setGsmBroadcastConfig", e);
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " with " + config.length + " configs : ");
+ for (int i = 0; i < config.length; i++) {
+ riljLog(config[i].toString());
}
}
+
+ radioServiceInvokeHelper(HAL_SERVICE_MESSAGING, rr, "setGsmBroadcastConfig", () -> {
+ messagingProxy.setGsmBroadcastConfig(rr.mSerial, config);
+ });
}
@Override
public void setGsmBroadcastActivation(boolean activate, Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_GSM_BROADCAST_ACTIVATION, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " activate = " + activate);
- }
-
- try {
- messagingProxy.setGsmBroadcastActivation(rr.mSerial, activate);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING,
- "setGsmBroadcastActivation", e);
- }
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_GSM_BROADCAST_ACTIVATION, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " activate = " + activate);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MESSAGING, rr, "setGsmBroadcastActivation", () -> {
+ messagingProxy.setGsmBroadcastActivation(rr.mSerial, activate);
+ });
}
@Override
public void getCdmaBroadcastConfig(Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_GET_BROADCAST_CONFIG, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- messagingProxy.getCdmaBroadcastConfig(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING, "getCdmaBroadcastConfig", e);
- }
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_GET_BROADCAST_CONFIG, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MESSAGING, rr, "getCdmaBroadcastConfig", () -> {
+ messagingProxy.getCdmaBroadcastConfig(rr.mSerial);
+ });
}
@Override
public void setCdmaBroadcastConfig(CdmaSmsBroadcastConfigInfo[] configs, Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_SET_BROADCAST_CONFIG, result,
- mRILDefaultWorkSource);
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
+ }
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " with " + configs.length + " configs : ");
- for (CdmaSmsBroadcastConfigInfo config : configs) {
- riljLog(config.toString());
- }
- }
+ RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_SET_BROADCAST_CONFIG, result,
+ mRILDefaultWorkSource);
- try {
- messagingProxy.setCdmaBroadcastConfig(rr.mSerial, configs);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING, "setCdmaBroadcastConfig", e);
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " with " + configs.length + " configs : ");
+ for (CdmaSmsBroadcastConfigInfo config : configs) {
+ riljLog(config.toString());
}
}
+
+ radioServiceInvokeHelper(HAL_SERVICE_MESSAGING, rr, "setCdmaBroadcastConfig", () -> {
+ messagingProxy.setCdmaBroadcastConfig(rr.mSerial, configs);
+ });
}
@Override
public void setCdmaBroadcastActivation(boolean activate, Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_BROADCAST_ACTIVATION, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " activate = " + activate);
- }
-
- try {
- messagingProxy.setCdmaBroadcastActivation(rr.mSerial, activate);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING,
- "setCdmaBroadcastActivation", e);
- }
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_BROADCAST_ACTIVATION, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " activate = " + activate);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MESSAGING, rr, "setCdmaBroadcastActivation", () -> {
+ messagingProxy.setCdmaBroadcastActivation(rr.mSerial, activate);
+ });
}
@Override
public void getCDMASubscription(Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_SUBSCRIPTION, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- simProxy.getCdmaSubscription(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "getCdmaSubscription", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_SUBSCRIPTION, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "getCDMASubscription", () -> {
+ simProxy.getCdmaSubscription(rr.mSerial);
+ });
}
@Override
public void writeSmsToRuim(int status, byte[] pdu, Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGV) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " status = " + status);
- }
-
- try {
- messagingProxy.writeSmsToRuim(rr.mSerial, status, pdu);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING, "writeSmsToRuim", e);
- }
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGV) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " status = " + status);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MESSAGING, rr, "writeSmsToRuim", () -> {
+ messagingProxy.writeSmsToRuim(rr.mSerial, status, pdu);
+ });
}
@Override
public void deleteSmsOnRuim(int index, Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGV) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " index = " + index);
- }
-
- try {
- messagingProxy.deleteSmsOnRuim(rr.mSerial, index);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING, "deleteSmsOnRuim", e);
- }
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGV) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " index = " + index);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MESSAGING, rr, "deleteSmsOnRuim", () -> {
+ messagingProxy.deleteSmsOnRuim(rr.mSerial, index);
+ });
}
@Override
public void getDeviceIdentity(Message result) {
- RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class, result);
- if (!modemProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_DEVICE_IDENTITY, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- modemProxy.getDeviceIdentity(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MODEM, "getDeviceIdentity", e);
- }
+ RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class);
+ if (modemProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(modemProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_DEVICE_IDENTITY, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MODEM, rr, "getDeviceIdentity", () -> {
+ modemProxy.getDeviceIdentity(rr.mSerial);
+ });
}
@Override
public void getImei(Message result) {
- RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class, result);
- if (!modemProxy.isEmpty() &&
- mHalVersion.get(HAL_SERVICE_MODEM).greaterOrEqual(RADIO_HAL_VERSION_2_1)) {
+ RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class);
+ if (modemProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(modemProxy, result);
+ return;
+ }
+ if (mHalVersion.get(HAL_SERVICE_MODEM).greaterOrEqual(RADIO_HAL_VERSION_2_1)) {
RILRequest rr = obtainRequest(RIL_REQUEST_DEVICE_IMEI, result,
mRILDefaultWorkSource);
@@ -3765,12 +3865,10 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_MODEM, rr, "getImei", () -> {
modemProxy.getImei(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MODEM, "getImei", e);
- }
- } else {
+ });
+ } else {
if (RILJ_LOGD) {
Rlog.e(RILJ_LOG_TAG, "getImei: REQUEST_NOT_SUPPORTED");
}
@@ -3784,359 +3882,372 @@
@Override
public void exitEmergencyCallbackMode(Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.exitEmergencyCallbackMode(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_VOICE, "exitEmergencyCallbackMode", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "exitEmergencyCallbackMode", () -> {
+ voiceProxy.exitEmergencyCallbackMode(rr.mSerial);
+ });
}
@Override
public void getSmscAddress(Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_GET_SMSC_ADDRESS, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- messagingProxy.getSmscAddress(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING, "getSmscAddress", e);
- }
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_GET_SMSC_ADDRESS, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MESSAGING, rr, "getSmscAddress", () -> {
+ messagingProxy.getSmscAddress(rr.mSerial);
+ });
}
@Override
public void setSmscAddress(String address, Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_SMSC_ADDRESS, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " address = " + address);
- }
-
- try {
- messagingProxy.setSmscAddress(rr.mSerial,
- RILUtils.convertNullToEmptyString(address));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING, "setSmscAddress", e);
- }
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_SMSC_ADDRESS, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " address = " + address);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MESSAGING, rr, "setSmscAddress", () -> {
+ messagingProxy.setSmscAddress(rr.mSerial,
+ RILUtils.convertNullToEmptyString(address));
+ });
}
@Override
public void reportSmsMemoryStatus(boolean available, Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_REPORT_SMS_MEMORY_STATUS, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " available = " + available);
- }
-
- try {
- messagingProxy.reportSmsMemoryStatus(rr.mSerial, available);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING, "reportSmsMemoryStatus", e);
- }
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_REPORT_SMS_MEMORY_STATUS, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " available = " + available);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MESSAGING, rr, "reportSmsMemoryStatus", () -> {
+ messagingProxy.reportSmsMemoryStatus(rr.mSerial, available);
+ });
}
@Override
public void reportStkServiceIsRunning(Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- simProxy.reportStkServiceIsRunning(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "reportStkServiceIsRunning", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "reportStkServiceIsRunning", () -> {
+ simProxy.reportStkServiceIsRunning(rr.mSerial);
+ });
}
@Override
public void getCdmaSubscriptionSource(Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- simProxy.getCdmaSubscriptionSource(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "getCdmaSubscriptionSource", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "getCdmaSubscriptionSource", () -> {
+ simProxy.getCdmaSubscriptionSource(rr.mSerial);
+ });
}
@Override
public void acknowledgeIncomingGsmSmsWithPdu(boolean success, String ackPdu, Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " success = " + success);
- }
-
- try {
- messagingProxy.acknowledgeIncomingGsmSmsWithPdu(rr.mSerial, success,
- RILUtils.convertNullToEmptyString(ackPdu));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING,
- "acknowledgeIncomingGsmSmsWithPdu", e);
- }
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " success = " + success);
+ }
+
+ radioServiceInvokeHelper(
+ HAL_SERVICE_MESSAGING, rr, "acknowledgeIncomingGsmSmsWithPdu", () -> {
+ messagingProxy.acknowledgeIncomingGsmSmsWithPdu(rr.mSerial, success,
+ RILUtils.convertNullToEmptyString(ackPdu));
+ });
}
@Override
public void getVoiceRadioTechnology(Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_VOICE_RADIO_TECH, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- networkProxy.getVoiceRadioTechnology(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "getVoiceRadioTechnology", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_VOICE_RADIO_TECH, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "getVoiceRadioTechnology", () -> {
+ networkProxy.getVoiceRadioTechnology(rr.mSerial);
+ });
}
@Override
public void getCellInfoList(Message result, WorkSource workSource) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_GET_CELL_INFO_LIST, result,
- getDefaultWorkSourceIfInvalid(workSource));
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- networkProxy.getCellInfoList(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "getCellInfoList", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_GET_CELL_INFO_LIST, result,
+ getDefaultWorkSourceIfInvalid(workSource));
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "getCellInfoList", () -> {
+ networkProxy.getCellInfoList(rr.mSerial);
+ });
}
@Override
public void setCellInfoListRate(int rateInMillis, Message result, WorkSource workSource) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE, result,
- getDefaultWorkSourceIfInvalid(workSource));
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " rateInMillis = " + rateInMillis);
- }
-
- try {
- networkProxy.setCellInfoListRate(rr.mSerial, rateInMillis);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "setCellInfoListRate", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE, result,
+ getDefaultWorkSourceIfInvalid(workSource));
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " rateInMillis = " + rateInMillis);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "setCellInfoListRate", () -> {
+ networkProxy.setCellInfoListRate(rr.mSerial, rateInMillis);
+ });
}
@Override
public void setInitialAttachApn(DataProfile dataProfile, boolean isRoaming, Message result) {
- RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class, result);
- if (!dataProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_INITIAL_ATTACH_APN, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + dataProfile);
- }
-
- try {
- dataProxy.setInitialAttachApn(rr.mSerial, dataProfile, isRoaming);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_DATA, "setInitialAttachApn", e);
- }
+ RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class);
+ if (dataProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(dataProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_INITIAL_ATTACH_APN, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + dataProfile);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_DATA, rr, "setInitialAttachApn", () -> {
+ dataProxy.setInitialAttachApn(rr.mSerial, dataProfile, isRoaming);
+ });
}
@Override
public void getImsRegistrationState(Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_IMS_REGISTRATION_STATE, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- networkProxy.getImsRegistrationState(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "getImsRegistrationState", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_IMS_REGISTRATION_STATE, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "getImsRegistrationState", () -> {
+ networkProxy.getImsRegistrationState(rr.mSerial);
+ });
}
@Override
public void sendImsGsmSms(String smscPdu, String pdu, int retry, int messageRef,
Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_IMS_SEND_SMS, result, mRILDefaultWorkSource);
-
- // Do not log function args for privacy
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- messagingProxy.sendImsSms(rr.mSerial, smscPdu, pdu, null, retry, messageRef);
- mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_IMS,
- SmsSession.Event.Format.SMS_FORMAT_3GPP, getOutgoingSmsMessageId(result));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING, "sendImsGsmSms", e);
- }
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_IMS_SEND_SMS, result, mRILDefaultWorkSource);
+
+ // Do not log function args for privacy
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MESSAGING, rr, "sendImsGsmSms", () -> {
+ messagingProxy.sendImsSms(rr.mSerial, smscPdu, pdu, null, retry, messageRef);
+ mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_IMS,
+ SmsSession.Event.Format.SMS_FORMAT_3GPP, getOutgoingSmsMessageId(result));
+ });
}
@Override
public void sendImsCdmaSms(byte[] pdu, int retry, int messageRef, Message result) {
RadioMessagingProxy messagingProxy =
- getRadioServiceProxy(RadioMessagingProxy.class, result);
- if (!messagingProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_IMS_SEND_SMS, result, mRILDefaultWorkSource);
-
- // Do not log function args for privacy
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- messagingProxy.sendImsSms(rr.mSerial, null, null, pdu, retry, messageRef);
- mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_IMS,
- SmsSession.Event.Format.SMS_FORMAT_3GPP2, getOutgoingSmsMessageId(result));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MESSAGING, "sendImsCdmaSms", e);
- }
+ getRadioServiceProxy(RadioMessagingProxy.class);
+ if (messagingProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(messagingProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_IMS_SEND_SMS, result, mRILDefaultWorkSource);
+
+ // Do not log function args for privacy
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MESSAGING, rr, "sendImsCdmaSms", () -> {
+ messagingProxy.sendImsSms(rr.mSerial, null, null, pdu, retry, messageRef);
+ mMetrics.writeRilSendSms(mPhoneId, rr.mSerial, SmsSession.Event.Tech.SMS_IMS,
+ SmsSession.Event.Format.SMS_FORMAT_3GPP2, getOutgoingSmsMessageId(result));
+ });
}
@Override
public void iccTransmitApduBasicChannel(int cla, int instruction, int p1, int p2, int p3,
String data, Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC, result,
- mRILDefaultWorkSource);
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
+ }
- if (RILJ_LOGD) {
- if (TelephonyUtils.IS_DEBUGGABLE) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + String.format(" cla = 0x%02X ins = 0x%02X", cla, instruction)
- + String.format(" p1 = 0x%02X p2 = 0x%02X p3 = 0x%02X", p1, p2, p3)
- + " data = " + data);
- } else {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
- }
+ RILRequest rr = obtainRequest(RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC, result,
+ mRILDefaultWorkSource);
- try {
- simProxy.iccTransmitApduBasicChannel(
- rr.mSerial, cla, instruction, p1, p2, p3, data);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "iccTransmitApduBasicChannel", e);
+ if (RILJ_LOGD) {
+ if (TelephonyUtils.IS_DEBUGGABLE) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + String.format(" cla = 0x%02X ins = 0x%02X", cla, instruction)
+ + String.format(" p1 = 0x%02X p2 = 0x%02X p3 = 0x%02X", p1, p2, p3)
+ + " data = " + data);
+ } else {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
}
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "iccTransmitApduBasicChannel", () -> {
+ simProxy.iccTransmitApduBasicChannel(
+ rr.mSerial, cla, instruction, p1, p2, p3, data);
+ });
}
@Override
public void iccOpenLogicalChannel(String aid, int p2, Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SIM_OPEN_CHANNEL, result,
- mRILDefaultWorkSource);
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
+ }
- if (RILJ_LOGD) {
- if (TelephonyUtils.IS_DEBUGGABLE) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " aid = " + aid + " p2 = " + p2);
- } else {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
- }
+ RILRequest rr = obtainRequest(RIL_REQUEST_SIM_OPEN_CHANNEL, result, mRILDefaultWorkSource);
- try {
- simProxy.iccOpenLogicalChannel(rr.mSerial, RILUtils.convertNullToEmptyString(aid),
- p2);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "iccOpenLogicalChannel", e);
+ if (RILJ_LOGD) {
+ if (TelephonyUtils.IS_DEBUGGABLE) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " aid = " + aid + " p2 = " + p2);
+ } else {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
}
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "iccOpenLogicalChannel", () -> {
+ simProxy.iccOpenLogicalChannel(rr.mSerial, RILUtils.convertNullToEmptyString(aid),
+ p2);
+ });
}
@Override
public void iccCloseLogicalChannel(int channel, boolean isEs10, Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SIM_CLOSE_CHANNEL, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " channel = " + channel + " isEs10 = " + isEs10);
- }
- try {
- simProxy.iccCloseLogicalChannel(rr.mSerial, channel, isEs10);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "iccCloseLogicalChannel", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SIM_CLOSE_CHANNEL, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " channel = " + channel + " isEs10 = " + isEs10);
+ }
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "iccCloseLogicalChannel", () -> {
+ simProxy.iccCloseLogicalChannel(rr.mSerial, channel, isEs10);
+ });
}
@Override
@@ -4147,135 +4258,139 @@
"Invalid channel in iccTransmitApduLogicalChannel: " + channel);
}
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL, result,
- mRILDefaultWorkSource);
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
+ }
- if (RILJ_LOGD) {
- if (TelephonyUtils.IS_DEBUGGABLE) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + String.format(" channel = %d", channel)
- + String.format(" cla = 0x%02X ins = 0x%02X", cla, instruction)
- + String.format(" p1 = 0x%02X p2 = 0x%02X p3 = 0x%02X", p1, p2, p3)
- + " isEs10Command = " + isEs10Command
- + " data = " + data);
- } else {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
- }
+ RILRequest rr = obtainRequest(RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL, result,
+ mRILDefaultWorkSource);
- try {
- simProxy.iccTransmitApduLogicalChannel(
- rr.mSerial, channel, cla, instruction, p1, p2, p3, data, isEs10Command);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "iccTransmitApduLogicalChannel", e);
+ if (RILJ_LOGD) {
+ if (TelephonyUtils.IS_DEBUGGABLE) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + String.format(" channel = %d", channel)
+ + String.format(" cla = 0x%02X ins = 0x%02X", cla, instruction)
+ + String.format(" p1 = 0x%02X p2 = 0x%02X p3 = 0x%02X", p1, p2, p3)
+ + " isEs10Command = " + isEs10Command
+ + " data = " + data);
+ } else {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
}
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "iccTransmitApduLogicalChannel", () -> {
+ simProxy.iccTransmitApduLogicalChannel(
+ rr.mSerial, channel, cla, instruction, p1, p2, p3, data, isEs10Command);
+ });
}
@Override
public void nvReadItem(int itemID, Message result, WorkSource workSource) {
- RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class, result);
- if (!modemProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_NV_READ_ITEM, result,
- getDefaultWorkSourceIfInvalid(workSource));
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " itemId = " + itemID);
- }
-
- try {
- modemProxy.nvReadItem(rr.mSerial, itemID);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MODEM, "nvReadItem", e);
- }
+ RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class);
+ if (modemProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(modemProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_NV_READ_ITEM, result,
+ getDefaultWorkSourceIfInvalid(workSource));
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " itemId = " + itemID);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MODEM, rr, "nvReadItem", () -> {
+ modemProxy.nvReadItem(rr.mSerial, itemID);
+ });
}
@Override
public void nvWriteItem(int itemId, String itemValue, Message result, WorkSource workSource) {
- RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class, result);
- if (!modemProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_NV_WRITE_ITEM, result,
- getDefaultWorkSourceIfInvalid(workSource));
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " itemId = " + itemId + " itemValue = " + itemValue);
- }
-
- try {
- modemProxy.nvWriteItem(rr.mSerial, itemId,
- RILUtils.convertNullToEmptyString(itemValue));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MODEM, "nvWriteItem", e);
- }
+ RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class);
+ if (modemProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(modemProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_NV_WRITE_ITEM, result,
+ getDefaultWorkSourceIfInvalid(workSource));
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " itemId = " + itemId + " itemValue = " + itemValue);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MODEM, rr, "nvWriteItem", () -> {
+ modemProxy.nvWriteItem(rr.mSerial, itemId,
+ RILUtils.convertNullToEmptyString(itemValue));
+ });
}
@Override
public void nvWriteCdmaPrl(byte[] preferredRoamingList, Message result) {
- RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class, result);
- if (!modemProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_NV_WRITE_CDMA_PRL, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " PreferredRoamingList = 0x"
- + IccUtils.bytesToHexString(preferredRoamingList));
- }
-
- try {
- modemProxy.nvWriteCdmaPrl(rr.mSerial, preferredRoamingList);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MODEM, "nvWriteCdmaPrl", e);
- }
+ RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class);
+ if (modemProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(modemProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_NV_WRITE_CDMA_PRL, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " PreferredRoamingList = 0x"
+ + IccUtils.bytesToHexString(preferredRoamingList));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MODEM, rr, "nvWriteCdmaPrl", () -> {
+ modemProxy.nvWriteCdmaPrl(rr.mSerial, preferredRoamingList);
+ });
}
@Override
public void nvResetConfig(int resetType, Message result) {
- RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class, result);
- if (!modemProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_NV_RESET_CONFIG, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " resetType = " + resetType);
- }
-
- try {
- modemProxy.nvResetConfig(rr.mSerial, resetType);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MODEM, "nvResetConfig", e);
- }
+ RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class);
+ if (modemProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(modemProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_NV_RESET_CONFIG, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " resetType = " + resetType);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MODEM, rr, "nvResetConfig", () -> {
+ modemProxy.nvResetConfig(rr.mSerial, resetType);
+ });
}
@Override
public void setUiccSubscription(int slotId, int appIndex, int subId, int subStatus,
Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_UICC_SUBSCRIPTION, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " slot = " + slotId + " appIndex = " + appIndex
- + " subId = " + subId + " subStatus = " + subStatus);
- }
-
- try {
- simProxy.setUiccSubscription(rr.mSerial, slotId, appIndex, subId, subStatus);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "setUiccSubscription", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_UICC_SUBSCRIPTION, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " slot = " + slotId + " appIndex = " + appIndex
+ + " subId = " + subId + " subStatus = " + subStatus);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "setUiccSubscription", () -> {
+ simProxy.setUiccSubscription(rr.mSerial, slotId, appIndex, subId, subStatus);
+ });
}
/**
@@ -4293,144 +4408,150 @@
@Override
public void setDataAllowed(boolean allowed, Message result) {
- RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class, result);
- if (!dataProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_ALLOW_DATA, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " allowed = " + allowed);
- }
-
- try {
- dataProxy.setDataAllowed(rr.mSerial, allowed);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_DATA, "setDataAllowed", e);
- }
+ RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class);
+ if (dataProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(dataProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_ALLOW_DATA, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " allowed = " + allowed);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_DATA, rr, "setDataAllowed", () -> {
+ dataProxy.setDataAllowed(rr.mSerial, allowed);
+ });
}
@Override
public void getHardwareConfig(Message result) {
- RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class, result);
- if (!modemProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_GET_HARDWARE_CONFIG, result,
- mRILDefaultWorkSource);
-
- // Do not log function args for privacy
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- modemProxy.getHardwareConfig(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MODEM, "getHardwareConfig", e);
- }
+ RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class);
+ if (modemProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(modemProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_GET_HARDWARE_CONFIG, result,
+ mRILDefaultWorkSource);
+
+ // Do not log function args for privacy
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MODEM, rr, "getHardwareConfig", () -> {
+ modemProxy.getHardwareConfig(rr.mSerial);
+ });
}
@Override
public void requestIccSimAuthentication(int authContext, String data, String aid,
Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SIM_AUTHENTICATION, result,
- mRILDefaultWorkSource);
-
- // Do not log function args for privacy
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- simProxy.requestIccSimAuthentication(rr.mSerial, authContext,
- RILUtils.convertNullToEmptyString(data),
- RILUtils.convertNullToEmptyString(aid));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "requestIccSimAuthentication", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SIM_AUTHENTICATION, result,
+ mRILDefaultWorkSource);
+
+ // Do not log function args for privacy
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "requestIccSimAuthentication", () -> {
+ simProxy.requestIccSimAuthentication(rr.mSerial, authContext,
+ RILUtils.convertNullToEmptyString(data),
+ RILUtils.convertNullToEmptyString(aid));
+ });
}
@Override
public void setDataProfile(DataProfile[] dps, boolean isRoaming, Message result) {
- RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class, result);
- if (!dataProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_DATA_PROFILE, result,
- mRILDefaultWorkSource);
+ RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class);
+ if (dataProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(dataProxy, result);
+ return;
+ }
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " with data profiles : ");
- for (DataProfile profile : dps) {
- riljLog(profile.toString());
- }
- }
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_DATA_PROFILE, result, mRILDefaultWorkSource);
- try {
- dataProxy.setDataProfile(rr.mSerial, dps, isRoaming);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_DATA, "setDataProfile", e);
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " with data profiles : ");
+ for (DataProfile profile : dps) {
+ riljLog(profile.toString());
}
}
+
+ radioServiceInvokeHelper(HAL_SERVICE_DATA, rr, "setDataProfile", () -> {
+ dataProxy.setDataProfile(rr.mSerial, dps, isRoaming);
+ });
}
@Override
public void requestShutdown(Message result) {
- RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class, result);
- if (!modemProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SHUTDOWN, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- modemProxy.requestShutdown(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MODEM, "requestShutdown", e);
- }
+ RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class);
+ if (modemProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(modemProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SHUTDOWN, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MODEM, rr, "requestShutdown", () -> {
+ modemProxy.requestShutdown(rr.mSerial);
+ });
}
@Override
public void getRadioCapability(Message result) {
- RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class, result);
- if (!modemProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_GET_RADIO_CAPABILITY, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- modemProxy.getRadioCapability(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MODEM, "getRadioCapability", e);
- }
+ RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class);
+ if (modemProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(modemProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_GET_RADIO_CAPABILITY, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MODEM, rr, "getRadioCapability", () -> {
+ modemProxy.getRadioCapability(rr.mSerial);
+ });
}
@Override
public void setRadioCapability(RadioCapability rc, Message result) {
- RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class, result);
- if (!modemProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_RADIO_CAPABILITY, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " RadioCapability = " + rc.toString());
- }
-
- try {
- modemProxy.setRadioCapability(rr.mSerial, rc);
- } catch (Exception e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MODEM, "setRadioCapability", e);
- }
+ RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class);
+ if (modemProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(modemProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_RADIO_CAPABILITY, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " RadioCapability = " + rc.toString());
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MODEM, rr, "setRadioCapability", () -> {
+ modemProxy.setRadioCapability(rr.mSerial, rc);
+ });
}
@Override
@@ -4447,21 +4568,22 @@
return;
}
- IRadio radioProxy = getRadioProxy(result);
- if (radioProxy != null) {
- RILRequest rr = obtainRequest(RIL_REQUEST_START_LCE, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " reportIntervalMs = " + reportIntervalMs + " pullMode = " + pullMode);
- }
-
- try {
- radioProxy.startLceService(rr.mSerial, reportIntervalMs, pullMode);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_RADIO, "startLceService", e);
- }
+ IRadio radioProxy = getRadioProxy();
+ if (radioProxy == null) {
+ handleRadioProxyNotAvailable(result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_START_LCE, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " reportIntervalMs = " + reportIntervalMs + " pullMode = " + pullMode);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_RADIO, rr, "startLceService", () -> {
+ radioProxy.startLceService(rr.mSerial, reportIntervalMs, pullMode);
+ });
}
@Override
@@ -4478,20 +4600,21 @@
return;
}
- IRadio radioProxy = getRadioProxy(result);
- if (radioProxy != null) {
- RILRequest rr = obtainRequest(RIL_REQUEST_STOP_LCE, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- radioProxy.stopLceService(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_RADIO, "stopLceService", e);
- }
+ IRadio radioProxy = getRadioProxy();
+ if (radioProxy == null) {
+ handleRadioProxyNotAvailable(result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_STOP_LCE, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_RADIO, rr, "stopLceService", () -> {
+ radioProxy.stopLceService(rr.mSerial);
+ });
}
/**
@@ -4506,8 +4629,11 @@
@Override
public void setDataThrottling(Message result, WorkSource workSource, int dataThrottlingAction,
long completionWindowMillis) {
- RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class, result);
- if (dataProxy.isEmpty()) return;
+ RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class);
+ if (dataProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(dataProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_DATA).greaterOrEqual(RADIO_HAL_VERSION_1_6)) {
RILRequest rr = obtainRequest(RIL_REQUEST_SET_DATA_THROTTLING, result,
getDefaultWorkSourceIfInvalid(workSource));
@@ -4519,12 +4645,10 @@
+ " completionWindowMillis " + completionWindowMillis);
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_DATA, rr, "setDataThrottling", () -> {
dataProxy.setDataThrottling(rr.mSerial, (byte) dataThrottlingAction,
completionWindowMillis);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_DATA, "setDataThrottling", e);
- }
+ });
} else {
if (RILJ_LOGD) Rlog.d(RILJ_LOG_TAG, "setDataThrottling: REQUEST_NOT_SUPPORTED");
if (result != null) {
@@ -4560,42 +4684,44 @@
return;
}
- IRadio radioProxy = getRadioProxy(result);
- if (radioProxy != null) {
- RILRequest rr = obtainRequest(RIL_REQUEST_PULL_LCEDATA, result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- radioProxy.pullLceData(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_RADIO, "pullLceData", e);
- }
+ IRadio radioProxy = getRadioProxy();
+ if (radioProxy == null) {
+ handleRadioProxyNotAvailable(result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_PULL_LCEDATA, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_RADIO, rr, "pullLceData", () -> {
+ radioProxy.pullLceData(rr.mSerial);
+ });
}
@Override
public void getModemActivityInfo(Message result, WorkSource workSource) {
- RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class, result);
- if (!modemProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_GET_ACTIVITY_INFO, result,
- getDefaultWorkSourceIfInvalid(workSource));
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- modemProxy.getModemActivityInfo(rr.mSerial);
- Message msg =
- mRilHandler.obtainMessage(EVENT_BLOCKING_RESPONSE_TIMEOUT, rr.mSerial);
- mRilHandler.sendMessageDelayed(msg, DEFAULT_BLOCKING_MESSAGE_RESPONSE_TIMEOUT_MS);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MODEM, "getModemActivityInfo", e);
- }
+ RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class);
+ if (modemProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(modemProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_GET_ACTIVITY_INFO, result,
+ getDefaultWorkSourceIfInvalid(workSource));
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MODEM, rr, "getModemActivityInfo", () -> {
+ modemProxy.getModemActivityInfo(rr.mSerial);
+ Message msg =
+ mRilHandler.obtainMessage(EVENT_BLOCKING_RESPONSE_TIMEOUT, rr.mSerial);
+ mRilHandler.sendMessageDelayed(msg, DEFAULT_BLOCKING_MESSAGE_RESPONSE_TIMEOUT_MS);
+ });
}
@Override
@@ -4603,88 +4729,94 @@
Message result, WorkSource workSource) {
Objects.requireNonNull(carrierRestrictionRules, "Carrier restriction cannot be null.");
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_ALLOWED_CARRIERS, result,
- getDefaultWorkSourceIfInvalid(workSource));
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " params: " + carrierRestrictionRules);
- }
-
- try {
- simProxy.setAllowedCarriers(rr.mSerial, carrierRestrictionRules, result);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "setAllowedCarriers", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_ALLOWED_CARRIERS, result,
+ getDefaultWorkSourceIfInvalid(workSource));
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " params: " + carrierRestrictionRules);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "setAllowedCarriers", () -> {
+ simProxy.setAllowedCarriers(rr.mSerial, carrierRestrictionRules, result);
+ });
}
@Override
public void getAllowedCarriers(Message result, WorkSource workSource) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_GET_ALLOWED_CARRIERS, result,
- getDefaultWorkSourceIfInvalid(workSource));
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- simProxy.getAllowedCarriers(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "getAllowedCarriers", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_GET_ALLOWED_CARRIERS, result,
+ getDefaultWorkSourceIfInvalid(workSource));
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "getAllowedCarriers", () -> {
+ simProxy.getAllowedCarriers(rr.mSerial);
+ });
}
@Override
public void sendDeviceState(int stateType, boolean state, Message result) {
- RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class, result);
- if (!modemProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SEND_DEVICE_STATE, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest) + " "
- + stateType + ":" + state);
- }
-
- try {
- modemProxy.sendDeviceState(rr.mSerial, stateType, state);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_MODEM, "sendDeviceState", e);
- }
+ RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class);
+ if (modemProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(modemProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SEND_DEVICE_STATE, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest) + " "
+ + stateType + ":" + state);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_MODEM, rr, "sendDeviceState", () -> {
+ modemProxy.sendDeviceState(rr.mSerial, stateType, state);
+ });
}
@Override
public void setUnsolResponseFilter(int filter, Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (!networkProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER, result,
- mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " " + filter);
- }
-
- try {
- networkProxy.setIndicationFilter(rr.mSerial, filter);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "setIndicationFilter", e);
- }
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " " + filter);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "setUnsolResponseFilter", () -> {
+ networkProxy.setIndicationFilter(rr.mSerial, filter);
+ });
}
@Override
public void setSignalStrengthReportingCriteria(
@NonNull List<SignalThresholdInfo> signalThresholdInfos, @Nullable Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (networkProxy.isEmpty()) return;
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_NETWORK).greaterOrEqual(RADIO_HAL_VERSION_1_2)) {
RILRequest rr = obtainRequest(RIL_REQUEST_SET_SIGNAL_STRENGTH_REPORTING_CRITERIA,
result, mRILDefaultWorkSource);
@@ -4693,12 +4825,11 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
- networkProxy.setSignalStrengthReportingCriteria(rr.mSerial, signalThresholdInfos);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK,
- "setSignalStrengthReportingCriteria", e);
- }
+ radioServiceInvokeHelper(
+ HAL_SERVICE_NETWORK, rr, "setSignalStrengthReportingCriteria", () -> {
+ networkProxy.setSignalStrengthReportingCriteria(rr.mSerial,
+ signalThresholdInfos);
+ });
} else {
riljLoge("setSignalStrengthReportingCriteria ignored on IRadio version less than 1.2");
}
@@ -4708,8 +4839,11 @@
public void setLinkCapacityReportingCriteria(int hysteresisMs, int hysteresisDlKbps,
int hysteresisUlKbps, int[] thresholdsDlKbps, int[] thresholdsUlKbps, int ran,
Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (networkProxy.isEmpty()) return;
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_NETWORK).greaterOrEqual(RADIO_HAL_VERSION_1_2)) {
RILRequest rr = obtainRequest(RIL_REQUEST_SET_LINK_CAPACITY_REPORTING_CRITERIA, result,
mRILDefaultWorkSource);
@@ -4718,14 +4852,13 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
- networkProxy.setLinkCapacityReportingCriteria(rr.mSerial, hysteresisMs,
- hysteresisDlKbps, hysteresisUlKbps, thresholdsDlKbps, thresholdsUlKbps,
- ran);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(
- HAL_SERVICE_NETWORK, "setLinkCapacityReportingCriteria", e);
- }
+ radioServiceInvokeHelper(
+ HAL_SERVICE_NETWORK, rr, "setLinkCapacityReportingCriteria", () -> {
+ networkProxy.setLinkCapacityReportingCriteria(rr.mSerial, hysteresisMs,
+ hysteresisDlKbps, hysteresisUlKbps, thresholdsDlKbps,
+ thresholdsUlKbps,
+ ran);
+ });
} else {
riljLoge("setLinkCapacityReportingCriteria ignored on IRadio version less than 1.2");
}
@@ -4733,30 +4866,34 @@
@Override
public void setSimCardPower(int state, Message result, WorkSource workSource) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (!simProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_SET_SIM_CARD_POWER, result,
- getDefaultWorkSourceIfInvalid(workSource));
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
- + " " + state);
- }
-
- try {
- simProxy.setSimCardPower(rr.mSerial, state, result);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "setSimCardPower", e);
- }
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_SIM_CARD_POWER, result,
+ getDefaultWorkSourceIfInvalid(workSource));
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " " + state);
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "setSimCardPower", () -> {
+ simProxy.setSimCardPower(rr.mSerial, state, result);
+ });
}
@Override
public void setCarrierInfoForImsiEncryption(ImsiEncryptionInfo imsiEncryptionInfo,
Message result) {
Objects.requireNonNull(imsiEncryptionInfo, "ImsiEncryptionInfo cannot be null.");
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (simProxy.isEmpty()) return;
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_SIM).greaterOrEqual(RADIO_HAL_VERSION_1_1)) {
RILRequest rr = obtainRequest(RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION, result,
mRILDefaultWorkSource);
@@ -4764,12 +4901,9 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "setCarrierInfoForImsiEncryption", () -> {
simProxy.setCarrierInfoForImsiEncryption(rr.mSerial, imsiEncryptionInfo);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM,
- "setCarrierInfoForImsiEncryption", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "setCarrierInfoForImsiEncryption: REQUEST_NOT_SUPPORTED");
@@ -4786,8 +4920,11 @@
public void startNattKeepalive(int contextId, KeepalivePacketData packetData,
int intervalMillis, Message result) {
Objects.requireNonNull(packetData, "KeepaliveRequest cannot be null.");
- RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class, result);
- if (dataProxy.isEmpty()) return;
+ RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class);
+ if (dataProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(dataProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_DATA).greaterOrEqual(RADIO_HAL_VERSION_1_1)) {
RILRequest rr = obtainRequest(RIL_REQUEST_START_KEEPALIVE, result,
mRILDefaultWorkSource);
@@ -4796,11 +4933,9 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_DATA, rr, "startNattKeepalive", () -> {
dataProxy.startKeepalive(rr.mSerial, contextId, packetData, intervalMillis, result);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_DATA, "startNattKeepalive", e);
- }
+ });
} else {
if (RILJ_LOGD) Rlog.d(RILJ_LOG_TAG, "startNattKeepalive: REQUEST_NOT_SUPPORTED");
if (result != null) {
@@ -4813,8 +4948,11 @@
@Override
public void stopNattKeepalive(int sessionHandle, Message result) {
- RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class, result);
- if (dataProxy.isEmpty()) return;
+ RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class);
+ if (dataProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(dataProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_DATA).greaterOrEqual(RADIO_HAL_VERSION_1_1)) {
RILRequest rr = obtainRequest(RIL_REQUEST_STOP_KEEPALIVE, result,
mRILDefaultWorkSource);
@@ -4823,11 +4961,9 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_DATA, rr, "stopNattKeepalive", () -> {
dataProxy.stopKeepalive(rr.mSerial, sessionHandle);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_DATA, "stopNattKeepalive", e);
- }
+ });
} else {
if (RILJ_LOGD) Rlog.d(RILJ_LOG_TAG, "stopNattKeepalive: REQUEST_NOT_SUPPORTED");
if (result != null) {
@@ -4873,8 +5009,11 @@
*/
@Override
public void enableUiccApplications(boolean enable, Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (simProxy.isEmpty()) return;
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_SIM).greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
RILRequest rr = obtainRequest(RIL_REQUEST_ENABLE_UICC_APPLICATIONS, result,
mRILDefaultWorkSource);
@@ -4884,11 +5023,9 @@
+ " " + enable);
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "enableUiccApplications", () -> {
simProxy.enableUiccApplications(rr.mSerial, enable);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "enableUiccApplications", e);
- }
+ });
} else {
if (RILJ_LOGD) Rlog.d(RILJ_LOG_TAG, "enableUiccApplications: REQUEST_NOT_SUPPORTED");
if (result != null) {
@@ -4906,8 +5043,11 @@
*/
@Override
public void areUiccApplicationsEnabled(Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (simProxy.isEmpty()) return;
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_SIM).greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
RILRequest rr = obtainRequest(RIL_REQUEST_GET_UICC_APPLICATIONS_ENABLEMENT, result,
mRILDefaultWorkSource);
@@ -4916,11 +5056,9 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "areUiccApplicationsEnabled", () -> {
simProxy.areUiccApplicationsEnabled(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "areUiccApplicationsEnabled", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "areUiccApplicationsEnabled: REQUEST_NOT_SUPPORTED");
@@ -4938,7 +5076,7 @@
*/
@Override
public boolean canToggleUiccApplicationsEnablement() {
- return !getRadioServiceProxy(RadioSimProxy.class, null).isEmpty()
+ return !getRadioServiceProxy(RadioSimProxy.class).isEmpty()
&& mHalVersion.get(HAL_SERVICE_SIM).greaterOrEqual(RADIO_HAL_VERSION_1_5);
}
@@ -4952,22 +5090,22 @@
*/
@Override
public void handleCallSetupRequestFromSim(boolean accept, Message result) {
- RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class, result);
- if (!voiceProxy.isEmpty()) {
- RILRequest rr = obtainRequest(RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM,
- result, mRILDefaultWorkSource);
-
- if (RILJ_LOGD) {
- riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
- }
-
- try {
- voiceProxy.handleStkCallSetupRequestFromSim(rr.mSerial, accept);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(
- HAL_SERVICE_VOICE, "handleStkCallSetupRequestFromSim", e);
- }
+ RadioVoiceProxy voiceProxy = getRadioServiceProxy(RadioVoiceProxy.class);
+ if (voiceProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(voiceProxy, result);
+ return;
}
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM,
+ result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_VOICE, rr, "handleCallSetupRequestFromSim", () -> {
+ voiceProxy.handleStkCallSetupRequestFromSim(rr.mSerial, accept);
+ });
}
/**
@@ -4975,8 +5113,11 @@
*/
@Override
public void getBarringInfo(Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (networkProxy.isEmpty()) return;
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_NETWORK).greaterOrEqual(RADIO_HAL_VERSION_1_5)) {
RILRequest rr = obtainRequest(RIL_REQUEST_GET_BARRING_INFO, result,
mRILDefaultWorkSource);
@@ -4985,11 +5126,9 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "getBarringInfo", () -> {
networkProxy.getBarringInfo(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "getBarringInfo", e);
- }
+ });
} else {
if (RILJ_LOGD) Rlog.d(RILJ_LOG_TAG, "getBarringInfo: REQUEST_NOT_SUPPORTED");
if (result != null) {
@@ -5005,8 +5144,11 @@
*/
@Override
public void allocatePduSessionId(Message result) {
- RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class, result);
- if (dataProxy.isEmpty()) return;
+ RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class);
+ if (dataProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(dataProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_DATA).greaterOrEqual(RADIO_HAL_VERSION_1_6)) {
RILRequest rr = obtainRequest(RIL_REQUEST_ALLOCATE_PDU_SESSION_ID, result,
mRILDefaultWorkSource);
@@ -5014,12 +5156,11 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_DATA, rr, "allocatePduSessionId", () -> {
dataProxy.allocatePduSessionId(rr.mSerial);
- } catch (RemoteException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_DATA, "allocatePduSessionId", e);
- }
+ });
} else {
+ if (RILJ_LOGD) Rlog.d(RILJ_LOG_TAG, "allocatePduSessionId: REQUEST_NOT_SUPPORTED");
AsyncResult.forMessage(result, null,
CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
result.sendToTarget();
@@ -5031,8 +5172,11 @@
*/
@Override
public void releasePduSessionId(Message result, int pduSessionId) {
- RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class, result);
- if (dataProxy.isEmpty()) return;
+ RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class);
+ if (dataProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(dataProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_DATA).greaterOrEqual(RADIO_HAL_VERSION_1_6)) {
RILRequest rr = obtainRequest(RIL_REQUEST_RELEASE_PDU_SESSION_ID, result,
mRILDefaultWorkSource);
@@ -5040,12 +5184,11 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_DATA, rr, "releasePduSessionId", () -> {
dataProxy.releasePduSessionId(rr.mSerial, pduSessionId);
- } catch (RemoteException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_DATA, "releasePduSessionId", e);
- }
+ });
} else {
+ if (RILJ_LOGD) Rlog.d(RILJ_LOG_TAG, "releasePduSessionId: REQUEST_NOT_SUPPORTED");
AsyncResult.forMessage(result, null,
CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
result.sendToTarget();
@@ -5057,8 +5200,11 @@
*/
@Override
public void startHandover(Message result, int callId) {
- RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class, result);
- if (dataProxy.isEmpty()) return;
+ RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class);
+ if (dataProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(dataProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_DATA).greaterOrEqual(RADIO_HAL_VERSION_1_6)) {
RILRequest rr = obtainRequest(RIL_REQUEST_START_HANDOVER, result,
mRILDefaultWorkSource);
@@ -5066,11 +5212,9 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_DATA, rr, "startHandover", () -> {
dataProxy.startHandover(rr.mSerial, callId);
- } catch (RemoteException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_DATA, "startHandover", e);
- }
+ });
} else {
if (RILJ_LOGD) Rlog.d(RILJ_LOG_TAG, "startHandover: REQUEST_NOT_SUPPORTED");
if (result != null) {
@@ -5086,8 +5230,11 @@
*/
@Override
public void cancelHandover(Message result, int callId) {
- RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class, result);
- if (dataProxy.isEmpty()) return;
+ RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class);
+ if (dataProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(dataProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_DATA).greaterOrEqual(RADIO_HAL_VERSION_1_6)) {
RILRequest rr = obtainRequest(RIL_REQUEST_CANCEL_HANDOVER, result,
mRILDefaultWorkSource);
@@ -5095,11 +5242,9 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_DATA, rr, "cancelHandover", () -> {
dataProxy.cancelHandover(rr.mSerial, callId);
- } catch (RemoteException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_DATA, "cancelHandover", e);
- }
+ });
} else {
if (RILJ_LOGD) Rlog.d(RILJ_LOG_TAG, "cancelHandover: REQUEST_NOT_SUPPORTED");
AsyncResult.forMessage(result, null,
@@ -5113,8 +5258,11 @@
*/
@Override
public void getSlicingConfig(Message result) {
- RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class, result);
- if (dataProxy.isEmpty()) return;
+ RadioDataProxy dataProxy = getRadioServiceProxy(RadioDataProxy.class);
+ if (dataProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(dataProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_DATA).greaterOrEqual(RADIO_HAL_VERSION_1_6)) {
RILRequest rr = obtainRequest(RIL_REQUEST_GET_SLICING_CONFIG, result,
mRILDefaultWorkSource);
@@ -5123,11 +5271,9 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_DATA, rr, "getSlicingConfig", () -> {
dataProxy.getSlicingConfig(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_DATA, "getSlicingConfig", e);
- }
+ });
} else {
if (RILJ_LOGD) Rlog.d(RILJ_LOG_TAG, "getSlicingConfig: REQUEST_NOT_SUPPORTED");
AsyncResult.forMessage(result, null,
@@ -5138,8 +5284,11 @@
@Override
public void getSimPhonebookRecords(Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (simProxy.isEmpty()) return;
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_SIM).greaterOrEqual(RADIO_HAL_VERSION_1_6)) {
RILRequest rr = obtainRequest(RIL_REQUEST_GET_SIM_PHONEBOOK_RECORDS, result,
mRILDefaultWorkSource);
@@ -5148,11 +5297,9 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "getSimPhonebookRecords", () -> {
simProxy.getSimPhonebookRecords(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "getSimPhonebookRecords", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "getSimPhonebookRecords: REQUEST_NOT_SUPPORTED");
@@ -5167,8 +5314,11 @@
@Override
public void getSimPhonebookCapacity(Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (simProxy.isEmpty()) return;
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_SIM).greaterOrEqual(RADIO_HAL_VERSION_1_6)) {
RILRequest rr = obtainRequest(RIL_REQUEST_GET_SIM_PHONEBOOK_CAPACITY, result,
mRILDefaultWorkSource);
@@ -5177,11 +5327,9 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "getSimPhonebookCapacity", () -> {
simProxy.getSimPhonebookCapacity(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "getSimPhonebookCapacity", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "getSimPhonebookCapacity: REQUEST_NOT_SUPPORTED");
@@ -5196,8 +5344,11 @@
@Override
public void updateSimPhonebookRecord(SimPhonebookRecord phonebookRecord, Message result) {
- RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class, result);
- if (simProxy.isEmpty()) return;
+ RadioSimProxy simProxy = getRadioServiceProxy(RadioSimProxy.class);
+ if (simProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(simProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_SIM).greaterOrEqual(RADIO_HAL_VERSION_1_6)) {
RILRequest rr = obtainRequest(RIL_REQUEST_UPDATE_SIM_PHONEBOOK_RECORD, result,
mRILDefaultWorkSource);
@@ -5207,11 +5358,9 @@
+ " with " + phonebookRecord.toString());
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_SIM, rr, "updateSimPhonebookRecord", () -> {
simProxy.updateSimPhonebookRecords(rr.mSerial, phonebookRecord);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_SIM, "updateSimPhonebookRecords", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "updateSimPhonebookRecords: REQUEST_NOT_SUPPORTED");
@@ -5233,8 +5382,11 @@
@Override
public void setUsageSetting(Message result,
/* @TelephonyManager.UsageSetting */ int usageSetting) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (networkProxy.isEmpty()) return;
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_NETWORK).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
RILRequest rr = obtainRequest(RIL_REQUEST_SET_USAGE_SETTING, result,
mRILDefaultWorkSource);
@@ -5243,11 +5395,9 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "setUsageSetting", () -> {
networkProxy.setUsageSetting(rr.mSerial, usageSetting);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "setUsageSetting", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "setUsageSetting: REQUEST_NOT_SUPPORTED");
@@ -5267,8 +5417,11 @@
*/
@Override
public void getUsageSetting(Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (networkProxy.isEmpty()) return;
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_NETWORK).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
RILRequest rr = obtainRequest(RIL_REQUEST_GET_USAGE_SETTING, result,
mRILDefaultWorkSource);
@@ -5277,11 +5430,9 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "getUsageSetting", () -> {
networkProxy.getUsageSetting(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "getUsageSetting", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "getUsageSetting: REQUEST_NOT_SUPPORTED");
@@ -5296,8 +5447,11 @@
@Override
public void setSrvccCallInfo(SrvccConnection[] srvccConnections, Message result) {
- RadioImsProxy imsProxy = getRadioServiceProxy(RadioImsProxy.class, result);
- if (imsProxy.isEmpty()) return;
+ RadioImsProxy imsProxy = getRadioServiceProxy(RadioImsProxy.class);
+ if (imsProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(imsProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_IMS).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
RILRequest rr = obtainRequest(RIL_REQUEST_SET_SRVCC_CALL_INFO, result,
mRILDefaultWorkSource);
@@ -5307,12 +5461,10 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_IMS, rr, "setSrvccCallInfo", () -> {
imsProxy.setSrvccCallInfo(rr.mSerial,
RILUtils.convertToHalSrvccCall(srvccConnections));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_IMS, "setSrvccCallInfo", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "setSrvccCallInfo: REQUEST_NOT_SUPPORTED");
@@ -5331,8 +5483,11 @@
@ImsRegistrationImplBase.ImsRegistrationTech int imsRadioTech,
@RegistrationManager.SuggestedAction int suggestedAction,
int capabilities, Message result) {
- RadioImsProxy imsProxy = getRadioServiceProxy(RadioImsProxy.class, result);
- if (imsProxy.isEmpty()) return;
+ RadioImsProxy imsProxy = getRadioServiceProxy(RadioImsProxy.class);
+ if (imsProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(imsProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_IMS).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
RILRequest rr = obtainRequest(RIL_REQUEST_UPDATE_IMS_REGISTRATION_INFO, result,
mRILDefaultWorkSource);
@@ -5350,11 +5505,9 @@
registrationInfo.suggestedAction = suggestedAction;
registrationInfo.capabilities = RILUtils.convertImsCapability(capabilities);
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_IMS, rr, "updateImsRegistrationInfo", () -> {
imsProxy.updateImsRegistrationInfo(rr.mSerial, registrationInfo);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_IMS, "updateImsRegistrationInfo", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "updateImsRegistrationInfo: REQUEST_NOT_SUPPORTED");
@@ -5370,8 +5523,11 @@
@Override
public void startImsTraffic(int token,
int trafficType, int accessNetworkType, int trafficDirection, Message result) {
- RadioImsProxy imsProxy = getRadioServiceProxy(RadioImsProxy.class, result);
- if (imsProxy.isEmpty()) return;
+ RadioImsProxy imsProxy = getRadioServiceProxy(RadioImsProxy.class);
+ if (imsProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(imsProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_IMS).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
RILRequest rr = obtainRequest(RIL_REQUEST_START_IMS_TRAFFIC, result,
mRILDefaultWorkSource);
@@ -5382,13 +5538,11 @@
+ accessNetworkType + ", " + trafficDirection + "}");
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_IMS, rr, "startImsTraffic", () -> {
imsProxy.startImsTraffic(rr.mSerial, token,
RILUtils.convertImsTrafficType(trafficType), accessNetworkType,
RILUtils.convertImsTrafficDirection(trafficDirection));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_IMS, "startImsTraffic", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "startImsTraffic: REQUEST_NOT_SUPPORTED");
@@ -5403,8 +5557,11 @@
@Override
public void stopImsTraffic(int token, Message result) {
- RadioImsProxy imsProxy = getRadioServiceProxy(RadioImsProxy.class, result);
- if (imsProxy.isEmpty()) return;
+ RadioImsProxy imsProxy = getRadioServiceProxy(RadioImsProxy.class);
+ if (imsProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(imsProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_IMS).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
RILRequest rr = obtainRequest(RIL_REQUEST_STOP_IMS_TRAFFIC, result,
mRILDefaultWorkSource);
@@ -5414,11 +5571,9 @@
+ "{" + token + "}");
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_IMS, rr, "stopImsTraffic", () -> {
imsProxy.stopImsTraffic(rr.mSerial, token);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_IMS, "stopImsTraffic", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "stopImsTraffic: REQUEST_NOT_SUPPORTED");
@@ -5433,8 +5588,11 @@
@Override
public void triggerEpsFallback(int reason, Message result) {
- RadioImsProxy imsProxy = getRadioServiceProxy(RadioImsProxy.class, result);
- if (imsProxy.isEmpty()) return;
+ RadioImsProxy imsProxy = getRadioServiceProxy(RadioImsProxy.class);
+ if (imsProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(imsProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_IMS).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
RILRequest rr = obtainRequest(RIL_REQUEST_TRIGGER_EPS_FALLBACK, result,
mRILDefaultWorkSource);
@@ -5444,11 +5602,9 @@
+ " reason=" + reason);
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_IMS, rr, "triggerEpsFallback", () -> {
imsProxy.triggerEpsFallback(rr.mSerial, reason);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_IMS, "triggerEpsFallback", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "triggerEpsFallback: REQUEST_NOT_SUPPORTED");
@@ -5464,8 +5620,11 @@
@Override
public void sendAnbrQuery(int mediaType, int direction, int bitsPerSecond,
Message result) {
- RadioImsProxy imsProxy = getRadioServiceProxy(RadioImsProxy.class, result);
- if (imsProxy.isEmpty()) return;
+ RadioImsProxy imsProxy = getRadioServiceProxy(RadioImsProxy.class);
+ if (imsProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(imsProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_IMS).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
RILRequest rr = obtainRequest(RIL_REQUEST_SEND_ANBR_QUERY, result,
mRILDefaultWorkSource);
@@ -5474,11 +5633,9 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_IMS, rr, "sendAnbrQuery", () -> {
imsProxy.sendAnbrQuery(rr.mSerial, mediaType, direction, bitsPerSecond);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_IMS, "sendAnbrQuery", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "sendAnbrQuery: REQUEST_NOT_SUPPORTED");
@@ -5496,8 +5653,11 @@
*/
@Override
public void setEmergencyMode(int emcMode, Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (networkProxy.isEmpty()) return;
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_NETWORK).greaterOrEqual(RADIO_HAL_VERSION_2_1)) {
RILRequest rr = obtainRequest(RIL_REQUEST_SET_EMERGENCY_MODE, result,
mRILDefaultWorkSource);
@@ -5507,11 +5667,9 @@
+ " mode=" + EmergencyConstants.emergencyModeToString(emcMode));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "setEmergencyMode", () -> {
networkProxy.setEmergencyMode(rr.mSerial, emcMode);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "setEmergencyMode", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "setEmergencyMode: REQUEST_NOT_SUPPORTED");
@@ -5531,8 +5689,11 @@
public void triggerEmergencyNetworkScan(
@NonNull @AccessNetworkConstants.RadioAccessNetworkType int[] accessNetwork,
@DomainSelectionService.EmergencyScanType int scanType, Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (networkProxy.isEmpty()) return;
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_NETWORK).greaterOrEqual(RADIO_HAL_VERSION_2_1)) {
RILRequest rr = obtainRequest(RIL_REQUEST_TRIGGER_EMERGENCY_NETWORK_SCAN, result,
mRILDefaultWorkSource);
@@ -5543,13 +5704,10 @@
+ ", scanType=" + RILUtils.scanTypeToString(scanType));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "triggerEmergencyNetworkScan", () -> {
networkProxy.triggerEmergencyNetworkScan(rr.mSerial,
RILUtils.convertEmergencyNetworkScanTrigger(accessNetwork, scanType));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK,
- "triggerEmergencyNetworkScan", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "triggerEmergencyNetworkScan: REQUEST_NOT_SUPPORTED");
@@ -5567,8 +5725,11 @@
*/
@Override
public void cancelEmergencyNetworkScan(boolean resetScan, Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (networkProxy.isEmpty()) return;
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_NETWORK).greaterOrEqual(RADIO_HAL_VERSION_2_1)) {
RILRequest rr = obtainRequest(RIL_REQUEST_CANCEL_EMERGENCY_NETWORK_SCAN, result,
mRILDefaultWorkSource);
@@ -5578,12 +5739,9 @@
+ " resetScan=" + resetScan);
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "cancelEmergencyNetworkScan", () -> {
networkProxy.cancelEmergencyNetworkScan(rr.mSerial, resetScan);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK,
- "cancelEmergencyNetworkScan", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "cancelEmergencyNetworkScan: REQUEST_NOT_SUPPORTED");
@@ -5601,8 +5759,11 @@
*/
@Override
public void exitEmergencyMode(Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (networkProxy.isEmpty()) return;
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_NETWORK).greaterOrEqual(RADIO_HAL_VERSION_2_1)) {
RILRequest rr = obtainRequest(RIL_REQUEST_EXIT_EMERGENCY_MODE, result,
mRILDefaultWorkSource);
@@ -5611,11 +5772,9 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "exitEmergencyMode", () -> {
networkProxy.exitEmergencyMode(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "exitEmergencyMode", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "exitEmergencyMode: REQUEST_NOT_SUPPORTED");
@@ -5636,8 +5795,11 @@
*/
@Override
public void setNullCipherAndIntegrityEnabled(boolean enabled, Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (networkProxy.isEmpty()) return;
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_NETWORK).greaterOrEqual(RADIO_HAL_VERSION_2_1)) {
RILRequest rr = obtainRequest(RIL_REQUEST_SET_NULL_CIPHER_AND_INTEGRITY_ENABLED, result,
mRILDefaultWorkSource);
@@ -5646,12 +5808,10 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
- networkProxy.setNullCipherAndIntegrityEnabled(rr.mSerial, enabled);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(
- HAL_SERVICE_NETWORK, "setNullCipherAndIntegrityEnabled", e);
- }
+ radioServiceInvokeHelper(
+ HAL_SERVICE_NETWORK, rr, "setNullCipherAndIntegrityEnabled", () -> {
+ networkProxy.setNullCipherAndIntegrityEnabled(rr.mSerial, enabled);
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "setNullCipherAndIntegrityEnabled: REQUEST_NOT_SUPPORTED");
@@ -5669,8 +5829,11 @@
*/
@Override
public void updateImsCallStatus(@NonNull List<ImsCallInfo> imsCallInfo, Message result) {
- RadioImsProxy imsProxy = getRadioServiceProxy(RadioImsProxy.class, result);
- if (imsProxy.isEmpty()) return;
+ RadioImsProxy imsProxy = getRadioServiceProxy(RadioImsProxy.class);
+ if (imsProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(imsProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_IMS).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
RILRequest rr = obtainRequest(RIL_REQUEST_UPDATE_IMS_CALL_STATUS, result,
mRILDefaultWorkSource);
@@ -5679,11 +5842,9 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ " " + imsCallInfo);
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_IMS, rr, "updateImsCallStatus", () -> {
imsProxy.updateImsCallStatus(rr.mSerial, RILUtils.convertImsCallInfo(imsCallInfo));
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_IMS, "updateImsCallStatus", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "updateImsCallStatus: REQUEST_NOT_SUPPORTED");
@@ -5701,8 +5862,11 @@
*/
@Override
public void setN1ModeEnabled(boolean enable, Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (networkProxy.isEmpty()) return;
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_NETWORK).greaterOrEqual(RADIO_HAL_VERSION_2_1)) {
RILRequest rr = obtainRequest(RIL_REQUEST_SET_N1_MODE_ENABLED, result,
mRILDefaultWorkSource);
@@ -5712,11 +5876,9 @@
+ " enable=" + enable);
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "setN1ModeEnabled", () -> {
networkProxy.setN1ModeEnabled(rr.mSerial, enable);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "setN1ModeEnabled", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "setN1ModeEnabled: REQUEST_NOT_SUPPORTED");
@@ -5734,8 +5896,11 @@
*/
@Override
public void isN1ModeEnabled(Message result) {
- RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class, result);
- if (networkProxy.isEmpty()) return;
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (networkProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(networkProxy, result);
+ return;
+ }
if (mHalVersion.get(HAL_SERVICE_NETWORK).greaterOrEqual(RADIO_HAL_VERSION_2_1)) {
RILRequest rr = obtainRequest(RIL_REQUEST_IS_N1_MODE_ENABLED, result,
mRILDefaultWorkSource);
@@ -5744,11 +5909,9 @@
riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
}
- try {
+ radioServiceInvokeHelper(HAL_SERVICE_NETWORK, rr, "isN1ModeEnabled", () -> {
networkProxy.isN1ModeEnabled(rr.mSerial);
- } catch (RemoteException | RuntimeException e) {
- handleRadioProxyExceptionForRR(HAL_SERVICE_NETWORK, "isN1ModeEnabled", e);
- }
+ });
} else {
if (RILJ_LOGD) {
Rlog.d(RILJ_LOG_TAG, "isN1ModeEnabled: REQUEST_NOT_SUPPORTED");
@@ -5768,11 +5931,33 @@
*/
@Override
public void getSatelliteCapabilities(Message result) {
- // Satellite HAL APIs are not supported before Android V.
- if (result != null) {
- AsyncResult.forMessage(result, null,
- CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
- result.sendToTarget();
+ RadioSatelliteProxy radioSatelliteProxy =
+ getRadioServiceProxy(RadioSatelliteProxy.class);
+ if (radioSatelliteProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(radioSatelliteProxy, result);
+ return;
+ }
+ if (mHalVersion.get(HAL_SERVICE_SATELLITE).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
+ RILRequest rr = obtainRequest(RIL_REQUEST_GET_SATELLITE_CAPABILITIES, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ // Do not log function arg for privacy
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SATELLITE, rr, "getSatelliteCapabilities", () -> {
+ radioSatelliteProxy.getCapabilities(rr.mSerial);
+ });
+ } else {
+ if (RILJ_LOGD) {
+ Rlog.d(RILJ_LOG_TAG, "getSatelliteCapabilities: REQUEST_NOT_SUPPORTED");
+ }
+ if (result != null) {
+ AsyncResult.forMessage(result, null,
+ CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
+ result.sendToTarget();
+ }
}
}
@@ -5785,11 +5970,33 @@
*/
@Override
public void setSatellitePower(Message result, boolean on) {
- // Satellite HAL APIs are not supported before Android V.
- if (result != null) {
- AsyncResult.forMessage(result, null,
- CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
- result.sendToTarget();
+ RadioSatelliteProxy radioSatelliteProxy =
+ getRadioServiceProxy(RadioSatelliteProxy.class);
+ if (radioSatelliteProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(radioSatelliteProxy, result);
+ return;
+ }
+ if (mHalVersion.get(HAL_SERVICE_SATELLITE).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_SATELLITE_POWER, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ // Do not log function arg for privacy
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SATELLITE, rr, "setSatellitePower", () -> {
+ radioSatelliteProxy.setPower(rr.mSerial, on);
+ });
+ } else {
+ if (RILJ_LOGD) {
+ Rlog.d(RILJ_LOG_TAG, "setSatellitePower: REQUEST_NOT_SUPPORTED");
+ }
+ if (result != null) {
+ AsyncResult.forMessage(result, null,
+ CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
+ result.sendToTarget();
+ }
}
}
@@ -5800,11 +6007,33 @@
*/
@Override
public void getSatellitePowerState(Message result) {
- // Satellite HAL APIs are not supported before Android V.
- if (result != null) {
- AsyncResult.forMessage(result, null,
- CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
- result.sendToTarget();
+ RadioSatelliteProxy radioSatelliteProxy =
+ getRadioServiceProxy(RadioSatelliteProxy.class);
+ if (radioSatelliteProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(radioSatelliteProxy, result);
+ return;
+ }
+ if (mHalVersion.get(HAL_SERVICE_SATELLITE).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
+ RILRequest rr = obtainRequest(RIL_REQUEST_GET_SATELLITE_POWER, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ // Do not log function arg for privacy
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SATELLITE, rr, "getSatellitePowerState", () -> {
+ radioSatelliteProxy.getPowerState(rr.mSerial);
+ });
+ } else {
+ if (RILJ_LOGD) {
+ Rlog.d(RILJ_LOG_TAG, "getSatellitePowerState: REQUEST_NOT_SUPPORTED");
+ }
+ if (result != null) {
+ AsyncResult.forMessage(result, null,
+ CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
+ result.sendToTarget();
+ }
}
}
@@ -5836,11 +6065,33 @@
@Override
public void provisionSatelliteService(
Message result, String imei, String msisdn, String imsi, int[] features) {
- // Satellite HAL APIs are not supported before Android V.
- if (result != null) {
- AsyncResult.forMessage(result, null,
- CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
- result.sendToTarget();
+ RadioSatelliteProxy radioSatelliteProxy =
+ getRadioServiceProxy(RadioSatelliteProxy.class);
+ if (radioSatelliteProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(radioSatelliteProxy, result);
+ return;
+ }
+ if (mHalVersion.get(HAL_SERVICE_SATELLITE).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
+ RILRequest rr = obtainRequest(RIL_REQUEST_PROVISION_SATELLITE_SERVICE, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ // Do not log function arg for privacy
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SATELLITE, rr, "provisionSatelliteService", () -> {
+ radioSatelliteProxy.provisionService(rr.mSerial, imei, msisdn, imsi, features);
+ });
+ } else {
+ if (RILJ_LOGD) {
+ Rlog.d(RILJ_LOG_TAG, "provisionSatelliteService: REQUEST_NOT_SUPPORTED");
+ }
+ if (result != null) {
+ AsyncResult.forMessage(result, null,
+ CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
+ result.sendToTarget();
+ }
}
}
@@ -5853,11 +6104,34 @@
*/
@Override
public void addAllowedSatelliteContacts(Message result, String[] contacts) {
- // Satellite HAL APIs are not supported before Android V.
- if (result != null) {
- AsyncResult.forMessage(result, null,
- CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
- result.sendToTarget();
+ RadioSatelliteProxy radioSatelliteProxy =
+ getRadioServiceProxy(RadioSatelliteProxy.class);
+ if (radioSatelliteProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(radioSatelliteProxy, result);
+ return;
+ }
+ if (mHalVersion.get(HAL_SERVICE_SATELLITE).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
+ RILRequest rr = obtainRequest(RIL_REQUEST_ADD_ALLOWED_SATELLITE_CONTACTS, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ // Do not log function arg for privacy
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(
+ HAL_SERVICE_SATELLITE, rr, "addAllowedSatelliteContacts", () -> {
+ radioSatelliteProxy.addAllowedSatelliteContacts(rr.mSerial, contacts);
+ });
+ } else {
+ if (RILJ_LOGD) {
+ Rlog.d(RILJ_LOG_TAG, "addAllowedSatelliteContacts: REQUEST_NOT_SUPPORTED");
+ }
+ if (result != null) {
+ AsyncResult.forMessage(result, null,
+ CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
+ result.sendToTarget();
+ }
}
}
@@ -5870,11 +6144,34 @@
*/
@Override
public void removeAllowedSatelliteContacts(Message result, String[] contacts) {
- // Satellite HAL APIs are not supported before Android V.
- if (result != null) {
- AsyncResult.forMessage(result, null,
- CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
- result.sendToTarget();
+ RadioSatelliteProxy radioSatelliteProxy =
+ getRadioServiceProxy(RadioSatelliteProxy.class);
+ if (radioSatelliteProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(radioSatelliteProxy, result);
+ return;
+ }
+ if (mHalVersion.get(HAL_SERVICE_SATELLITE).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
+ RILRequest rr = obtainRequest(RIL_REQUEST_REMOVE_ALLOWED_SATELLITE_CONTACTS, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ // Do not log function arg for privacy
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(
+ HAL_SERVICE_SATELLITE, rr, "removeAllowedSatelliteContacts", () -> {
+ radioSatelliteProxy.removeAllowedSatelliteContacts(rr.mSerial, contacts);
+ });
+ } else {
+ if (RILJ_LOGD) {
+ Rlog.d(RILJ_LOG_TAG, "removeAllowedSatelliteContacts: REQUEST_NOT_SUPPORTED");
+ }
+ if (result != null) {
+ AsyncResult.forMessage(result, null,
+ CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
+ result.sendToTarget();
+ }
}
}
@@ -5890,11 +6187,34 @@
@Override
public void sendSatelliteMessages(Message result, String[] messages, String destination,
double latitude, double longitude) {
- // Satellite HAL APIs are not supported before Android V.
- if (result != null) {
- AsyncResult.forMessage(result, null,
- CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
- result.sendToTarget();
+ RadioSatelliteProxy radioSatelliteProxy =
+ getRadioServiceProxy(RadioSatelliteProxy.class);
+ if (radioSatelliteProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(radioSatelliteProxy, result);
+ return;
+ }
+ if (mHalVersion.get(HAL_SERVICE_SATELLITE).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
+ RILRequest rr = obtainRequest(
+ RIL_REQUEST_SEND_SATELLITE_MESSAGES, result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ // Do not log function arg for privacy
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SATELLITE, rr, "sendSatelliteMessages", () -> {
+ radioSatelliteProxy.sendMessages(rr.mSerial, messages, destination, latitude,
+ longitude);
+ });
+ } else {
+ if (RILJ_LOGD) {
+ Rlog.d(RILJ_LOG_TAG, "sendSatelliteMessages: REQUEST_NOT_SUPPORTED");
+ }
+ if (result != null) {
+ AsyncResult.forMessage(result, null,
+ CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
+ result.sendToTarget();
+ }
}
}
@@ -5905,11 +6225,34 @@
*/
@Override
public void getPendingSatelliteMessages(Message result) {
- // Satellite HAL APIs are not supported before Android V.
- if (result != null) {
- AsyncResult.forMessage(result, null,
- CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
- result.sendToTarget();
+ RadioSatelliteProxy radioSatelliteProxy =
+ getRadioServiceProxy(RadioSatelliteProxy.class);
+ if (radioSatelliteProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(radioSatelliteProxy, result);
+ return;
+ }
+ if (mHalVersion.get(HAL_SERVICE_SATELLITE).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
+ RILRequest rr = obtainRequest(RIL_REQUEST_GET_PENDING_SATELLITE_MESSAGES, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ // Do not log function arg for privacy
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(
+ HAL_SERVICE_SATELLITE, rr, "getPendingSatelliteMessages", () -> {
+ radioSatelliteProxy.getPendingMessages(rr.mSerial);
+ });
+ } else {
+ if (RILJ_LOGD) {
+ Rlog.d(RILJ_LOG_TAG, "getPendingSatelliteMessages: REQUEST_NOT_SUPPORTED");
+ }
+ if (result != null) {
+ AsyncResult.forMessage(result, null,
+ CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
+ result.sendToTarget();
+ }
}
}
@@ -5920,11 +6263,33 @@
*/
@Override
public void getSatelliteMode(Message result) {
- // Satellite HAL APIs are not supported before Android V.
- if (result != null) {
- AsyncResult.forMessage(result, null,
- CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
- result.sendToTarget();
+ RadioSatelliteProxy radioSatelliteProxy =
+ getRadioServiceProxy(RadioSatelliteProxy.class);
+ if (radioSatelliteProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(radioSatelliteProxy, result);
+ return;
+ }
+ if (mHalVersion.get(HAL_SERVICE_SATELLITE).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
+ RILRequest rr = obtainRequest(RIL_REQUEST_GET_SATELLITE_MODE, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ // Do not log function arg for privacy
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(HAL_SERVICE_SATELLITE, rr, "getSatelliteMode", () -> {
+ radioSatelliteProxy.getSatelliteMode(rr.mSerial);
+ });
+ } else {
+ if (RILJ_LOGD) {
+ Rlog.d(RILJ_LOG_TAG, "getSatelliteMode: REQUEST_NOT_SUPPORTED");
+ }
+ if (result != null) {
+ AsyncResult.forMessage(result, null,
+ CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
+ result.sendToTarget();
+ }
}
}
@@ -5937,11 +6302,34 @@
*/
@Override
public void setSatelliteIndicationFilter(Message result, int filterBitmask) {
- // Satellite HAL APIs are not supported before Android V.
- if (result != null) {
- AsyncResult.forMessage(result, null,
- CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
- result.sendToTarget();
+ RadioSatelliteProxy radioSatelliteProxy =
+ getRadioServiceProxy(RadioSatelliteProxy.class);
+ if (radioSatelliteProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(radioSatelliteProxy, result);
+ return;
+ }
+ if (mHalVersion.get(HAL_SERVICE_SATELLITE).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_SATELLITE_INDICATION_FILTER, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ // Do not log function arg for privacy
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(
+ HAL_SERVICE_SATELLITE, rr, "setSatelliteIndicationFilter", () -> {
+ radioSatelliteProxy.setIndicationFilter(rr.mSerial, filterBitmask);
+ });
+ } else {
+ if (RILJ_LOGD) {
+ Rlog.d(RILJ_LOG_TAG, "setSatelliteIndicationFilter: REQUEST_NOT_SUPPORTED");
+ }
+ if (result != null) {
+ AsyncResult.forMessage(result, null,
+ CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
+ result.sendToTarget();
+ }
}
}
@@ -5952,12 +6340,16 @@
*/
@Override
public void isSatelliteSupported(Message result) {
- // Satellite HAL APIs are not supported before Android V.
if (result != null) {
AsyncResult.forMessage(result, null,
CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
result.sendToTarget();
}
+ /**
+ * TODO: when adding implementation of this method, we need to return successful result
+ * with satellite support set to false if radioSatelliteProxy.isEmpty() is true or
+ * mHalVersion.get(HAL_SERVICE_SATELLITE).greaterOrEqual(RADIO_HAL_VERSION_2_0) is false.
+ */
}
/**
@@ -5968,11 +6360,35 @@
*/
@Override
public void startSendingSatellitePointingInfo(Message result) {
- // Satellite HAL APIs are not supported before Android V.
- if (result != null) {
- AsyncResult.forMessage(result, null,
- CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
- result.sendToTarget();
+ RadioSatelliteProxy radioSatelliteProxy =
+ getRadioServiceProxy(RadioSatelliteProxy.class);
+ if (radioSatelliteProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(radioSatelliteProxy, result);
+ return;
+ }
+ if (mHalVersion.get(HAL_SERVICE_SATELLITE).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
+ RILRequest rr = obtainRequest(RIL_REQUEST_START_SENDING_SATELLITE_POINTING_INFO, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ // Do not log function arg for privacy
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(
+ HAL_SERVICE_SATELLITE, rr, "startSendingSatellitePointingInfo", () -> {
+ radioSatelliteProxy.startSendingSatellitePointingInfo(rr.mSerial);
+ });
+ } else {
+ if (RILJ_LOGD) {
+ Rlog.d(RILJ_LOG_TAG,
+ "startSendingSatellitePointingInfo: REQUEST_NOT_SUPPORTED");
+ }
+ if (result != null) {
+ AsyncResult.forMessage(result, null,
+ CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
+ result.sendToTarget();
+ }
}
}
@@ -5983,11 +6399,35 @@
*/
@Override
public void stopSendingSatellitePointingInfo(Message result) {
- // Satellite HAL APIs are not supported before Android V.
- if (result != null) {
- AsyncResult.forMessage(result, null,
- CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
- result.sendToTarget();
+ RadioSatelliteProxy radioSatelliteProxy =
+ getRadioServiceProxy(RadioSatelliteProxy.class);
+ if (radioSatelliteProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(radioSatelliteProxy, result);
+ return;
+ }
+ if (mHalVersion.get(HAL_SERVICE_SATELLITE).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
+ RILRequest rr = obtainRequest(RIL_REQUEST_STOP_SENDING_SATELLITE_POINTING_INFO, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ // Do not log function arg for privacy
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(
+ HAL_SERVICE_SATELLITE, rr, "stopSendingSatellitePointingInfo", () -> {
+ radioSatelliteProxy.stopSendingSatellitePointingInfo(rr.mSerial);
+ });
+ } else {
+ if (RILJ_LOGD) {
+ Rlog.d(RILJ_LOG_TAG,
+ "stopSendingSatellitePointingInfo: REQUEST_NOT_SUPPORTED");
+ }
+ if (result != null) {
+ AsyncResult.forMessage(result, null,
+ CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
+ result.sendToTarget();
+ }
}
}
@@ -5998,11 +6438,35 @@
*/
@Override
public void getMaxCharactersPerSatelliteTextMessage(Message result) {
- // Satellite HAL APIs are not supported before Android V.
- if (result != null) {
- AsyncResult.forMessage(result, null,
- CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
- result.sendToTarget();
+ RadioSatelliteProxy radioSatelliteProxy =
+ getRadioServiceProxy(RadioSatelliteProxy.class);
+ if (radioSatelliteProxy.isEmpty()) {
+ handleRadioServiceNotAvailable(radioSatelliteProxy, result);
+ return;
+ }
+ if (mHalVersion.get(HAL_SERVICE_SATELLITE).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
+ RILRequest rr = obtainRequest(RIL_REQUEST_GET_MAX_CHARACTERS_PER_SATELLITE_TEXT_MESSAGE,
+ result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ // Do not log function arg for privacy
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(
+ HAL_SERVICE_SATELLITE, rr, "getMaxCharactersPerSatelliteTextMessage", () -> {
+ radioSatelliteProxy.getMaxCharactersPerTextMessage(rr.mSerial);
+ });
+ } else {
+ if (RILJ_LOGD) {
+ Rlog.d(RILJ_LOG_TAG,
+ "getMaxCharactersPerSatelliteTextMessage: REQUEST_NOT_SUPPORTED");
+ }
+ if (result != null) {
+ AsyncResult.forMessage(result, null,
+ CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
+ result.sendToTarget();
+ }
}
}
@@ -6013,7 +6477,11 @@
*/
@Override
public void isSatelliteCommunicationAllowedForCurrentLocation(Message result) {
- // Satellite HAL APIs are not supported before Android V.
+ // TODO: link to HAL implementation
+ if (RILJ_LOGD) {
+ Rlog.d(RILJ_LOG_TAG,
+ "stopSendingSatellitePointingInfo: REQUEST_NOT_SUPPORTED");
+ }
if (result != null) {
AsyncResult.forMessage(result, null,
CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
@@ -6028,11 +6496,40 @@
*/
@Override
public void getTimeForNextSatelliteVisibility(Message result) {
- // Satellite HAL APIs are not supported before Android V.
- if (result != null) {
- AsyncResult.forMessage(result, null,
- CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
- result.sendToTarget();
+ RadioSatelliteProxy radioSatelliteProxy =
+ getRadioServiceProxy(RadioSatelliteProxy.class);
+ if (radioSatelliteProxy.isEmpty()) {
+ riljLoge("getTimeForNextSatelliteVisibility: RadioSatelliteProxy is empty");
+ if (result != null) {
+ AsyncResult.forMessage(result, null,
+ CommandException.fromRilErrno(RADIO_NOT_AVAILABLE));
+ result.sendToTarget();
+ }
+ return;
+ }
+ if (mHalVersion.get(HAL_SERVICE_SATELLITE).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
+ RILRequest rr = obtainRequest(RIL_REQUEST_GET_TIME_FOR_NEXT_SATELLITE_VISIBILITY,
+ result, mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ // Do not log function arg for privacy
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(
+ HAL_SERVICE_SATELLITE, rr, "getTimeForNextSatelliteVisibility", () -> {
+ radioSatelliteProxy.getTimeForNextSatelliteVisibility(rr.mSerial);
+ });
+ } else {
+ if (RILJ_LOGD) {
+ Rlog.d(RILJ_LOG_TAG,
+ "getTimeForNextSatelliteVisibility: REQUEST_NOT_SUPPORTED");
+ }
+ if (result != null) {
+ AsyncResult.forMessage(result, null,
+ CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
+ result.sendToTarget();
+ }
}
}
@@ -6303,7 +6800,7 @@
mRILDefaultWorkSource);
acquireWakeLock(rr, FOR_ACK_WAKELOCK);
if (service == HAL_SERVICE_RADIO) {
- IRadio radioProxy = getRadioProxy(null);
+ IRadio radioProxy = getRadioProxy();
if (radioProxy != null) {
try {
radioProxy.responseAcknowledgement();
@@ -6315,7 +6812,7 @@
Rlog.e(RILJ_LOG_TAG, "Error trying to send ack, radioProxy = null");
}
} else {
- RadioServiceProxy serviceProxy = getRadioServiceProxy(service, null);
+ RadioServiceProxy serviceProxy = getRadioServiceProxy(service);
if (!serviceProxy.isEmpty()) {
try {
serviceProxy.responseAcknowledgement();
@@ -6826,6 +7323,7 @@
pw.println(" " + mServiceProxies.get(HAL_SERVICE_SIM));
pw.println(" " + mServiceProxies.get(HAL_SERVICE_VOICE));
pw.println(" " + mServiceProxies.get(HAL_SERVICE_IMS));
+ pw.println(" " + mServiceProxies.get(HAL_SERVICE_SATELLITE));
pw.println(" mWakeLock=" + mWakeLock);
pw.println(" mWakeLockTimeout=" + mWakeLockTimeout);
synchronized (mRequestList) {
@@ -6955,6 +7453,8 @@
return "VOICE";
case HAL_SERVICE_IMS:
return "IMS";
+ case HAL_SERVICE_SATELLITE:
+ return "SATELLITE";
default:
return "UNKNOWN:" + service;
}
diff --git a/src/java/com/android/internal/telephony/RILUtils.java b/src/java/com/android/internal/telephony/RILUtils.java
index 01dd59b..0c5bc18 100644
--- a/src/java/com/android/internal/telephony/RILUtils.java
+++ b/src/java/com/android/internal/telephony/RILUtils.java
@@ -25,6 +25,7 @@
import static android.telephony.TelephonyManager.CAPABILITY_USES_ALLOWED_NETWORK_TYPES_BITMASK;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ADD_ALLOWED_SATELLITE_CONTACTS;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ALLOCATE_PDU_SESSION_ID;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ALLOW_DATA;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ANSWER;
@@ -91,12 +92,17 @@
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_IMEI;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_IMEISV;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_IMSI;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_MAX_CHARACTERS_PER_SATELLITE_TEXT_MESSAGE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_MODEM_STATUS;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_MUTE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_NEIGHBORING_CELL_IDS;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_PENDING_SATELLITE_MESSAGES;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_PHONE_CAPABILITY;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_RADIO_CAPABILITY;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SATELLITE_CAPABILITIES;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SATELLITE_MODE;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SATELLITE_POWER;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SIM_PHONEBOOK_CAPACITY;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SIM_PHONEBOOK_RECORDS;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SIM_STATUS;
@@ -104,6 +110,7 @@
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SLOT_STATUS;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SMSC_ADDRESS;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SYSTEM_SELECTION_CHANNELS;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_TIME_FOR_NEXT_SATELLITE_VISIBILITY;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_UICC_APPLICATIONS_ENABLEMENT;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_USAGE_SETTING;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GSM_BROADCAST_ACTIVATION;
@@ -127,6 +134,7 @@
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_OEM_HOOK_RAW;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_OEM_HOOK_STRINGS;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_OPERATOR;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_PROVISION_SATELLITE_SERVICE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_PULL_LCEDATA;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_QUERY_AVAILABLE_NETWORKS;
@@ -138,12 +146,14 @@
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_QUERY_TTY_MODE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_RADIO_POWER;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_RELEASE_PDU_SESSION_ID;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_REMOVE_ALLOWED_SATELLITE_CONTACTS;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_REPORT_SMS_MEMORY_STATUS;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_RESET_RADIO;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SCREEN_STATE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SEND_ANBR_QUERY;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SEND_DEVICE_STATE;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SEND_SATELLITE_MESSAGES;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SEND_SMS;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SEND_SMS_EXPECT_MORE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SEND_USSD;
@@ -173,6 +183,8 @@
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_PREFERRED_DATA_MODEM;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_RADIO_CAPABILITY;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SATELLITE_INDICATION_FILTER;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SATELLITE_POWER;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SIGNAL_STRENGTH_REPORTING_CRITERIA;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SIM_CARD_POWER;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SMSC_ADDRESS;
@@ -198,6 +210,7 @@
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_START_KEEPALIVE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_START_LCE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_START_NETWORK_SCAN;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_START_SENDING_SATELLITE_POINTING_INFO;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_STK_GET_PROFILE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND;
@@ -208,6 +221,7 @@
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_STOP_KEEPALIVE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_STOP_LCE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_STOP_NETWORK_SCAN;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_STOP_SENDING_SATELLITE_POINTING_INFO;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SWITCH_DUAL_SIM_CONFIG;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_TRIGGER_EMERGENCY_NETWORK_SCAN;
@@ -242,6 +256,7 @@
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_LCEDATA_RECV;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_MODEM_RESTART;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_NETWORK_SCAN_RESULT;
+import static com.android.internal.telephony.RILConstants.RIL_UNSOL_NEW_SATELLITE_MESSAGES;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_NITZ_TIME_RECEIVED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_NOTIFY_ANBR;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_OEM_HOOK_RAW;
@@ -249,6 +264,7 @@
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_ON_USSD;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_ON_USSD_REQUEST;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_PCO_DATA;
+import static com.android.internal.telephony.RILConstants.RIL_UNSOL_PENDING_SATELLITE_MESSAGE_COUNT;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_PHYSICAL_CHANNEL_CONFIG;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RADIO_CAPABILITY;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_REGISTRATION_FAILED;
@@ -268,6 +284,11 @@
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESTRICTED_STATE_CHANGED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RIL_CONNECTED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RINGBACK_TONE;
+import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_MESSAGES_TRANSFER_COMPLETE;
+import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_MODE_CHANGED;
+import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_POINTING_INFO_CHANGED;
+import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_PROVISION_STATE_CHANGED;
+import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_RADIO_TECHNOLOGY_CHANGED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SIGNAL_STRENGTH;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SIM_REFRESH;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SIM_SMS_STORAGE_FULL;
@@ -354,6 +375,8 @@
import android.telephony.ims.feature.MmTelFeature;
import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.telephony.ims.stub.ImsRegistrationImplBase.ImsDeregistrationReason;
+import android.telephony.satellite.PointingInfo;
+import android.telephony.satellite.SatelliteCapabilities;
import android.telephony.satellite.SatelliteManager;
import android.text.TextUtils;
import android.util.ArraySet;
@@ -5351,6 +5374,34 @@
return "SET_N1_MODE_ENABLED";
case RIL_REQUEST_IS_N1_MODE_ENABLED:
return "IS_N1_MODE_ENABLED";
+ case RIL_REQUEST_GET_SATELLITE_CAPABILITIES:
+ return "GET_SATELLITE_CAPABILITIES";
+ case RIL_REQUEST_SET_SATELLITE_POWER:
+ return "SET_SATELLITE_POWER";
+ case RIL_REQUEST_GET_SATELLITE_POWER:
+ return "GET_SATELLITE_POWER";
+ case RIL_REQUEST_PROVISION_SATELLITE_SERVICE:
+ return "PROVISION_SATELLITE_SERVICE";
+ case RIL_REQUEST_ADD_ALLOWED_SATELLITE_CONTACTS:
+ return "ADD_ALLOWED_SATELLITE_CONTACTS";
+ case RIL_REQUEST_REMOVE_ALLOWED_SATELLITE_CONTACTS:
+ return "REMOVE_ALLOWED_SATELLITE_CONTACTS";
+ case RIL_REQUEST_SEND_SATELLITE_MESSAGES:
+ return "SEND_SATELLITE_MESSAGES";
+ case RIL_REQUEST_GET_PENDING_SATELLITE_MESSAGES:
+ return "GET_PENDING_SATELLITE_MESSAGES";
+ case RIL_REQUEST_GET_SATELLITE_MODE:
+ return "GET_SATELLITE_MODE";
+ case RIL_REQUEST_SET_SATELLITE_INDICATION_FILTER:
+ return "SET_SATELLITE_INDICATION_FILTER";
+ case RIL_REQUEST_START_SENDING_SATELLITE_POINTING_INFO:
+ return "START_SENDING_SATELLITE_POINTING_INFO";
+ case RIL_REQUEST_STOP_SENDING_SATELLITE_POINTING_INFO:
+ return "STOP_SENDING_SATELLITE_POINTING_INFO";
+ case RIL_REQUEST_GET_MAX_CHARACTERS_PER_SATELLITE_TEXT_MESSAGE:
+ return "GET_MAX_CHARACTERS_PER_SATELLITE_TEXT_MESSAGE";
+ case RIL_REQUEST_GET_TIME_FOR_NEXT_SATELLITE_VISIBILITY:
+ return "GET_TIME_FOR_NEXT_SATELLITE_VISIBILITY";
default:
return "<unknown request " + request + ">";
}
@@ -5491,6 +5542,20 @@
return "UNSOL_NOTIFY_ANBR";
case RIL_UNSOL_TRIGGER_IMS_DEREGISTRATION:
return "UNSOL_TRIGGER_IMS_DEREGISTRATION";
+ case RIL_UNSOL_PENDING_SATELLITE_MESSAGE_COUNT:
+ return "UNSOL_PENDING_SATELLITE_MESSAGE_COUNT";
+ case RIL_UNSOL_NEW_SATELLITE_MESSAGES:
+ return "UNSOL_NEW_SATELLITE_MESSAGES";
+ case RIL_UNSOL_SATELLITE_MESSAGES_TRANSFER_COMPLETE:
+ return "UNSOL_SATELLITE_MESSAGES_TRANSFER_COMPLETE";
+ case RIL_UNSOL_SATELLITE_POINTING_INFO_CHANGED:
+ return "UNSOL_SATELLITE_POINTING_INFO_CHANGED";
+ case RIL_UNSOL_SATELLITE_MODE_CHANGED:
+ return "UNSOL_SATELLITE_MODE_CHANGED";
+ case RIL_UNSOL_SATELLITE_RADIO_TECHNOLOGY_CHANGED:
+ return "UNSOL_SATELLITE_RADIO_TECHNOLOGY_CHANGED";
+ case RIL_UNSOL_SATELLITE_PROVISION_STATE_CHANGED:
+ return "UNSOL_SATELLITE_PROVISION_STATE_CHANGED";
default:
return "<unknown response>";
}
@@ -5876,6 +5941,46 @@
}
/**
+ * Convert android.hardware.radio.satellite.SatelliteCapabilities to
+ * android.telephony.satellite.SatelliteCapabilities
+ */
+ public static SatelliteCapabilities convertHalSatelliteCapabilities(
+ android.hardware.radio.satellite.SatelliteCapabilities capabilities) {
+ Set<Integer> supportedRadioTechnologies = new HashSet<>();
+ if (capabilities.supportedRadioTechnologies != null
+ && capabilities.supportedRadioTechnologies.length > 0) {
+ for (int technology : capabilities.supportedRadioTechnologies) {
+ supportedRadioTechnologies.add(technology);
+ }
+ }
+ return new SatelliteCapabilities(supportedRadioTechnologies,
+ capabilities.needsPointingToSatellite, 0, null);
+ }
+
+ /**
+ * Convert from android.hardware.radio.satellite.PointingInfo to
+ * android.telephony.satellite.stub.PointingInfo
+ */
+ public static PointingInfo convertHalSatellitePointingInfo(
+ android.hardware.radio.satellite.PointingInfo pointingInfo) {
+ return new PointingInfo(pointingInfo.satelliteAzimuthDegrees,
+ pointingInfo.satelliteElevationDegrees);
+ }
+
+ /**
+ * Convert from android.telephony.satellite.stub.PointingInfo to
+ * android.hardware.radio.satellite.PointingInfo
+ */
+ public static android.hardware.radio.satellite.PointingInfo convertToHalSatellitePointingInfo(
+ PointingInfo pointingInfo) {
+ android.hardware.radio.satellite.PointingInfo halPointingInfo =
+ new android.hardware.radio.satellite.PointingInfo();
+ halPointingInfo.satelliteAzimuthDegrees = pointingInfo.getSatelliteAzimuthDegrees();
+ halPointingInfo.satelliteElevationDegrees = pointingInfo.getSatelliteElevationDegrees();
+ return halPointingInfo;
+ }
+
+ /**
* Convert satellite-related errors from CommandException.Error to
* SatelliteManager.SatelliteServiceResult.
* @param error The satellite error.
@@ -5905,12 +6010,18 @@
return SatelliteManager.SATELLITE_NO_RESOURCES;
case NETWORK_ERR:
return SatelliteManager.SATELLITE_NETWORK_ERROR;
+ case NETWORK_TIMEOUT:
+ return SatelliteManager.SATELLITE_NETWORK_TIMEOUT;
case NO_NETWORK_FOUND:
+ //fallthrough to NO_SATELLITE_SIGNAL
+ case NO_SATELLITE_SIGNAL:
return SatelliteManager.SATELLITE_NOT_REACHABLE;
case ABORTED:
return SatelliteManager.SATELLITE_REQUEST_ABORTED;
case ACCESS_BARRED:
return SatelliteManager.SATELLITE_ACCESS_BARRED;
+ case SUBSCRIBER_NOT_AUTHORIZED:
+ return SatelliteManager.SATELLITE_NOT_AUTHORIZED;
default:
return SatelliteManager.SATELLITE_ERROR;
}
diff --git a/src/java/com/android/internal/telephony/RadioSatelliteProxy.java b/src/java/com/android/internal/telephony/RadioSatelliteProxy.java
new file mode 100644
index 0000000..6101f3f
--- /dev/null
+++ b/src/java/com/android/internal/telephony/RadioSatelliteProxy.java
@@ -0,0 +1,279 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+package com.android.internal.telephony;
+
+import android.os.RemoteException;
+import android.telephony.Rlog;
+
+/**
+ * A holder for IRadioSatellite.
+ * Use getAidl to get IRadioSatellite and call the AIDL implementations of the HAL APIs.
+ */
+public class RadioSatelliteProxy extends RadioServiceProxy {
+ private static final String TAG = "RadioSatelliteProxy";
+ private volatile android.hardware.radio.satellite.IRadioSatellite mSatelliteProxy = null;
+
+ /**
+ * Sets IRadioSatellite as the AIDL implementation for RadioServiceProxy.
+ * @param halVersion Radio HAL version.
+ * @param satellite IRadioSatellite implementation.
+ *
+ * @return updated HAL version.
+ */
+ public HalVersion setAidl(HalVersion halVersion,
+ android.hardware.radio.satellite.IRadioSatellite satellite) {
+ HalVersion version = halVersion;
+ try {
+ 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;
+ }
+
+ /**
+ * Gets the AIDL implementation of RadioSatelliteProxy.
+ * @return IRadioSatellite implementation.
+ */
+ public android.hardware.radio.satellite.IRadioSatellite getAidl() {
+ return mSatelliteProxy;
+ }
+
+ /**
+ * Resets RadioSatelliteProxy.
+ */
+ @Override
+ public void clear() {
+ super.clear();
+ mSatelliteProxy = null;
+ }
+
+ /**
+ * Checks whether a IRadioSatellite implementation exists.
+ * @return true if there is neither a HIDL nor AIDL implementation.
+ */
+ @Override
+ public boolean isEmpty() {
+ return mRadioProxy == null && mSatelliteProxy == null;
+ }
+
+ /**
+ * Call IRadioSatellite#responseAcknowledgement
+ * @throws RemoteException Throws RemoteException when RadioSatellite service is not available.
+ */
+ @Override
+ public void responseAcknowledgement() throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mSatelliteProxy.responseAcknowledgement();
+ }
+ }
+
+ /**
+ * Call IRadioSatellite#getCapabilities
+ * @param serial Serial number of request.
+ * @throws RemoteException Throws RemoteException when RadioSatellite service is not available.
+ */
+ public void getCapabilities(int serial) throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mSatelliteProxy.getCapabilities(serial);
+ }
+ }
+
+ /**
+ * Call IRadioSatellite#setPower
+ * @param serial Serial number of request.
+ * @param on True for turning on.
+ * False for turning off.
+ * @throws RemoteException Throws RemoteException when RadioSatellite service is not available.
+ */
+ public void setPower(int serial, boolean on) throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mSatelliteProxy.setPower(serial, on);
+ }
+ }
+
+ /**
+ * Call IRadioSatellite#getPowerState
+ * @param serial Serial number of request.
+ * @throws RemoteException Throws RemoteException when RadioSatellite service is not available.
+ */
+ public void getPowerState(int serial) throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mSatelliteProxy.getPowerState(serial);
+ }
+ }
+
+ /**
+ * Call IRadioSatellite#provisionService
+ * @param serial Serial number of request.
+ * @param imei IMEI of the SIM associated with the satellite modem.
+ * @param msisdn MSISDN of the SIM associated with the satellite modem.
+ * @param imsi IMSI of the SIM associated with the satellite modem.
+ * @param features List of features to be provisioned.
+ * @throws RemoteException Throws RemoteException when RadioSatellite service is not available.
+ */
+ public void provisionService(
+ int serial,
+ String imei,
+ String msisdn,
+ String imsi,
+ int[] features) throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mSatelliteProxy.provisionService(serial, imei, msisdn, imsi, features);
+ }
+ }
+
+ /**
+ * Call IRadioSatellite#addAllowedSatelliteContacts
+ * @param serial Serial number of request.
+ * @param contacts List of allowed contacts to be added.
+ * @throws RemoteException Throws RemoteException when RadioSatellite service is not available.
+ */
+ public void addAllowedSatelliteContacts(int serial, String[] contacts) throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mSatelliteProxy.addAllowedSatelliteContacts(serial, contacts);
+ }
+ }
+
+ /**
+ * Call IRadioSatellite#removeAllowedSatelliteContacts
+ * @param serial Serial number of request.
+ * @param contacts List of allowed contacts to be removed.
+ * @throws RemoteException Throws RemoteException when RadioSatellite service is not available.
+ */
+ public void removeAllowedSatelliteContacts(int serial, String[] contacts)
+ throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mSatelliteProxy.removeAllowedSatelliteContacts(serial, contacts);
+ }
+ }
+
+ /**
+ * Call IRadioSatellite#sendMessages
+ * @param serial Serial number of request.
+ * @param messages List of messages in text format to be sent.
+ * @param destination The recipient of the message.
+ * @param latitude The current latitude of the device.
+ * @param longitude The current longitude of the device
+ * @throws RemoteException Throws RemoteException when RadioSatellite service is not available.
+ */
+ public void sendMessages(int serial, String[] messages, String destination, double latitude,
+ double longitude) throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mSatelliteProxy.sendMessages(serial, messages, destination, latitude, longitude);
+ }
+ }
+
+ /**
+ * Call IRadioSatellite#getPendingMessages
+ * @param serial Serial number of request.
+ * @throws RemoteException Throws RemoteException when RadioSatellite service is not available.
+ */
+ public void getPendingMessages(int serial) throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mSatelliteProxy.getPendingMessages(serial);
+ }
+ }
+
+ /**
+ * Call IRadioSatellite#getSatelliteMode
+ * @param serial Serial number of request.
+ * @throws RemoteException Throws RemoteException when RadioSatellite service is not available.
+ */
+ public void getSatelliteMode(int serial) throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mSatelliteProxy.getSatelliteMode(serial);
+ }
+ }
+
+ /**
+ * Call IRadioSatellite#setIndicationFilter
+ * @param serial Serial number of request.
+ * @param filterBitmask The filter identifying what type of indication framework want to
+ * receive from modem.
+ * @throws RemoteException Throws RemoteException when RadioSatellite service is not available.
+ */
+ public void setIndicationFilter(int serial, int filterBitmask) throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mSatelliteProxy.setIndicationFilter(serial, filterBitmask);
+ }
+ }
+
+ /**
+ * Call IRadioSatellite#startSendingSatellitePointingInfo
+ * @param serial Serial number of request.
+ * @throws RemoteException Throws RemoteException when RadioSatellite service is not available.
+ */
+ public void startSendingSatellitePointingInfo(int serial) throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mSatelliteProxy.startSendingSatellitePointingInfo(serial);
+ }
+ }
+
+ /**
+ * Call IRadioSatellite#stopSendingSatellitePointingInfo
+ * @param serial Serial number of request.
+ * @throws RemoteException Throws RemoteException when RadioSatellite service is not available.
+ */
+ public void stopSendingSatellitePointingInfo(int serial) throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mSatelliteProxy.stopSendingSatellitePointingInfo(serial);
+ }
+ }
+
+ /**
+ * Call IRadioSatellite#getMaxCharactersPerTextMessage
+ * @param serial Serial number of request.
+ * @throws RemoteException Throws RemoteException when RadioSatellite service is not available.
+ */
+ public void getMaxCharactersPerTextMessage(int serial) throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mSatelliteProxy.getMaxCharactersPerTextMessage(serial);
+ }
+ }
+
+ /**
+ * Call IRadioSatellite#getTimeForNextSatelliteVisibility
+ * @param serial Serial number of request.
+ * @throws RemoteException Throws RemoteException when RadioSatellite service is not available.
+ */
+ public void getTimeForNextSatelliteVisibility(int serial) throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mSatelliteProxy.getTimeForNextSatelliteVisibility(serial);
+ }
+ }
+}
diff --git a/src/java/com/android/internal/telephony/SatelliteIndication.java b/src/java/com/android/internal/telephony/SatelliteIndication.java
new file mode 100644
index 0000000..2e561c3
--- /dev/null
+++ b/src/java/com/android/internal/telephony/SatelliteIndication.java
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+package com.android.internal.telephony;
+
+import static android.telephony.TelephonyManager.HAL_SERVICE_SATELLITE;
+
+import static com.android.internal.telephony.RILConstants.RIL_UNSOL_NEW_SATELLITE_MESSAGES;
+import static com.android.internal.telephony.RILConstants.RIL_UNSOL_PENDING_SATELLITE_MESSAGE_COUNT;
+import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_MESSAGES_TRANSFER_COMPLETE;
+import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_MODE_CHANGED;
+import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_POINTING_INFO_CHANGED;
+import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_PROVISION_STATE_CHANGED;
+import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_RADIO_TECHNOLOGY_CHANGED;
+
+import android.hardware.radio.satellite.IRadioSatelliteIndication;
+import android.os.AsyncResult;
+import android.telephony.satellite.SatelliteDatagram;
+import android.util.Pair;
+
+/**
+ * Interface declaring unsolicited radio indications for Satellite APIs.
+ */
+public class SatelliteIndication extends IRadioSatelliteIndication.Stub {
+ private final RIL mRil;
+
+ public SatelliteIndication(RIL ril) {
+ mRil = ril;
+ }
+
+ @Override
+ public String getInterfaceHash() {
+ return IRadioSatelliteIndication.HASH;
+ }
+
+ @Override
+ public int getInterfaceVersion() {
+ return IRadioSatelliteIndication.VERSION;
+ }
+
+ /**
+ * Indicates that satellite has pending messages for the device to be pulled.
+ *
+ * @param indicationType Type of radio indication
+ * @param count Number of pending messages.
+ */
+ public void onPendingMessageCount(int indicationType, int count) {
+ mRil.processIndication(HAL_SERVICE_SATELLITE, indicationType);
+
+ if (mRil.isLogOrTrace()) mRil.unsljLog(RIL_UNSOL_PENDING_SATELLITE_MESSAGE_COUNT);
+
+ if (mRil.mPendingSatelliteMessageCountRegistrants != null) {
+ mRil.mPendingSatelliteMessageCountRegistrants.notifyRegistrants(
+ new AsyncResult(null, count, null));
+ }
+ }
+
+ /**
+ * Indicates new message received on device.
+ *
+ * @param indicationType Type of radio indication
+ * @param messages List of new messages received.
+ */
+ public void onNewMessages(int indicationType, String[] messages) {
+ mRil.processIndication(HAL_SERVICE_SATELLITE, indicationType);
+
+ if (mRil.isLogOrTrace()) mRil.unsljLog(RIL_UNSOL_NEW_SATELLITE_MESSAGES);
+
+ if (mRil.mNewSatelliteMessagesRegistrants != null) {
+ for (int i = 0; i < messages.length; i++) {
+ SatelliteDatagram datagram = new SatelliteDatagram(messages[i].getBytes());
+ mRil.mNewSatelliteMessagesRegistrants.notifyRegistrants(
+ new AsyncResult(null, new Pair<>(datagram, messages.length - i - 1), null));
+ }
+ }
+ }
+
+ /**
+ * Confirms that ongoing message transfer is complete.
+ *
+ * @param indicationType Type of radio indication
+ * @param complete True mean the transfer is complete.
+ * False means the transfer is not complete.
+ */
+ public void onMessagesTransferComplete(int indicationType, boolean complete) {
+ mRil.processIndication(HAL_SERVICE_SATELLITE, indicationType);
+
+ if (mRil.isLogOrTrace()) mRil.unsljLog(RIL_UNSOL_SATELLITE_MESSAGES_TRANSFER_COMPLETE);
+
+ if (mRil.mSatelliteMessagesTransferCompleteRegistrants != null) {
+ mRil.mSatelliteMessagesTransferCompleteRegistrants.notifyRegistrants(
+ new AsyncResult(null, complete, null));
+ }
+ }
+
+ /**
+ * Indicate that satellite Pointing input has changed.
+ *
+ * @param indicationType Type of radio indication
+ * @param pointingInfo The current pointing info.
+ */
+ public void onSatellitePointingInfoChanged(int indicationType,
+ android.hardware.radio.satellite.PointingInfo pointingInfo) {
+ mRil.processIndication(HAL_SERVICE_SATELLITE, indicationType);
+
+ if (mRil.isLogOrTrace()) mRil.unsljLog(RIL_UNSOL_SATELLITE_POINTING_INFO_CHANGED);
+
+ if (mRil.mSatellitePointingInfoChangedRegistrants != null) {
+ mRil.mSatellitePointingInfoChangedRegistrants.notifyRegistrants(
+ new AsyncResult(
+ null,
+ RILUtils.convertHalSatellitePointingInfo(pointingInfo),
+ null));
+ }
+ }
+
+ /**
+ * Indicate that satellite mode has changed.
+ *
+ * @param indicationType Type of radio indication
+ * @param mode The current mode of the satellite modem.
+ */
+ public void onSatelliteModeChanged(int indicationType, int mode) {
+ mRil.processIndication(HAL_SERVICE_SATELLITE, indicationType);
+
+ if (mRil.isLogOrTrace()) mRil.unsljLog(RIL_UNSOL_SATELLITE_MODE_CHANGED);
+
+ if (mRil.mSatelliteModeChangedRegistrants != null) {
+ mRil.mSatelliteModeChangedRegistrants.notifyRegistrants(
+ new AsyncResult(null, mode, null));
+ }
+ }
+
+ /**
+ * Indicate that satellite radio technology has changed.
+ *
+ * @param indicationType Type of radio indication
+ * @param technology The current technology of the satellite modem.
+ */
+ public void onSatelliteRadioTechnologyChanged(int indicationType, int technology) {
+ mRil.processIndication(HAL_SERVICE_SATELLITE, indicationType);
+
+ if (mRil.isLogOrTrace()) mRil.unsljLog(RIL_UNSOL_SATELLITE_RADIO_TECHNOLOGY_CHANGED);
+
+ if (mRil.mSatelliteRadioTechnologyChangedRegistrants != null) {
+ mRil.mSatelliteRadioTechnologyChangedRegistrants.notifyRegistrants(
+ new AsyncResult(null, technology, null));
+ }
+ }
+
+ /**
+ * Indicate that satellite provision state has changed.
+ *
+ * @param indicationType Type of radio indication
+ * @param provisioned True means the service is provisioned.
+ * False means the service is not provisioned.
+ * @param features List of Feature whose provision state has changed.
+ */
+ public void onProvisionStateChanged(int indicationType, boolean provisioned, int[] features) {
+ // TODO: remove features and update AsyncResult
+ mRil.processIndication(HAL_SERVICE_SATELLITE, indicationType);
+
+ if (mRil.isLogOrTrace()) mRil.unsljLog(RIL_UNSOL_SATELLITE_PROVISION_STATE_CHANGED);
+
+ if (mRil.mSatelliteProvisionStateChangedRegistrants != null) {
+ mRil.mSatelliteProvisionStateChangedRegistrants.notifyRegistrants(
+ new AsyncResult(provisioned, null, null));
+ }
+ }
+}
diff --git a/src/java/com/android/internal/telephony/SatelliteResponse.java b/src/java/com/android/internal/telephony/SatelliteResponse.java
new file mode 100644
index 0000000..559691b
--- /dev/null
+++ b/src/java/com/android/internal/telephony/SatelliteResponse.java
@@ -0,0 +1,217 @@
+/*
+ * 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.
+ */
+
+package com.android.internal.telephony;
+
+import static android.telephony.TelephonyManager.HAL_SERVICE_SATELLITE;
+
+import android.hardware.radio.RadioError;
+import android.hardware.radio.RadioResponseInfo;
+import android.hardware.radio.satellite.IRadioSatelliteResponse;
+import android.telephony.satellite.SatelliteCapabilities;
+
+/**
+ * Interface declaring response functions to solicited radio requests for Satellite APIs.
+ */
+public class SatelliteResponse extends IRadioSatelliteResponse.Stub {
+ private final RIL mRil;
+
+ public SatelliteResponse(RIL ril) {
+ mRil = ril;
+ }
+
+ /**
+ * Acknowledge the receipt of radio request sent to the vendor. This must be sent only for
+ * radio request which take long time to respond.
+ * For more details, refer https://source.android.com/devices/tech/connect/ril.html
+ * @param serial Serial no. of the request whose acknowledgement is sent.
+ */
+ public void acknowledgeRequest(int serial) {
+ mRil.processRequestAck(serial);
+ }
+ /**
+ * Response of the request getCapabilities.
+ *
+ * @param responseInfo Response info struct containing serial no. and error
+ * @param capabilities List of capabilities that the satellite modem supports.
+ */
+ public void getCapabilitiesResponse(RadioResponseInfo responseInfo,
+ android.hardware.radio.satellite.SatelliteCapabilities capabilities) {
+ RILRequest rr = mRil.processResponse(HAL_SERVICE_SATELLITE, responseInfo);
+
+ if (rr != null) {
+ SatelliteCapabilities convertedSatelliteCapabilities =
+ RILUtils.convertHalSatelliteCapabilities(capabilities);
+ if (responseInfo.error == RadioError.NONE) {
+ RadioResponse.sendMessageResponse(rr.mResult, convertedSatelliteCapabilities);
+ }
+ mRil.processResponseDone(rr, responseInfo, convertedSatelliteCapabilities);
+ }
+ }
+
+ /**
+ * Response of the request setPower.
+ *
+ * @param responseInfo Response info struct containing serial no. and error
+ */
+ public void setPowerResponse(RadioResponseInfo responseInfo) {
+ RadioResponse.responseVoid(HAL_SERVICE_SATELLITE, mRil, responseInfo);
+ }
+
+ /**
+ * Response of the request getPowerState.
+ *
+ * @param responseInfo Response info struct containing serial no. and error
+ * @param on True means the modem is ON.
+ * False means the modem is OFF.
+ */
+ public void getPowerStateResponse(RadioResponseInfo responseInfo, boolean on) {
+ RadioResponse.responseInts(HAL_SERVICE_SATELLITE, mRil, responseInfo, on ? 1 : 0);
+ }
+
+ /**
+ * Response of the request provisionService.
+ *
+ * @param responseInfo Response info struct containing serial no. and error
+ * @param provisioned True means the service is provisioned.
+ * False means the service is not provisioned.
+ */
+ public void provisionServiceResponse(RadioResponseInfo responseInfo, boolean provisioned) {
+ RadioResponse.responseInts(HAL_SERVICE_SATELLITE, mRil, responseInfo, provisioned ? 1 : 0);
+ }
+
+ /**
+ * Response of the request addAllowedSatelliteContacts.
+ *
+ * @param responseInfo Response info struct containing serial no. and error
+ */
+ public void addAllowedSatelliteContactsResponse(RadioResponseInfo responseInfo) {
+ RadioResponse.responseVoid(HAL_SERVICE_SATELLITE, mRil, responseInfo);
+ }
+
+ /**
+ * Response of the request removeAllowedSatelliteContacts.
+ *
+ * @param responseInfo Response info struct containing serial no. and error
+ */
+ public void removeAllowedSatelliteContactsResponse(RadioResponseInfo responseInfo) {
+ RadioResponse.responseVoid(HAL_SERVICE_SATELLITE, mRil, responseInfo);
+ }
+
+ /**
+ * Response of the request sendMessages.
+ *
+ * @param responseInfo Response info struct containing serial no. and error
+ */
+ public void sendMessagesResponse(RadioResponseInfo responseInfo) {
+ RadioResponse.responseVoid(HAL_SERVICE_SATELLITE, mRil, responseInfo);
+ }
+
+ /**
+ * Response of the request getPendingMessages.
+ *
+ * @param responseInfo Response info struct containing serial no. and error
+ * @param messages List of pending messages received.
+ */
+ public void getPendingMessagesResponse(RadioResponseInfo responseInfo, String[] messages) {
+ RILRequest rr = mRil.processResponse(HAL_SERVICE_SATELLITE, responseInfo);
+
+ if (rr != null) {
+ if (responseInfo.error == RadioError.NONE) {
+ RadioResponse.sendMessageResponse(rr.mResult, messages);
+ }
+ mRil.processResponseDone(rr, responseInfo, messages);
+ }
+ }
+
+ /**
+ * Response of the request getSatelliteMode.
+ *
+ * @param responseInfo Response info struct containing serial no. and error
+ * @param mode Current Mode of the satellite modem.
+ * @param technology The current technology of the satellite modem.
+ */
+ public void getSatelliteModeResponse(RadioResponseInfo responseInfo, int mode, int technology) {
+ RILRequest rr = mRil.processResponse(HAL_SERVICE_SATELLITE, responseInfo);
+
+ if (rr != null) {
+ int[] ret = new int[]{mode, technology};
+ if (responseInfo.error == RadioError.NONE) {
+ RadioResponse.sendMessageResponse(rr.mResult, ret);
+ }
+ mRil.processResponseDone(rr, responseInfo, ret);
+ }
+ }
+
+ /**
+ * Response of the request setIndicationFilter.
+ *
+ * @param responseInfo Response info struct containing serial no. and error
+ */
+ public void setIndicationFilterResponse(RadioResponseInfo responseInfo) {
+ RadioResponse.responseVoid(HAL_SERVICE_SATELLITE, mRil, responseInfo);
+ }
+
+ /**
+ * Response of the request startSendingSatellitePointingInfo.
+ *
+ * @param responseInfo Response info struct containing serial no. and error
+ */
+ public void startSendingSatellitePointingInfoResponse(RadioResponseInfo responseInfo) {
+ RadioResponse.responseVoid(HAL_SERVICE_SATELLITE, mRil, responseInfo);
+ }
+
+ /**
+ * Response of the request stopSendingSatellitePointingInfo.
+ *
+ * @param responseInfo Response info struct containing serial no. and error
+ */
+ public void stopSendingSatellitePointingInfoResponse(RadioResponseInfo responseInfo) {
+ RadioResponse.responseVoid(HAL_SERVICE_SATELLITE, mRil, responseInfo);
+ }
+
+ /**
+ * Response of the request getMaxCharactersPerTextMessage.
+ *
+ * @param responseInfo Response info struct containing serial no. and error
+ * @param charLimit Maximum number of characters in a text message that can be sent.
+ */
+ public void getMaxCharactersPerTextMessageResponse(
+ RadioResponseInfo responseInfo, int charLimit) {
+ RadioResponse.responseInts(HAL_SERVICE_SATELLITE, mRil, responseInfo, charLimit);
+ }
+
+ /**
+ * Response of the request getTimeForNextSatelliteVisibility.
+ *
+ * @param responseInfo Response info struct containing serial no. and error
+ * @param timeInSeconds The duration in seconds after which the satellite will be visible.
+ */
+ public void getTimeForNextSatelliteVisibilityResponse(
+ RadioResponseInfo responseInfo, int timeInSeconds) {
+ RadioResponse.responseInts(HAL_SERVICE_SATELLITE, mRil, responseInfo, timeInSeconds);
+ }
+
+ @Override
+ public String getInterfaceHash() {
+ return IRadioSatelliteResponse.HASH;
+ }
+
+ @Override
+ public int getInterfaceVersion() {
+ return IRadioSatelliteResponse.VERSION;
+ }
+}
diff --git a/src/java/com/android/internal/telephony/metrics/MetricsCollector.java b/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
index 0e68224..72e069e 100644
--- a/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
+++ b/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
@@ -97,6 +97,8 @@
import com.android.internal.telephony.nano.PersistAtomsProto.UceEventStats;
import com.android.internal.telephony.nano.PersistAtomsProto.VoiceCallRatUsage;
import com.android.internal.telephony.nano.PersistAtomsProto.VoiceCallSession;
+import com.android.internal.telephony.uicc.UiccController;
+import com.android.internal.telephony.uicc.UiccSlot;
import com.android.internal.util.ConcurrentUtils;
import com.android.telephony.Rlog;
@@ -191,13 +193,13 @@
registerAtom(GBA_EVENT);
registerAtom(PER_SIM_STATUS);
registerAtom(OUTGOING_SHORT_CODE_SMS);
+ registerAtom(EMERGENCY_NUMBERS_INFO);
registerAtom(SATELLITE_CONTROLLER);
registerAtom(SATELLITE_SESSION);
registerAtom(SATELLITE_INCOMING_DATAGRAM);
registerAtom(SATELLITE_OUTGOING_DATAGRAM);
registerAtom(SATELLITE_PROVISION);
registerAtom(SATELLITE_SOS_MESSAGE_RECOMMENDER);
- registerAtom(EMERGENCY_NUMBERS_INFO);
Rlog.d(TAG, "registered");
} else {
Rlog.e(TAG, "could not get StatsManager, atoms not registered");
@@ -274,6 +276,8 @@
return pullPerSimStatus(data);
case OUTGOING_SHORT_CODE_SMS:
return pullOutgoingShortCodeSms(data);
+ case EMERGENCY_NUMBERS_INFO:
+ return pullEmergencyNumbersInfo(data);
case SATELLITE_CONTROLLER:
return pullSatelliteController(data);
case SATELLITE_SESSION:
@@ -286,8 +290,6 @@
return pullSatelliteProvision(data);
case SATELLITE_SOS_MESSAGE_RECOMMENDER:
return pullSatelliteSosMessageRecommender(data);
- case EMERGENCY_NUMBERS_INFO:
- return pullEmergencyNumbersInfo(data);
default:
Rlog.e(TAG, String.format("unexpected atom ID %d", atomTag));
return StatsManager.PULL_SKIP;
@@ -376,7 +378,9 @@
SIM_SLOT_STATE,
state.numActiveSlots,
state.numActiveSims,
- state.numActiveEsims));
+ state.numActiveEsims,
+ state.numActiveEsimSlots,
+ state.numActiveMepSlots));
return StatsManager.PULL_SUCCESS;
}
@@ -565,9 +569,14 @@
boolean hasDedicatedManagedProfileSub = Arrays.stream(phones)
.anyMatch(Phone::isManagedProfile);
+ UiccSlot[] slots = UiccController.getInstance().getUiccSlots();
+ int mepSupportedSlotCount = (int) Arrays.stream(slots)
+ .filter(UiccSlot::isMultipleEnabledProfileSupported)
+ .count();
+
data.add(TelephonyStatsLog.buildStatsEvent(DEVICE_TELEPHONY_PROPERTIES, true,
isAutoDataSwitchOn, mStorage.getAutoDataSwitchToggleCount(),
- hasDedicatedManagedProfileSub));
+ hasDedicatedManagedProfileSub, mepSupportedSlotCount));
return StatsManager.PULL_SUCCESS;
}
@@ -769,7 +778,8 @@
perSimStatus.pin1Enabled, // isPin1Enabled
perSimStatus.minimumVoltageClass, // simVoltageClass
perSimStatus.userModifiedApnTypes, // userModifiedApnTypeBitmask
- perSimStatus.unmeteredNetworks); // unmeteredNetworks
+ perSimStatus.unmeteredNetworks, // unmeteredNetworks
+ perSimStatus.vonrEnabled); // vonrEnabled
data.add(statsEvent);
result = StatsManager.PULL_SUCCESS;
}
@@ -789,6 +799,21 @@
}
}
+ private int pullEmergencyNumbersInfo(List<StatsEvent> data) {
+ boolean isDataLogged = false;
+ for (Phone phone : getPhonesIfAny()) {
+ if (phone != null) {
+ EmergencyNumberTracker tracker = phone.getEmergencyNumberTracker();
+ if (tracker != null) {
+ EmergencyNumbersInfo[] numList = tracker.getEmergencyNumbersProtoArray();
+ Arrays.stream(numList).forEach(number -> data.add(buildStatsEvent(number)));
+ isDataLogged = true;
+ }
+ }
+ }
+ return isDataLogged ? StatsManager.PULL_SUCCESS : StatsManager.PULL_SKIP;
+ }
+
private int pullSatelliteController(List<StatsEvent> data) {
SatelliteController[] controllerAtoms =
mStorage.getSatelliteControllerStats(MIN_COOLDOWN_MILLIS);
@@ -869,21 +894,6 @@
}
}
- private int pullEmergencyNumbersInfo(List<StatsEvent> data) {
- boolean isDataLogged = false;
- for (Phone phone : getPhonesIfAny()) {
- if (phone != null) {
- EmergencyNumberTracker tracker = phone.getEmergencyNumberTracker();
- if (tracker != null) {
- EmergencyNumbersInfo[] numList = tracker.getEmergencyNumbersProtoArray();
- Arrays.stream(numList).forEach(number -> data.add(buildStatsEvent(number)));
- isDataLogged = true;
- }
- }
- }
- return isDataLogged ? StatsManager.PULL_SUCCESS : StatsManager.PULL_SKIP;
- }
-
/** Registers a pulled atom ID {@code atomId}. */
private void registerAtom(int atomId) {
mStatsManager.setPullAtomCallback(atomId, /* metadata= */ null,
@@ -1233,6 +1243,21 @@
shortCodeSms.shortCodeSmsCount);
}
+ private static StatsEvent buildStatsEvent(EmergencyNumbersInfo emergencyNumber) {
+ return TelephonyStatsLog.buildStatsEvent(
+ EMERGENCY_NUMBERS_INFO,
+ emergencyNumber.isDbVersionIgnored,
+ emergencyNumber.assetVersion,
+ emergencyNumber.otaVersion,
+ emergencyNumber.number,
+ emergencyNumber.countryIso,
+ emergencyNumber.mnc,
+ emergencyNumber.route,
+ emergencyNumber.urns,
+ emergencyNumber.serviceCategories,
+ emergencyNumber.sources);
+ }
+
private static StatsEvent buildStatsEvent(SatelliteController satelliteController) {
return TelephonyStatsLog.buildStatsEvent(
SATELLITE_CONTROLLER,
@@ -1299,21 +1324,6 @@
stats.count);
}
- private static StatsEvent buildStatsEvent(EmergencyNumbersInfo emergencyNumber) {
- return TelephonyStatsLog.buildStatsEvent(
- EMERGENCY_NUMBERS_INFO,
- emergencyNumber.isDbVersionIgnored,
- emergencyNumber.assetVersion,
- emergencyNumber.otaVersion,
- emergencyNumber.number,
- emergencyNumber.countryIso,
- emergencyNumber.mnc,
- emergencyNumber.route,
- emergencyNumber.urns,
- emergencyNumber.serviceCategories,
- emergencyNumber.sources);
- }
-
/** Returns all phones in {@link PhoneFactory}, or an empty array if phones not made yet. */
private static Phone[] getPhonesIfAny() {
try {
diff --git a/src/java/com/android/internal/telephony/metrics/PerSimStatus.java b/src/java/com/android/internal/telephony/metrics/PerSimStatus.java
index 0b55815..ba43a84 100644
--- a/src/java/com/android/internal/telephony/metrics/PerSimStatus.java
+++ b/src/java/com/android/internal/telephony/metrics/PerSimStatus.java
@@ -76,6 +76,7 @@
public final int minimumVoltageClass;
public final int userModifiedApnTypes;
public final long unmeteredNetworks;
+ public final boolean vonrEnabled;
/** Returns the current sim status of the given {@link Phone}. */
@Nullable
@@ -107,7 +108,8 @@
iccCard == null ? false : iccCard.getIccLockEnabled(),
getMinimumVoltageClass(phone),
getUserModifiedApnTypes(phone),
- persistAtomsStorage.getUnmeteredNetworks(phone.getPhoneId(), carrierId));
+ persistAtomsStorage.getUnmeteredNetworks(phone.getPhoneId(), carrierId),
+ isVonrEnabled(phone));
}
private PerSimStatus(
@@ -126,7 +128,8 @@
boolean pin1Enabled,
int minimumVoltageClass,
int userModifiedApnTypes,
- long unmeteredNetworks) {
+ long unmeteredNetworks,
+ boolean vonrEnabled) {
this.carrierId = carrierId;
this.phoneNumberSourceUicc = phoneNumberSourceUicc;
this.phoneNumberSourceCarrier = phoneNumberSourceCarrier;
@@ -143,6 +146,7 @@
this.minimumVoltageClass = minimumVoltageClass;
this.userModifiedApnTypes = userModifiedApnTypes;
this.unmeteredNetworks = unmeteredNetworks;
+ this.vonrEnabled = vonrEnabled;
}
@Nullable
@@ -295,4 +299,16 @@
return bitmask;
}
}
+
+ /** Returns true if VoNR is enabled */
+ private static boolean isVonrEnabled(Phone phone) {
+ TelephonyManager telephonyManager =
+ phone.getContext()
+ .getSystemService(TelephonyManager.class);
+ if (telephonyManager == null) {
+ return false;
+ }
+ telephonyManager = telephonyManager.createForSubscriptionId(phone.getSubId());
+ return telephonyManager.isVoNrEnabled();
+ }
}
diff --git a/src/java/com/android/internal/telephony/metrics/SimSlotState.java b/src/java/com/android/internal/telephony/metrics/SimSlotState.java
index f840894..59237e1 100644
--- a/src/java/com/android/internal/telephony/metrics/SimSlotState.java
+++ b/src/java/com/android/internal/telephony/metrics/SimSlotState.java
@@ -23,6 +23,9 @@
import com.android.internal.telephony.uicc.UiccSlot;
import com.android.telephony.Rlog;
+import java.util.Arrays;
+import java.util.Objects;
+
/** Snapshots and stores the current SIM state. */
public class SimSlotState {
private static final String TAG = SimSlotState.class.getSimpleName();
@@ -30,31 +33,41 @@
public final int numActiveSlots;
public final int numActiveSims;
public final int numActiveEsims;
+ public final int numActiveEsimSlots;
+ public final int numActiveMepSlots;
/** Returns the current SIM state. */
public static SimSlotState getCurrentState() {
int numActiveSlots = 0;
int numActiveSims = 0;
int numActiveEsims = 0;
+ int numActiveEsimSlots = 0;
+ int numActiveMepSlots = 0;
UiccController uiccController = UiccController.getInstance();
// since we cannot hold lock insider UiccController, using getUiccSlots() for length only
for (int i = 0; i < uiccController.getUiccSlots().length; i++) {
UiccSlot slot = uiccController.getUiccSlot(i);
if (slot != null && slot.isActive()) {
numActiveSlots++;
+ if (slot.isEuicc()) {
+ numActiveEsimSlots++;
+ }
// avoid CardState.isCardPresent() since this should not include restricted cards
if (slot.getCardState() == CardState.CARDSTATE_PRESENT) {
if (slot.isEuicc()) {
// need to check active profiles besides the presence of eSIM cards
UiccCard card = slot.getUiccCard();
if (card != null) {
- // Check each port on the EuiccCard
- UiccPort[] uiccPorts = card.getUiccPortList();
- for (UiccPort port : uiccPorts) {
- if (port != null && port.getNumApplications() > 0) {
- numActiveSims++;
- numActiveEsims++;
- }
+ int numActiveProfiles = (int) Arrays.stream(card.getUiccPortList())
+ .filter(Objects::nonNull)
+ .map(UiccPort::getUiccProfile)
+ .filter(Objects::nonNull)
+ .filter(profile -> profile.getNumApplications() > 0)
+ .count();
+ numActiveSims += numActiveProfiles;
+ numActiveEsims += numActiveProfiles;
+ if (numActiveProfiles > 1) {
+ numActiveMepSlots++;
}
}
} else {
@@ -64,13 +77,25 @@
}
}
}
- return new SimSlotState(numActiveSlots, numActiveSims, numActiveEsims);
+ return new SimSlotState(
+ numActiveSlots,
+ numActiveSims,
+ numActiveEsims,
+ numActiveEsimSlots,
+ numActiveMepSlots);
}
- private SimSlotState(int numActiveSlots, int numActiveSims, int numActiveEsims) {
+ private SimSlotState(
+ int numActiveSlots,
+ int numActiveSims,
+ int numActiveEsims,
+ int numActiveEsimSlots,
+ int numActiveMepSlots) {
this.numActiveSlots = numActiveSlots;
this.numActiveSims = numActiveSims;
this.numActiveEsims = numActiveEsims;
+ this.numActiveEsimSlots = numActiveEsimSlots;
+ this.numActiveMepSlots = numActiveMepSlots;
}
/** Returns whether the given phone is using a eSIM. */
diff --git a/src/java/com/android/internal/telephony/satellite/SatelliteSessionController.java b/src/java/com/android/internal/telephony/satellite/SatelliteSessionController.java
index ea7681b..bb8a5af 100644
--- a/src/java/com/android/internal/telephony/satellite/SatelliteSessionController.java
+++ b/src/java/com/android/internal/telephony/satellite/SatelliteSessionController.java
@@ -313,9 +313,9 @@
if (DBG) logd("Entering IdleState");
mCurrentState = SatelliteManager.SATELLITE_MODEM_STATE_IDLE;
mIsSendingTriggeredDuringTransferringState.set(false);
+ //Enable Cellular Modem scanning
+ mSatelliteModemInterface.enableCellularModemWhileSatelliteModeIsOn(true, null);
notifyStateChangedEvent(SatelliteManager.SATELLITE_MODEM_STATE_IDLE);
- //Disable Cellular Modem
- mSatelliteModemInterface.enableCellularModemWhileSatelliteModeIsOn(false, null);
}
@Override
@@ -345,8 +345,8 @@
@Override
public void exit() {
if (DBG) logd("Exiting IdleState");
- //Enable Cellular Modem
- mSatelliteModemInterface.enableCellularModemWhileSatelliteModeIsOn(true, null);
+ //Disable Cellular Modem Scanning
+ mSatelliteModemInterface.enableCellularModemWhileSatelliteModeIsOn(false, null);
}
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/PhoneNumberUtilsTest.java b/tests/telephonytests/src/com/android/internal/telephony/PhoneNumberUtilsTest.java
index 2f3bbf7..c0dea23 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/PhoneNumberUtilsTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/PhoneNumberUtilsTest.java
@@ -216,6 +216,12 @@
assertNull(PhoneNumberUtils.toCallerIDMinMatch(null));
assertNull(PhoneNumberUtils.getStrippedReversed(null));
assertNull(PhoneNumberUtils.stringFromStringAndTOA(null, 1));
+
+ // Test for known potential bad extraction of post dial portion.
+ assertEquals(";123456",
+ PhoneNumberUtils.extractPostDialPortion("6281769222;123456"));
+ assertEquals("6281769222", PhoneNumberUtils.extractNetworkPortion(
+ "6281769222;123456"));
}
@SmallTest
diff --git a/tests/telephonytests/src/com/android/internal/telephony/RILTest.java b/tests/telephonytests/src/com/android/internal/telephony/RILTest.java
index 2396d1d..c0e5d67 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/RILTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/RILTest.java
@@ -105,11 +105,13 @@
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import android.content.Context;
import android.content.pm.ApplicationInfo;
@@ -130,6 +132,7 @@
import android.net.LinkAddress;
import android.os.AsyncResult;
import android.os.Handler;
+import android.os.HandlerThread;
import android.os.IPowerManager;
import android.os.IThermalService;
import android.os.Looper;
@@ -199,6 +202,8 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
@RunWith(AndroidTestingRunner.class)
@@ -341,15 +346,13 @@
RadioAccessFamily.getRafFromNetworkType(RILConstants.PREFERRED_NETWORK_MODE),
Phone.PREFERRED_CDMA_SUBSCRIPTION, 0, proxies);
mRILUnderTest = spy(mRILInstance);
- doReturn(mRadioProxy).when(mRILUnderTest).getRadioProxy(any());
- doReturn(mDataProxy).when(mRILUnderTest).getRadioServiceProxy(eq(RadioDataProxy.class),
- any());
+ doReturn(mRadioProxy).when(mRILUnderTest).getRadioProxy();
+ doReturn(mDataProxy).when(mRILUnderTest).getRadioServiceProxy(eq(RadioDataProxy.class));
doReturn(mNetworkProxy).when(mRILUnderTest).getRadioServiceProxy(
- eq(RadioNetworkProxy.class), any());
- doReturn(mSimProxy).when(mRILUnderTest).getRadioServiceProxy(eq(RadioSimProxy.class),
- any());
+ eq(RadioNetworkProxy.class));
+ doReturn(mSimProxy).when(mRILUnderTest).getRadioServiceProxy(eq(RadioSimProxy.class));
doReturn(mRadioModemProxy).when(mRILUnderTest).getRadioServiceProxy(
- eq(RadioModemProxy.class), any());
+ eq(RadioModemProxy.class));
doReturn(false).when(mDataProxy).isEmpty();
doReturn(false).when(mNetworkProxy).isEmpty();
doReturn(false).when(mSimProxy).isEmpty();
@@ -2897,7 +2900,7 @@
@Test
public void testAreUiccApplicationsEnabled_nullRadioProxy() throws Exception {
// Not supported on Radio 1.0.
- doReturn(null).when(mRILUnderTest).getRadioProxy(any());
+ doReturn(null).when(mRILUnderTest).getRadioProxy();
Message message = obtainMessage();
mRILUnderTest.areUiccApplicationsEnabled(message);
processAllMessages();
@@ -2967,4 +2970,59 @@
Assert.assertNotNull(ar.exception.getMessage());
Assert.assertEquals("REQUEST_NOT_SUPPORTED", ar.exception.getMessage());
}
+
+ @Test
+ public void testRadioServiceInvokeHelper() throws Exception {
+ CountDownLatch latch = new CountDownLatch(1);
+ HandlerThread handlerThread = new HandlerThread("testRilServiceInvokeHelper");
+ handlerThread.start();
+ Handler handler = new Handler(handlerThread.getLooper()) {
+ public void handleMessage(Message msg) {
+ AsyncResult ar = (AsyncResult) msg.obj;
+ if (ar != null && ar.exception != null
+ && ar.exception instanceof CommandException) {
+ CommandException.Error err =
+ ((CommandException) (ar.exception)).getCommandError();
+ if (err == CommandException.Error.SYSTEM_ERR) {
+ latch.countDown();
+ }
+ }
+ }
+ };
+
+ // RuntimeException
+ doThrow(new RuntimeException()).when(mDataProxy).getDataCallList(anyInt());
+ mRILUnderTest.getDataCallList(handler.obtainMessage());
+ assertTrue(latch.await(3, TimeUnit.SECONDS));
+
+ // RemoteException
+ doThrow(new RemoteException()).when(mDataProxy).getDataCallList(anyInt());
+ mRILUnderTest.getDataCallList(handler.obtainMessage());
+ assertEquals(mRILUnderTest.getRadioState(), TelephonyManager.RADIO_POWER_UNAVAILABLE);
+ }
+
+
+ @Test
+ public void testRadioServiceNotAvailable() throws Exception {
+ CountDownLatch latch = new CountDownLatch(1);
+ HandlerThread handlerThread = new HandlerThread("testRadioServiceNotAvailable");
+ handlerThread.start();
+ Handler handler = new Handler(handlerThread.getLooper()) {
+ public void handleMessage(Message msg) {
+ AsyncResult ar = (AsyncResult) msg.obj;
+ if (ar != null && ar.exception != null
+ && ar.exception instanceof CommandException) {
+ CommandException.Error err =
+ ((CommandException) (ar.exception)).getCommandError();
+ if (err == CommandException.Error.RADIO_NOT_AVAILABLE) {
+ latch.countDown();
+ }
+ }
+ }
+ };
+
+ when(mDataProxy.isEmpty()).thenReturn(true);
+ mRILUnderTest.getDataCallList(handler.obtainMessage());
+ assertTrue(latch.await(3, TimeUnit.SECONDS));
+ }
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/metrics/MetricsCollectorTest.java b/tests/telephonytests/src/com/android/internal/telephony/metrics/MetricsCollectorTest.java
index 5886422..5b05e3b 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/metrics/MetricsCollectorTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/metrics/MetricsCollectorTest.java
@@ -51,6 +51,7 @@
import com.android.internal.telephony.uicc.UiccCard;
import com.android.internal.telephony.uicc.UiccController;
import com.android.internal.telephony.uicc.UiccPort;
+import com.android.internal.telephony.uicc.UiccProfile;
import com.android.internal.telephony.uicc.UiccSlot;
import org.junit.After;
@@ -119,6 +120,9 @@
@SmallTest
public void onPullAtom_simSlotState_bothSimPresent() {
// these have been tested extensively in SimSlotStateTest, here we verify atom generation
+ UiccProfile activeProfile = mock(UiccProfile.class);
+ doReturn(4).when(activeProfile).getNumApplications();
+ doReturn(activeProfile).when(mActivePort).getUiccProfile();
doReturn(true).when(mPhysicalSlot).isActive();
doReturn(CardState.CARDSTATE_PRESENT).when(mPhysicalSlot).getCardState();
doReturn(false).when(mPhysicalSlot).isEuicc();
@@ -126,7 +130,6 @@
doReturn(CardState.CARDSTATE_PRESENT).when(mEsimSlot).getCardState();
doReturn(true).when(mEsimSlot).isEuicc();
doReturn(mActiveCard).when(mEsimSlot).getUiccCard();
- doReturn(4).when(mActivePort).getNumApplications();
doReturn(new UiccPort[] {mActivePort}).when(mActiveCard).getUiccPortList();
doReturn(new UiccSlot[] {mPhysicalSlot, mEsimSlot}).when(mUiccController).getUiccSlots();
doReturn(mPhysicalSlot).when(mUiccController).getUiccSlot(eq(0));
diff --git a/tests/telephonytests/src/com/android/internal/telephony/metrics/PerSimStatusTest.java b/tests/telephonytests/src/com/android/internal/telephony/metrics/PerSimStatusTest.java
index 10151b8..6dbe607 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/metrics/PerSimStatusTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/metrics/PerSimStatusTest.java
@@ -133,6 +133,7 @@
doReturn(UiccSlot.VOLTAGE_CLASS_A).when(uiccSlot1).getMinimumVoltageClass();
doReturn(uiccSlot1).when(mUiccController).getUiccSlotForPhone(0);
doReturn(NETWORK_TYPE_BITMASK_GSM).when(mPersistAtomsStorage).getUnmeteredNetworks(0, 100);
+ doReturn(false).when(mTelephonyManager).isVoNrEnabled();
// phone 1 setup
doReturn(mContext).when(mSecondPhone).getContext();
doReturn(1).when(mSecondPhone).getPhoneId();
@@ -210,6 +211,7 @@
PER_SIM_STATUS__SIM_VOLTAGE_CLASS__VOLTAGE_CLASS_A,
perSimStatus1.minimumVoltageClass);
assertEquals(NETWORK_TYPE_BITMASK_GSM, perSimStatus1.unmeteredNetworks);
+ assertEquals(false, perSimStatus1.vonrEnabled);
assertEquals(101, perSimStatus2.carrierId);
assertEquals(1, perSimStatus2.phoneNumberSourceUicc);
assertEquals(2, perSimStatus2.phoneNumberSourceCarrier);
@@ -228,6 +230,7 @@
PER_SIM_STATUS__SIM_VOLTAGE_CLASS__VOLTAGE_CLASS_B,
perSimStatus2.minimumVoltageClass);
assertEquals(NETWORK_TYPE_BITMASK_GSM, perSimStatus2.unmeteredNetworks);
+ assertEquals(false, perSimStatus2.vonrEnabled);
}
@Test
@@ -286,6 +289,7 @@
doReturn(UiccSlot.VOLTAGE_CLASS_A).when(uiccSlot1).getMinimumVoltageClass();
doReturn(uiccSlot1).when(mUiccController).getUiccSlotForPhone(0);
doReturn(NETWORK_TYPE_BITMASK_GSM).when(mPersistAtomsStorage).getUnmeteredNetworks(0, 100);
+ doReturn(true).when(mTelephonyManager).isVoNrEnabled();
PerSimStatus perSimStatus = PerSimStatus.getCurrentState(mPhone);
@@ -306,6 +310,7 @@
PER_SIM_STATUS__SIM_VOLTAGE_CLASS__VOLTAGE_CLASS_A,
perSimStatus.minimumVoltageClass);
assertEquals(NETWORK_TYPE_BITMASK_GSM, perSimStatus.unmeteredNetworks);
+ assertEquals(true, perSimStatus.vonrEnabled);
}
@Test
@@ -355,6 +360,7 @@
doReturn(UiccSlot.VOLTAGE_CLASS_A).when(uiccSlot1).getMinimumVoltageClass();
doReturn(uiccSlot1).when(mUiccController).getUiccSlotForPhone(0);
doReturn(NETWORK_TYPE_BITMASK_GSM).when(mPersistAtomsStorage).getUnmeteredNetworks(0, 100);
+ doReturn(true).when(mTelephonyManager).isVoNrEnabled();
PerSimStatus perSimStatus = PerSimStatus.getCurrentState(mPhone);
@@ -375,6 +381,7 @@
PER_SIM_STATUS__SIM_VOLTAGE_CLASS__VOLTAGE_CLASS_A,
perSimStatus.minimumVoltageClass);
assertEquals(NETWORK_TYPE_BITMASK_GSM, perSimStatus.unmeteredNetworks);
+ assertEquals(true, perSimStatus.vonrEnabled);
}
@Test
@@ -420,6 +427,7 @@
doReturn(iccCard).when(mPhone).getIccCard();
doReturn(null).when(mUiccController).getUiccSlotForPhone(0);
doReturn(NETWORK_TYPE_BITMASK_GSM).when(mPersistAtomsStorage).getUnmeteredNetworks(0, 100);
+ doReturn(true).when(mTelephonyManager).isVoNrEnabled();
PerSimStatus perSimStatus = PerSimStatus.getCurrentState(mPhone);
@@ -440,5 +448,6 @@
PER_SIM_STATUS__SIM_VOLTAGE_CLASS__VOLTAGE_CLASS_UNKNOWN,
perSimStatus.minimumVoltageClass);
assertEquals(NETWORK_TYPE_BITMASK_GSM, perSimStatus.unmeteredNetworks);
+ assertEquals(true, perSimStatus.vonrEnabled);
}
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/metrics/SimSlotStateTest.java b/tests/telephonytests/src/com/android/internal/telephony/metrics/SimSlotStateTest.java
index 0a64ee3..c5c672c 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/metrics/SimSlotStateTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/metrics/SimSlotStateTest.java
@@ -29,6 +29,7 @@
import com.android.internal.telephony.uicc.IccCardStatus.CardState;
import com.android.internal.telephony.uicc.UiccCard;
import com.android.internal.telephony.uicc.UiccPort;
+import com.android.internal.telephony.uicc.UiccProfile;
import com.android.internal.telephony.uicc.UiccSlot;
import org.junit.After;
@@ -71,8 +72,12 @@
doReturn(CardState.CARDSTATE_PRESENT).when(mEsimSlot).getCardState();
doReturn(true).when(mEsimSlot).isEuicc();
- doReturn(0).when(mInactivePort).getNumApplications();
- doReturn(4).when(mActivePort).getNumApplications();
+ UiccProfile inactiveProfile = mock(UiccProfile.class);
+ UiccProfile activeProfile = mock(UiccProfile.class);
+ doReturn(0).when(inactiveProfile).getNumApplications();
+ doReturn(4).when(activeProfile).getNumApplications();
+ doReturn(inactiveProfile).when(mInactivePort).getUiccProfile();
+ doReturn(activeProfile).when(mActivePort).getUiccProfile();
doReturn(new UiccPort[]{mInactivePort}).when(mInactiveCard).getUiccPortList();
doReturn(new UiccPort[]{mActivePort}).when(mActiveCard).getUiccPortList();
@@ -94,6 +99,8 @@
assertEquals(0, state.numActiveSlots);
assertEquals(0, state.numActiveSims);
assertEquals(0, state.numActiveEsims);
+ assertEquals(0, state.numActiveEsimSlots);
+ assertEquals(0, state.numActiveMepSlots);
assertFalse(isMultiSim);
}
@@ -108,6 +115,8 @@
assertEquals(0, state.numActiveSlots);
assertEquals(0, state.numActiveSims);
assertEquals(0, state.numActiveEsims);
+ assertEquals(0, state.numActiveEsimSlots);
+ assertEquals(0, state.numActiveMepSlots);
assertFalse(isMultiSim);
}
@@ -122,6 +131,8 @@
assertEquals(0, state.numActiveSlots);
assertEquals(0, state.numActiveSims);
assertEquals(0, state.numActiveEsims);
+ assertEquals(0, state.numActiveEsimSlots);
+ assertEquals(0, state.numActiveMepSlots);
assertFalse(isMultiSim);
}
@@ -136,6 +147,8 @@
assertEquals(1, state.numActiveSlots);
assertEquals(0, state.numActiveSims);
assertEquals(0, state.numActiveEsims);
+ assertEquals(0, state.numActiveEsimSlots);
+ assertEquals(0, state.numActiveMepSlots);
assertFalse(isMultiSim);
}
@@ -151,6 +164,8 @@
assertEquals(1, state.numActiveSlots);
assertEquals(1, state.numActiveSims);
assertEquals(0, state.numActiveEsims);
+ assertEquals(0, state.numActiveEsimSlots);
+ assertEquals(0, state.numActiveMepSlots);
assertFalse(isMultiSim);
}
@@ -166,6 +181,8 @@
assertEquals(1, state.numActiveSlots);
assertEquals(0, state.numActiveSims);
assertEquals(0, state.numActiveEsims);
+ assertEquals(0, state.numActiveEsimSlots);
+ assertEquals(0, state.numActiveMepSlots);
assertFalse(isMultiSim);
}
@@ -182,6 +199,8 @@
assertEquals(1, state.numActiveSlots);
assertEquals(0, state.numActiveSims);
assertEquals(0, state.numActiveEsims);
+ assertEquals(0, state.numActiveEsimSlots);
+ assertEquals(0, state.numActiveMepSlots);
assertFalse(isMultiSim);
}
@@ -197,6 +216,8 @@
assertEquals(1, state.numActiveSlots);
assertEquals(0, state.numActiveSims);
assertEquals(0, state.numActiveEsims);
+ assertEquals(1, state.numActiveEsimSlots);
+ assertEquals(0, state.numActiveMepSlots);
assertFalse(isMultiSim);
}
@@ -212,6 +233,8 @@
assertEquals(1, state.numActiveSlots);
assertEquals(0, state.numActiveSims);
assertEquals(0, state.numActiveEsims);
+ assertEquals(1, state.numActiveEsimSlots);
+ assertEquals(0, state.numActiveMepSlots);
assertFalse(isMultiSim);
}
@@ -227,11 +250,31 @@
assertEquals(1, state.numActiveSlots);
assertEquals(1, state.numActiveSims);
assertEquals(1, state.numActiveEsims);
+ assertEquals(1, state.numActiveEsimSlots);
+ assertEquals(0, state.numActiveMepSlots);
assertFalse(isMultiSim);
}
@Test
@SmallTest
+ public void testSingleSim_esimCardWithMultipleProfiles() {
+ doReturn(mActiveCard).when(mEsimSlot).getUiccCard();
+ doReturn(new UiccPort[]{mActivePort, mActivePort}).when(mActiveCard).getUiccPortList();
+ setupSingleSim(mEsimSlot);
+
+ SimSlotState state = SimSlotState.getCurrentState();
+ boolean isMultiSim = SimSlotState.isMultiSim();
+
+ assertEquals(1, state.numActiveSlots);
+ assertEquals(2, state.numActiveSims);
+ assertEquals(2, state.numActiveEsims);
+ assertEquals(1, state.numActiveEsimSlots);
+ assertEquals(1, state.numActiveMepSlots);
+ assertTrue(isMultiSim);
+ }
+
+ @Test
+ @SmallTest
public void testDsdsSingleSimMode_noSimCard() {
setupDualSim(mEmptySlot, mInactiveSlot);
@@ -241,6 +284,8 @@
assertEquals(1, state.numActiveSlots);
assertEquals(0, state.numActiveSims);
assertEquals(0, state.numActiveEsims);
+ assertEquals(0, state.numActiveEsimSlots);
+ assertEquals(0, state.numActiveMepSlots);
assertFalse(isMultiSim);
}
@@ -255,6 +300,8 @@
assertEquals(1, state.numActiveSlots);
assertEquals(1, state.numActiveSims);
assertEquals(0, state.numActiveEsims);
+ assertEquals(0, state.numActiveEsimSlots);
+ assertEquals(0, state.numActiveMepSlots);
assertFalse(isMultiSim);
}
@@ -270,6 +317,8 @@
assertEquals(1, state.numActiveSlots);
assertEquals(0, state.numActiveSims);
assertEquals(0, state.numActiveEsims);
+ assertEquals(1, state.numActiveEsimSlots);
+ assertEquals(0, state.numActiveMepSlots);
assertFalse(isMultiSim);
}
@@ -285,6 +334,8 @@
assertEquals(1, state.numActiveSlots);
assertEquals(1, state.numActiveSims);
assertEquals(1, state.numActiveEsims);
+ assertEquals(1, state.numActiveEsimSlots);
+ assertEquals(0, state.numActiveMepSlots);
assertFalse(isMultiSim);
}
@@ -300,6 +351,8 @@
assertEquals(2, state.numActiveSlots);
assertEquals(0, state.numActiveSims);
assertEquals(0, state.numActiveEsims);
+ assertEquals(1, state.numActiveEsimSlots);
+ assertEquals(0, state.numActiveMepSlots);
assertFalse(isMultiSim);
}
@@ -315,6 +368,8 @@
assertEquals(2, state.numActiveSlots);
assertEquals(1, state.numActiveSims);
assertEquals(0, state.numActiveEsims);
+ assertEquals(1, state.numActiveEsimSlots);
+ assertEquals(0, state.numActiveMepSlots);
assertFalse(isMultiSim);
}
@@ -330,11 +385,31 @@
assertEquals(2, state.numActiveSlots);
assertEquals(1, state.numActiveSims);
assertEquals(1, state.numActiveEsims);
+ assertEquals(1, state.numActiveEsimSlots);
+ assertEquals(0, state.numActiveMepSlots);
assertFalse(isMultiSim);
}
@Test
@SmallTest
+ public void testDsds_esimCardWithMultipleProfiles() {
+ doReturn(mActiveCard).when(mEsimSlot).getUiccCard();
+ doReturn(new UiccPort[]{mActivePort, mActivePort}).when(mActiveCard).getUiccPortList();
+ setupDualSim(mEmptySlot, mEsimSlot);
+
+ SimSlotState state = SimSlotState.getCurrentState();
+ boolean isMultiSim = SimSlotState.isMultiSim();
+
+ assertEquals(2, state.numActiveSlots);
+ assertEquals(2, state.numActiveSims);
+ assertEquals(2, state.numActiveEsims);
+ assertEquals(1, state.numActiveEsimSlots);
+ assertEquals(1, state.numActiveMepSlots);
+ assertTrue(isMultiSim);
+ }
+
+ @Test
+ @SmallTest
public void testDsds_physicalAndEsimCardWithProfile() {
doReturn(mActiveCard).when(mEsimSlot).getUiccCard();
setupDualSim(mPhysicalSlot, mEsimSlot);
@@ -345,6 +420,8 @@
assertEquals(2, state.numActiveSlots);
assertEquals(2, state.numActiveSims);
assertEquals(1, state.numActiveEsims);
+ assertEquals(1, state.numActiveEsimSlots);
+ assertEquals(0, state.numActiveMepSlots);
assertTrue(isMultiSim);
}
@@ -359,6 +436,8 @@
assertEquals(2, state.numActiveSlots);
assertEquals(2, state.numActiveSims);
assertEquals(0, state.numActiveEsims);
+ assertEquals(0, state.numActiveEsimSlots);
+ assertEquals(0, state.numActiveMepSlots);
assertTrue(isMultiSim);
}
@@ -382,6 +461,8 @@
assertEquals(2, state.numActiveSlots);
assertEquals(1, state.numActiveSims);
assertEquals(1, state.numActiveEsims);
+ assertEquals(1, state.numActiveEsimSlots);
+ assertEquals(0, state.numActiveMepSlots);
assertFalse(isMultiSim); // one Uicc Port does not have active sim profile
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/metrics/VoiceCallSessionStatsTest.java b/tests/telephonytests/src/com/android/internal/telephony/metrics/VoiceCallSessionStatsTest.java
index 2ca0b16..4d4181e 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/metrics/VoiceCallSessionStatsTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/metrics/VoiceCallSessionStatsTest.java
@@ -73,6 +73,7 @@
import com.android.internal.telephony.uicc.IccCardStatus.CardState;
import com.android.internal.telephony.uicc.UiccCard;
import com.android.internal.telephony.uicc.UiccPort;
+import com.android.internal.telephony.uicc.UiccProfile;
import com.android.internal.telephony.uicc.UiccSlot;
import org.junit.After;
@@ -177,8 +178,13 @@
doReturn(true).when(mEsimSlot).isActive();
doReturn(CardState.CARDSTATE_PRESENT).when(mEsimSlot).getCardState();
doReturn(true).when(mEsimSlot).isEuicc();
- doReturn(0).when(mInactivePort).getNumApplications();
- doReturn(4).when(mActivePort).getNumApplications();
+
+ UiccProfile inactiveProfile = mock(UiccProfile.class);
+ UiccProfile activeProfile = mock(UiccProfile.class);
+ doReturn(0).when(inactiveProfile).getNumApplications();
+ doReturn(4).when(activeProfile).getNumApplications();
+ doReturn(inactiveProfile).when(mInactivePort).getUiccProfile();
+ doReturn(activeProfile).when(mActivePort).getUiccProfile();
doReturn(new UiccSlot[] {mPhysicalSlot}).when(mUiccController).getUiccSlots();
doReturn(mPhysicalSlot).when(mUiccController).getUiccSlot(eq(0));