diff options
11 files changed, 236 insertions, 75 deletions
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index 6ac126e..3a35cb9 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -800,6 +800,8 @@ public class ConnectivityManager { * Ensure that a network route exists to deliver traffic to the specified * host via the specified network interface. An attempt to add a route that * already exists is ignored, but treated as successful. + * <p>This method requires the caller to hold the permission + * {@link android.Manifest.permission#CHANGE_NETWORK_STATE}. * @param networkType the type of the network over which traffic to the specified * host is to be routed * @param hostAddress the IP address of the host to which the route is desired diff --git a/core/java/android/net/MobileDataStateTracker.java b/core/java/android/net/MobileDataStateTracker.java index d9c35c0..3c3d8ec 100644 --- a/core/java/android/net/MobileDataStateTracker.java +++ b/core/java/android/net/MobileDataStateTracker.java @@ -306,18 +306,18 @@ public class MobileDataStateTracker extends BaseNetworkStateTracker { if (VDBG) { Slog.d(TAG, "TelephonyMgr.DataConnectionStateChanged"); if (mNetworkInfo != null) { - Slog.d(TAG, "NetworkInfo = " + mNetworkInfo.toString()); - Slog.d(TAG, "subType = " + String.valueOf(mNetworkInfo.getSubtype())); + Slog.d(TAG, "NetworkInfo = " + mNetworkInfo); + Slog.d(TAG, "subType = " + mNetworkInfo.getSubtype()); Slog.d(TAG, "subType = " + mNetworkInfo.getSubtypeName()); } if (mLinkProperties != null) { - Slog.d(TAG, "LinkProperties = " + mLinkProperties.toString()); + Slog.d(TAG, "LinkProperties = " + mLinkProperties); } else { Slog.d(TAG, "LinkProperties = " ); } if (mLinkCapabilities != null) { - Slog.d(TAG, "LinkCapabilities = " + mLinkCapabilities.toString()); + Slog.d(TAG, "LinkCapabilities = " + mLinkCapabilities); } else { Slog.d(TAG, "LinkCapabilities = " ); } diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 315b119..7ea08af 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -583,7 +583,7 @@ <!-- =============================================================== --> <eat-comment /> - <!-- Used for permissions that provide access to the user voicemail box. --> + <!-- Used for permissions that provide access to device alarms. --> <permission-group android:name="android.permission-group.DEVICE_ALARMS" android:label="@string/permgrouplab_deviceAlarms" android:icon="@drawable/perm_group_device_alarms" @@ -1061,7 +1061,7 @@ <!-- =========================================== --> <eat-comment /> - <!-- Used for permissions that are associated with accessing and modifyign + <!-- Used for permissions that are associated with accessing and modifying telephony state: placing calls, intercepting outgoing calls, reading and modifying the phone state. --> <permission-group android:name="android.permission-group.PHONE_CALLS" diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 015185f..9349730 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -169,9 +169,9 @@ public class ConnectivityService extends IConnectivityManager.Stub { private static final String TAG = "ConnectivityService"; private static final boolean DBG = true; - private static final boolean VDBG = false; + private static final boolean VDBG = true; - private static final boolean LOGD_RULES = false; + private static final boolean LOGD_RULES = true; // TODO: create better separation between radio types and network types @@ -4495,11 +4495,16 @@ public class ConnectivityService extends IConnectivityManager.Stub { * @param seconds */ private static void sleep(int seconds) { - try { - Thread.sleep(seconds * 1000); - } catch (InterruptedException e) { - e.printStackTrace(); + log("XXXXX sleeping for " + seconds + " sec"); + long stopTime = System.nanoTime() + (seconds * 1000000000); + long sleepTime; + while ((sleepTime = stopTime - System.nanoTime()) > 0) { + try { + Thread.sleep(sleepTime / 1000000); + } catch (InterruptedException ignored) { + } } + log("XXXXX returning from sleep"); } private static void log(String s) { 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> — One of <code>"CONNECTED"</code> - * <code>"CONNECTING"</code> or <code>"DISCONNNECTED"</code></li> - * <li><em>reason</em> — 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://<code></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"; |