Commit 75697538 authored by Sungmin Choi's avatar Sungmin Choi Committed by Vineeta Srivastava
Browse files

Set initial attach apn for LTE network


When mobile register LTE network, APN provided by operators is needed.
If mobile does not have apn information, it could not register LTE network.
To deliver APN information which is used during LTE attach to modem chipset,
setLteAttachProfile() and RIL_REQUEST_SET_LTE_ATTACH_PROFILE command is added.

When Telephony DB is loaded or Telephony DB is changed, follow steps.
1. If preferred default ApnContext exists, this is delivered to modem chipset.
2. If preferred default ApnContext is null, find other ApnContext which can
   handle default type.
3. If other ApnContext which can handle default type does not exist, any other
   ApnContext delivered to modem chipset.

Then modem register LTE network with APN information delivered from AP.

Bug: 8733613

Change-Id: If84c62cddccf96a531dae0527ed1a6592ae76201
Signed-off-by: default avatarSeonju Oh <seonju.oh@lge.com>
Signed-off-by: default avatarHyejin Kim <hyejin.kim@lge.com>
Signed-off-by: default avatarSungmin Choi <sungmin.choi@lge.com>
parent f467af61
......@@ -3482,6 +3482,20 @@ typedef struct {
*/
#define RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE 110
/**
* RIL_REQUEST_SET_INITIAL_ATTACH_APN
*
* Set an apn to initial attach network
* "response" is NULL
*
* Valid errors:
* SUCCESS
* RADIO_NOT_AVAILABLE (radio resetting)
* GENERIC_FAILURE
* SUBSCRIPTION_NOT_AVAILABLE
*/
#define RIL_REQUEST_SET_INITIAL_ATTACH_APN 111
/***********************************************************************/
......@@ -4040,6 +4054,14 @@ typedef struct {
RIL_GetVersion getVersion;
} RIL_RadioFunctions;
typedef struct {
char *apn;
char *protocol;
int authtype;
char *username;
char *password;
} RIL_InitialAttachApn;
#ifdef RIL_SHLIB
struct RIL_Env {
/**
......
......@@ -204,6 +204,7 @@ static void dispatchRaw(Parcel& p, RequestInfo *pRI);
static void dispatchSmsWrite (Parcel &p, RequestInfo *pRI);
static void dispatchDataCall (Parcel& p, RequestInfo *pRI);
static void dispatchVoiceRadioTech (Parcel& p, RequestInfo *pRI);
static void dispatchSetInitialAttachApn (Parcel& p, RequestInfo *pRI);
static void dispatchCdmaSubscriptionSource (Parcel& p, RequestInfo *pRI);
static void dispatchCdmaSms(Parcel &p, RequestInfo *pRI);
......@@ -1305,6 +1306,56 @@ static void dispatchCdmaSubscriptionSource(Parcel& p, RequestInfo *pRI) {
RIL_onRequestComplete(pRI, RIL_E_SUCCESS, &cdmaSubscriptionSource, sizeof(int));
}
static void dispatchSetInitialAttachApn(Parcel &p, RequestInfo *pRI)
{
RIL_InitialAttachApn pf;
int32_t t;
status_t status;
memset(&pf, 0, sizeof(pf));
pf.apn = strdupReadString(p);
pf.protocol = strdupReadString(p);
status = p.readInt32(&t);
pf.authtype = (int) t;
pf.username = strdupReadString(p);
pf.password = strdupReadString(p);
startRequest;
appendPrintBuf("%sapn=%s, protocol=%s, auth_type=%d, username=%s, password=%s",
printBuf, pf.apn, pf.protocol, pf.auth_type, pf.username, pf.password);
closeRequest;
printRequest(pRI->token, pRI->pCI->requestNumber);
if (status != NO_ERROR) {
goto invalid;
}
s_callbacks.onRequest(pRI->pCI->requestNumber, &pf, sizeof(pf), pRI);
#ifdef MEMSET_FREED
memsetString(pf.apn);
memsetString(pf.protocol);
memsetString(pf.username);
memsetString(pf.password);
#endif
free(pf.apn);
free(pf.protocol);
free(pf.username);
free(pf.password);
#ifdef MEMSET_FREED
memset(&pf, 0, sizeof(pf));
#endif
return;
invalid:
invalidCommandBlock(pRI);
return;
}
static int
blockingWrite(int fd, const void *buffer, size_t len) {
size_t writeOffset = 0;
......@@ -3601,6 +3652,7 @@ requestToString(int request) {
case RIL_REQUEST_VOICE_RADIO_TECH: return "VOICE_RADIO_TECH";
case RIL_REQUEST_GET_CELL_INFO_LIST: return"GET_CELL_INFO_LIST";
case RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE: return"SET_UNSOL_CELL_INFO_LIST_RATE";
case RIL_REQUEST_SET_INITIAL_ATTACH_APN: return "RIL_REQUEST_SET_INITIAL_ATTACH_APN";
case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: return "UNSOL_RESPONSE_RADIO_STATE_CHANGED";
case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED: return "UNSOL_RESPONSE_CALL_STATE_CHANGED";
case RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED: return "UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED";
......
......@@ -125,3 +125,4 @@
{RIL_REQUEST_VOICE_RADIO_TECH, dispatchVoiceRadioTech, responseInts},
{RIL_REQUEST_GET_CELL_INFO_LIST, dispatchVoid, responseCellInfoList},
{RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE, dispatchInts, responseVoid},
{RIL_REQUEST_SET_INITIAL_ATTACH_APN, dispatchSetInitialAttachApn, 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