Commit 8a4a233b authored by Jake Hamby's avatar Jake Hamby
Browse files

Add new RIL commands to read, write, and reset NV items.

Add new RIL commands to read, write, and reset NV items,
including the CDMA Preferred Roaming List (PRL).

Used for device configuration by some CDMA operators.

Bug: 12864208
Change-Id: I792e272438b56bca725e6c034baac19244e5563f
parent bfb41c60
......@@ -20,6 +20,8 @@
#include <stdlib.h>
#include <stdint.h>
#include <telephony/ril_cdma_sms.h>
#include <telephony/ril_nv_items.h>
#ifndef FEATURE_UNIT_TEST
#include <sys/time.h>
#endif /* !FEATURE_UNIT_TEST */
......@@ -987,6 +989,17 @@ typedef struct {
RIL_CDMA_InformationRecord infoRec[RIL_CDMA_MAX_NUMBER_OF_INFO_RECS];
} RIL_CDMA_InformationRecords;
/* See RIL_REQUEST_NV_READ_ITEM */
typedef struct {
RIL_NV_Item itemID;
} RIL_NV_ReadItem;
/* See RIL_REQUEST_NV_WRITE_ITEM */
typedef struct {
RIL_NV_Item itemID;
char * value;
} RIL_NV_WriteItem;
/**
* RIL_REQUEST_GET_SIM_STATUS
*
......@@ -3663,6 +3676,96 @@ typedef struct {
*/
#define RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL 117
/**
* RIL_REQUEST_NV_READ_ITEM
*
* Read one of the radio NV items defined in RadioNVItems.java / ril_nv_items.h.
* This is used for device configuration by some CDMA operators.
*
* "data" is a const RIL_NV_ReadItem *
*
* "response" is const char * containing the contents of the NV item
*
* Valid errors:
* SUCCESS
* RADIO_NOT_AVAILABLE
* GENERIC_FAILURE
*/
#define RIL_REQUEST_NV_READ_ITEM 118
/**
* RIL_REQUEST_NV_WRITE_ITEM
*
* Write one of the radio NV items defined in RadioNVItems.java / ril_nv_items.h.
* This is used for device configuration by some CDMA operators.
*
* "data" is a const RIL_NV_WriteItem *
*
* "response" is NULL
*
* Valid errors:
* SUCCESS
* RADIO_NOT_AVAILABLE
* GENERIC_FAILURE
*/
#define RIL_REQUEST_NV_WRITE_ITEM 119
/**
* RIL_REQUEST_NV_WRITE_CDMA_PRL
*
* Update the CDMA Preferred Roaming List (PRL) in the radio NV storage.
* This is used for device configuration by some CDMA operators.
*
* "data" is a const char * containing the PRL as a byte array
*
* "response" is NULL
*
* Valid errors:
* SUCCESS
* RADIO_NOT_AVAILABLE
* GENERIC_FAILURE
*/
#define RIL_REQUEST_NV_WRITE_CDMA_PRL 120
/**
* RIL_REQUEST_NV_RESET_CONFIG
*
* Reset the radio NV configuration to the factory state.
* This is used for device configuration by some CDMA operators.
*
* "data" is int *
* ((int *)data)[0] is 1 for a factory reset (RTN)
* ((int *)data)[0] is 2 for a radio reset (SCRTN)
*
* "response" is NULL
*
* Valid errors:
* SUCCESS
* RADIO_NOT_AVAILABLE
* GENERIC_FAILURE
*/
#define RIL_REQUEST_NV_RESET_CONFIG 121
/**
* RIL_REQUEST_SET_RADIO_MODE
*
* Set radio mode. The exact meaning of these states is defined by the OEM.
*
* "data" is int *
* ((int *)data)[0] is 0 for "offline mode"
* ((int *)data)[0] is 1 for "online mode"
* ((int *)data)[0] is 2 for "low-power mode"
* ((int *)data)[0] is 3 for "reset radio"
*
* "response" is NULL
*
* Valid errors:
* SUCCESS
* RADIO_NOT_AVAILABLE
* GENERIC_FAILURE
*/
#define RIL_REQUEST_SET_RADIO_MODE 122
/***********************************************************************/
......
/*
* Copyright (C) 2014 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.
*/
#ifndef ANDROID_RIL_NV_ITEMS_H
#define ANDROID_RIL_NV_ITEMS_H 1
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Must match the values in RadioNVItems.java. */
typedef enum {
// CDMA radio information
RIL_NV_CDMA_MEID = 1, // hex MEID
RIL_NV_CDMA_PRL_VERSION = 2, // CDMA PRL version
// CDMA mobile account information
RIL_NV_CDMA_MDN = 3, // CDMA MDN
RIL_NV_CDMA_MIN = 4, // CDMA MIN (MSID)
// Carrier device provisioning
RIL_NV_DEVICE_MSL = 5, // device MSL
RIL_NV_RTN_RECONDITIONED_STATUS = 6, // RTN reconditioned status
RIL_NV_RTN_ACTIVATION_DATE = 7, // RTN activation date
RIL_NV_RTN_LIFE_TIMER = 8, // RTN life timer
RIL_NV_RTN_LIFE_CALLS = 9, // RTN life calls
RIL_NV_RTN_LIFE_DATA_TX = 10, // RTN life data TX
RIL_NV_RTN_LIFE_DATA_RX = 11, // RTN life data RX
RIL_NV_OMADM_HFA_LEVEL = 12, // HFA in progress
// Mobile IP profile information
RIL_NV_MIP_PROFILE_NAI = 13, // NAI realm
RIL_NV_MIP_PROFILE_HOME_ADDRESS = 14, // MIP home address
RIL_NV_MIP_PROFILE_AAA_AUTH = 15, // AAA auth
RIL_NV_MIP_PROFILE_HA_AUTH = 16, // HA auth
RIL_NV_MIP_PROFILE_PRI_HA_ADDR = 17, // primary HA address
RIL_NV_MIP_PROFILE_SEC_HA_ADDR = 18, // secondary HA address
RIL_NV_MIP_PROFILE_REV_TUN_PREF = 19, // reverse TUN preference
RIL_NV_MIP_PROFILE_HA_SPI = 20, // HA SPI
RIL_NV_MIP_PROFILE_AAA_SPI = 21, // AAA SPI
RIL_NV_MIP_PROFILE_MN_HA_SS = 22, // HA shared secret
RIL_NV_MIP_PROFILE_MN_AAA_SS = 23, // AAA shared secret
// CDMA network and band config
RIL_NV_CDMA_BC10 = 24, // CDMA band class 10
RIL_NV_CDMA_BC14 = 25, // CDMA band class 14
RIL_NV_CDMA_SO68 = 26, // CDMA SO68
RIL_NV_CDMA_SO73_COP0 = 27, // CDMA SO73 COP0
RIL_NV_CDMA_SO73_COP1TO7 = 28, // CDMA SO73 COP1-7
RIL_NV_CDMA_1X_ADVANCED_ENABLED = 29, // CDMA 1X Advanced enabled
RIL_NV_CDMA_EHRPD_ENABLED = 30, // CDMA eHRPD enabled
RIL_NV_CDMA_EHRPD_FORCED = 31, // CDMA eHRPD forced
// LTE network and band config
RIL_NV_LTE_BAND_ENABLE_25 = 32, // LTE band 25 enable
RIL_NV_LTE_BAND_ENABLE_26 = 33, // LTE band 26 enable
RIL_NV_LTE_BAND_ENABLE_41 = 34, // LTE band 41 enable
RIL_NV_LTE_SCAN_PRIORITY_25 = 35, // LTE band 25 scan priority
RIL_NV_LTE_SCAN_PRIORITY_26 = 36, // LTE band 26 scan priority
RIL_NV_LTE_SCAN_PRIORITY_41 = 37, // LTE band 41 scan priority
RIL_NV_LTE_HIDDEN_BAND_PRIORITY_25 = 38, // LTE hidden band 25 priority
RIL_NV_LTE_HIDDEN_BAND_PRIORITY_26 = 39, // LTE hidden band 26 priority
RIL_NV_LTE_HIDDEN_BAND_PRIORITY_41 = 40, // LTE hidden band 41 priority
} RIL_NV_Item;
#ifdef __cplusplus
}
#endif
#endif /* ANDROID_RIL_NV_ITEMS_H */
......@@ -216,6 +216,9 @@ static void dispatchCdmaSmsAck(Parcel &p, RequestInfo *pRI);
static void dispatchGsmBrSmsCnf(Parcel &p, RequestInfo *pRI);
static void dispatchCdmaBrSmsCnf(Parcel &p, RequestInfo *pRI);
static void dispatchRilCdmaSmsWriteArgs(Parcel &p, RequestInfo *pRI);
static void dispatchNVReadItem(Parcel &p, RequestInfo *pRI);
static void dispatchNVWriteItem(Parcel &p, RequestInfo *pRI);
static int responseInts(Parcel &p, void *response, size_t responselen);
static int responseStrings(Parcel &p, void *response, size_t responselen);
static int responseString(Parcel &p, void *response, size_t responselen);
......@@ -1582,6 +1585,82 @@ invalid:
return;
}
static void dispatchNVReadItem(Parcel &p, RequestInfo *pRI) {
RIL_NV_ReadItem nvri;
int32_t t;
status_t status;
memset(&nvri, 0, sizeof(nvri));
status = p.readInt32(&t);
nvri.itemID = (RIL_NV_Item) t;
if (status != NO_ERROR) {
goto invalid;
}
startRequest;
appendPrintBuf("%snvri.itemID=%d, ", printBuf, nvri.itemID);
closeRequest;
printRequest(pRI->token, pRI->pCI->requestNumber);
s_callbacks.onRequest(pRI->pCI->requestNumber, &nvri, sizeof(nvri), pRI);
#ifdef MEMSET_FREED
memset(&nvri, 0, sizeof(nvri));
#endif
return;
invalid:
invalidCommandBlock(pRI);
return;
}
static void dispatchNVWriteItem(Parcel &p, RequestInfo *pRI) {
RIL_NV_WriteItem nvwi;
int32_t t;
status_t status;
memset(&nvwi, 0, sizeof(nvwi));
status = p.readInt32(&t);
nvwi.itemID = (RIL_NV_Item) t;
nvwi.value = strdupReadString(p);
if (status != NO_ERROR || nvwi.value == NULL) {
goto invalid;
}
startRequest;
appendPrintBuf("%snvwi.itemID=%d, value=%s, ", printBuf, nvwi.itemID,
nvwi.value);
closeRequest;
printRequest(pRI->token, pRI->pCI->requestNumber);
s_callbacks.onRequest(pRI->pCI->requestNumber, &nvwi, sizeof(nvwi), pRI);
#ifdef MEMSET_FREED
memsetString(nvwi.value);
#endif
free(nvwi.value);
#ifdef MEMSET_FREED
memset(&nvwi, 0, sizeof(nvwi));
#endif
return;
invalid:
invalidCommandBlock(pRI);
return;
}
static int
blockingWrite(int fd, const void *buffer, size_t len) {
size_t writeOffset = 0;
......
......@@ -132,3 +132,8 @@
{RIL_REQUEST_SIM_OPEN_CHANNEL, dispatchString, responseInts},
{RIL_REQUEST_SIM_CLOSE_CHANNEL, dispatchInts, responseVoid},
{RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL, dispatchSIM_APDU, responseSIM_IO},
{RIL_REQUEST_NV_READ_ITEM, dispatchNVReadItem, responseString},
{RIL_REQUEST_NV_WRITE_ITEM, dispatchNVWriteItem, responseVoid},
{RIL_REQUEST_NV_WRITE_CDMA_PRL, dispatchRaw, responseVoid},
{RIL_REQUEST_NV_RESET_CONFIG, dispatchInts, responseVoid},
{RIL_REQUEST_SET_RADIO_MODE, dispatchInts, responseVoid},
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment