Merge "HACK: rild: include librilutils as whole static lib"
diff --git a/include/telephony/ril.h b/include/telephony/ril.h
index 68656fa..1da4d10 100644
--- a/include/telephony/ril.h
+++ b/include/telephony/ril.h
@@ -3482,6 +3482,20 @@
*/
#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 @@
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 {
/**
diff --git a/libril/ril.cpp b/libril/ril.cpp
index 7275903..46a150f 100644
--- a/libril/ril.cpp
+++ b/libril/ril.cpp
@@ -204,6 +204,7 @@
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 @@
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 @@
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";
diff --git a/libril/ril_commands.h b/libril/ril_commands.h
index 0519a2a..3e5a619 100644
--- a/libril/ril_commands.h
+++ b/libril/ril_commands.h
@@ -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},