diff options
Diffstat (limited to 'telephony/java/android')
8 files changed, 85 insertions, 35 deletions
diff --git a/telephony/java/android/telephony/NeighboringCellInfo.java b/telephony/java/android/telephony/NeighboringCellInfo.java index ad7dfc9e2858..2f7666d118bc 100644 --- a/telephony/java/android/telephony/NeighboringCellInfo.java +++ b/telephony/java/android/telephony/NeighboringCellInfo.java @@ -133,8 +133,11 @@ public class NeighboringCellInfo implements Parcelable case NETWORK_TYPE_GPRS: case NETWORK_TYPE_EDGE: mNetworkType = radioType; - mLac = Integer.valueOf(location.substring(0, 4), 16); - mCid = Integer.valueOf(location.substring(4), 16); + // check if 0xFFFFFFFF for UNKNOWN_CID + if (!location.equalsIgnoreCase("FFFFFFFF")) { + mCid = Integer.valueOf(location.substring(4), 16); + mLac = Integer.valueOf(location.substring(0, 4), 16); + } break; case NETWORK_TYPE_UMTS: case NETWORK_TYPE_HSDPA: @@ -293,4 +296,4 @@ public class NeighboringCellInfo implements Parcelable return new NeighboringCellInfo[size]; } }; -}
\ No newline at end of file +} diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java index 55d25a5950a8..b4a3c953bc50 100644 --- a/telephony/java/android/telephony/PhoneNumberUtils.java +++ b/telephony/java/android/telephony/PhoneNumberUtils.java @@ -130,7 +130,7 @@ public class PhoneNumberUtils Uri uri = intent.getData(); String scheme = uri.getScheme(); - if (scheme.equals("tel")) { + if (scheme.equals("tel") || scheme.equals("sip")) { return uri.getSchemeSpecificPart(); } @@ -732,7 +732,8 @@ public class PhoneNumberUtils return ""; } - if ((bytes[offset] & 0xff) == TOA_International) { + //Only TON field should be taken in consideration + if ((bytes[offset] & 0xf0) == (TOA_International & 0xf0)) { prependPlus = true; } @@ -1648,6 +1649,15 @@ public class PhoneNumberUtils } /** + * @hide + * @param number + * @return true if number contains @ + */ + public static boolean isUriNumber(String number) { + return number != null && number.contains("@"); + } + + /** * This function handles the plus code conversion within NANP CDMA network * If the number format is * 1)+1NANP,remove +, diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index 6c665595cc26..35a2c196e0cf 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -57,7 +57,7 @@ public class ServiceState implements Parcelable { public static final int STATE_EMERGENCY_ONLY = 2; /** - * Radio of telephony is explictly powered off. + * Radio of telephony is explicitly powered off. */ public static final int STATE_POWER_OFF = 3; @@ -89,6 +89,8 @@ public class ServiceState implements Parcelable { public static final int RADIO_TECHNOLOGY_HSUPA = 10; /** @hide */ public static final int RADIO_TECHNOLOGY_HSPA = 11; + /** @hide */ + public static final int RADIO_TECHNOLOGY_EVDO_B = 12; /** * Available registration states for GSM, UMTS and CDMA. @@ -218,7 +220,8 @@ public class ServiceState implements Parcelable { return 0; } - public static final Parcelable.Creator<ServiceState> CREATOR = new Parcelable.Creator() { + public static final Parcelable.Creator<ServiceState> CREATOR = + new Parcelable.Creator<ServiceState>() { public ServiceState createFromParcel(Parcel in) { return new ServiceState(in); } @@ -229,7 +232,7 @@ public class ServiceState implements Parcelable { }; /** - * Get current servcie state of phone + * Get current service state of phone * * @see #STATE_IN_SERVICE * @see #STATE_OUT_OF_SERVICE @@ -288,10 +291,10 @@ public class ServiceState implements Parcelable { } /** - * Get current registered operator name in long alphanumeric format + * Get current registered operator name in long alphanumeric format. * - * In GSM/UMTS, long format can be upto 16 characters long - * In CDMA, returns the ERI text, if set, otherwise the ONS + * In GSM/UMTS, long format can be up to 16 characters long. + * In CDMA, returns the ERI text, if set. Otherwise, returns the ONS. * * @return long name of operator, null if unregistered or unknown */ @@ -300,9 +303,9 @@ public class ServiceState implements Parcelable { } /** - * Get current registered operator name in short lphanumeric format + * Get current registered operator name in short alphanumeric format. * - * In GSM/UMST, short format can be upto 8 characters long + * In GSM/UMTS, short format can be up to 8 characters long. * * @return short name of operator, null if unregistered or unknown */ @@ -311,21 +314,23 @@ public class ServiceState implements Parcelable { } /** - * Get current registered operator numeric id + * Get current registered operator numeric id. * * In GSM/UMTS, numeric format is 3 digit country code plus 2 or 3 digit - * network code - * - * The country code can be decoded using MccTable.countryCodeForMcc() + * network code. * * @return numeric format of operator, null if unregistered or unknown */ + /* + * The country code can be decoded using + * {@link com.android.internal.telephony.MccTable#countryCodeForMcc(int)}. + */ public String getOperatorNumeric() { return mOperatorNumeric; } /** - * Get current network selection mode + * Get current network selection mode. * * @return true if manual mode, false if automatic mode */ @@ -379,7 +384,6 @@ public class ServiceState implements Parcelable { @Override public String toString() { String radioTechnology = new String("Error in radioTechnology"); - switch(this.mRadioTechnology) { case 0: radioTechnology = "Unknown"; @@ -417,6 +421,9 @@ public class ServiceState implements Parcelable { case 11: radioTechnology = "HSPA"; break; + case 12: + radioTechnology = "EvDo rev. B"; + break; default: Log.w(LOG_TAG, "mRadioTechnology variable out of range."); break; @@ -454,7 +461,7 @@ public class ServiceState implements Parcelable { mIsEmergencyOnly = false; } - // TODO - can't this be combined with the above func.. + // TODO - can't this be combined with the above method? public void setStateOff() { mState = STATE_POWER_OFF; mRoaming = false; @@ -524,8 +531,8 @@ public class ServiceState implements Parcelable { } /** - * In CDMA mOperatorAlphaLong can be set from the ERI - * text, this is done from the CDMAPhone and not from the CdmaServiceStateTracker + * In CDMA, mOperatorAlphaLong can be set from the ERI text. + * This is done from the CDMAPhone and not from the CdmaServiceStateTracker. * * @hide */ @@ -538,7 +545,7 @@ public class ServiceState implements Parcelable { } /** - * Test whether two objects hold the same data values or both are null + * Test whether two objects hold the same data values or both are null. * * @param a first obj * @param b second obj @@ -549,7 +556,7 @@ public class ServiceState implements Parcelable { } /** - * Set ServiceState based on intent notifier map + * Set ServiceState based on intent notifier map. * * @param m intent notifier map * @hide @@ -571,7 +578,7 @@ public class ServiceState implements Parcelable { } /** - * Set intent notifier Bundle based on service state + * Set intent notifier Bundle based on service state. * * @param m intent notifier Bundle * @hide diff --git a/telephony/java/android/telephony/SmsManager.java b/telephony/java/android/telephony/SmsManager.java index 312272272f85..f5e9751b9571 100644 --- a/telephony/java/android/telephony/SmsManager.java +++ b/telephony/java/android/telephony/SmsManager.java @@ -398,4 +398,6 @@ public final class SmsManager { static public final int RESULT_ERROR_NO_SERVICE = 4; /** Failed because we reached the sending queue limit. {@hide} */ static public final int RESULT_ERROR_LIMIT_EXCEEDED = 5; + /** Failed because FDN is enabled. {@hide} */ + static public final int RESULT_ERROR_FDN_CHECK_FAILURE = 6; } diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 278e8cab3290..27e08d490f45 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -391,6 +391,9 @@ public class TelephonyManager { public static final int NETWORK_TYPE_HSPA = 10; /** Current network is iDen */ public static final int NETWORK_TYPE_IDEN = 11; + /** Current network is EVDO revision B*/ + public static final int NETWORK_TYPE_EVDO_B = 12; + /** * Returns a constant indicating the radio technology (network type) @@ -407,6 +410,7 @@ public class TelephonyManager { * @see #NETWORK_TYPE_CDMA * @see #NETWORK_TYPE_EVDO_0 * @see #NETWORK_TYPE_EVDO_A + * @see #NETWORK_TYPE_EVDO_B * @see #NETWORK_TYPE_1xRTT */ public int getNetworkType() { @@ -454,6 +458,8 @@ public class TelephonyManager { return "CDMA - EvDo rev. 0"; case NETWORK_TYPE_EVDO_A: return "CDMA - EvDo rev. A"; + case NETWORK_TYPE_EVDO_B: + return "CDMA - EvDo rev. B"; case NETWORK_TYPE_1xRTT: return "CDMA - 1xRTT"; default: diff --git a/telephony/java/android/telephony/gsm/GsmCellLocation.java b/telephony/java/android/telephony/gsm/GsmCellLocation.java index fa1f9852bd9f..c4204fae682f 100644 --- a/telephony/java/android/telephony/gsm/GsmCellLocation.java +++ b/telephony/java/android/telephony/gsm/GsmCellLocation.java @@ -25,6 +25,7 @@ import android.telephony.CellLocation; public class GsmCellLocation extends CellLocation { private int mLac; private int mCid; + private int mPsc; /** * Empty constructor. Initializes the LAC and CID to -1. @@ -32,6 +33,7 @@ public class GsmCellLocation extends CellLocation { public GsmCellLocation() { mLac = -1; mCid = -1; + mPsc = -1; } /** @@ -40,6 +42,7 @@ public class GsmCellLocation extends CellLocation { public GsmCellLocation(Bundle bundle) { mLac = bundle.getInt("lac", mLac); mCid = bundle.getInt("cid", mCid); + mPsc = bundle.getInt("psc", mPsc); } /** @@ -57,11 +60,20 @@ public class GsmCellLocation extends CellLocation { } /** + * @return primary scrambling code for UMTS, -1 if unknown or GSM + * @hide + */ + public int getPsc() { + return mPsc; + } + + /** * Invalidate this object. The location area code and the cell id are set to -1. */ public void setStateInvalid() { mLac = -1; mCid = -1; + mPsc = -1; } /** @@ -72,6 +84,14 @@ public class GsmCellLocation extends CellLocation { mCid = cid; } + /** + * Set the primary scrambling code. + * @hide + */ + public void setPsc(int psc) { + mPsc = psc; + } + @Override public int hashCode() { return mLac ^ mCid; @@ -91,12 +111,13 @@ public class GsmCellLocation extends CellLocation { return false; } - return equalsHandlesNulls(mLac, s.mLac) && equalsHandlesNulls(mCid, s.mCid); + return equalsHandlesNulls(mLac, s.mLac) && equalsHandlesNulls(mCid, s.mCid) + && equalsHandlesNulls(mPsc, s.mPsc); } @Override public String toString() { - return "["+ mLac + "," + mCid + "]"; + return "["+ mLac + "," + mCid + "," + mPsc + "]"; } /** @@ -118,12 +139,13 @@ public class GsmCellLocation extends CellLocation { public void fillInNotifierBundle(Bundle m) { m.putInt("lac", mLac); m.putInt("cid", mCid); + m.putInt("psc", mPsc); } /** * @hide */ public boolean isEmpty() { - return (mLac == -1 && mCid == -1); + return (mLac == -1 && mCid == -1 && mPsc == -1); } } diff --git a/telephony/java/android/telephony/gsm/SmsManager.java b/telephony/java/android/telephony/gsm/SmsManager.java index 241c4852c4eb..3b75298b593d 100644 --- a/telephony/java/android/telephony/gsm/SmsManager.java +++ b/telephony/java/android/telephony/gsm/SmsManager.java @@ -56,7 +56,7 @@ import java.util.ArrayList; * the current default SMSC * @param text the body of the message to send * @param sentIntent if not NULL this <code>PendingIntent</code> is - * broadcast when the message is sucessfully sent, or failed. + * broadcast when the message is successfully sent, or failed. * The result code will be <code>Activity.RESULT_OK<code> for success, * or one of these errors: * <code>RESULT_ERROR_GENERIC_FAILURE</code> diff --git a/telephony/java/android/telephony/gsm/SmsMessage.java b/telephony/java/android/telephony/gsm/SmsMessage.java index 37ef91248d44..0c63c37d37da 100644 --- a/telephony/java/android/telephony/gsm/SmsMessage.java +++ b/telephony/java/android/telephony/gsm/SmsMessage.java @@ -304,9 +304,9 @@ public class SmsMessage { int septets = GsmAlphabet.countGsmSeptets(messageBody, !use7bitOnly); ret[1] = septets; if (septets > MAX_USER_DATA_SEPTETS) { - ret[0] = (septets / MAX_USER_DATA_SEPTETS_WITH_HEADER) + 1; - ret[2] = MAX_USER_DATA_SEPTETS_WITH_HEADER - - (septets % MAX_USER_DATA_SEPTETS_WITH_HEADER); + ret[0] = (septets + (MAX_USER_DATA_SEPTETS_WITH_HEADER - 1)) / + MAX_USER_DATA_SEPTETS_WITH_HEADER; + ret[2] = (ret[0] * MAX_USER_DATA_SEPTETS_WITH_HEADER) - septets; } else { ret[0] = 1; ret[2] = MAX_USER_DATA_SEPTETS - septets; @@ -318,9 +318,9 @@ public class SmsMessage { ret[1] = messageBody.length(); if (octets > MAX_USER_DATA_BYTES) { // 6 is the size of the user data header - ret[0] = (octets / MAX_USER_DATA_BYTES_WITH_HEADER) + 1; - ret[2] = (MAX_USER_DATA_BYTES_WITH_HEADER - - (octets % MAX_USER_DATA_BYTES_WITH_HEADER))/2; + ret[0] = (octets + (MAX_USER_DATA_BYTES_WITH_HEADER - 1)) / + MAX_USER_DATA_BYTES_WITH_HEADER; + ret[2] = ((ret[0] * MAX_USER_DATA_BYTES_WITH_HEADER) - octets) / 2; } else { ret[0] = 1; ret[2] = (MAX_USER_DATA_BYTES - octets)/2; |
