diff options
Diffstat (limited to 'telephony')
18 files changed, 621 insertions, 148 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/CellLocation.java b/telephony/java/android/telephony/CellLocation.java index 42c2aff..f9a222f 100644 --- a/telephony/java/android/telephony/CellLocation.java +++ b/telephony/java/android/telephony/CellLocation.java @@ -19,9 +19,6 @@ package android.telephony; import android.os.Bundle; import android.os.RemoteException; import android.os.ServiceManager; -import android.os.SystemProperties; -import android.provider.Settings; - import android.telephony.cdma.CdmaCellLocation; import android.telephony.gsm.GsmCellLocation; diff --git a/telephony/java/android/telephony/CellSignalStrength.java b/telephony/java/android/telephony/CellSignalStrength.java index 3b470fc..9c23f78 100644 --- a/telephony/java/android/telephony/CellSignalStrength.java +++ b/telephony/java/android/telephony/CellSignalStrength.java @@ -16,9 +16,6 @@ package android.telephony; -import android.os.Parcel; -import android.os.Parcelable; - /** * Abstract base class for cell phone signal strength related information. */ diff --git a/telephony/java/android/telephony/CellSignalStrengthCdma.java b/telephony/java/android/telephony/CellSignalStrengthCdma.java index 46d09f6..be13acc 100644 --- a/telephony/java/android/telephony/CellSignalStrengthCdma.java +++ b/telephony/java/android/telephony/CellSignalStrengthCdma.java @@ -137,7 +137,6 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements /** * Get the signal level as an asu value between 0..97, 99 is unknown - * Asu is calculated based on 3GPP RSRP. Refer to 3GPP 27.007 (Ver 10.3.0) Sec 8.69 */ @Override public int getAsuLevel() { @@ -342,7 +341,7 @@ public final class CellSignalStrengthCdma extends CellSignalStrength implements /** * Construct a SignalStrength object from the given parcel - * where the TYPE_LTE token is already been processed. + * where the TYPE_CDMA token is already been processed. */ private CellSignalStrengthCdma(Parcel in) { // CdmaDbm, CdmaEcio, EvdoDbm and EvdoEcio are written into diff --git a/telephony/java/android/telephony/DataConnectionRealTimeInfo.aidl b/telephony/java/android/telephony/DataConnectionRealTimeInfo.aidl new file mode 100644 index 0000000..70fbb11 --- /dev/null +++ b/telephony/java/android/telephony/DataConnectionRealTimeInfo.aidl @@ -0,0 +1,20 @@ +/* +** +** Copyright 2007, 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. +*/ + +package android.telephony; + +parcelable DataConnectionRealTimeInfo; diff --git a/telephony/java/android/telephony/DataConnectionRealTimeInfo.java b/telephony/java/android/telephony/DataConnectionRealTimeInfo.java new file mode 100644 index 0000000..96069213 --- /dev/null +++ b/telephony/java/android/telephony/DataConnectionRealTimeInfo.java @@ -0,0 +1,139 @@ +/* + * 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. + */ + +package android.telephony; + +import android.os.Parcel; +import android.os.Parcelable; + +/** + * Data connection real time information + * + * TODO: How to handle multiple subscriptions? + * @hide + */ +public class DataConnectionRealTimeInfo implements Parcelable { + private long mTime; // Time the info was collected since boot in nanos; + + public static int DC_POWER_STATE_LOW = 1; + public static int DC_POWER_STATE_MEDIUM = 2; + public static int DC_POWER_STATE_HIGH = 3; + public static int DC_POWER_STATE_UNKNOWN = Integer.MAX_VALUE; + + private int mDcPowerState; // DC_POWER_STATE_[LOW | MEDIUM | HIGH | UNKNOWN] + + /** + * Constructor + * + * @hide + */ + public DataConnectionRealTimeInfo(long time, int dcPowerState) { + mTime = time; + mDcPowerState = dcPowerState; + } + + /** + * Constructor + * + * @hide + */ + public DataConnectionRealTimeInfo() { + mTime = Long.MAX_VALUE; + mDcPowerState = DC_POWER_STATE_UNKNOWN; + } + + /** + * Construct a PreciseCallState object from the given parcel. + */ + private DataConnectionRealTimeInfo(Parcel in) { + mTime = in.readLong(); + mDcPowerState = in.readInt(); + } + + /** + * @return time the information was collected or Long.MAX_VALUE if unknown + */ + public long getTime() { + return mTime; + } + + /** + * @return DC_POWER_STATE_[LOW | MEDIUM | HIGH | UNKNOWN] + */ + public int getDcPowerState() { + return mDcPowerState; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel out, int flags) { + out.writeLong(mTime); + out.writeInt(mDcPowerState); + } + + public static final Parcelable.Creator<DataConnectionRealTimeInfo> CREATOR + = new Parcelable.Creator<DataConnectionRealTimeInfo>() { + + @Override + public DataConnectionRealTimeInfo createFromParcel(Parcel in) { + return new DataConnectionRealTimeInfo(in); + } + + @Override + public DataConnectionRealTimeInfo[] newArray(int size) { + return new DataConnectionRealTimeInfo[size]; + } + }; + + @Override + public int hashCode() { + final long prime = 17; + long result = 1; + result = (prime * result) + mTime; + result += (prime * result) + mDcPowerState; + return (int)result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + DataConnectionRealTimeInfo other = (DataConnectionRealTimeInfo) obj; + return (mTime == other.mTime) + && (mDcPowerState == other.mDcPowerState); + } + + @Override + public String toString() { + StringBuffer sb = new StringBuffer(); + + sb.append("mTime=").append(mTime); + sb.append(" mDcPowerState=").append(mDcPowerState); + + return sb.toString(); + } +} diff --git a/telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java b/telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java index 983c349..438b572 100644 --- a/telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java +++ b/telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java @@ -65,8 +65,6 @@ public class PhoneNumberFormattingTextWatcher implements TextWatcher { * * @param countryCode the ISO 3166-1 two-letter country code that indicates the country/region * where the phone number is being entered. - * - * @hide */ public PhoneNumberFormattingTextWatcher(String countryCode) { if (countryCode == null) throw new IllegalArgumentException(); diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java index e3a1aa6..c79e9bf 100644 --- a/telephony/java/android/telephony/PhoneNumberUtils.java +++ b/telephony/java/android/telephony/PhoneNumberUtils.java @@ -1143,6 +1143,8 @@ public class PhoneNumberUtils * @param source The phone number to format * @return A locally acceptable formatting of the input, or the raw input if * formatting rules aren't known for the number + * + * @deprecated Use {@link #formatNumber(String phoneNumber, String defaultCountryIso)} instead */ public static String formatNumber(String source) { SpannableStringBuilder text = new SpannableStringBuilder(source); @@ -1159,7 +1161,8 @@ public class PhoneNumberUtils * not begin with +[country_code] * @return The phone number formatted with the given formatting type. * - * @hide TODO: Should be unhidden. + * @hide + * @deprecated Use {@link #formatNumber(String phoneNumber, String defaultCountryIso)} instead */ public static String formatNumber(String source, int defaultFormattingType) { SpannableStringBuilder text = new SpannableStringBuilder(source); @@ -1173,6 +1176,8 @@ public class PhoneNumberUtils * @param locale The locale of interest, usually {@link Locale#getDefault()} * @return The formatting type for the given locale, or FORMAT_UNKNOWN if the formatting * rules are not known for the given locale + * + * @deprecated Use {@link #formatNumber(String phoneNumber, String defaultCountryIso)} instead */ public static int getFormatTypeForLocale(Locale locale) { String country = locale.getCountry(); @@ -1187,6 +1192,8 @@ public class PhoneNumberUtils * @param text The number to be formatted, will be modified with the formatting * @param defaultFormattingType The default formatting rules to apply if the number does * not begin with +[country_code] + * + * @deprecated Use {@link #formatNumber(String phoneNumber, String defaultCountryIso)} instead */ public static void formatNumber(Editable text, int defaultFormattingType) { int formatType = defaultFormattingType; @@ -1233,6 +1240,8 @@ public class PhoneNumberUtils * </code></p> * * @param text the number to be formatted, will be modified with the formatting + * + * @deprecated Use {@link #formatNumber(String phoneNumber, String defaultCountryIso)} instead */ public static void formatNanpNumber(Editable text) { int length = text.length(); @@ -1346,6 +1355,8 @@ public class PhoneNumberUtils * * @param text the number to be formatted, will be modified with * the formatting + * + * @deprecated Use {@link #formatNumber(String phoneNumber, String defaultCountryIso)} instead */ public static void formatJapaneseNumber(Editable text) { JapanesePhoneNumberFormatter.format(text); @@ -1382,8 +1393,6 @@ public class PhoneNumberUtils * the ISO 3166-1 two letters country code * @return the E.164 representation, or null if the given phone number is * not valid. - * - * @hide */ public static String formatNumberToE164(String phoneNumber, String defaultCountryIso) { PhoneNumberUtil util = PhoneNumberUtil.getInstance(); @@ -1410,8 +1419,6 @@ public class PhoneNumberUtils * the ISO 3166-1 two letters country code whose convention will * be used if the given number doesn't have the country code. * @return the formatted number, or null if the given number is not valid. - * - * @hide */ public static String formatNumber(String phoneNumber, String defaultCountryIso) { // Do not attempt to format numbers that start with a hash or star symbol. @@ -1446,8 +1453,6 @@ public class PhoneNumberUtils * contains IDD. * @return the formatted number if the given number has been formatted, * otherwise, return the given number. - * - * @hide */ public static String formatNumber( String phoneNumber, String phoneNumberE164, String defaultCountryIso) { @@ -1483,11 +1488,8 @@ public class PhoneNumberUtils * the given number has keypad letters, the letters will be converted to * digits first. * - * @param phoneNumber - * the number to be normalized. + * @param phoneNumber the number to be normalized. * @return the normalized number. - * - * @hide */ public static String normalizeNumber(String phoneNumber) { StringBuilder sb = new StringBuilder(); @@ -1508,12 +1510,10 @@ public class PhoneNumberUtils } /** - * Replace arabic/unicode digits with decimal digits. - * @param number - * the number to be normalized. - * @return the replaced number. + * Replaces all unicode(e.g. Arabic, Persian) digits with their decimal digit equivalents. * - * @hide + * @param number the number to perform the replacement on. + * @return the replaced number. */ public static String replaceUnicodeDigits(String number) { StringBuilder normalizedDigits = new StringBuilder(number.length()); @@ -1737,16 +1737,12 @@ public class PhoneNumberUtils } /** - * Checks if a given number is an emergency number for the country that the user is in. The - * current country is determined using the CountryDetector. + * Checks if a given number is an emergency number for the country that the user is in. * * @param number the number to look up. * @param context the specific context which the number should be checked against - * @return true if the specified number is an emergency number for a local country, based on the - * CountryDetector. - * - * @see android.location.CountryDetector - * @hide + * @return true if the specified number is an emergency number for the country the user + * is currently in. */ public static boolean isLocalEmergencyNumber(String number, Context context) { return isLocalEmergencyNumberInternal(number, @@ -1825,7 +1821,6 @@ public class PhoneNumberUtils * @return true if the number is in the list of voicemail. False * otherwise, including if the caller does not have the permission * to read the VM number. - * @hide TODO: pending API Council approval */ public static boolean isVoiceMailNumber(String number) { String vmNumber; diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java index 538548d..59ec6f5 100644 --- a/telephony/java/android/telephony/PhoneStateListener.java +++ b/telephony/java/android/telephony/PhoneStateListener.java @@ -18,6 +18,7 @@ package android.telephony; import android.os.Bundle; import android.os.Handler; +import android.os.Looper; import android.os.Message; import android.telephony.ServiceState; import android.telephony.SignalStrength; @@ -188,7 +189,78 @@ public class PhoneStateListener { */ public static final int LISTEN_PRECISE_DATA_CONNECTION_STATE = 0x00001000; + /** + * Listen for real time info for all data connections (cellular)). + * {@more} + * Requires Permission: {@link android.Manifest.permission#READ_PRECISE_PHONE_STATE + * READ_PRECISE_PHONE_STATE} + * + * @see #onDataConnectionRealTimeInfoChanged(DataConnectionRealTimeInfo) + * @hide + */ + public static final int LISTEN_DATA_CONNECTION_REAL_TIME_INFO = 0x00002000; + + private final Handler mHandler; + public PhoneStateListener() { + this(Looper.myLooper()); + } + + /** @hide */ + public PhoneStateListener(Looper looper) { + mHandler = new Handler(looper) { + public void handleMessage(Message msg) { + //Rlog.d("TelephonyRegistry", "what=0x" + Integer.toHexString(msg.what) + // + " msg=" + msg); + switch (msg.what) { + case LISTEN_SERVICE_STATE: + PhoneStateListener.this.onServiceStateChanged((ServiceState)msg.obj); + break; + case LISTEN_SIGNAL_STRENGTH: + PhoneStateListener.this.onSignalStrengthChanged(msg.arg1); + break; + case LISTEN_MESSAGE_WAITING_INDICATOR: + PhoneStateListener.this.onMessageWaitingIndicatorChanged(msg.arg1 != 0); + break; + case LISTEN_CALL_FORWARDING_INDICATOR: + PhoneStateListener.this.onCallForwardingIndicatorChanged(msg.arg1 != 0); + break; + case LISTEN_CELL_LOCATION: + PhoneStateListener.this.onCellLocationChanged((CellLocation)msg.obj); + break; + case LISTEN_CALL_STATE: + PhoneStateListener.this.onCallStateChanged(msg.arg1, (String)msg.obj); + break; + case LISTEN_DATA_CONNECTION_STATE: + PhoneStateListener.this.onDataConnectionStateChanged(msg.arg1, msg.arg2); + PhoneStateListener.this.onDataConnectionStateChanged(msg.arg1); + break; + case LISTEN_DATA_ACTIVITY: + PhoneStateListener.this.onDataActivity(msg.arg1); + break; + case LISTEN_SIGNAL_STRENGTHS: + PhoneStateListener.this.onSignalStrengthsChanged((SignalStrength)msg.obj); + break; + case LISTEN_OTASP_CHANGED: + PhoneStateListener.this.onOtaspChanged(msg.arg1); + break; + case LISTEN_CELL_INFO: + PhoneStateListener.this.onCellInfoChanged((List<CellInfo>)msg.obj); + break; + case LISTEN_PRECISE_CALL_STATE: + PhoneStateListener.this.onPreciseCallStateChanged((PreciseCallState)msg.obj); + break; + case LISTEN_PRECISE_DATA_CONNECTION_STATE: + PhoneStateListener.this.onPreciseDataConnectionStateChanged( + (PreciseDataConnectionState)msg.obj); + break; + case LISTEN_DATA_CONNECTION_REAL_TIME_INFO: + PhoneStateListener.this.onDataConnectionRealTimeInfoChanged( + (DataConnectionRealTimeInfo)msg.obj); + break; + } + } + }; } /** @@ -299,7 +371,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 */ @@ -335,6 +407,16 @@ public class PhoneStateListener { } /** + * Callback invoked when data connection state changes with precise information. + * + * @hide + */ + public void onDataConnectionRealTimeInfoChanged( + DataConnectionRealTimeInfo dcRtInfo) { + // default implementation empty + } + + /** * The callback methods need to be called on the handler thread where * this object was created. If the binder did that for us it'd be nice. */ @@ -396,52 +478,11 @@ public class PhoneStateListener { Message.obtain(mHandler, LISTEN_PRECISE_DATA_CONNECTION_STATE, 0, 0, dataConnectionState).sendToTarget(); } - }; - Handler mHandler = new Handler() { - public void handleMessage(Message msg) { - //Rlog.d("TelephonyRegistry", "what=0x" + Integer.toHexString(msg.what) + " msg=" + msg); - switch (msg.what) { - case LISTEN_SERVICE_STATE: - PhoneStateListener.this.onServiceStateChanged((ServiceState)msg.obj); - break; - case LISTEN_SIGNAL_STRENGTH: - PhoneStateListener.this.onSignalStrengthChanged(msg.arg1); - break; - case LISTEN_MESSAGE_WAITING_INDICATOR: - PhoneStateListener.this.onMessageWaitingIndicatorChanged(msg.arg1 != 0); - break; - case LISTEN_CALL_FORWARDING_INDICATOR: - PhoneStateListener.this.onCallForwardingIndicatorChanged(msg.arg1 != 0); - break; - case LISTEN_CELL_LOCATION: - PhoneStateListener.this.onCellLocationChanged((CellLocation)msg.obj); - break; - case LISTEN_CALL_STATE: - PhoneStateListener.this.onCallStateChanged(msg.arg1, (String)msg.obj); - break; - case LISTEN_DATA_CONNECTION_STATE: - PhoneStateListener.this.onDataConnectionStateChanged(msg.arg1, msg.arg2); - PhoneStateListener.this.onDataConnectionStateChanged(msg.arg1); - break; - case LISTEN_DATA_ACTIVITY: - PhoneStateListener.this.onDataActivity(msg.arg1); - break; - case LISTEN_SIGNAL_STRENGTHS: - PhoneStateListener.this.onSignalStrengthsChanged((SignalStrength)msg.obj); - break; - case LISTEN_OTASP_CHANGED: - PhoneStateListener.this.onOtaspChanged(msg.arg1); - break; - case LISTEN_CELL_INFO: - PhoneStateListener.this.onCellInfoChanged((List<CellInfo>)msg.obj); - break; - case LISTEN_PRECISE_CALL_STATE: - PhoneStateListener.this.onPreciseCallStateChanged((PreciseCallState)msg.obj); - break; - case LISTEN_PRECISE_DATA_CONNECTION_STATE: - PhoneStateListener.this.onPreciseDataConnectionStateChanged((PreciseDataConnectionState)msg.obj); - } + public void onDataConnectionRealTimeInfoChanged( + DataConnectionRealTimeInfo dcRtInfo) { + Message.obtain(mHandler, LISTEN_DATA_CONNECTION_REAL_TIME_INFO, 0, 0, + dcRtInfo).sendToTarget(); } }; } diff --git a/telephony/java/android/telephony/Rlog.java b/telephony/java/android/telephony/Rlog.java index 9ac7bda..2a7f7af 100644 --- a/telephony/java/android/telephony/Rlog.java +++ b/telephony/java/android/telephony/Rlog.java @@ -16,13 +16,8 @@ package android.telephony; -import com.android.internal.os.RuntimeInit; - import android.util.Log; -import java.io.PrintWriter; -import java.io.StringWriter; - /** * A class to log strings to the RADIO LOG. * diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 4d69c9b..df972d5 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -733,7 +733,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 @@ -1571,7 +1571,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 @@ -1753,6 +1753,189 @@ public class TelephonyManager { com.android.internal.R.string.config_mms_user_agent_profile_url); } + /** + * Opens a logical channel to the ICC card. + * + * Input parameters equivalent to TS 27.007 AT+CCHO command. + * + * @param AID Application id. See ETSI 102.221 and 101.220. + * @return The logical channel id which is negative on error. + */ + public int iccOpenLogicalChannel(String AID) { + try { + return getITelephony().iccOpenLogicalChannel(AID); + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + return -1; + } + + /** + * Closes a previously opened logical channel to the ICC card. + * + * Input parameters equivalent to TS 27.007 AT+CCHC command. + * + * @param channel is the channel id to be closed as retruned by a successful + * iccOpenLogicalChannel. + * @return true if the channel was closed successfully. + */ + public boolean iccCloseLogicalChannel(int channel) { + try { + return getITelephony().iccCloseLogicalChannel(channel); + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + return false; + } + + /** + * Transmit an APDU to the ICC card over a logical channel. + * + * Input parameters equivalent to TS 27.007 AT+CGLA command. + * + * @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. + * @param p1 P1 value of the APDU command. + * @param p2 P2 value of the APDU command. + * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU + * is sent to the SIM. + * @param data Data to be sent with the APDU. + * @return The APDU response from the ICC card with the status appended at + * the end. If an error occurs, an empty string is returned. + */ + public String iccTransmitApduLogicalChannel(int channel, int cla, + int instruction, int p1, int p2, int p3, String data) { + try { + return getITelephony().iccTransmitApduLogicalChannel(channel, cla, + instruction, p1, p2, p3, data); + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + 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. The radio will be taken offline + * and the device must be rebooted after the operation. Used for device + * configuration by some CDMA operators. + * + * @param resetType reset type: 1: reload NV reset, 2: erase NV reset, 3: factory NV 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; + } + + /** + * Get the preferred network type. + * Used for device configuration by some CDMA operators. + * + * @return the preferred network type, defined in RILConstants.java. + * @hide + */ + public int getPreferredNetworkType() { + try { + return getITelephony().getPreferredNetworkType(); + } catch (RemoteException ex) { + Rlog.e(TAG, "getPreferredNetworkType RemoteException", ex); + } catch (NullPointerException ex) { + Rlog.e(TAG, "getPreferredNetworkType NPE", ex); + } + return -1; + } + + /** + * Set the preferred network type. + * Used for device configuration by some CDMA operators. + * + * @param networkType the preferred network type, defined in RILConstants.java. + * @return true on success; false on any failure. + * @hide + */ + public boolean setPreferredNetworkType(int networkType) { + try { + return getITelephony().setPreferredNetworkType(networkType); + } catch (RemoteException ex) { + Rlog.e(TAG, "setPreferredNetworkType RemoteException", ex); + } catch (NullPointerException ex) { + Rlog.e(TAG, "setPreferredNetworkType NPE", ex); + } + return false; + } + + /** + * Expose the rest of ITelephony to @PrivateApi + */ + /** @hide */ @PrivateApi public void dial(String number) { diff --git a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java b/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java index c63be91..74f73b5 100644 --- a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java +++ b/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java @@ -24,7 +24,6 @@ import android.net.Uri; import android.os.Handler; import android.os.Looper; import android.os.Message; -import android.os.SystemProperties; import android.provider.ContactsContract.CommonDataKinds.SipAddress; import android.provider.ContactsContract.Data; import android.provider.ContactsContract.PhoneLookup; diff --git a/telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl b/telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl index f228d4e..3f36645 100644 --- a/telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl +++ b/telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl @@ -20,6 +20,7 @@ import android.os.Bundle; import android.telephony.ServiceState; import android.telephony.SignalStrength; import android.telephony.CellInfo; +import android.telephony.DataConnectionRealTimeInfo; import android.telephony.PreciseCallState; import android.telephony.PreciseDataConnectionState; @@ -39,5 +40,6 @@ oneway interface IPhoneStateListener { void onCellInfoChanged(in List<CellInfo> cellInfo); void onPreciseCallStateChanged(in PreciseCallState callState); void onPreciseDataConnectionStateChanged(in PreciseDataConnectionState dataConnectionState); + void onDataConnectionRealTimeInfoChanged(in DataConnectionRealTimeInfo dcRtInfo); } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 9c73059..fa74494 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -329,6 +329,102 @@ interface ITelephony { void setCellInfoListRate(int rateInMillis); /** + * Opens a logical channel to the ICC card. + * + * Input parameters equivalent to TS 27.007 AT+CCHO command. + * + * @param AID Application id. See ETSI 102.221 and 101.220. + * @return The logical channel id which is set to -1 on error. + */ + int iccOpenLogicalChannel(String AID); + + /** + * Closes a previously opened logical channel to the ICC card. + * + * Input parameters equivalent to TS 27.007 AT+CCHC command. + * + * @param channel is the channel id to be closed as retruned by a + * successful iccOpenLogicalChannel. + * @return true if the channel was closed successfully. + */ + boolean iccCloseLogicalChannel(int channel); + + /** + * Transmit an APDU to the ICC card over a logical channel. + * + * Input parameters equivalent to TS 27.007 AT+CGLA command. + * + * @param channel is the channel id to be closed as retruned by a + * successful iccOpenLogicalChannel. + * @param cla Class of the APDU command. + * @param instruction Instruction of the APDU command. + * @param p1 P1 value of the APDU command. + * @param p2 P2 value of the APDU command. + * @param p3 P3 value of the APDU command. If p3 is negative a 4 byte APDU + * is sent to the SIM. + * @param data Data to be sent with the APDU. + * @return The APDU response from the ICC card with the status appended at + * the end. If an error occurs, an empty string is returned. + */ + 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. The radio will be taken offline + * and the device must be rebooted after the operation. 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); + + /** + * Get the preferred network type. + * Used for device configuration by some CDMA operators. + * + * @return the preferred network type, defined in RILConstants.java. + */ + int getPreferredNetworkType(); + + /** + * Set the preferred network type. + * Used for device configuration by some CDMA operators. + * + * @param networkType the preferred network type, defined in RILConstants.java. + * @return true on success; false on any failure. + */ + boolean setPreferredNetworkType(int networkType); + + /** * Put a call on hold. */ void toggleHold(); @@ -371,4 +467,3 @@ interface ITelephony { */ void removeListener(ITelephonyListener listener); } - diff --git a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl index 546ce17..8ea9b0d 100644 --- a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl @@ -20,9 +20,10 @@ import android.content.Intent; import android.net.LinkProperties; import android.net.LinkCapabilities; import android.os.Bundle; +import android.telephony.CellInfo; +import android.telephony.DataConnectionRealTimeInfo; import android.telephony.ServiceState; import android.telephony.SignalStrength; -import android.telephony.CellInfo; import com.android.internal.telephony.IPhoneStateListener; interface ITelephonyRegistry { @@ -46,4 +47,5 @@ interface ITelephonyRegistry { void notifyDisconnectCause(int disconnectCause, int preciseDisconnectCause); void notifyPreciseDataConnectionFailed(String reason, String apnType, String apn, String failCause); + void notifyDataConnectionRealTimeInfo(in DataConnectionRealTimeInfo dcRtInfo); } diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java index 1fed417..8c42d25 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..d338857 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,11 @@ public interface RILConstants { int DEACTIVATE_REASON_RADIO_OFF = 1; int DEACTIVATE_REASON_PDP_RESET = 2; + /* NV config radio reset types. */ + int NV_CONFIG_RELOAD_RESET = 1; + int NV_CONFIG_ERASE_RESET = 2; + int NV_CONFIG_FACTORY_RESET = 3; + /* cat include/telephony/ril.h | \ egrep '^#define' | \ @@ -271,6 +276,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"; |