* RIL_UNSOL_MODEM_RESTART,
* RIL_REQUEST_SEND_DEVICE_STATE,
* RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER,
- * RIL_REQUEST_SET_SIM_CARD_POWER
+ * RIL_REQUEST_SET_SIM_CARD_POWER,
+ * RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION,
+ * RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION
* The new parameters for RIL_REQUEST_SETUP_DATA_CALL,
* Updated data structures: RIL_DataProfileInfo_v15, RIL_InitialAttachApn_v15
* New data structure RIL_DataRegistrationStateResponse,
* used in RIL_REQUEST_DATA_REGISTRATION_STATE and
* RIL_REQUEST_VOICE_REGISTRATION_STATE respectively.
* New data structure RIL_OpenChannelParams.
+ * RIL_REQUEST_START_NETWORK_SCAN
+ * RIL_REQUEST_STOP_NETWORK_SCAN
+ * RIL_UNSOL_NETWORK_SCAN_RESULT
*/
#define RIL_VERSION 12
#define LAST_IMPRECISE_RIL_VERSION 12 // Better self-documented name
#define MAX_DEBUG_SOCKET_NAME_LENGTH 12
#define MAX_QEMU_PIPE_NAME_LENGTH 11
#define MAX_UUID_LENGTH 64
+#define MAX_BANDS 8
+#define MAX_CHANNELS 32
+#define MAX_RADIO_ACCESS_NETWORKS 8
typedef void * RIL_Token;
*/
} RIL_CarrierRestrictions;
+typedef struct {
+ char * mcc; /* MCC of the Carrier. */
+ char * mnc ; /* MNC of the Carrier. */
+ uint8_t * carrierKey; /* Public Key from the Carrier used to encrypt the
+ * IMSI/IMPI.
+ */
+ char * keyIdentifier; /* The keyIdentifier Attribute value pair that helps
+ * a server locate the private key to decrypt the
+ * permanent identity.
+ */
+ int64_t expirationTime; /* Date-Time (in UTC) when the key will expire. */
+
+} RIL_CarrierInfoForImsiEncryption;
+
/* See RIL_REQUEST_LAST_CALL_FAIL_CAUSE */
typedef enum {
CALL_FAIL_UNOBTAINABLE_NUMBER = 1,
P2Constants:NO_P2 if to be ignored */
} RIL_OpenChannelParams;
+typedef enum {
+ RIL_ONE_SHOT = 0x01, // Performs the scan only once
+ RIL_PERIODIC = 0x02 // Performs the scan periodically until cancelled
+} RIL_ScanType;
+
+typedef enum {
+ GERAN = 0x01, // GSM EDGE Radio Access Network
+ UTRAN = 0x02, // Universal Terrestrial Radio Access Network
+ EUTRAN = 0x03, // Evolved Universal Terrestrial Radio Access Network
+} RIL_RadioAccessNetworks;
+
+typedef enum {
+ GERAN_BAND_T380 = 1,
+ GERAN_BAND_T410 = 2,
+ GERAN_BAND_450 = 3,
+ GERAN_BAND_480 = 4,
+ GERAN_BAND_710 = 5,
+ GERAN_BAND_750 = 6,
+ GERAN_BAND_T810 = 7,
+ GERAN_BAND_850 = 8,
+ GERAN_BAND_P900 = 9,
+ GERAN_BAND_E900 = 10,
+ GERAN_BAND_R900 = 11,
+ GERAN_BAND_DCS1800 = 12,
+ GERAN_BAND_PCS1900 = 13,
+ GERAN_BAND_ER900 = 14,
+} RIL_GeranBands;
+
+typedef enum {
+ UTRAN_BAND_1 = 1,
+ UTRAN_BAND_2 = 2,
+ UTRAN_BAND_3 = 3,
+ UTRAN_BAND_4 = 4,
+ UTRAN_BAND_5 = 5,
+ UTRAN_BAND_6 = 6,
+ UTRAN_BAND_7 = 7,
+ UTRAN_BAND_8 = 8,
+ UTRAN_BAND_9 = 9,
+ UTRAN_BAND_10 = 10,
+ UTRAN_BAND_11 = 11,
+ UTRAN_BAND_12 = 12,
+ UTRAN_BAND_13 = 13,
+ UTRAN_BAND_14 = 14,
+ UTRAN_BAND_19 = 19,
+ UTRAN_BAND_20 = 20,
+ UTRAN_BAND_21 = 21,
+ UTRAN_BAND_22 = 22,
+ UTRAN_BAND_25 = 25,
+ UTRAN_BAND_26 = 26,
+} RIL_UtranBands;
+
+typedef enum {
+ EUTRAN_BAND_1 = 1,
+ EUTRAN_BAND_2 = 2,
+ EUTRAN_BAND_3 = 3,
+ EUTRAN_BAND_4 = 4,
+ EUTRAN_BAND_5 = 5,
+ EUTRAN_BAND_6 = 6,
+ EUTRAN_BAND_7 = 7,
+ EUTRAN_BAND_8 = 8,
+ EUTRAN_BAND_9 = 9,
+ EUTRAN_BAND_10 = 10,
+ EUTRAN_BAND_11 = 11,
+ EUTRAN_BAND_12 = 12,
+ EUTRAN_BAND_13 = 13,
+ EUTRAN_BAND_14 = 14,
+ EUTRAN_BAND_17 = 17,
+ EUTRAN_BAND_18 = 18,
+ EUTRAN_BAND_19 = 19,
+ EUTRAN_BAND_20 = 20,
+ EUTRAN_BAND_21 = 21,
+ EUTRAN_BAND_22 = 22,
+ EUTRAN_BAND_23 = 23,
+ EUTRAN_BAND_24 = 24,
+ EUTRAN_BAND_25 = 25,
+ EUTRAN_BAND_26 = 26,
+ EUTRAN_BAND_27 = 27,
+ EUTRAN_BAND_28 = 28,
+ EUTRAN_BAND_30 = 30,
+ EUTRAN_BAND_31 = 31,
+ EUTRAN_BAND_33 = 33,
+ EUTRAN_BAND_34 = 34,
+ EUTRAN_BAND_35 = 35,
+ EUTRAN_BAND_36 = 36,
+ EUTRAN_BAND_37 = 37,
+ EUTRAN_BAND_38 = 38,
+ EUTRAN_BAND_39 = 39,
+ EUTRAN_BAND_40 = 40,
+ EUTRAN_BAND_41 = 41,
+ EUTRAN_BAND_42 = 42,
+ EUTRAN_BAND_43 = 43,
+ EUTRAN_BAND_44 = 44,
+ EUTRAN_BAND_45 = 45,
+ EUTRAN_BAND_46 = 46,
+ EUTRAN_BAND_47 = 47,
+ EUTRAN_BAND_48 = 48,
+ EUTRAN_BAND_65 = 65,
+ EUTRAN_BAND_66 = 66,
+ EUTRAN_BAND_68 = 68,
+ EUTRAN_BAND_70 = 70,
+} RIL_EutranBands;
+
+typedef struct {
+ RIL_RadioAccessNetworks radio_access_network; // The type of network to scan.
+ uint32_t bands_length; // Length of bands
+ union {
+ RIL_GeranBands geran_bands[MAX_BANDS];
+ RIL_UtranBands utran_bands[MAX_BANDS];
+ RIL_EutranBands eutran_bands[MAX_BANDS];
+ } bands;
+ uint32_t channels_length; // Length of channels
+ uint32_t channels[MAX_CHANNELS]; // Frequency channels to scan
+} RIL_RadioAccessSpecifier;
+
+typedef struct {
+ RIL_ScanType type; // Type of the scan
+ int32_t interval; // Time interval in seconds
+ // between periodic scans, only
+ // valid when type=RIL_PERIODIC
+ uint32_t specifiers_length; // Length of specifiers
+ RIL_RadioAccessSpecifier specifiers[MAX_RADIO_ACCESS_NETWORKS]; // Radio access networks
+ // with bands/channels.
+} RIL_NetworkScanRequest;
+
+typedef enum {
+ PARTIAL = 0x01, // The result contains a part of the scan results
+ COMPLETE = 0x02, // The result contains the last part of the scan results
+} RIL_ScanStatus;
+
+typedef struct {
+ RIL_ScanStatus status; // The status of the scan
+ uint32_t network_infos_length; // Total length of RIL_CellInfo
+ RIL_CellInfo_v12* network_infos; // List of network information
+} RIL_NetworkScanResult;
+
/**
* RIL_REQUEST_GET_SIM_STATUS
*
* INVALID_ARGUMENTS
*/
#define RIL_REQUEST_SET_SIM_CARD_POWER 140
+
+/**
+ * RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION
+ *
+ * Provide Carrier specific information to the modem that will be used to
+ * encrypt the IMSI and IMPI. Sent by the framework during boot, carrier
+ * switch and everytime we receive a new certificate.
+ *
+ * "data" is the RIL_CarrierInfoForImsiEncryption * structure.
+ *
+ * "response" is NULL
+ *
+ * Valid errors:
+ * RIL_E_SUCCESS
+ * RIL_E_RADIO_NOT_AVAILABLE
+ * SIM_ABSENT
+ * RIL_E_REQUEST_NOT_SUPPORTED
+ * INVALID_ARGUMENTS
+ * MODEM_INTERNAL_FAILURE
+ */
+#define RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION 141
+
+/**
+ * RIL_REQUEST_START_NETWORK_SCAN
+ *
+ * Starts a new network scan
+ *
+ * Request to start a network scan with specified radio access networks with frequency bands and/or
+ * channels.
+ *
+ * "data" is a const RIL_NetworkScanRequest *.
+ * "response" is NULL
+ *
+ * Valid errors:
+ * SUCCESS
+ * RADIO_NOT_AVAILABLE
+ * OPERATION_NOT_ALLOWED
+ * DEVICE_IN_USE
+ * INTERNAL_ERR
+ * NO_MEMORY
+ * MODEM_ERR
+ * INVALID_ARGUMENTS
+ * REQUEST_NOT_SUPPORTED
+ *
+ */
+#define RIL_REQUEST_START_NETWORK_SCAN 142
+
+/**
+ * RIL_REQUEST_STOP_NETWORK_SCAN
+ *
+ * Stops an ongoing network scan
+ *
+ * Request to stop the ongoing network scan. Since the modem can only perform one scan at a time,
+ * there is no parameter for this request.
+ *
+ * "data" is NULL
+ * "response" is NULL
+ *
+ * Valid errors:
+ * SUCCESS
+ * INTERNAL_ERR
+ * MODEM_ERR
+ *
+ */
+#define RIL_REQUEST_STOP_NETWORK_SCAN 143
+
+/**
+ * RIL_REQUEST_START_KEEPALIVE
+ *
+ * Start a keepalive session
+ *
+ * Request that the modem begin sending keepalive packets on a particular
+ * data call, with a specified source, destination, and format.
+ *
+ * "data" is a const RIL_RequestKeepalive
+ * "response" is RIL_KeepaliveStatus with a valid "handle"
+ *
+ * Valid errors:
+ * SUCCESS
+ * NO_RESOURCES
+ * INVALID_ARGUMENTS
+ *
+ */
+#define RIL_REQUEST_START_KEEPALIVE 144
+
+/**
+ * RIL_REQUEST_STOP_KEEPALIVE
+ *
+ * Stops an ongoing keepalive session
+ *
+ * Requests that a keepalive session with the given handle be stopped.
+ * there is no parameter for this request.
+ *
+ * "data" is an integer handle
+ * "response" is NULL
+ *
+ * Valid errors:
+ * SUCCESS
+ * INVALID_ARGUMENTS
+ *
+ */
+#define RIL_REQUEST_STOP_KEEPALIVE 145
+
/***********************************************************************/
/**
*/
#define RIL_UNSOL_MODEM_RESTART 1047
+/**
+ * RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION
+ *
+ * Called when the modem needs Carrier specific information that will
+ * be used to encrypt IMSI and IMPI.
+ *
+ * "data" is NULL
+ *
+ */
+#define RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION 1048
+
+/**
+ * RIL_UNSOL_NETWORK_SCAN_RESULT
+ *
+ * Returns incremental result for the network scan which is started by
+ * RIL_REQUEST_START_NETWORK_SCAN, sent to report results, status, or errors.
+ *
+ * "data" is NULL
+ * "response" is a const RIL_NetworkScanResult *
+ */
+#define RIL_UNSOL_NETWORK_SCAN_RESULT 1049
+
+/**
+ * RIL_UNSOL_KEEPALIVE_STATUS
+ *
+ * "data" is NULL
+ * "response" is a const RIL_KeepaliveStatus *
+ */
+#define RIL_UNSOL_KEEPALIVE_STATUS 1050
+
/***********************************************************************/
loosely defined in LTE Layer 3 spec 24.008 */
} RIL_PCO_Data;
+typedef enum {
+ NATT_IPV4 = 0, /* Keepalive specified by RFC 3948 Sec. 2.3 using IPv4 */
+ NATT_IPV6 = 1 /* Keepalive specified by RFC 3948 Sec. 2.3 using IPv6 */
+} RIL_KeepaliveType;
+
+#define MAX_INADDR_LEN 16
+typedef struct {
+ RIL_KeepaliveType type; /* Type of keepalive packet */
+ char sourceAddress[MAX_INADDR_LEN]; /* Source address in network-byte order */
+ int sourcePort; /* Source port if applicable, or 0x7FFFFFFF;
+ the maximum value is 65535 */
+ char destinationAddress[MAX_INADDR_LEN]; /* Destination address in network-byte order */
+ int destinationPort; /* Destination port if applicable or 0x7FFFFFFF;
+ the maximum value is 65535 */
+ int maxKeepaliveIntervalMillis; /* Maximum milliseconds between two packets */
+ int cid; /* Context ID, uniquely identifies this call */
+} RIL_KeepaliveRequest;
+
+typedef enum {
+ KEEPALIVE_ACTIVE, /* Keepalive session is active */
+ KEEPALIVE_INACTIVE, /* Keepalive session is inactive */
+ KEEPALIVE_PENDING /* Keepalive session status not available */
+} RIL_KeepaliveStatusCode;
+
+typedef struct {
+ uint32_t sessionHandle;
+ RIL_KeepaliveStatusCode code;
+} RIL_KeepaliveStatus;
+
#ifdef RIL_SHLIB
struct RIL_Env {
/**
#define LOG_TAG "RILC"
-#include <android/hardware/radio/1.0/IRadio.h>
+#include <android/hardware/radio/1.1/IRadio.h>
+#include <android/hardware/radio/1.1/IRadioResponse.h>
+#include <android/hardware/radio/1.1/IRadioIndication.h>
+#include <android/hardware/radio/1.1/types.h>
+
#include <android/hardware/radio/deprecated/1.0/IOemHook.h>
#include <hwbinder/IPCThreadState.h>
#define INVALID_HEX_CHAR 16
-// Enable verbose logging
-#define VDBG 0
-
using namespace android::hardware::radio::V1_0;
using namespace android::hardware::radio::deprecated::V1_0;
using ::android::hardware::configureRpcThreadpool;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_array;
+using ::android::hardware::radio::V1_1::NetworkScanRequest;
+using ::android::hardware::radio::V1_1::KeepaliveRequest;
using ::android::hardware::Void;
using android::CommandInfo;
using android::RequestInfo;
void convertRilCellInfoListToHal(void *response, size_t responseLen, hidl_vec<CellInfo>& records);
-struct RadioImpl : public IRadio {
+struct RadioImpl : public ::android::hardware::radio::V1_1::IRadio {
int32_t mSlotId;
sp<IRadioResponse> mRadioResponse;
sp<IRadioIndication> mRadioIndication;
Return<void> getAvailableNetworks(int32_t serial);
+ Return<void> startNetworkScan(int32_t serial, const NetworkScanRequest& request);
+
+ Return<void> stopNetworkScan(int32_t serial);
+
Return<void> startDtmf(int32_t serial,
const ::android::hardware::hidl_string& s);
Return<void> setIndicationFilter(int32_t serial, int32_t indicationFilter);
+ Return<void> startKeepalive(int32_t serial, const KeepaliveRequest& keepalive);
+
+ Return<void> stopKeepalive(int32_t serial, int32_t sessionHandle);
+
Return<void> setSimCardPower(int32_t serial, bool powerUp);
+ Return<void> setSimCardPower_1_1(int32_t serial,
+ const ::android::hardware::radio::V1_1::CardPowerState state);
Return<void> responseAcknowledgement();
+ Return<void> setCarrierInfoForImsiEncryption(int32_t serial,
+ const ::android::hardware::radio::V1_1::ImsiEncryptionInfo& message);
+
void checkReturnStatus(Return<void>& ret);
};
char *ptr = va_arg(ap, char *);
if (ptr) {
#ifdef MEMSET_FREED
- // TODO: Should pass in the maximum length of the string
- memsetString(ptr);
+#define MAX_STRING_LENGTH 4096
+ memset(ptr, 0, strnlen(ptr, MAX_STRING_LENGTH));
#endif
free(ptr);
}
return Void();
}
+Return<void> RadioImpl::startNetworkScan(int32_t serial, const NetworkScanRequest& request) {
+#if VDBG
+ RLOGD("startNetworkScan: serial %d", serial);
+#endif
+
+ RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_START_NETWORK_SCAN);
+ if (pRI == NULL) {
+ return Void();
+ }
+
+ if (request.specifiers.size() > MAX_RADIO_ACCESS_NETWORKS) {
+ sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS);
+ return Void();
+ }
+
+ RIL_NetworkScanRequest scan_request = {};
+
+ scan_request.type = (RIL_ScanType) request.type;
+ scan_request.interval = request.interval;
+ scan_request.specifiers_length = request.specifiers.size();
+ for (size_t i = 0; i < request.specifiers.size(); ++i) {
+ if (request.specifiers[i].geranBands.size() > MAX_BANDS ||
+ request.specifiers[i].utranBands.size() > MAX_BANDS ||
+ request.specifiers[i].eutranBands.size() > MAX_BANDS ||
+ request.specifiers[i].channels.size() > MAX_CHANNELS) {
+ sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS);
+ return Void();
+ }
+ const ::android::hardware::radio::V1_1::RadioAccessSpecifier& ras_from =
+ request.specifiers[i];
+ RIL_RadioAccessSpecifier& ras_to = scan_request.specifiers[i];
+
+ ras_to.radio_access_network = (RIL_RadioAccessNetworks) ras_from.radioAccessNetwork;
+ ras_to.channels_length = ras_from.channels.size();
+
+ std::copy(ras_from.channels.begin(), ras_from.channels.end(), ras_to.channels);
+ const std::vector<uint32_t> * bands = nullptr;
+ switch (request.specifiers[i].radioAccessNetwork) {
+ case ::android::hardware::radio::V1_1::RadioAccessNetworks::GERAN:
+ ras_to.bands_length = ras_from.geranBands.size();
+ bands = (std::vector<uint32_t> *) &ras_from.geranBands;
+ break;
+ case ::android::hardware::radio::V1_1::RadioAccessNetworks::UTRAN:
+ ras_to.bands_length = ras_from.utranBands.size();
+ bands = (std::vector<uint32_t> *) &ras_from.utranBands;
+ break;
+ case ::android::hardware::radio::V1_1::RadioAccessNetworks::EUTRAN:
+ ras_to.bands_length = ras_from.eutranBands.size();
+ bands = (std::vector<uint32_t> *) &ras_from.eutranBands;
+ break;
+ default:
+ sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS);
+ return Void();
+ }
+ // safe to copy to geran_bands because it's a union member
+ std::memcpy(&ras_to.bands.geran_bands, bands, ras_to.bands_length * sizeof(uint32_t));
+ }
+
+ s_vendorFunctions->onRequest(
+ RIL_REQUEST_START_NETWORK_SCAN, &scan_request, sizeof(scan_request), pRI);
+
+ return Void();
+}
+
+Return<void> RadioImpl::stopNetworkScan(int32_t serial) {
+#if VDBG
+ RLOGD("stopNetworkScan: serial %d", serial);
+#endif
+ dispatchVoid(serial, mSlotId, RIL_REQUEST_STOP_NETWORK_SCAN);
+ return Void();
+}
+
Return<void> RadioImpl::startDtmf(int32_t serial, const hidl_string& s) {
#if VDBG
RLOGD("startDtmf: serial %d", serial);
if (!copyHidlStringToRil(&pStrings[0], message.gsmMessage[0].smscPdu, pRI)) {
#ifdef MEMSET_FREED
- memset(pStrings, 0, datalen);
+ memset(pStrings, 0, dataLen);
#endif
free(pStrings);
return false;
if (!copyHidlStringToRil(&pStrings[1], message.gsmMessage[0].pdu, pRI)) {
memsetAndFreeStrings(1, pStrings[0]);
#ifdef MEMSET_FREED
- memset(pStrings, 0, datalen);
+ memset(pStrings, 0, dataLen);
#endif
free(pStrings);
return false;
}
#ifdef MEMSET_FREED
- memset(pStrings, 0, datalen);
+ memset(pStrings, 0, dataLen);
#endif
free(pStrings);
pRI)) {
success = false;
}
-
if (success && !copyHidlStringToRil(&dataProfiles[i].mvnoMatchData,
profiles[i].mvnoMatchData, pRI)) {
success = false;
return Void();
}
+Return<void> RadioImpl::setSimCardPower_1_1(int32_t serial,
+ const ::android::hardware::radio::V1_1::CardPowerState state) {
+#if VDBG
+ RLOGD("setSimCardPower_1_1: serial %d state %d", serial, state);
+#endif
+ dispatchInts(serial, mSlotId, RIL_REQUEST_SET_SIM_CARD_POWER, 1, state);
+ return Void();
+}
+
Return<void> RadioImpl::responseAcknowledgement() {
android::releaseWakeLock();
return Void();
return Void();
}
+Return<void> RadioImpl::setCarrierInfoForImsiEncryption(int32_t serial,
+ const ::android::hardware::radio::V1_1::ImsiEncryptionInfo& data) {
+ RLOGD("setCarrierInfoForImsiEncryption: serial %d", serial);
+ RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION);
+ RIL_CarrierInfoForImsiEncryption imsiEncryption = {};
+
+ if (!copyHidlStringToRil(&imsiEncryption.mnc, data.mnc, pRI)) {
+ return Void();
+ }
+ if (!copyHidlStringToRil(&imsiEncryption.mcc, data.mcc, pRI)) {
+ memsetAndFreeStrings(1, imsiEncryption.mnc);
+ return Void();
+ }
+ if (!copyHidlStringToRil(&imsiEncryption.keyIdentifier, data.keyIdentifier, pRI)) {
+ memsetAndFreeStrings(2, imsiEncryption.mnc, imsiEncryption.mcc);
+ return Void();
+ }
+ int32_t lSize = data.carrierKey.size();
+ imsiEncryption.carrierKey = new uint8_t[lSize];
+ memcpy(imsiEncryption.carrierKey, data.carrierKey.data(), lSize);
+ imsiEncryption.expirationTime = data.expirationTime;
+ s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &imsiEncryption, sizeof(RIL_CarrierInfoForImsiEncryption), pRI);
+ delete(imsiEncryption.carrierKey);
+ return Void();
+}
+
+Return<void> RadioImpl::startKeepalive(int32_t serial, const KeepaliveRequest& keepalive) {
+ RLOGD("startKeepalive: serial %d", serial);
+ return Void();
+}
+
+Return<void> RadioImpl::stopKeepalive(int32_t serial, int32_t sessionHandle) {
+ RLOGD("stopKeepalive: serial %d", serial);
+ return Void();
+}
+
+
/***************************************************************************************************
* RESPONSE FUNCTIONS
* Functions above are used for requests going from framework to vendor code. The ones below are
RadioResponseInfo responseInfo = {};
populateResponseInfo(responseInfo, serial, responseType, e);
CardStatus cardStatus = {};
- if (response == NULL || responseLen != sizeof(RIL_CardStatus_v6)) {
+ RIL_CardStatus_v6 *p_cur = ((RIL_CardStatus_v6 *) response);
+ if (response == NULL || responseLen != sizeof(RIL_CardStatus_v6)
+ || p_cur->gsm_umts_subscription_app_index >= p_cur->num_applications
+ || p_cur->cdma_subscription_app_index >= p_cur->num_applications
+ || p_cur->ims_subscription_app_index >= p_cur->num_applications) {
RLOGE("getIccCardStatusResponse: Invalid response");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
- RIL_CardStatus_v6 *p_cur = ((RIL_CardStatus_v6 *) response);
cardStatus.cardState = (CardState) p_cur->card_state;
cardStatus.universalPinState = (PinState) p_cur->universal_pin_state;
cardStatus.gsmUmtsSubscriptionAppIndex = p_cur->gsm_umts_subscription_app_index;
return 0;
}
+int radio::setCarrierInfoForImsiEncryptionResponse(int slotId,
+ int responseType, int serial, RIL_Errno e,
+ void *response, size_t responseLen) {
+ RLOGD("setCarrierInfoForImsiEncryptionResponse: serial %d", serial);
+ if (radioService[slotId]->mRadioResponse != NULL) {
+ RadioResponseInfo responseInfo = {};
+ populateResponseInfo(responseInfo, serial, responseType, e);
+ Return<sp<::android::hardware::radio::V1_1::IRadioResponse>> ret =
+ ::android::hardware::radio::V1_1::IRadioResponse::castFrom(
+ radioService[slotId]->mRadioResponse);
+ if (ret.isOk()) {
+ sp<::android::hardware::radio::V1_1::IRadioResponse> radioResponseV1_1 = ret;
+ Return<void> retStatus
+ = radioResponseV1_1->setCarrierInfoForImsiEncryptionResponse(responseInfo);
+ radioService[slotId]->checkReturnStatus(retStatus);
+ } else {
+ RLOGE("setCarrierInfoForImsiEncryptionResponse: ret.isOk() == false for "
+ "radioService[%d]" , slotId);
+ }
+ } else {
+ RLOGE("setCarrierInfoForImsiEncryptionResponse: radioService[%d]->mRadioResponse == NULL",
+ slotId);
+ }
+ return 0;
+}
+
int radio::setIndicationFilterResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen) {
return 0;
}
-
int radio::setSimCardPowerResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responseLen) {
if (radioService[slotId]->mRadioResponse != NULL) {
RadioResponseInfo responseInfo = {};
populateResponseInfo(responseInfo, serial, responseType, e);
- Return<void> retStatus
- = radioService[slotId]->mRadioResponse->setSimCardPowerResponse(responseInfo);
- radioService[slotId]->checkReturnStatus(retStatus);
+ Return<sp<::android::hardware::radio::V1_1::IRadioResponse>> ret =
+ ::android::hardware::radio::V1_1::IRadioResponse::castFrom(
+ radioService[slotId]->mRadioResponse);
+ if (ret.isOk()) {
+ sp<::android::hardware::radio::V1_1::IRadioResponse> radioResponseV1_1 = ret;
+ Return<void> retStatus
+ = radioResponseV1_1->setSimCardPowerResponse_1_1(responseInfo);
+ radioService[slotId]->checkReturnStatus(retStatus);
+ } else {
+ RLOGD("setSimCardPowerResponse: ret.isOK() == false for radioService[%d]",
+ slotId);
+ Return<void> retStatus
+ = radioService[slotId]->mRadioResponse->setSimCardPowerResponse(responseInfo);
+ radioService[slotId]->checkReturnStatus(retStatus);
+ }
} else {
- RLOGE("setSimCardPowerResponse: radioService[%d]->mRadioResponse == NULL", slotId);
+ RLOGE("setSimCardPowerResponse: radioService[%d]->mRadioResponse == NULL",
+ slotId);
+ }
+ return 0;
+}
+
+int radio::startNetworkScanResponse(int slotId, int responseType, int serial, RIL_Errno e,
+ void *response, size_t responseLen) {
+#if VDBG
+ RLOGD("startNetworkScanResponse: serial %d", serial);
+#endif
+
+ if (radioService[slotId]->mRadioResponse != NULL) {
+ RadioResponseInfo responseInfo = {};
+ populateResponseInfo(responseInfo, serial, responseType, e);
+ Return<sp<::android::hardware::radio::V1_1::IRadioResponse>> ret =
+ ::android::hardware::radio::V1_1::IRadioResponse::castFrom(
+ radioService[slotId]->mRadioResponse);
+ if (ret.isOk()) {
+ sp<::android::hardware::radio::V1_1::IRadioResponse> radioResponseV1_1 = ret;
+ Return<void> retStatus = radioResponseV1_1->startNetworkScanResponse(responseInfo);
+ radioService[slotId]->checkReturnStatus(retStatus);
+ } else {
+ RLOGD("startNetworkScanResponse: ret.isOK() == false for radioService[%d]", slotId);
+ }
+ } else {
+ RLOGE("startNetworkScanResponse: radioService[%d]->mRadioResponse == NULL", slotId);
+ }
+
+ return 0;
+}
+
+int radio::stopNetworkScanResponse(int slotId, int responseType, int serial, RIL_Errno e,
+ void *response, size_t responseLen) {
+#if VDBG
+ RLOGD("stopNetworkScanResponse: serial %d", serial);
+#endif
+
+ if (radioService[slotId]->mRadioResponse != NULL) {
+ RadioResponseInfo responseInfo = {};
+ populateResponseInfo(responseInfo, serial, responseType, e);
+ Return<sp<::android::hardware::radio::V1_1::IRadioResponse>> ret =
+ ::android::hardware::radio::V1_1::IRadioResponse::castFrom(
+ radioService[slotId]->mRadioResponse);
+ if (ret.isOk()) {
+ sp<::android::hardware::radio::V1_1::IRadioResponse> radioResponseV1_1 = ret;
+ Return<void> retStatus = radioResponseV1_1->stopNetworkScanResponse(responseInfo);
+ radioService[slotId]->checkReturnStatus(retStatus);
+ } else {
+ RLOGD("stopNetworkScanResponse: ret.isOK() == false for radioService[%d]", slotId);
+ }
+ } else {
+ RLOGE("stopNetworkScanResponse: radioService[%d]->mRadioResponse == NULL", slotId);
}
return 0;
return 0;
}
+int radio::networkScanResultInd(int slotId,
+ int indicationType, int token, RIL_Errno e, void *response,
+ size_t responseLen) {
+#if VDBG
+ RLOGD("networkScanResultInd");
+#endif
+ if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
+ if (response == NULL || responseLen == 0) {
+ RLOGE("networkScanResultInd: invalid response");
+ return 0;
+ }
+ RLOGD("networkScanResultInd");
+
+#if VDBG
+ RLOGD("networkScanResultInd");
+#endif
+
+ Return<sp<::android::hardware::radio::V1_1::IRadioIndication>> ret =
+ ::android::hardware::radio::V1_1::IRadioIndication::castFrom(
+ radioService[slotId]->mRadioIndication);
+ if (ret.isOk()) {
+ RIL_NetworkScanResult *networkScanResult = (RIL_NetworkScanResult *) response;
+
+ ::android::hardware::radio::V1_1::NetworkScanResult result;
+ result.status =
+ (::android::hardware::radio::V1_1::ScanStatus) networkScanResult->status;
+ result.error = (RadioError) e;
+ convertRilCellInfoListToHal(
+ networkScanResult->network_infos,
+ networkScanResult->network_infos_length * sizeof(RIL_CellInfo_v12),
+ result.networkInfos);
+
+ sp<::android::hardware::radio::V1_1::IRadioIndication> radioIndicationV1_1 = ret;
+ Return<void> retStatus = radioIndicationV1_1->networkScanResult(
+ convertIntToRadioIndicationType(indicationType), result);
+ radioService[slotId]->checkReturnStatus(retStatus);
+ } else {
+ RLOGE("networkScanResultInd: ret.isOk() == false for radioService[%d]", slotId);
+ }
+ } else {
+ RLOGE("networkScanResultInd: radioService[%d]->mRadioIndication == NULL", slotId);
+ }
+ return 0;
+}
+
+int radio::carrierInfoForImsiEncryption(int slotId,
+ int indicationType, int token, RIL_Errno e, void *response,
+ size_t responseLen) {
+ if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
+ if (response == NULL || responseLen == 0) {
+ RLOGE("carrierInfoForImsiEncryption: invalid response");
+ return 0;
+ }
+ RLOGD("carrierInfoForImsiEncryption");
+ Return<sp<::android::hardware::radio::V1_1::IRadioIndication>> ret =
+ ::android::hardware::radio::V1_1::IRadioIndication::castFrom(
+ radioService[slotId]->mRadioIndication);
+ if (ret.isOk()) {
+ sp<::android::hardware::radio::V1_1::IRadioIndication> radioIndicationV1_1 = ret;
+ Return<void> retStatus = radioIndicationV1_1->carrierInfoForImsiEncryption(
+ convertIntToRadioIndicationType(indicationType));
+ radioService[slotId]->checkReturnStatus(retStatus);
+ } else {
+ RLOGE("carrierInfoForImsiEncryptionResponse: ret.isOk() == false for radioService[%d]",
+ slotId);
+ }
+ } else {
+ RLOGE("carrierInfoForImsiEncryption: radioService[%d]->mRadioIndication == NULL", slotId);
+ }
+
+ return 0;
+}
+
int radio::oemHookRawInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responseLen) {
radioService[i]->mSlotId = i;
oemHookService[i] = new OemHookImpl;
oemHookService[i]->mSlotId = i;
- RLOGD("registerService: starting IRadio %s", serviceNames[i]);
+ RLOGD("registerService: starting android::hardware::radio::V1_1::IRadio %s",
+ serviceNames[i]);
android::status_t status = radioService[i]->registerAsService(serviceNames[i]);
status = oemHookService[i]->registerAsService(serviceNames[i]);