diff options
Diffstat (limited to 'telephony')
6 files changed, 73 insertions, 34 deletions
diff --git a/telephony/java/com/android/internal/telephony/CommandsInterface.java b/telephony/java/com/android/internal/telephony/CommandsInterface.java index 5e4c136..259acdb 100644 --- a/telephony/java/com/android/internal/telephony/CommandsInterface.java +++ b/telephony/java/com/android/internal/telephony/CommandsInterface.java @@ -1289,18 +1289,25 @@ public interface CommandsInterface { void setCdmaSubscription(int cdmaSubscriptionType, Message response); /** - * Set the TTY mode for the CDMA phone + * Set the TTY mode * - * @param enable is true to enable, false to disable + * @param ttyMode one of the following: + * - {@link com.android.internal.telephony.Phone#TTY_MODE_OFF} + * - {@link com.android.internal.telephony.Phone#TTY_MODE_FULL} + * - {@link com.android.internal.telephony.Phone#TTY_MODE_HCO} + * - {@link com.android.internal.telephony.Phone#TTY_MODE_VCO} * @param response is callback message */ void setTTYMode(int ttyMode, Message response); /** - * Query the TTY mode for the CDMA phone + * Query the TTY mode * (AsyncResult)response.obj).result is an int[] with element [0] set to - * 0 for disabled, 1 for enabled. - * + * tty mode: + * - {@link com.android.internal.telephony.Phone#TTY_MODE_OFF} + * - {@link com.android.internal.telephony.Phone#TTY_MODE_FULL} + * - {@link com.android.internal.telephony.Phone#TTY_MODE_HCO} + * - {@link com.android.internal.telephony.Phone#TTY_MODE_VCO} * @param response is callback message */ void queryTTYMode(Message response); diff --git a/telephony/java/com/android/internal/telephony/Phone.java b/telephony/java/com/android/internal/telephony/Phone.java index d0b5540..ef9e783 100644 --- a/telephony/java/com/android/internal/telephony/Phone.java +++ b/telephony/java/com/android/internal/telephony/Phone.java @@ -1430,9 +1430,11 @@ public interface Phone { /** * setTTYMode * sets a TTY mode option. - * - * @param ttyMode is a boolean representing the state that you are - * requesting, true for enabled, false for disabled. + * @param ttyMode is a one of the following: + * - {@link com.android.internal.telephony.Phone#TTY_MODE_OFF} + * - {@link com.android.internal.telephony.Phone#TTY_MODE_FULL} + * - {@link com.android.internal.telephony.Phone#TTY_MODE_HCO} + * - {@link com.android.internal.telephony.Phone#TTY_MODE_VCO} * @param onComplete a callback message when the action is completed */ void setTTYMode(int ttyMode, Message onComplete); diff --git a/telephony/java/com/android/internal/telephony/PhoneBase.java b/telephony/java/com/android/internal/telephony/PhoneBase.java index 5887130..cbff130 100644 --- a/telephony/java/com/android/internal/telephony/PhoneBase.java +++ b/telephony/java/com/android/internal/telephony/PhoneBase.java @@ -702,13 +702,11 @@ public abstract class PhoneBase extends Handler implements Phone { } public void setTTYMode(int ttyMode, Message onComplete) { - // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone. - logUnexpectedCdmaMethodCall("setTTYMode"); + mCM.setTTYMode(ttyMode, onComplete); } public void queryTTYMode(Message onComplete) { - // This function should be overridden by the class CDMAPhone. Not implemented in GSMPhone. - logUnexpectedCdmaMethodCall("queryTTYMode"); + mCM.queryTTYMode(onComplete); } public void enableEnhancedVoicePrivacy(boolean enable, Message onComplete) { diff --git a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java index a1d5121..bd00a0b 100755 --- a/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java +++ b/telephony/java/com/android/internal/telephony/cdma/CDMAPhone.java @@ -1103,20 +1103,6 @@ public class CDMAPhone extends PhoneBase { } /** - * Set the TTY mode of the CDMAPhone - */ - public void setTTYMode(int ttyMode, Message onComplete) { - this.mCM.setTTYMode(ttyMode, onComplete); - } - - /** - * Queries the TTY mode of the CDMAPhone - */ - public void queryTTYMode(Message onComplete) { - this.mCM.queryTTYMode(onComplete); - } - - /** * Activate or deactivate cell broadcast SMS. * * @param activate 0 = activate, 1 = deactivate diff --git a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java index 438996f..3b133da 100644..100755 --- a/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java +++ b/telephony/java/com/android/internal/telephony/gsm/SIMRecords.java @@ -144,6 +144,25 @@ public final class SIMRecords extends IccRecords { private static final int EVENT_GET_CFIS_DONE = 32; private static final int EVENT_GET_CSP_CPHS_DONE = 33; + // Lookup table for carriers known to produce SIMs which incorrectly indicate MNC length. + + private static final String[] MCCMNC_CODES_HAVING_3DIGITS_MNC = { + "405025", "405026", "405027", "405028", "405029", "405030", "405031", "405032", + "405033", "405034", "405035", "405036", "405037", "405038", "405039", "405040", + "405041", "405042", "405043", "405044", "405045", "405046", "405047", "405750", + "405751", "405752", "405753", "405754", "405755", "405756", "405799", "405800", + "405801", "405802", "405803", "405804", "405805", "405806", "405807", "405808", + "405809", "405810", "405811", "405812", "405813", "405814", "405815", "405816", + "405817", "405818", "405819", "405820", "405821", "405822", "405823", "405824", + "405825", "405826", "405827", "405828", "405829", "405830", "405831", "405832", + "405833", "405834", "405835", "405836", "405837", "405838", "405839", "405840", + "405841", "405842", "405843", "405844", "405845", "405846", "405847", "405848", + "405849", "405850", "405851", "405852", "405853", "405875", "405876", "405877", + "405878", "405879", "405880", "405881", "405882", "405883", "405884", "405885", + "405886", "405908", "405909", "405910", "405911", "405925", "405926", "405927", + "405928", "405929", "405932" + }; + // ***** Constructor SIMRecords(GSMPhone p) { @@ -501,6 +520,17 @@ public final class SIMRecords extends IccRecords { Log.d(LOG_TAG, "IMSI: " + imsi.substring(0, 6) + "xxxxxxx"); + if (((mncLength == UNKNOWN) || (mncLength == 2)) && + ((imsi != null) && (imsi.length() >= 6))) { + String mccmncCode = imsi.substring(0, 6); + for (String mccmnc : MCCMNC_CODES_HAVING_3DIGITS_MNC) { + if (mccmnc.equals(mccmncCode)) { + mncLength = 3; + break; + } + } + } + if (mncLength == UNKNOWN) { // the SIM has told us all it knows, but it didn't know the mnc length. // guess using the mcc @@ -752,6 +782,17 @@ public final class SIMRecords extends IccRecords { mncLength = UNKNOWN; } } finally { + if (((mncLength == UNINITIALIZED) || (mncLength == UNKNOWN) || + (mncLength == 2)) && ((imsi != null) && (imsi.length() >= 6))) { + String mccmncCode = imsi.substring(0, 6); + for (String mccmnc : MCCMNC_CODES_HAVING_3DIGITS_MNC) { + if (mccmnc.equals(mccmncCode)) { + mncLength = 3; + break; + } + } + } + if (mncLength == UNKNOWN || mncLength == UNINITIALIZED) { if (imsi != null) { try { diff --git a/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java b/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java index 37867b2..8b3a3ad 100644 --- a/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java +++ b/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java @@ -1392,23 +1392,28 @@ public final class SimulatedCommands extends BaseCommands } /** - * Set the TTY mode for the CDMA phone + * Set the TTY mode * - * @param enable is true to enable, false to disable - * @param serviceClass is a sum of SERVICE_CLASS_* + * @param ttyMode is one of the following: + * - {@link com.android.internal.telephony.Phone#TTY_MODE_OFF} + * - {@link com.android.internal.telephony.Phone#TTY_MODE_FULL} + * - {@link com.android.internal.telephony.Phone#TTY_MODE_HCO} + * - {@link com.android.internal.telephony.Phone#TTY_MODE_VCO} * @param response is callback message */ public void setTTYMode(int ttyMode, Message response) { - Log.w(LOG_TAG, "CDMA not implemented in SimulatedCommands"); + Log.w(LOG_TAG, "Not implemented in SimulatedCommands"); unimplemented(response); } /** - * Query the TTY mode for the CDMA phone + * Query the TTY mode * (AsyncResult)response.obj).result is an int[] with element [0] set to - * 0 for disabled, 1 for enabled. - * - * @param serviceClass is a sum of SERVICE_CLASS_* + * tty mode: + * - {@link com.android.internal.telephony.Phone#TTY_MODE_OFF} + * - {@link com.android.internal.telephony.Phone#TTY_MODE_FULL} + * - {@link com.android.internal.telephony.Phone#TTY_MODE_HCO} + * - {@link com.android.internal.telephony.Phone#TTY_MODE_VCO} * @param response is callback message */ public void queryTTYMode(Message response) { |