summaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
authorJake Hamby <jhamby@google.com>2014-01-15 13:08:03 -0800
committerJake Hamby <jhamby@google.com>2014-02-03 15:52:18 -0800
commit8f9b33e77686de8e917ba61c5e2f2e31a1e0e49b (patch)
tree40fe31d23a5e47aaec0cab9ff93872e18b31fca8 /telephony
parent6c90d439758add5981dee67674d0aafc5208f427 (diff)
downloadframeworks_base-8f9b33e77686de8e917ba61c5e2f2e31a1e0e49b.zip
frameworks_base-8f9b33e77686de8e917ba61c5e2f2e31a1e0e49b.tar.gz
frameworks_base-8f9b33e77686de8e917ba61c5e2f2e31a1e0e49b.tar.bz2
Add new RIL commands to read/write NV items and reset NV config.
Add new RIL commands and generic code cleanups. The only changes required for OMA DM support are the addition of five new methods in ITelephony.aidl for reading/writing NV items and performing NV config and radio resets (requires MODIFY_PHONE_STATE), along with the new RIL request IDs in RILConstants.java. Bug: 12864208 Change-Id: I958d2571580d98a49936ef2e6822e5ac086acbe2
Diffstat (limited to 'telephony')
-rw-r--r--telephony/java/android/telephony/CellInfo.java2
-rw-r--r--telephony/java/android/telephony/PhoneStateListener.java2
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java105
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephony.aidl47
-rw-r--r--telephony/java/com/android/internal/telephony/PhoneConstants.java10
-rw-r--r--telephony/java/com/android/internal/telephony/RILConstants.java12
-rw-r--r--telephony/java/com/android/internal/telephony/TelephonyIntents.java102
7 files changed, 217 insertions, 63 deletions
diff --git a/telephony/java/android/telephony/CellInfo.java b/telephony/java/android/telephony/CellInfo.java
index bfa0942..b5e4eef 100644
--- a/telephony/java/android/telephony/CellInfo.java
+++ b/telephony/java/android/telephony/CellInfo.java
@@ -76,7 +76,7 @@ public abstract class CellInfo implements Parcelable {
return mRegistered;
}
/** @hide */
- public void setRegisterd(boolean registered) {
+ public void setRegistered(boolean registered) {
mRegistered = registered;
}
diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java
index 022bf12..d34c55c 100644
--- a/telephony/java/android/telephony/PhoneStateListener.java
+++ b/telephony/java/android/telephony/PhoneStateListener.java
@@ -275,7 +275,7 @@ public class PhoneStateListener {
* @param otaspMode is integer <code>OTASP_UNKNOWN=1<code>
* means the value is currently unknown and the system should wait until
* <code>OTASP_NEEDED=2<code> or <code>OTASP_NOT_NEEDED=3<code> is received before
- * making the decisision to perform OTASP or not.
+ * making the decision to perform OTASP or not.
*
* @hide
*/
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index a785bac..3d416fb 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -23,7 +23,6 @@ import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
-import android.telephony.Rlog;
import com.android.internal.telephony.IPhoneSubInfo;
import com.android.internal.telephony.ITelephony;
@@ -433,7 +432,7 @@ public class TelephonyManager {
case RILConstants.NETWORK_MODE_GSM_UMTS:
case RILConstants.NETWORK_MODE_LTE_GSM_WCDMA:
case RILConstants.NETWORK_MODE_LTE_WCDMA:
- case RILConstants.NETWORK_MODE_LTE_CMDA_EVDO_GSM_WCDMA:
+ case RILConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA:
return PhoneConstants.PHONE_TYPE_GSM;
// Use CDMA Phone for the global mode including CDMA
@@ -1258,7 +1257,7 @@ public class TelephonyManager {
* At registration, and when a specified telephony state
* changes, the telephony manager invokes the appropriate
* callback method on the listener object and passes the
- * current (udpated) values.
+ * current (updated) values.
* <p>
* To unregister a listener, pass the listener object and set the
* events argument to
@@ -1480,7 +1479,7 @@ public class TelephonyManager {
*
* Input parameters equivalent to TS 27.007 AT+CGLA command.
*
- * @param channel is the channel id to be closed as retruned by a successful
+ * @param channel is the channel id to be closed as returned by a successful
* iccOpenLogicalChannel.
* @param cla Class of the APDU command.
* @param instruction Instruction of the APDU command.
@@ -1502,4 +1501,102 @@ public class TelephonyManager {
}
return "";
}
+
+ /**
+ * Read one of the NV items defined in {@link com.android.internal.telephony.RadioNVItems}.
+ * Used for device configuration by some CDMA operators.
+ *
+ * @param itemID the ID of the item to read.
+ * @return the NV item as a String, or null on any failure.
+ * @hide
+ */
+ public String nvReadItem(int itemID) {
+ try {
+ return getITelephony().nvReadItem(itemID);
+ } catch (RemoteException ex) {
+ Rlog.e(TAG, "nvReadItem RemoteException", ex);
+ } catch (NullPointerException ex) {
+ Rlog.e(TAG, "nvReadItem NPE", ex);
+ }
+ return "";
+ }
+
+
+ /**
+ * Write one of the NV items defined in {@link com.android.internal.telephony.RadioNVItems}.
+ * Used for device configuration by some CDMA operators.
+ *
+ * @param itemID the ID of the item to read.
+ * @param itemValue the value to write, as a String.
+ * @return true on success; false on any failure.
+ * @hide
+ */
+ public boolean nvWriteItem(int itemID, String itemValue) {
+ try {
+ return getITelephony().nvWriteItem(itemID, itemValue);
+ } catch (RemoteException ex) {
+ Rlog.e(TAG, "nvWriteItem RemoteException", ex);
+ } catch (NullPointerException ex) {
+ Rlog.e(TAG, "nvWriteItem NPE", ex);
+ }
+ return false;
+ }
+
+ /**
+ * Update the CDMA Preferred Roaming List (PRL) in the radio NV storage.
+ * Used for device configuration by some CDMA operators.
+ *
+ * @param preferredRoamingList byte array containing the new PRL.
+ * @return true on success; false on any failure.
+ * @hide
+ */
+ public boolean nvWriteCdmaPrl(byte[] preferredRoamingList) {
+ try {
+ return getITelephony().nvWriteCdmaPrl(preferredRoamingList);
+ } catch (RemoteException ex) {
+ Rlog.e(TAG, "nvWriteCdmaPrl RemoteException", ex);
+ } catch (NullPointerException ex) {
+ Rlog.e(TAG, "nvWriteCdmaPrl NPE", ex);
+ }
+ return false;
+ }
+
+ /**
+ * Perform the specified type of NV config reset.
+ * Used for device configuration by some CDMA operators.
+ *
+ * @param resetType the type of reset to perform (1 == factory reset; 2 == NV-only reset).
+ * @return true on success; false on any failure.
+ * @hide
+ */
+ public boolean nvResetConfig(int resetType) {
+ try {
+ return getITelephony().nvResetConfig(resetType);
+ } catch (RemoteException ex) {
+ Rlog.e(TAG, "nvResetConfig RemoteException", ex);
+ } catch (NullPointerException ex) {
+ Rlog.e(TAG, "nvResetConfig NPE", ex);
+ }
+ return false;
+ }
+
+ /**
+ * Change the radio to the specified mode.
+ * Used for device configuration by some operators.
+ *
+ * @param radioMode is 0 for offline mode, 1 for online mode, 2 for low-power mode,
+ * or 3 to reset the radio.
+ * @return true on success; false on any failure.
+ * @hide
+ */
+ public boolean setRadioMode(int radioMode) {
+ try {
+ return getITelephony().setRadioMode(radioMode);
+ } catch (RemoteException ex) {
+ Rlog.e(TAG, "setRadioMode RemoteException", ex);
+ } catch (NullPointerException ex) {
+ Rlog.e(TAG, "setRadioMode NPE", ex);
+ }
+ return false;
+ }
}
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index d9e9d56..370e27a 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -365,4 +365,51 @@ interface ITelephony {
*/
String iccTransmitApduLogicalChannel(int channel, int cla, int instruction,
int p1, int p2, int p3, String data);
+
+ /**
+ * Read one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}.
+ * Used for device configuration by some CDMA operators.
+ *
+ * @param itemID the ID of the item to read.
+ * @return the NV item as a String, or null on any failure.
+ */
+ String nvReadItem(int itemID);
+
+ /**
+ * Write one of the NV items defined in {@link RadioNVItems} / {@code ril_nv_items.h}.
+ * Used for device configuration by some CDMA operators.
+ *
+ * @param itemID the ID of the item to read.
+ * @param itemValue the value to write, as a String.
+ * @return true on success; false on any failure.
+ */
+ boolean nvWriteItem(int itemID, String itemValue);
+
+ /**
+ * Update the CDMA Preferred Roaming List (PRL) in the radio NV storage.
+ * Used for device configuration by some CDMA operators.
+ *
+ * @param preferredRoamingList byte array containing the new PRL.
+ * @return true on success; false on any failure.
+ */
+ boolean nvWriteCdmaPrl(in byte[] preferredRoamingList);
+
+ /**
+ * Perform the specified type of NV config reset.
+ * Used for device configuration by some CDMA operators.
+ *
+ * @param resetType the type of reset to perform (1 == factory reset; 2 == NV-only reset).
+ * @return true on success; false on any failure.
+ */
+ boolean nvResetConfig(int resetType);
+
+ /**
+ * Change the radio to the specified mode.
+ * Used for device configuration by some operators.
+ *
+ * @param radioMode is 0 for offline mode, 1 for online mode, 2 for low-power mode,
+ * or 3 to reset the radio.
+ * @return true on success; false on any failure.
+ */
+ boolean setRadioMode(int radioMode);
}
diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java
index 4163255..fc6c997 100644
--- a/telephony/java/com/android/internal/telephony/PhoneConstants.java
+++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java
@@ -63,11 +63,11 @@ public class PhoneConstants {
public static final int LTE_ON_CDMA_FALSE = RILConstants.LTE_ON_CDMA_FALSE;
public static final int LTE_ON_CDMA_TRUE = RILConstants.LTE_ON_CDMA_TRUE;
- // Number presentation type for caller id display (From internal/Conneciton.java)
- public static int PRESENTATION_ALLOWED = 1; // normal
- public static int PRESENTATION_RESTRICTED = 2; // block by user
- public static int PRESENTATION_UNKNOWN = 3; // no specified or unknown by network
- public static int PRESENTATION_PAYPHONE = 4; // show pay phone info
+ // Number presentation type for caller id display (From internal/Connection.java)
+ public static final int PRESENTATION_ALLOWED = 1; // normal
+ public static final int PRESENTATION_RESTRICTED = 2; // block by user
+ public static final int PRESENTATION_UNKNOWN = 3; // no specified or unknown by network
+ public static final int PRESENTATION_PAYPHONE = 4; // show pay phone info
public static final String PHONE_NAME_KEY = "phoneName";
diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java
index 8e445d9..6015df0 100644
--- a/telephony/java/com/android/internal/telephony/RILConstants.java
+++ b/telephony/java/com/android/internal/telephony/RILConstants.java
@@ -72,7 +72,7 @@ public interface RILConstants {
AVAILABLE Application Settings menu*/
int NETWORK_MODE_LTE_CDMA_EVDO = 8; /* LTE, CDMA and EvDo */
int NETWORK_MODE_LTE_GSM_WCDMA = 9; /* LTE, GSM/WCDMA */
- int NETWORK_MODE_LTE_CMDA_EVDO_GSM_WCDMA = 10; /* LTE, CDMA, EvDo, GSM/WCDMA */
+ int NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA = 10; /* LTE, CDMA, EvDo, GSM/WCDMA */
int NETWORK_MODE_LTE_ONLY = 11; /* LTE Only mode. */
int NETWORK_MODE_LTE_WCDMA = 12; /* LTE/WCDMA */
int PREFERRED_NETWORK_MODE = NETWORK_MODE_WCDMA_PREF;
@@ -114,6 +114,10 @@ public interface RILConstants {
int DEACTIVATE_REASON_RADIO_OFF = 1;
int DEACTIVATE_REASON_PDP_RESET = 2;
+ /* NV config radio reset types. */
+ int NV_CONFIG_RESET_FACTORY = 1;
+ int NV_CONFIG_RESET_NV_ONLY = 2;
+
/*
cat include/telephony/ril.h | \
egrep '^#define' | \
@@ -271,6 +275,12 @@ cat include/telephony/ril.h | \
int RIL_REQUEST_SIM_OPEN_CHANNEL = 115;
int RIL_REQUEST_SIM_CLOSE_CHANNEL = 116;
int RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL = 117;
+ int RIL_REQUEST_NV_READ_ITEM = 118;
+ int RIL_REQUEST_NV_WRITE_ITEM = 119;
+ int RIL_REQUEST_NV_WRITE_CDMA_PRL = 120;
+ int RIL_REQUEST_NV_RESET_CONFIG = 121;
+ int RIL_REQUEST_SET_RADIO_MODE = 122;
+
int RIL_UNSOL_RESPONSE_BASE = 1000;
int RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED = 1000;
int RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED = 1001;
diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
index a7baf1c..9ad2d42 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyIntents.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyIntents.java
@@ -125,16 +125,14 @@ public class TelephonyIntents {
* Broadcast Action: The data connection state has changed for any one of the
* phone's mobile data connections (eg, default, MMS or GPS specific connection).
* The intent will have the following extra values:</p>
- * <ul>
- * <li><em>phoneName</em> - A string version of the phone name.</li>
- * <li><em>state</em> - One of <code>"CONNECTED"</code>
- * <code>"CONNECTING"</code> or <code>"DISCONNNECTED"</code></li>
- * <li><em>apn</em> - A string that is the APN associated with this
- * connection.</li>
- * <li><em>apnType</em> - A string array of APN types associated with
- * this connection. The APN type <code>"*"</code> is a special
- * type that means this APN services all types.</li>
- * </ul>
+ * <dl>
+ * <dt>phoneName</dt><dd>A string version of the phone name.</dd>
+ * <dt>state</dt><dd>One of {@code CONNECTED}, {@code CONNECTING},
+ * or {@code DISCONNECTED}.</dd>
+ * <dt>apn</dt><dd>A string that is the APN associated with this connection.</dd>
+ * <dt>apnType</dt><dd>A string array of APN types associated with this connection.
+ * The APN type {@code *} is a special type that means this APN services all types.</dd>
+ * </dl>
*
* <p class="note">
* Requires the READ_PHONE_STATE permission.
@@ -149,16 +147,14 @@ public class TelephonyIntents {
* Broadcast Action: Occurs when a data connection connects to a provisioning apn
* and is broadcast by the low level data connection code.
* The intent will have the following extra values:</p>
- * <ul>
- * <li><em>apn</em> - A string that is the APN associated with this
- * connection.</li>
- * <li><em>apnType</em> - A string array of APN types associated with
- * this connection. The APN type <code>"*"</code> is a special
- * type that means this APN services all types.</li>
- * <li><em>linkProperties</em> - The <code>LinkProperties</code> for this APN</li>
- * <li><em>linkCapabilities</em> - The <code>linkCapabilities</code> for this APN</li>
- * <li><em>iface</em> - A string that is the name of the interface</li>
- * </ul>
+ * <dl>
+ * <dt>apn</dt><dd>A string that is the APN associated with this connection.</dd>
+ * <dt>apnType</dt><dd>A string array of APN types associated with this connection.
+ * The APN type {@code *} is a special type that means this APN services all types.</dd>
+ * <dt>linkProperties</dt><dd>{@code LinkProperties} for this APN.</dd>
+ * <dt>linkCapabilities</dt><dd>The {@code LinkCapabilities} for this APN.</dd>
+ * <dt>iface</dt><dd>A string that is the name of the interface.</dd>
+ * </dl>
*
* <p class="note">
* Requires the READ_PHONE_STATE permission.
@@ -172,12 +168,11 @@ public class TelephonyIntents {
/**
* Broadcast Action: An attempt to establish a data connection has failed.
* The intent will have the following extra values:</p>
- * <ul>
- * <li><em>phoneName</em> &mdash A string version of the phone name.</li>
- * <li><em>state</em> &mdash; One of <code>"CONNECTED"</code>
- * <code>"CONNECTING"</code> or <code>"DISCONNNECTED"</code></li>
- * <li><em>reason</em> &mdash; A string indicating the reason for the failure, if available</li>
- * </ul>
+ * <dl>
+ * <dt>phoneName</dt><dd>A string version of the phone name.</dd>
+ * <dt>state</dt><dd>One of {@code CONNECTED}, {@code CONNECTING}, or {code DISCONNECTED}.</dd>
+ * <dt>reason</dt><dd>A string indicating the reason for the failure, if available.</dd>
+ * </dl>
*
* <p class="note">
* Requires the READ_PHONE_STATE permission.
@@ -192,16 +187,23 @@ public class TelephonyIntents {
/**
* Broadcast Action: The sim card state has changed.
* The intent will have the following extra values:</p>
- * <ul>
- * <li><em>phoneName</em> - A string version of the phone name.</li>
- * <li><em>ss</em> - The sim state. One of
- * <code>"ABSENT"</code> <code>"LOCKED"</code>
- * <code>"READY"</code> <code>"ISMI"</code> <code>"LOADED"</code> </li>
- * <li><em>reason</em> - The reason while ss is LOCKED, otherwise is null
- * <code>"PIN"</code> locked on PIN1
- * <code>"PUK"</code> locked on PUK1
- * <code>"NETWORK"</code> locked on Network Personalization </li>
- * </ul>
+ * <dl>
+ * <dt>phoneName</dt><dd>A string version of the phone name.</dd>
+ * <dt>ss</dt><dd>The sim state. One of:
+ * <dl>
+ * <dt>{@code ABSENT}</dt><dd>SIM card not found</dd>
+ * <dt>{@code LOCKED}</dt><dd>SIM card locked (see {@code reason})</dd>
+ * <dt>{@code READY}</dt><dd>SIM card ready</dd>
+ * <dt>{@code IMSI}</dt><dd>FIXME: what is this state?</dd>
+ * <dt>{@code LOADED}</dt><dd>SIM card data loaded</dd>
+ * </dl></dd>
+ * <dt>reason</dt><dd>The reason why ss is {@code LOCKED}; null otherwise.</dd>
+ * <dl>
+ * <dt>{@code PIN}</dt><dd>locked on PIN1</dd>
+ * <dt>{@code PUK}</dt><dd>locked on PUK1</dd>
+ * <dt>{@code NETWORK}</dt><dd>locked on network personalization</dd>
+ * </dl>
+ * </dl>
*
* <p class="note">
* Requires the READ_PHONE_STATE permission.
@@ -272,31 +274,30 @@ public class TelephonyIntents {
/**
* A <em>prefix</em> for the MCC/MNC filtering used with {@link #ACTION_CARRIER_SETUP}.
* The MCC/MNC will be concatenated (zero-padded to 3 digits each) to create a final
- * string of the form:
- * <br />
- * <code>android.intent.category.MCCMNC_310260</code>
+ * string of the form: {@code android.intent.category.MCCMNC_310260}
*/
public static final String CATEGORY_MCCMNC_PREFIX = "android.intent.category.MCCMNC_";
/**
* Broadcast Action: A "secret code" has been entered in the dialer. Secret codes are
- * of the form *#*#<code>#*#*. The intent will have the data URI:</p>
+ * of the form {@code *#*#<code>#*#*}. The intent will have the data URI:
*
- * <p><code>android_secret_code://&lt;code&gt;</code></p>
+ * {@code android_secret_code://<code>}
*/
- public static final String SECRET_CODE_ACTION =
- "android.provider.Telephony.SECRET_CODE";
+ public static final String SECRET_CODE_ACTION = "android.provider.Telephony.SECRET_CODE";
/**
* Broadcast Action: The Service Provider string(s) have been updated. Activities or
* services that use these strings should update their display.
* The intent will have the following extra values:</p>
- * <ul>
- * <li><em>showPlmn</em> - Boolean that indicates whether the PLMN should be shown.</li>
- * <li><em>plmn</em> - The operator name of the registered network, as a string.</li>
- * <li><em>showSpn</em> - Boolean that indicates whether the SPN should be shown.</li>
- * <li><em>spn</em> - The service provider name, as a string.</li>
- * </ul>
+ *
+ * <dl>
+ * <dt>showPlmn</dt><dd>Boolean that indicates whether the PLMN should be shown.</dd>
+ * <dt>plmn</dt><dd>The operator name of the registered network, as a string.</dd>
+ * <dt>showSpn</dt><dd>Boolean that indicates whether the SPN should be shown.</dd>
+ * <dt>spn</dt><dd>The service provider name, as a string.</dd>
+ * </dl>
+ *
* Note that <em>showPlmn</em> may indicate that <em>plmn</em> should be displayed, even
* though the value for <em>plmn</em> is null. This can happen, for example, if the phone
* has not registered to a network yet. In this case the receiver may substitute an
@@ -305,8 +306,7 @@ public class TelephonyIntents {
* It is recommended to display <em>plmn</em> before / above <em>spn</em> if
* both are displayed.
*
- * <p>Note this is a protected intent that can only be sent
- * by the system.
+ * <p>Note: this is a protected intent that can only be sent by the system.
*/
public static final String SPN_STRINGS_UPDATED_ACTION =
"android.provider.Telephony.SPN_STRINGS_UPDATED";