diff options
author | Wink Saville <wink@google.com> | 2011-02-18 12:40:47 -0800 |
---|---|---|
committer | Wink Saville <wink@google.com> | 2011-02-18 12:40:47 -0800 |
commit | 5284090631e638b916d9a453212e9dc802656a67 (patch) | |
tree | f59aa838d1a4de9022565788554c7b639a847812 /telephony/java | |
parent | 4b6c6249a39c42c9b96e9cf1ab031de18f921870 (diff) | |
download | frameworks_base-5284090631e638b916d9a453212e9dc802656a67.zip frameworks_base-5284090631e638b916d9a453212e9dc802656a67.tar.gz frameworks_base-5284090631e638b916d9a453212e9dc802656a67.tar.bz2 |
Changes for ril.h version 6.
Change-Id: Iacd9d362c4836546ac277cf3571227d426a721aa
Diffstat (limited to 'telephony/java')
17 files changed, 891 insertions, 148 deletions
diff --git a/telephony/java/android/telephony/SignalStrength.java b/telephony/java/android/telephony/SignalStrength.java index c9e304a..98ab3d1 100644 --- a/telephony/java/android/telephony/SignalStrength.java +++ b/telephony/java/android/telephony/SignalStrength.java @@ -27,7 +27,25 @@ import android.util.Log; */ public class SignalStrength implements Parcelable { - static final String LOG_TAG = "PHONE"; + private static final String LOG_TAG = "SignalStrength"; + private static final boolean DBG = false; + + /** @hide */ + public static final int SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0; + /** @hide */ + public static final int SIGNAL_STRENGTH_POOR = 1; + /** @hide */ + public static final int SIGNAL_STRENGTH_MODERATE = 2; + /** @hide */ + public static final int SIGNAL_STRENGTH_GOOD = 3; + /** @hide */ + public static final int SIGNAL_STRENGTH_GREAT = 4; + /** @hide */ + public static final int NUM_SIGNAL_STRENGTH_BINS = 5; + /** @hide */ + public static final String[] SIGNAL_STRENGTH_NAMES = { + "none", "poor", "moderate", "good", "great" + }; private int mGsmSignalStrength; // Valid values are (0-31, 99) as defined in TS 27.007 8.5 private int mGsmBitErrorRate; // bit error rate (0-7, 99) as defined in TS 27.007 8.5 @@ -36,6 +54,11 @@ public class SignalStrength implements Parcelable { private int mEvdoDbm; // This value is the EVDO RSSI value private int mEvdoEcio; // This value is the EVDO Ec/Io private int mEvdoSnr; // Valid values are 0-8. 8 is the highest signal to noise ratio + private int mLteSignalStrength; + private int mLteRsrp; + private int mLteRsrq; + private int mLteRssnr; + private int mLteCqi; private boolean isGsm; // This value is set by the ServiceStateTracker onSignalStrengthResult @@ -70,6 +93,11 @@ public class SignalStrength implements Parcelable { mEvdoDbm = -1; mEvdoEcio = -1; mEvdoSnr = -1; + mLteSignalStrength = -1; + mLteRsrp = -1; + mLteRsrq = -1; + mLteRssnr = -1; + mLteCqi = -1; isGsm = true; } @@ -80,7 +108,9 @@ public class SignalStrength implements Parcelable { */ public SignalStrength(int gsmSignalStrength, int gsmBitErrorRate, int cdmaDbm, int cdmaEcio, - int evdoDbm, int evdoEcio, int evdoSnr, boolean gsm) { + int evdoDbm, int evdoEcio, int evdoSnr, + int lteSignalStrength, int lteRsrp, int lteRsrq, int lteRssnr, int lteCqi, + boolean gsm) { mGsmSignalStrength = gsmSignalStrength; mGsmBitErrorRate = gsmBitErrorRate; mCdmaDbm = cdmaDbm; @@ -88,10 +118,28 @@ public class SignalStrength implements Parcelable { mEvdoDbm = evdoDbm; mEvdoEcio = evdoEcio; mEvdoSnr = evdoSnr; + mLteSignalStrength = lteSignalStrength; + mLteRsrp = lteRsrp; + mLteRsrq = lteRsrq; + mLteRssnr = lteRssnr; + mLteCqi = lteCqi; isGsm = gsm; } /** + * Constructor + * + * @hide + */ + public SignalStrength(int gsmSignalStrength, int gsmBitErrorRate, + int cdmaDbm, int cdmaEcio, + int evdoDbm, int evdoEcio, int evdoSnr, + boolean gsm) { + this(gsmSignalStrength, gsmBitErrorRate, cdmaDbm, cdmaEcio, + evdoDbm, evdoEcio, evdoSnr, -1, -1, -1, -1, -1, gsm); + } + + /** * Copy constructors * * @param s Source SignalStrength @@ -113,6 +161,11 @@ public class SignalStrength implements Parcelable { mEvdoDbm = s.mEvdoDbm; mEvdoEcio = s.mEvdoEcio; mEvdoSnr = s.mEvdoSnr; + mLteSignalStrength = s.mLteSignalStrength; + mLteRsrp = s.mLteRsrp; + mLteRsrq = s.mLteRsrq; + mLteRssnr = s.mLteRssnr; + mLteCqi = s.mLteCqi; isGsm = s.isGsm; } @@ -129,6 +182,11 @@ public class SignalStrength implements Parcelable { mEvdoDbm = in.readInt(); mEvdoEcio = in.readInt(); mEvdoSnr = in.readInt(); + mLteSignalStrength = in.readInt(); + mLteRsrp = in.readInt(); + mLteRsrq = in.readInt(); + mLteRssnr = in.readInt(); + mLteCqi = in.readInt(); isGsm = (in.readInt() != 0); } @@ -143,6 +201,11 @@ public class SignalStrength implements Parcelable { out.writeInt(mEvdoDbm); out.writeInt(mEvdoEcio); out.writeInt(mEvdoSnr); + out.writeInt(mLteSignalStrength); + out.writeInt(mLteRsrp); + out.writeInt(mLteRsrq); + out.writeInt(mLteRssnr); + out.writeInt(mLteCqi); out.writeInt(isGsm ? 1 : 0); } @@ -218,6 +281,312 @@ public class SignalStrength implements Parcelable { } /** + * Get signal level as an int from 0..4 + * + * @hide + */ + public int getLevel() { + int level; + + if (isGsm) { + if ((mLteSignalStrength == -1) + && (mLteRsrp == -1) + && (mLteRsrq == -1) + && (mLteRssnr == -1) + && (mLteCqi == -1)) { + level = getGsmLevel(); + } else { + level = getLteLevel(); + } + } else { + int cdmaLevel = getCdmaLevel(); + int evdoLevel = getEvdoLevel(); + if (evdoLevel == SIGNAL_STRENGTH_NONE_OR_UNKNOWN) { + /* We don't know evdo, use cdma */ + level = getCdmaLevel(); + } else if (cdmaLevel == SIGNAL_STRENGTH_NONE_OR_UNKNOWN) { + /* We don't know cdma, use evdo */ + level = getEvdoLevel(); + } else { + /* We know both, use the lowest level */ + level = cdmaLevel < evdoLevel ? cdmaLevel : evdoLevel; + } + } + if (DBG) log("getLevel=" + level); + return level; + } + + /** + * Get the signal level as an asu value between 0..31, 99 is unknown + * + * @hide + */ + public int getAsuLevel() { + int asuLevel; + if (isGsm) { + if ((mLteSignalStrength == -1) + && (mLteRsrp == -1) + && (mLteRsrq == -1) + && (mLteRssnr == -1) + && (mLteCqi == -1)) { + asuLevel = getGsmAsuLevel(); + } else { + asuLevel = getLteAsuLevel(); + } + } else { + int cdmaAsuLevel = getCdmaAsuLevel(); + int evdoAsuLevel = getEvdoAsuLevel(); + if (evdoAsuLevel == 0) { + /* We don't know evdo use, cdma */ + asuLevel = cdmaAsuLevel; + } else if (cdmaAsuLevel == 0) { + /* We don't know cdma use, evdo */ + asuLevel = evdoAsuLevel; + } else { + /* We know both, use the lowest level */ + asuLevel = cdmaAsuLevel < evdoAsuLevel ? cdmaAsuLevel : evdoAsuLevel; + } + } + if (DBG) log("getAsuLevel=" + asuLevel); + return asuLevel; + } + + /** + * Get the signal strength as dBm + * + * @hide + */ + public int getDbm() { + int dBm; + + if(isGsm()) { + if ((mLteSignalStrength == -1) + && (mLteRsrp == -1) + && (mLteRsrq == -1) + && (mLteRssnr == -1) + && (mLteCqi == -1)) { + dBm = getGsmDbm(); + } else { + dBm = getLteDbm(); + } + } else { + dBm = getCdmaDbm(); + } + if (DBG) log("getDbm=" + dBm); + return dBm; + } + + /** + * Get Gsm signal strength as dBm + * + * @hide + */ + public int getGsmDbm() { + int dBm; + + int gsmSignalStrength = getGsmSignalStrength(); + int asu = (gsmSignalStrength == 99 ? -1 : gsmSignalStrength); + if (asu != -1) { + dBm = -113 + (2 * asu); + } else { + dBm = -1; + } + if (DBG) log("getGsmDbm=" + dBm); + return dBm; + } + + /** + * Get gsm as level 0..4 + * + * @hide + */ + public int getGsmLevel() { + int level; + + // ASU ranges from 0 to 31 - TS 27.007 Sec 8.5 + // asu = 0 (-113dB or less) is very weak + // signal, its better to show 0 bars to the user in such cases. + // asu = 99 is a special case, where the signal strength is unknown. + int asu = getGsmSignalStrength(); + if (asu <= 2 || asu == 99) level = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; + else if (asu >= 12) level = SIGNAL_STRENGTH_GREAT; + else if (asu >= 8) level = SIGNAL_STRENGTH_GOOD; + else if (asu >= 5) level = SIGNAL_STRENGTH_MODERATE; + else level = SIGNAL_STRENGTH_POOR; + if (DBG) log("getGsmLevel=" + level); + return level; + } + + /** + * Get the gsm signal level as an asu value between 0..31, 99 is unknown + * + * @hide + */ + public int getGsmAsuLevel() { + // ASU ranges from 0 to 31 - TS 27.007 Sec 8.5 + // asu = 0 (-113dB or less) is very weak + // signal, its better to show 0 bars to the user in such cases. + // asu = 99 is a special case, where the signal strength is unknown. + int level = getGsmSignalStrength(); + if (DBG) log("getGsmAsuLevel=" + level); + return level; + } + + /** + * Get cdma as level 0..4 + * + * @hide + */ + public int getCdmaLevel() { + final int cdmaDbm = getCdmaDbm(); + final int cdmaEcio = getCdmaEcio(); + int levelDbm; + int levelEcio; + + if (cdmaDbm >= -75) levelDbm = SIGNAL_STRENGTH_GREAT; + else if (cdmaDbm >= -85) levelDbm = SIGNAL_STRENGTH_GOOD; + else if (cdmaDbm >= -95) levelDbm = SIGNAL_STRENGTH_MODERATE; + else if (cdmaDbm >= -100) levelDbm = SIGNAL_STRENGTH_POOR; + else levelDbm = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; + + // Ec/Io are in dB*10 + if (cdmaEcio >= -90) levelEcio = SIGNAL_STRENGTH_GREAT; + else if (cdmaEcio >= -110) levelEcio = SIGNAL_STRENGTH_GOOD; + else if (cdmaEcio >= -130) levelEcio = SIGNAL_STRENGTH_MODERATE; + else if (cdmaEcio >= -150) levelEcio = SIGNAL_STRENGTH_POOR; + else levelEcio = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; + + int level = (levelDbm < levelEcio) ? levelDbm : levelEcio; + if (DBG) log("getCdmaLevel=" + level); + return level; + } + + /** + * Get the cdma signal level as an asu value between 0..31, 99 is unknown + * + * @hide + */ + public int getCdmaAsuLevel() { + final int cdmaDbm = getCdmaDbm(); + final int cdmaEcio = getCdmaEcio(); + int cdmaAsuLevel; + int ecioAsuLevel; + + if (cdmaDbm >= -75) cdmaAsuLevel = 16; + else if (cdmaDbm >= -82) cdmaAsuLevel = 8; + else if (cdmaDbm >= -90) cdmaAsuLevel = 4; + else if (cdmaDbm >= -95) cdmaAsuLevel = 2; + else if (cdmaDbm >= -100) cdmaAsuLevel = 1; + else cdmaAsuLevel = 99; + + // Ec/Io are in dB*10 + if (cdmaEcio >= -90) ecioAsuLevel = 16; + else if (cdmaEcio >= -100) ecioAsuLevel = 8; + else if (cdmaEcio >= -115) ecioAsuLevel = 4; + else if (cdmaEcio >= -130) ecioAsuLevel = 2; + else if (cdmaEcio >= -150) ecioAsuLevel = 1; + else ecioAsuLevel = 99; + + int level = (cdmaAsuLevel < ecioAsuLevel) ? cdmaAsuLevel : ecioAsuLevel; + if (DBG) log("getCdmaAsuLevel=" + level); + return level; + } + + /** + * Get Evdo as level 0..4 + * + * @hide + */ + public int getEvdoLevel() { + int evdoDbm = getEvdoDbm(); + int evdoSnr = getEvdoSnr(); + int levelEvdoDbm; + int levelEvdoSnr; + + if (evdoDbm >= -65) levelEvdoDbm = SIGNAL_STRENGTH_GREAT; + else if (evdoDbm >= -75) levelEvdoDbm = SIGNAL_STRENGTH_GOOD; + else if (evdoDbm >= -90) levelEvdoDbm = SIGNAL_STRENGTH_MODERATE; + else if (evdoDbm >= -105) levelEvdoDbm = SIGNAL_STRENGTH_POOR; + else levelEvdoDbm = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; + + if (evdoSnr >= 7) levelEvdoSnr = SIGNAL_STRENGTH_GREAT; + else if (evdoSnr >= 5) levelEvdoSnr = SIGNAL_STRENGTH_GOOD; + else if (evdoSnr >= 3) levelEvdoSnr = SIGNAL_STRENGTH_MODERATE; + else if (evdoSnr >= 1) levelEvdoSnr = SIGNAL_STRENGTH_POOR; + else levelEvdoSnr = SIGNAL_STRENGTH_NONE_OR_UNKNOWN; + + int level = (levelEvdoDbm < levelEvdoSnr) ? levelEvdoDbm : levelEvdoSnr; + if (DBG) log("getEvdoLevel=" + level); + return level; + } + + /** + * Get the evdo signal level as an asu value between 0..31, 99 is unknown + * + * @hide + */ + public int getEvdoAsuLevel() { + int evdoDbm = getEvdoDbm(); + int evdoSnr = getEvdoSnr(); + int levelEvdoDbm; + int levelEvdoSnr; + + if (evdoDbm >= -65) levelEvdoDbm = 16; + else if (evdoDbm >= -75) levelEvdoDbm = 8; + else if (evdoDbm >= -85) levelEvdoDbm = 4; + else if (evdoDbm >= -95) levelEvdoDbm = 2; + else if (evdoDbm >= -105) levelEvdoDbm = 1; + else levelEvdoDbm = 99; + + if (evdoSnr >= 7) levelEvdoSnr = 16; + else if (evdoSnr >= 6) levelEvdoSnr = 8; + else if (evdoSnr >= 5) levelEvdoSnr = 4; + else if (evdoSnr >= 3) levelEvdoSnr = 2; + else if (evdoSnr >= 1) levelEvdoSnr = 1; + else levelEvdoSnr = 99; + + int level = (levelEvdoDbm < levelEvdoSnr) ? levelEvdoDbm : levelEvdoSnr; + if (DBG) log("getEvdoAsuLevel=" + level); + return level; + } + + /** + * Get LTE as dBm + * + * @hide + */ + public int getLteDbm() { + log("STOPSHIP teach getLteDbm to compute dBm properly"); + int level = -1; + if (DBG) log("getLteDbm=" + level); + return level; + } + + /** + * Get LTE as level 0..4 + * + * @hide + */ + public int getLteLevel() { + log("STOPSHIP teach getLteLevel to compute Level properly"); + int level = SIGNAL_STRENGTH_MODERATE; + if (DBG) log("getLteLevel=" + level); + return level; + } + + /** + * Get the LTE signal level as an asu value between 0..31, 99 is unknown + * + * @hide + */ + public int getLteAsuLevel() { + log("STOPSHIP teach getLteAsuLevel to compute asu Level properly"); + int level = 4; + if (DBG) log("getLteAsuLevel=" + level); + return level; + } + + /** * @return true if this is for GSM */ public boolean isGsm() { @@ -229,10 +598,13 @@ public class SignalStrength implements Parcelable { */ @Override public int hashCode() { - return ((mGsmSignalStrength * 0x1234) - + mGsmBitErrorRate - + mCdmaDbm + mCdmaEcio - + mEvdoDbm + mEvdoEcio + mEvdoSnr + int primeNum = 31; + return ((mGsmSignalStrength * primeNum) + + (mGsmBitErrorRate * primeNum) + + (mCdmaDbm * primeNum) + (mCdmaEcio * primeNum) + + (mEvdoDbm * primeNum) + (mEvdoEcio * primeNum) + (mEvdoSnr * primeNum) + + (mLteSignalStrength * primeNum) + (mLteRsrp * primeNum) + + (mLteRsrq * primeNum) + (mLteRssnr * primeNum) + (mLteCqi * primeNum) + (isGsm ? 1 : 0)); } @@ -260,6 +632,11 @@ public class SignalStrength implements Parcelable { && mEvdoDbm == s.mEvdoDbm && mEvdoEcio == s.mEvdoEcio && mEvdoSnr == s.mEvdoSnr + && mLteSignalStrength == s.mLteSignalStrength + && mLteRsrp == s.mLteRsrp + && mLteRsrq == s.mLteRsrq + && mLteRssnr == s.mLteRssnr + && mLteCqi == s.mLteCqi && isGsm == s.isGsm); } @@ -276,19 +653,12 @@ public class SignalStrength implements Parcelable { + " " + mEvdoDbm + " " + mEvdoEcio + " " + mEvdoSnr - + " " + (isGsm ? "gsm" : "cdma")); - } - - /** - * Test whether two objects hold the same data values or both are null - * - * @param a first obj - * @param b second obj - * @return true if two objects equal or both are null - * @hide - */ - private static boolean equalsHandlesNulls (Object a, Object b) { - return (a == null) ? (b == null) : a.equals (b); + + " " + mLteSignalStrength + + " " + mLteRsrp + + " " + mLteRsrq + + " " + mLteRssnr + + " " + mLteCqi + + " " + (isGsm ? "gsm|lte" : "cdma")); } /** @@ -305,6 +675,11 @@ public class SignalStrength implements Parcelable { mEvdoDbm = m.getInt("EvdoDbm"); mEvdoEcio = m.getInt("EvdoEcio"); mEvdoSnr = m.getInt("EvdoSnr"); + mLteSignalStrength = m.getInt("LteSignalStrength"); + mLteRsrp = m.getInt("LteRsrp"); + mLteRsrq = m.getInt("LteRsrq"); + mLteRssnr = m.getInt("LteRssnr"); + mLteCqi = m.getInt("LteCqi"); isGsm = m.getBoolean("isGsm"); } @@ -322,6 +697,18 @@ public class SignalStrength implements Parcelable { m.putInt("EvdoDbm", mEvdoDbm); m.putInt("EvdoEcio", mEvdoEcio); m.putInt("EvdoSnr", mEvdoSnr); + m.putInt("LteSignalStrength", mLteSignalStrength); + m.putInt("LteRsrp", mLteRsrp); + m.putInt("LteRsrq", mLteRsrq); + m.putInt("LteRssnr", mLteRssnr); + m.putInt("LteCqi", mLteCqi); m.putBoolean("isGsm", Boolean.valueOf(isGsm)); } + + /** + * log + */ + private static void log(String s) { + Log.w(LOG_TAG, s); + } } diff --git a/telephony/java/com/android/internal/telephony/BaseCommands.java b/telephony/java/com/android/internal/telephony/BaseCommands.java index 815fbfb..9b19600 100644 --- a/telephony/java/com/android/internal/telephony/BaseCommands.java +++ b/telephony/java/com/android/internal/telephony/BaseCommands.java @@ -47,8 +47,8 @@ public abstract class BaseCommands implements CommandsInterface { protected RegistrantList mRUIMLockedRegistrants = new RegistrantList(); protected RegistrantList mNVReadyRegistrants = new RegistrantList(); protected RegistrantList mCallStateRegistrants = new RegistrantList(); - protected RegistrantList mNetworkStateRegistrants = new RegistrantList(); - protected RegistrantList mDataConnectionRegistrants = new RegistrantList(); + protected RegistrantList mVoiceNetworkStateRegistrants = new RegistrantList(); + protected RegistrantList mDataNetworkStateRegistrants = new RegistrantList(); protected RegistrantList mRadioTechnologyChangedRegistrants = new RegistrantList(); protected RegistrantList mIccStatusChangedRegistrants = new RegistrantList(); protected RegistrantList mVoicePrivacyOnRegistrants = new RegistrantList(); @@ -65,6 +65,9 @@ public abstract class BaseCommands implements CommandsInterface { protected RegistrantList mT53AudCntrlInfoRegistrants = new RegistrantList(); protected RegistrantList mRingbackToneRegistrants = new RegistrantList(); protected RegistrantList mResendIncallMuteRegistrants = new RegistrantList(); + protected RegistrantList mCdmaSubscriptionChangedRegistrants = new RegistrantList(); + protected RegistrantList mCdmaPrlChangedRegistrants = new RegistrantList(); + protected RegistrantList mExitEmergencyCallbackModeRegistrants = new RegistrantList(); protected Registrant mSMSRegistrant; protected Registrant mNITZTimeRegistrant; @@ -293,24 +296,24 @@ public abstract class BaseCommands implements CommandsInterface { mCallStateRegistrants.remove(h); } - public void registerForNetworkStateChanged(Handler h, int what, Object obj) { + public void registerForVoiceNetworkStateChanged(Handler h, int what, Object obj) { Registrant r = new Registrant (h, what, obj); - mNetworkStateRegistrants.add(r); + mVoiceNetworkStateRegistrants.add(r); } - public void unregisterForNetworkStateChanged(Handler h) { - mNetworkStateRegistrants.remove(h); + public void unregisterForVoiceNetworkStateChanged(Handler h) { + mVoiceNetworkStateRegistrants.remove(h); } - public void registerForDataStateChanged(Handler h, int what, Object obj) { + public void registerForDataNetworkStateChanged(Handler h, int what, Object obj) { Registrant r = new Registrant (h, what, obj); - mDataConnectionRegistrants.add(r); + mDataNetworkStateRegistrants.add(r); } - public void unregisterForDataStateChanged(Handler h) { - mDataConnectionRegistrants.remove(h); + public void unregisterForDataNetworkStateChanged(Handler h) { + mDataNetworkStateRegistrants.remove(h); } public void registerForRadioTechnologyChanged(Handler h, int what, Object obj) { @@ -588,6 +591,39 @@ public abstract class BaseCommands implements CommandsInterface { mResendIncallMuteRegistrants.remove(h); } + @Override + public void registerForCdmaSubscriptionChanged(Handler h, int what, Object obj) { + Registrant r = new Registrant (h, what, obj); + mCdmaSubscriptionChangedRegistrants.add(r); + } + + @Override + public void unregisterForCdmaSubscriptionChanged(Handler h) { + mCdmaSubscriptionChangedRegistrants.remove(h); + } + + @Override + public void registerForCdmaPrlChanged(Handler h, int what, Object obj) { + Registrant r = new Registrant (h, what, obj); + mCdmaPrlChangedRegistrants.add(r); + } + + @Override + public void unregisterForCdmaPrlChanged(Handler h) { + mCdmaPrlChangedRegistrants.remove(h); + } + + @Override + public void registerForExitEmergencyCallbackMode(Handler h, int what, Object obj) { + Registrant r = new Registrant (h, what, obj); + mExitEmergencyCallbackModeRegistrants.add(r); + } + + @Override + public void unregisterForExitEmergencyCallbackMode(Handler h) { + mExitEmergencyCallbackModeRegistrants.remove(h); + } + //***** Protected Methods /** * Store new RadioState and send notification based on the changes diff --git a/telephony/java/com/android/internal/telephony/CommandsInterface.java b/telephony/java/com/android/internal/telephony/CommandsInterface.java index 259acdb..21e9e44 100644 --- a/telephony/java/com/android/internal/telephony/CommandsInterface.java +++ b/telephony/java/com/android/internal/telephony/CommandsInterface.java @@ -216,10 +216,10 @@ public interface CommandsInterface { void registerForCallStateChanged(Handler h, int what, Object obj); void unregisterForCallStateChanged(Handler h); - void registerForNetworkStateChanged(Handler h, int what, Object obj); - void unregisterForNetworkStateChanged(Handler h); - void registerForDataStateChanged(Handler h, int what, Object obj); - void unregisterForDataStateChanged(Handler h); + void registerForVoiceNetworkStateChanged(Handler h, int what, Object obj); + void unregisterForVoiceNetworkStateChanged(Handler h); + void registerForDataNetworkStateChanged(Handler h, int what, Object obj); + void unregisterForDataNetworkStateChanged(Handler h); void registerForRadioTechnologyChanged(Handler h, int what, Object obj); void unregisterForRadioTechnologyChanged(Handler h); @@ -549,6 +549,39 @@ public interface CommandsInterface { void registerForResendIncallMute(Handler h, int what, Object obj); void unregisterForResendIncallMute(Handler h); + /** + * Registers the handler for when Cdma subscription changed events + * + * @param h Handler for notification message. + * @param what User-defined message code. + * @param obj User object. + * + */ + void registerForCdmaSubscriptionChanged(Handler h, int what, Object obj); + void unregisterForCdmaSubscriptionChanged(Handler h); + + /** + * Registers the handler for when Cdma prl changed events + * + * @param h Handler for notification message. + * @param what User-defined message code. + * @param obj User object. + * + */ + void registerForCdmaPrlChanged(Handler h, int what, Object obj); + void unregisterForCdmaPrlChanged(Handler h); + + /** + * Registers the handler for when Cdma prl changed events + * + * @param h Handler for notification message. + * @param what User-defined message code. + * @param obj User object. + * + */ + void registerForExitEmergencyCallbackMode(Handler h, int what, Object obj); + void unregisterForExitEmergencyCallbackMode(Handler h); + /** * Supply the ICC PIN to the ICC card * @@ -564,7 +597,23 @@ public interface CommandsInterface { void supplyIccPin(String pin, Message result); /** - * Supply the ICC PUK to the ICC card + * Supply the PIN for the app with this AID on the ICC card + * + * AID (Application ID), See ETSI 102.221 8.1 and 101.220 4 + * + * returned message + * retMsg.obj = AsyncResult ar + * ar.exception carries exception on failure + * This exception is CommandException with an error of PASSWORD_INCORRECT + * if the password is incorrect + * + * ar.exception and ar.result are null on success + */ + + void supplyIccPinForApp(String pin, String aid, Message result); + + /** + * Supply the ICC PUK and newPin to the ICC card * * returned message * retMsg.obj = AsyncResult ar @@ -578,6 +627,22 @@ public interface CommandsInterface { void supplyIccPuk(String puk, String newPin, Message result); /** + * Supply the PUK, new pin for the app with this AID on the ICC card + * + * AID (Application ID), See ETSI 102.221 8.1 and 101.220 4 + * + * returned message + * retMsg.obj = AsyncResult ar + * ar.exception carries exception on failure + * This exception is CommandException with an error of PASSWORD_INCORRECT + * if the password is incorrect + * + * ar.exception and ar.result are null on success + */ + + void supplyIccPukForApp(String puk, String newPin, String aid, Message result); + + /** * Supply the ICC PIN2 to the ICC card * Only called following operation where ICC_PIN2 was * returned as a a failure from a previous operation @@ -594,6 +659,24 @@ public interface CommandsInterface { void supplyIccPin2(String pin2, Message result); /** + * Supply the PIN2 for the app with this AID on the ICC card + * Only called following operation where ICC_PIN2 was + * returned as a a failure from a previous operation + * + * AID (Application ID), See ETSI 102.221 8.1 and 101.220 4 + * + * returned message + * retMsg.obj = AsyncResult ar + * ar.exception carries exception on failure + * This exception is CommandException with an error of PASSWORD_INCORRECT + * if the password is incorrect + * + * ar.exception and ar.result are null on success + */ + + void supplyIccPin2ForApp(String pin2, String aid, Message result); + + /** * Supply the SIM PUK2 to the SIM card * Only called following operation where SIM_PUK2 was * returned as a a failure from a previous operation @@ -609,8 +692,28 @@ public interface CommandsInterface { void supplyIccPuk2(String puk2, String newPin2, Message result); + /** + * Supply the PUK2, newPin2 for the app with this AID on the ICC card + * Only called following operation where SIM_PUK2 was + * returned as a a failure from a previous operation + * + * AID (Application ID), See ETSI 102.221 8.1 and 101.220 4 + * + * returned message + * retMsg.obj = AsyncResult ar + * ar.exception carries exception on failure + * This exception is CommandException with an error of PASSWORD_INCORRECT + * if the password is incorrect + * + * ar.exception and ar.result are null on success + */ + + void supplyIccPuk2ForApp(String puk2, String newPin2, String aid, Message result); + void changeIccPin(String oldPin, String newPin, Message result); + void changeIccPinForApp(String oldPin, String newPin, String aidPtr, Message result); void changeIccPin2(String oldPin2, String newPin2, Message result); + void changeIccPin2ForApp(String oldPin2, String newPin2, String aidPtr, Message result); void changeBarringPassword(String facility, String oldPwd, String newPwd, Message result); @@ -853,7 +956,7 @@ public interface CommandsInterface { * Please note that registration state 4 ("unknown") is treated * as "out of service" above */ - void getRegistrationState (Message response); + void getVoiceRegistrationState (Message response); /** * response.obj.result is an int[3] @@ -865,7 +968,7 @@ public interface CommandsInterface { * Please note that registration state 4 ("unknown") is treated * as "out of service" above */ - void getGPRSRegistrationState (Message response); + void getDataRegistrationState (Message response); /** * response.obj.result is a String[3] @@ -1286,7 +1389,7 @@ public interface CommandsInterface { * @param cdmaSubscriptionType one of CDMA_SUBSCRIPTION_* * @param response is callback message */ - void setCdmaSubscription(int cdmaSubscriptionType, Message response); + void setCdmaSubscriptionSource(int cdmaSubscriptionType, Message response); /** * Set the TTY mode diff --git a/telephony/java/com/android/internal/telephony/DataCallState.java b/telephony/java/com/android/internal/telephony/DataCallState.java index df12153..fda1e47 100644 --- a/telephony/java/com/android/internal/telephony/DataCallState.java +++ b/telephony/java/com/android/internal/telephony/DataCallState.java @@ -30,6 +30,7 @@ public class DataCallState { public String ifname = ""; public String [] addresses = new String[0]; public String [] dnses = new String[0]; + public String[] gateways = new String[0]; @Override public String toString() { @@ -53,6 +54,12 @@ public class DataCallState { sb.append(","); } if (dnses.length > 0) sb.deleteCharAt(sb.length()-1); + sb.append("] gateways=["); + for (String addr : gateways) { + sb.append(addr); + sb.append(","); + } + if (gateways.length > 0) sb.deleteCharAt(sb.length()-1); sb.append("]}"); return sb.toString(); } diff --git a/telephony/java/com/android/internal/telephony/DataConnection.java b/telephony/java/com/android/internal/telephony/DataConnection.java index aa9c4a3..e0b9603 100644 --- a/telephony/java/com/android/internal/telephony/DataConnection.java +++ b/telephony/java/com/android/internal/telephony/DataConnection.java @@ -398,22 +398,34 @@ public abstract class DataConnection extends HierarchicalStateMachine { // a failure we'll clear again at the bottom of this code. LinkProperties linkProperties = new LinkProperties(); if (response.status == FailCause.NONE.getErrorCode()) { + String propertyPrefix = "net." + response.ifname + "."; + try { cid = response.cid; linkProperties.setInterfaceName(response.ifname); if (response.addresses != null && response.addresses.length > 0) { for (String addr : response.addresses) { LinkAddress la; + int addrPrefixLen; + + String [] ap = addr.split("/"); + if (ap.length == 2) { + addr = ap[0]; + addrPrefixLen = Integer.parseInt(ap[1]); + } else { + addrPrefixLen = 0; + } if (!InetAddress.isNumeric(addr)) { EventLogTags.writeBadIpAddress(addr); throw new UnknownHostException("Non-numeric ip addr=" + addr); } InetAddress ia = InetAddress.getByName(addr); - if (ia instanceof Inet4Address) { - la = new LinkAddress(ia, 32); - } else { - la = new LinkAddress(ia, 128); + if (addrPrefixLen == 0) { + // Assume point to point + addrPrefixLen = (ia instanceof Inet4Address) ? 32 : 128; } + if (DBG) log("addr/pl=" + addr + "/" + addrPrefixLen); + la = new LinkAddress(ia, addrPrefixLen); linkProperties.addLinkAddress(la); } } else { @@ -431,11 +443,9 @@ public abstract class DataConnection extends HierarchicalStateMachine { } result = SetupResult.SUCCESS; } else { - String prefix = "net." + response.ifname + "."; - String dnsServers[] = new String[2]; - dnsServers[0] = SystemProperties.get(prefix + "dns1"); - dnsServers[1] = SystemProperties.get(prefix + "dns2"); + dnsServers[0] = SystemProperties.get(propertyPrefix + "dns1"); + dnsServers[1] = SystemProperties.get(propertyPrefix + "dns2"); if (isDnsOk(dnsServers)) { for (String dnsAddr : dnsServers) { if (!InetAddress.isNumeric(dnsAddr)) { @@ -457,6 +467,23 @@ public abstract class DataConnection extends HierarchicalStateMachine { throw new UnknownHostException("Unacceptable dns addresses=" + sb); } } + if ((response.gateways == null) || (response.gateways.length == 0)) { + String gateways = SystemProperties.get(propertyPrefix + "gw"); + if (gateways != null) { + response.gateways = gateways.split(" "); + } else { + response.gateways = new String[0]; + } + } + for (String addr : response.gateways) { + if (!InetAddress.isNumeric(addr)) { + EventLogTags.writePdpBadDnsAddress("gateway=" + addr); + throw new UnknownHostException("Non-numeric gateway addr=" + addr); + } + InetAddress ia = InetAddress.getByName(addr); + linkProperties.addGateway(ia); + } + result = SetupResult.SUCCESS; } catch (UnknownHostException e) { log("onSetupCompleted: UnknownHostException " + e); e.printStackTrace(); diff --git a/telephony/java/com/android/internal/telephony/IccCardStatus.java b/telephony/java/com/android/internal/telephony/IccCardStatus.java index 0e7bad7..7199616 100644 --- a/telephony/java/com/android/internal/telephony/IccCardStatus.java +++ b/telephony/java/com/android/internal/telephony/IccCardStatus.java @@ -34,7 +34,7 @@ public class IccCardStatus { boolean isCardPresent() { return this == CARDSTATE_PRESENT; } - }; + } public enum PinState { PINSTATE_UNKNOWN, @@ -43,12 +43,13 @@ public class IccCardStatus { PINSTATE_DISABLED, PINSTATE_ENABLED_BLOCKED, PINSTATE_ENABLED_PERM_BLOCKED - }; + } private CardState mCardState; private PinState mUniversalPinState; private int mGsmUmtsSubscriptionAppIndex; private int mCdmaSubscriptionAppIndex; + private int mImsSubscriptionAppIndex; private int mNumApplications; private ArrayList<IccCardApplication> mApplications = @@ -74,6 +75,10 @@ public class IccCardStatus { } } + public PinState getUniversalPinState() { + return mUniversalPinState; + } + public void setUniversalPinState(int state) { switch(state) { case 0: @@ -115,6 +120,14 @@ public class IccCardStatus { mCdmaSubscriptionAppIndex = cdmaSubscriptionAppIndex; } + public int getImsSubscriptionAppIndex() { + return mImsSubscriptionAppIndex; + } + + public void setImsSubscriptionAppIndex(int imsSubscriptionAppIndex) { + mImsSubscriptionAppIndex = imsSubscriptionAppIndex; + } + public int getNumApplications() { return mNumApplications; } @@ -130,4 +143,5 @@ public class IccCardStatus { public IccCardApplication getApplication(int index) { return mApplications.get(index); } + } diff --git a/telephony/java/com/android/internal/telephony/PhoneBase.java b/telephony/java/com/android/internal/telephony/PhoneBase.java index cbff130..54341b1 100644 --- a/telephony/java/com/android/internal/telephony/PhoneBase.java +++ b/telephony/java/com/android/internal/telephony/PhoneBase.java @@ -679,7 +679,7 @@ public abstract class PhoneBase extends Handler implements Phone { * Set the status of the CDMA subscription mode */ public void setCdmaSubscription(int cdmaSubscriptionType, Message response) { - mCM.setCdmaSubscription(cdmaSubscriptionType, response); + mCM.setCdmaSubscriptionSource(cdmaSubscriptionType, response); } /** diff --git a/telephony/java/com/android/internal/telephony/PhoneStateIntentReceiver.java b/telephony/java/com/android/internal/telephony/PhoneStateIntentReceiver.java index b31161c..898e624 100644 --- a/telephony/java/com/android/internal/telephony/PhoneStateIntentReceiver.java +++ b/telephony/java/com/android/internal/telephony/PhoneStateIntentReceiver.java @@ -95,25 +95,17 @@ public final class PhoneStateIntentReceiver extends BroadcastReceiver { } /** - * Returns current signal strength in "asu", ranging from 0-31 - * or -1 if unknown - * - * For GSM, dBm = -113 + 2*asu - * 0 means "-113 dBm or less" - * 31 means "-51 dBm or greater" + * Returns current signal strength in as an asu 0..31 * - * @return signal strength in asu, -1 if not yet updated * Throws RuntimeException if client has not called notifySignalStrength() */ - public int getSignalStrength() { + public int getSignalStrengthLevelAsu() { // TODO: use new SignalStrength instead of asu if ((mWants & NOTIF_SIGNAL) == 0) { throw new RuntimeException ("client must call notifySignalStrength(int)"); } - int gsmSignalStrength = mSignalStrength.getGsmSignalStrength(); - - return (gsmSignalStrength == 99 ? -1 : gsmSignalStrength); + return mSignalStrength.getAsuLevel(); } /** @@ -128,19 +120,7 @@ public final class PhoneStateIntentReceiver extends BroadcastReceiver { throw new RuntimeException ("client must call notifySignalStrength(int)"); } - - int dBm = -1; - - if(!mSignalStrength.isGsm()) { - dBm = mSignalStrength.getCdmaDbm(); - } else { - int gsmSignalStrength = mSignalStrength.getGsmSignalStrength(); - int asu = (gsmSignalStrength == 99 ? -1 : gsmSignalStrength); - if (asu != -1) { - dBm = -113 + 2*asu; - } - } - return dBm; + return mSignalStrength.getDbm(); } public void notifyPhoneCallState(int eventWhat) { diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java index 3ef1924..76c6229 100644 --- a/telephony/java/com/android/internal/telephony/RIL.java +++ b/telephony/java/com/android/internal/telephony/RIL.java @@ -224,7 +224,6 @@ public final class RIL extends BaseCommands implements CommandsInterface { RILSender mSender; Thread mReceiverThread; RILReceiver mReceiver; - private Context mContext; WakeLock mWakeLock; int mWakeLockTimeout; // The number of requests pending to be sent out, it increases before calling @@ -649,8 +648,6 @@ public final class RIL extends BaseCommands implements CommandsInterface { mRequestMessagesPending = 0; mRequestMessagesWaiting = 0; - mContext = context; - mSenderThread = new HandlerThread("RILSender"); mSenderThread.start(); @@ -693,90 +690,126 @@ public final class RIL extends BaseCommands implements CommandsInterface { send(rr); } - public void + @Override public void supplyIccPin(String pin, Message result) { + supplyIccPinForApp(pin, null, result); + } + + @Override public void + supplyIccPinForApp(String pin, String aid, Message result) { //Note: This RIL request has not been renamed to ICC, // but this request is also valid for SIM and RUIM RILRequest rr = RILRequest.obtain(RIL_REQUEST_ENTER_SIM_PIN, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); - rr.mp.writeInt(1); + rr.mp.writeInt(2); rr.mp.writeString(pin); + rr.mp.writeString(aid); send(rr); } - public void + @Override public void supplyIccPuk(String puk, String newPin, Message result) { + supplyIccPukForApp(puk, newPin, null, result); + } + + @Override public void + supplyIccPukForApp(String puk, String newPin, String aid, Message result) { //Note: This RIL request has not been renamed to ICC, // but this request is also valid for SIM and RUIM RILRequest rr = RILRequest.obtain(RIL_REQUEST_ENTER_SIM_PUK, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); - rr.mp.writeInt(2); + rr.mp.writeInt(3); rr.mp.writeString(puk); rr.mp.writeString(newPin); + rr.mp.writeString(aid); send(rr); } - public void + @Override public void supplyIccPin2(String pin, Message result) { + supplyIccPin2ForApp(pin, null, result); + } + + @Override public void + supplyIccPin2ForApp(String pin, String aid, Message result) { //Note: This RIL request has not been renamed to ICC, // but this request is also valid for SIM and RUIM RILRequest rr = RILRequest.obtain(RIL_REQUEST_ENTER_SIM_PIN2, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); - rr.mp.writeInt(1); + rr.mp.writeInt(2); rr.mp.writeString(pin); + rr.mp.writeString(aid); send(rr); } - public void - supplyIccPuk2(String puk, String newPin2, Message result) { + @Override public void + supplyIccPuk2(String puk2, String newPin2, Message result) { + supplyIccPuk2ForApp(puk2, newPin2, null, result); + } + + @Override public void + supplyIccPuk2ForApp(String puk, String newPin2, String aid, Message result) { //Note: This RIL request has not been renamed to ICC, // but this request is also valid for SIM and RUIM RILRequest rr = RILRequest.obtain(RIL_REQUEST_ENTER_SIM_PUK2, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); - rr.mp.writeInt(2); + rr.mp.writeInt(3); rr.mp.writeString(puk); rr.mp.writeString(newPin2); + rr.mp.writeString(aid); send(rr); } - public void + @Override public void changeIccPin(String oldPin, String newPin, Message result) { + changeIccPinForApp(oldPin, newPin, null, result); + } + + @Override public void + changeIccPinForApp(String oldPin, String newPin, String aid, Message result) { //Note: This RIL request has not been renamed to ICC, // but this request is also valid for SIM and RUIM RILRequest rr = RILRequest.obtain(RIL_REQUEST_CHANGE_SIM_PIN, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); - rr.mp.writeInt(2); + rr.mp.writeInt(3); rr.mp.writeString(oldPin); rr.mp.writeString(newPin); + rr.mp.writeString(aid); send(rr); } - public void + @Override public void changeIccPin2(String oldPin2, String newPin2, Message result) { + changeIccPin2ForApp(oldPin2, newPin2, null, result); + } + + @Override public void + changeIccPin2ForApp(String oldPin2, String newPin2, String aid, Message result) { //Note: This RIL request has not been renamed to ICC, // but this request is also valid for SIM and RUIM RILRequest rr = RILRequest.obtain(RIL_REQUEST_CHANGE_SIM_PIN2, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); - rr.mp.writeInt(2); + rr.mp.writeInt(3); rr.mp.writeString(oldPin2); rr.mp.writeString(newPin2); + rr.mp.writeString(aid); send(rr); } @@ -1072,9 +1105,9 @@ public final class RIL extends BaseCommands implements CommandsInterface { } public void - getRegistrationState (Message result) { + getVoiceRegistrationState (Message result) { RILRequest rr - = RILRequest.obtain(RIL_REQUEST_REGISTRATION_STATE, result); + = RILRequest.obtain(RIL_REQUEST_VOICE_REGISTRATION_STATE, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); @@ -1082,9 +1115,9 @@ public final class RIL extends BaseCommands implements CommandsInterface { } public void - getGPRSRegistrationState (Message result) { + getDataRegistrationState (Message result) { RILRequest rr - = RILRequest.obtain(RIL_REQUEST_GPRS_REGISTRATION_STATE, result); + = RILRequest.obtain(RIL_REQUEST_DATA_REGISTRATION_STATE, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); @@ -1357,7 +1390,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { send(rrPnt); RILRequest rrCs = RILRequest.obtain( - RIL_REQUEST_CDMA_SET_SUBSCRIPTION, null); + RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE, null); rrCs.mp.writeInt(1); rrCs.mp.writeInt(mCdmaSubscription); if (RILJ_LOGD) riljLog(rrCs.serialString() + "> " @@ -2171,8 +2204,8 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_REQUEST_UDUB: ret = responseVoid(p); break; case RIL_REQUEST_LAST_CALL_FAIL_CAUSE: ret = responseInts(p); break; case RIL_REQUEST_SIGNAL_STRENGTH: ret = responseSignalStrength(p); break; - case RIL_REQUEST_REGISTRATION_STATE: ret = responseStrings(p); break; - case RIL_REQUEST_GPRS_REGISTRATION_STATE: ret = responseStrings(p); break; + case RIL_REQUEST_VOICE_REGISTRATION_STATE: ret = responseStrings(p); break; + case RIL_REQUEST_DATA_REGISTRATION_STATE: ret = responseStrings(p); break; case RIL_REQUEST_OPERATOR: ret = responseStrings(p); break; case RIL_REQUEST_RADIO_POWER: ret = responseVoid(p); break; case RIL_REQUEST_DTMF: ret = responseVoid(p); break; @@ -2228,7 +2261,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE: ret = responseInts(p); break; case RIL_REQUEST_GET_NEIGHBORING_CELL_IDS: ret = responseCellList(p); break; case RIL_REQUEST_SET_LOCATION_UPDATES: ret = responseVoid(p); break; - case RIL_REQUEST_CDMA_SET_SUBSCRIPTION: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE: ret = responseVoid(p); break; case RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE: ret = responseVoid(p); break; case RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE: ret = responseInts(p); break; case RIL_REQUEST_SET_TTY_MODE: ret = responseVoid(p); break; @@ -2255,6 +2288,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE: ret = responseVoid(p); break; case RIL_REQUEST_REPORT_SMS_MEMORY_STATUS: ret = responseVoid(p); break; case RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE: ret = responseInts(p); break; default: throw new RuntimeException("Unrecognized solicited response: " + rr.mRequest); //break; @@ -2368,7 +2402,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: ret = responseVoid(p); break; case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED: ret = responseVoid(p); break; - case RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED: ret = responseVoid(p); break; + case RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED: ret = responseVoid(p); break; case RIL_UNSOL_RESPONSE_NEW_SMS: ret = responseString(p); break; case RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT: ret = responseString(p); break; case RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM: ret = responseInts(p); break; @@ -2396,6 +2430,9 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_UNSOL_OEM_HOOK_RAW: ret = responseRaw(p); break; case RIL_UNSOL_RINGBACK_TONE: ret = responseInts(p); break; case RIL_UNSOL_RESEND_INCALL_MUTE: ret = responseVoid(p); break; + case RIL_UNSOL_CDMA_SUBSCRIPTION_CHANGED: ret = responseInts(p); break; + case RIL_UNSOl_CDMA_PRL_CHANGED: ret = responseInts(p); break; + case RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE: ret = responseVoid(p); break; default: throw new RuntimeException("Unrecognized unsol response: " + response); @@ -2420,10 +2457,10 @@ public final class RIL extends BaseCommands implements CommandsInterface { mCallStateRegistrants .notifyRegistrants(new AsyncResult(null, null, null)); break; - case RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED: + case RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED: if (RILJ_LOGD) unsljLog(response); - mNetworkStateRegistrants + mVoiceNetworkStateRegistrants .notifyRegistrants(new AsyncResult(null, null, null)); break; case RIL_UNSOL_RESPONSE_NEW_SMS: { @@ -2515,7 +2552,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_UNSOL_DATA_CALL_LIST_CHANGED: if (RILJ_LOGD) unsljLogRet(response, ret); - mDataConnectionRegistrants.notifyRegistrants(new AsyncResult(null, ret, null)); + mDataNetworkStateRegistrants.notifyRegistrants(new AsyncResult(null, ret, null)); break; case RIL_UNSOL_SUPP_SVC_NOTIFICATION: @@ -2698,6 +2735,34 @@ public final class RIL extends BaseCommands implements CommandsInterface { mResendIncallMuteRegistrants.notifyRegistrants( new AsyncResult (null, ret, null)); } + break; + + case RIL_UNSOL_CDMA_SUBSCRIPTION_CHANGED: + if (RILJ_LOGD) unsljLogRet(response, ret); + + if (mCdmaSubscriptionChangedRegistrants != null) { + mCdmaSubscriptionChangedRegistrants.notifyRegistrants( + new AsyncResult (null, ret, null)); + } + break; + + case RIL_UNSOl_CDMA_PRL_CHANGED: + if (RILJ_LOGD) unsljLogRet(response, ret); + + if (mCdmaPrlChangedRegistrants != null) { + mCdmaPrlChangedRegistrants.notifyRegistrants( + new AsyncResult (null, ret, null)); + } + break; + + case RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE: + if (RILJ_LOGD) unsljLogRet(response, ret); + + if (mExitEmergencyCallbackModeRegistrants != null) { + mExitEmergencyCallbackModeRegistrants.notifyRegistrants( + new AsyncResult (null, null, null)); + } + break; } } @@ -2848,6 +2913,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { status.setUniversalPinState(p.readInt()); status.setGsmUmtsSubscriptionAppIndex(p.readInt()); status.setCdmaSubscriptionAppIndex(p.readInt()); + status.setImsSubscriptionAppIndex(p.readInt()); int numApplications = p.readInt(); // limit to maximum allowed applications @@ -2905,16 +2971,15 @@ public final class RIL extends BaseCommands implements CommandsInterface { dc.uusInfo.setDcs(p.readInt()); byte[] userData = p.createByteArray(); dc.uusInfo.setUserData(userData); - Log - .v(LOG_TAG, String.format("Incoming UUS : type=%d, dcs=%d, length=%d", + riljLogv(String.format("Incoming UUS : type=%d, dcs=%d, length=%d", dc.uusInfo.getType(), dc.uusInfo.getDcs(), dc.uusInfo.getUserData().length)); - Log.v(LOG_TAG, "Incoming UUS : data (string)=" + riljLogv("Incoming UUS : data (string)=" + new String(dc.uusInfo.getUserData())); - Log.v(LOG_TAG, "Incoming UUS : data (hex): " + riljLogv("Incoming UUS : data (hex): " + IccUtils.bytesToHexString(dc.uusInfo.getUserData())); } else { - Log.v(LOG_TAG, "Incoming UUS : NOT present!"); + riljLogv("Incoming UUS : NOT present!"); } // Make sure there's a leading + on addresses with a TOA of 145 @@ -2924,10 +2989,10 @@ public final class RIL extends BaseCommands implements CommandsInterface { if (dc.isVoicePrivacy) { mVoicePrivacyOnRegistrants.notifyRegistrants(); - Log.d(LOG_TAG, "InCall VoicePrivacy is enabled"); + riljLog("InCall VoicePrivacy is enabled"); } else { mVoicePrivacyOffRegistrants.notifyRegistrants(); - Log.d(LOG_TAG, "InCall VoicePrivacy is disabled"); + riljLog("InCall VoicePrivacy is disabled"); } } @@ -2944,7 +3009,6 @@ public final class RIL extends BaseCommands implements CommandsInterface { dataCall.cid = p.readInt(); dataCall.active = p.readInt(); dataCall.type = p.readString(); - p.readString(); // Ignore apn String addresses = p.readString(); if (TextUtils.isEmpty(addresses)) { dataCall.addresses = addresses.split(" "); @@ -2966,6 +3030,10 @@ public final class RIL extends BaseCommands implements CommandsInterface { if (!TextUtils.isEmpty(dnses)) { dataCall.dnses = dnses.split(" "); } + String gateways = p.readString(); + if (!TextUtils.isEmpty(gateways)) { + dataCall.gateways = gateways.split(" "); + } } return dataCall; } @@ -2976,7 +3044,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { int ver = p.readInt(); int num = p.readInt(); - Log.d(LOG_TAG, "responseDataCallList ver=" + ver + " num=" + num); + riljLog("responseDataCallList ver=" + ver + " num=" + num); response = new ArrayList<DataCallState>(num); for (int i = 0; i < num; i++) { @@ -2990,7 +3058,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { responseSetupDataCall(Parcel p) { int ver = p.readInt(); int num = p.readInt(); - Log.d(LOG_TAG, "responseSetupDataCall ver=" + ver + " num=" + num); + if (RILJ_LOGD) riljLog("responseSetupDataCall ver=" + ver + " num=" + num); DataCallState dataCall; @@ -3009,11 +3077,18 @@ public final class RIL extends BaseCommands implements CommandsInterface { } if (num >= 4) { String dnses = p.readString(); - Log.d(LOG_TAG, "responseSetupDataCall got dnses=" + dnses); + if (RILJ_LOGD) riljLog("responseSetupDataCall got dnses=" + dnses); if (!TextUtils.isEmpty(dnses)) { dataCall.dnses = dnses.split(" "); } } + if (num >= 5) { + String gateways = p.readString(); + if (RILJ_LOGD) riljLog("responseSetupDataCall got gateways=" + gateways); + if (!TextUtils.isEmpty(gateways)) { + dataCall.gateways = gateways.split(" "); + } + } } else { if (num != 1) { throw new RuntimeException( @@ -3156,7 +3231,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { private Object responseSignalStrength(Parcel p) { - int numInts = 7; + int numInts = 12; int response[]; /* TODO: Add SignalStrength class to match RIL_SignalStrength */ @@ -3200,6 +3275,8 @@ public final class RIL extends BaseCommands implements CommandsInterface { notification.signalType = p.readInt(); notification.alertPitch = p.readInt(); notification.signal = p.readInt(); + notification.numberType = p.readInt(); + notification.numberPlan = p.readInt(); return notification; } @@ -3291,8 +3368,8 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_REQUEST_UDUB: return "UDUB"; case RIL_REQUEST_LAST_CALL_FAIL_CAUSE: return "LAST_CALL_FAIL_CAUSE"; case RIL_REQUEST_SIGNAL_STRENGTH: return "SIGNAL_STRENGTH"; - case RIL_REQUEST_REGISTRATION_STATE: return "REGISTRATION_STATE"; - case RIL_REQUEST_GPRS_REGISTRATION_STATE: return "GPRS_REGISTRATION_STATE"; + case RIL_REQUEST_VOICE_REGISTRATION_STATE: return "VOICE_REGISTRATION_STATE"; + case RIL_REQUEST_DATA_REGISTRATION_STATE: return "DATA_REGISTRATION_STATE"; case RIL_REQUEST_OPERATOR: return "OPERATOR"; case RIL_REQUEST_RADIO_POWER: return "RADIO_POWER"; case RIL_REQUEST_DTMF: return "DTMF"; @@ -3348,7 +3425,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE: return "REQUEST_GET_PREFERRED_NETWORK_TYPE"; case RIL_REQUEST_GET_NEIGHBORING_CELL_IDS: return "REQUEST_GET_NEIGHBORING_CELL_IDS"; case RIL_REQUEST_SET_LOCATION_UPDATES: return "REQUEST_SET_LOCATION_UPDATES"; - case RIL_REQUEST_CDMA_SET_SUBSCRIPTION: return "RIL_REQUEST_CDMA_SET_SUBSCRIPTION"; + case RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE: return "RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE"; case RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE: return "RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE"; case RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE: return "RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE"; case RIL_REQUEST_SET_TTY_MODE: return "RIL_REQUEST_SET_TTY_MODE"; @@ -3375,6 +3452,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE: return "REQUEST_EXIT_EMERGENCY_CALLBACK_MODE"; case RIL_REQUEST_REPORT_SMS_MEMORY_STATUS: return "RIL_REQUEST_REPORT_SMS_MEMORY_STATUS"; case RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING: return "RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING"; + case RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE: return "RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE"; default: return "<unknown request>"; } } @@ -3390,7 +3468,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { switch(request) { case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: return "UNSOL_RESPONSE_RADIO_STATE_CHANGED"; case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED: return "UNSOL_RESPONSE_CALL_STATE_CHANGED"; - case RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED: return "UNSOL_RESPONSE_NETWORK_STATE_CHANGED"; + case RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED: return "UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED"; case RIL_UNSOL_RESPONSE_NEW_SMS: return "UNSOL_RESPONSE_NEW_SMS"; case RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT: return "UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT"; case RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM: return "UNSOL_RESPONSE_NEW_SMS_ON_SIM"; @@ -3419,6 +3497,9 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_UNSOL_OEM_HOOK_RAW: return "UNSOL_OEM_HOOK_RAW"; case RIL_UNSOL_RINGBACK_TONE: return "UNSOL_RINGBACK_TONG"; case RIL_UNSOL_RESEND_INCALL_MUTE: return "UNSOL_RESEND_INCALL_MUTE"; + case RIL_UNSOL_CDMA_SUBSCRIPTION_CHANGED: return "CDMA_SUBSCRIPTION_CHANGED"; + case RIL_UNSOl_CDMA_PRL_CHANGED: return "UNSOL_CDMA_PRL_CHANGED"; + case RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE: return "UNSOL_EXIT_EMERGENCY_CALLBACK_MODE"; default: return "<unknown reponse>"; } } @@ -3502,9 +3583,9 @@ public final class RIL extends BaseCommands implements CommandsInterface { /** * {@inheritDoc} */ - public void setCdmaSubscription(int cdmaSubscription , Message response) { + public void setCdmaSubscriptionSource(int cdmaSubscription , Message response) { RILRequest rr = RILRequest.obtain( - RILConstants.RIL_REQUEST_CDMA_SET_SUBSCRIPTION, response); + RILConstants.RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE, response); rr.mp.writeInt(1); rr.mp.writeInt(cdmaSubscription); @@ -3518,6 +3599,19 @@ public final class RIL extends BaseCommands implements CommandsInterface { /** * {@inheritDoc} */ + public void getCdmaSubscriptionSource(int cdmaSubscription , Message response) { + RILRequest rr = RILRequest.obtain( + RILConstants.RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE, response); + + if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + + " : " + cdmaSubscription); + + send(rr); + } + + /** + * {@inheritDoc} + */ public void queryTTYMode(Message response) { RILRequest rr = RILRequest.obtain( RILConstants.RIL_REQUEST_QUERY_TTY_MODE, response); @@ -3598,4 +3692,5 @@ public final class RIL extends BaseCommands implements CommandsInterface { send(rr); } + } diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java index 9b21de8..cdf1977 100644 --- a/telephony/java/com/android/internal/telephony/RILConstants.java +++ b/telephony/java/com/android/internal/telephony/RILConstants.java @@ -162,8 +162,8 @@ cat include/telephony/ril.h | \ int RIL_REQUEST_UDUB = 17; int RIL_REQUEST_LAST_CALL_FAIL_CAUSE = 18; int RIL_REQUEST_SIGNAL_STRENGTH = 19; - int RIL_REQUEST_REGISTRATION_STATE = 20; - int RIL_REQUEST_GPRS_REGISTRATION_STATE = 21; + int RIL_REQUEST_VOICE_REGISTRATION_STATE = 20; + int RIL_REQUEST_DATA_REGISTRATION_STATE = 21; int RIL_REQUEST_OPERATOR = 22; int RIL_REQUEST_RADIO_POWER = 23; int RIL_REQUEST_DTMF = 24; @@ -219,7 +219,7 @@ cat include/telephony/ril.h | \ int RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE = 74; int RIL_REQUEST_GET_NEIGHBORING_CELL_IDS = 75; int RIL_REQUEST_SET_LOCATION_UPDATES = 76; - int RIL_REQUEST_CDMA_SET_SUBSCRIPTION = 77; + int RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE = 77; int RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE = 78; int RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE = 79; int RIL_REQUEST_SET_TTY_MODE = 80; @@ -246,10 +246,11 @@ cat include/telephony/ril.h | \ int RIL_REQUEST_SET_SMSC_ADDRESS = 101; int RIL_REQUEST_REPORT_SMS_MEMORY_STATUS = 102; int RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING = 103; + int RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE = 104; int RIL_UNSOL_RESPONSE_BASE = 1000; int RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED = 1000; int RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED = 1001; - int RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED = 1002; + int RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED = 1002; int RIL_UNSOL_RESPONSE_NEW_SMS = 1003; int RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT = 1004; int RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM = 1005; @@ -278,4 +279,7 @@ cat include/telephony/ril.h | \ int RIL_UNSOL_OEM_HOOK_RAW = 1028; int RIL_UNSOL_RINGBACK_TONE = 1029; int RIL_UNSOL_RESEND_INCALL_MUTE = 1030; + int RIL_UNSOL_CDMA_SUBSCRIPTION_CHANGED = 1031; + int RIL_UNSOl_CDMA_PRL_CHANGED = 1032; + int RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE = 1033; } diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaCallWaitingNotification.java b/telephony/java/com/android/internal/telephony/cdma/CdmaCallWaitingNotification.java index f4119ad..81ff042 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaCallWaitingNotification.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaCallWaitingNotification.java @@ -26,10 +26,12 @@ import com.android.internal.telephony.Connection; */ public class CdmaCallWaitingNotification { static final String LOG_TAG = "CDMA"; - public String number =null; + public String number = null; public int numberPresentation = 0; public String name = null; public int namePresentation = 0; + public int numberType = 0; + public int numberPlan = 0; public int isPresent = 0; public int signalType = 0; public int alertPitch = 0; @@ -42,6 +44,8 @@ public class CdmaCallWaitingNotification { + " numberPresentation: " + numberPresentation + " name: " + name + " namePresentation: " + namePresentation + + " numberType: " + numberType + + " numberPlan: " + numberPlan + " isPresent: " + isPresent + " signalType: " + signalType + " alertPitch: " + alertPitch diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java index c324a71..8c36106 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java @@ -101,7 +101,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { p.mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null); p.mRuimRecords.registerForRecordsLoaded(this, EVENT_RECORDS_LOADED, null); p.mCM.registerForNVReady(this, EVENT_NV_READY, null); - p.mCM.registerForDataStateChanged (this, EVENT_DATA_STATE_CHANGED, null); + p.mCM.registerForDataNetworkStateChanged (this, EVENT_DATA_STATE_CHANGED, null); p.mCT.registerForVoiceCallEnded (this, EVENT_VOICE_CALL_ENDED, null); p.mCT.registerForVoiceCallStarted (this, EVENT_VOICE_CALL_STARTED, null); p.mSST.registerForCdmaDataConnectionAttached(this, EVENT_TRY_SETUP_DATA, null); @@ -125,7 +125,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { mPhone.mCM.unregisterForOffOrNotAvailable(this); mCdmaPhone.mRuimRecords.unregisterForRecordsLoaded(this); mPhone.mCM.unregisterForNVReady(this); - mPhone.mCM.unregisterForDataStateChanged(this); + mPhone.mCM.unregisterForDataNetworkStateChanged(this); mCdmaPhone.mCT.unregisterForVoiceCallEnded(this); mCdmaPhone.mCT.unregisterForVoiceCallStarted(this); mCdmaPhone.mSST.unregisterForCdmaDataConnectionAttached(this); diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java index b217f07..0debb42 100755 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java @@ -186,7 +186,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { cm.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null); cm.registerForRadioStateChanged(this, EVENT_RADIO_STATE_CHANGED, null); - cm.registerForNetworkStateChanged(this, EVENT_NETWORK_STATE_CHANGED_CDMA, null); + cm.registerForVoiceNetworkStateChanged(this, EVENT_NETWORK_STATE_CHANGED_CDMA, null); cm.setOnNITZTime(this, EVENT_NITZ_TIME, null); cm.setOnSignalStrengthUpdate(this, EVENT_SIGNAL_STRENGTH_UPDATE, null); @@ -215,7 +215,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { // Unregister for all events. cm.unregisterForAvailable(this); cm.unregisterForRadioStateChanged(this); - cm.unregisterForNetworkStateChanged(this); + cm.unregisterForVoiceNetworkStateChanged(this); cm.unregisterForRUIMReady(this); cm.unregisterForNVReady(this); cm.unregisterForCdmaOtaProvision(this); @@ -517,7 +517,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { ar = (AsyncResult) msg.obj; if (ar.exception == null) { - cm.getRegistrationState(obtainMessage(EVENT_GET_LOC_DONE_CDMA, null)); + cm.getVoiceRegistrationState(obtainMessage(EVENT_GET_LOC_DONE_CDMA, null)); } break; @@ -897,7 +897,8 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { } private void setSignalStrengthDefaultValues() { - mSignalStrength = new SignalStrength(99, -1, -1, -1, -1, -1, -1, false); + mSignalStrength = new SignalStrength(99, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, false); } /** @@ -955,8 +956,8 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { obtainMessage(EVENT_POLL_STATE_OPERATOR_CDMA, pollingContext)); pollingContext[0]++; - // RIL_REQUEST_REGISTRATION_STATE is necessary for CDMA - cm.getRegistrationState( + // RIL_REQUEST_VOICE_REGISTRATION_STATE is necessary for CDMA + cm.getVoiceRegistrationState( obtainMessage(EVENT_POLL_STATE_REGISTRATION_CDMA, pollingContext)); break; @@ -1252,7 +1253,7 @@ final class CdmaServiceStateTracker extends ServiceStateTracker { //log(String.format("onSignalStrengthResult cdmaDbm=%d cdmaEcio=%d evdoRssi=%d evdoEcio=%d evdoSnr=%d", // cdmaDbm, cdmaEcio, evdoRssi, evdoEcio, evdoSnr)); mSignalStrength = new SignalStrength(99, -1, cdmaDbm, cdmaEcio, - evdoRssi, evdoEcio, evdoSnr, false); + evdoRssi, evdoEcio, evdoSnr, -1, -1, -1, -1, -1, false); } try { diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java index f2cdf0c..c57f2f1 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java @@ -141,7 +141,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { p.mCM.registerForAvailable (this, EVENT_RADIO_AVAILABLE, null); p.mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null); p.mSIMRecords.registerForRecordsLoaded(this, EVENT_RECORDS_LOADED, null); - p.mCM.registerForDataStateChanged (this, EVENT_DATA_STATE_CHANGED, null); + p.mCM.registerForDataNetworkStateChanged (this, EVENT_DATA_STATE_CHANGED, null); p.mCT.registerForVoiceCallEnded (this, EVENT_VOICE_CALL_ENDED, null); p.mCT.registerForVoiceCallStarted (this, EVENT_VOICE_CALL_STARTED, null); p.mSST.registerForGprsAttached(this, EVENT_GPRS_ATTACHED, null); @@ -171,7 +171,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { mPhone.mCM.unregisterForAvailable(this); mPhone.mCM.unregisterForOffOrNotAvailable(this); mGsmPhone.mSIMRecords.unregisterForRecordsLoaded(this); - mPhone.mCM.unregisterForDataStateChanged(this); + mPhone.mCM.unregisterForDataNetworkStateChanged(this); mGsmPhone.mCT.unregisterForVoiceCallEnded(this); mGsmPhone.mCT.unregisterForVoiceCallStarted(this); mGsmPhone.mSST.unregisterForGprsAttached(this); diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java index bb99e45..ac83808 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java @@ -79,6 +79,10 @@ final class GsmServiceStateTracker extends ServiceStateTracker { private int gprsState = ServiceState.STATE_OUT_OF_SERVICE; private int newGPRSState = ServiceState.STATE_OUT_OF_SERVICE; + private int mMaxDataCalls = 1; + private int mNewMaxDataCalls = 1; + private int mReasonDataDenied = -1; + private int mNewReasonDataDenied = -1; /** * Values correspond to ServiceStateTracker.DATA_ACCESS_ definitions. @@ -212,7 +216,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker { cm.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null); cm.registerForRadioStateChanged(this, EVENT_RADIO_STATE_CHANGED, null); - cm.registerForNetworkStateChanged(this, EVENT_NETWORK_STATE_CHANGED, null); + cm.registerForVoiceNetworkStateChanged(this, EVENT_NETWORK_STATE_CHANGED, null); cm.setOnNITZTime(this, EVENT_NITZ_TIME, null); cm.setOnSignalStrengthUpdate(this, EVENT_SIGNAL_STRENGTH_UPDATE, null); cm.setOnRestrictedStateChanged(this, EVENT_RESTRICTED_STATE_CHANGED, null); @@ -248,7 +252,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker { // Unregister for all events. cm.unregisterForAvailable(this); cm.unregisterForRadioStateChanged(this); - cm.unregisterForNetworkStateChanged(this); + cm.unregisterForVoiceNetworkStateChanged(this); cm.unregisterForSIMReady(this); phone.mSIMRecords.unregisterForRecordsLoaded(this); @@ -491,7 +495,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker { ar = (AsyncResult) msg.obj; if (ar.exception == null) { - cm.getRegistrationState(obtainMessage(EVENT_GET_LOC_DONE, null)); + cm.getVoiceRegistrationState(obtainMessage(EVENT_GET_LOC_DONE, null)); } break; @@ -683,6 +687,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker { int lac = -1; int cid = -1; int regState = -1; + int reasonRegStateDenied = -1; int psc = -1; if (states.length > 0) { try { @@ -724,6 +729,8 @@ final class GsmServiceStateTracker extends ServiceStateTracker { int type = 0; regState = -1; + mNewReasonDataDenied = -1; + mNewMaxDataCalls = 1; if (states.length > 0) { try { regState = Integer.parseInt(states[0]); @@ -732,6 +739,12 @@ final class GsmServiceStateTracker extends ServiceStateTracker { if (states.length >= 4 && states[3] != null) { type = Integer.parseInt(states[3]); } + if ((states.length >= 5 ) && (regState == 3)) { + mNewReasonDataDenied = Integer.parseInt(states[4]); + } + if (states.length >= 6) { + mNewMaxDataCalls = Integer.parseInt(states[5]); + } } catch (NumberFormatException ex) { Log.w(LOG_TAG, "error parsing GprsRegistrationState: " + ex); } @@ -785,7 +798,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker { } private void setSignalStrengthDefaultValues() { - mSignalStrength = new SignalStrength(99, -1, -1, -1, -1, -1, -1, true); + mSignalStrength = new SignalStrength(99, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, true); } /** @@ -842,12 +855,12 @@ final class GsmServiceStateTracker extends ServiceStateTracker { EVENT_POLL_STATE_OPERATOR, pollingContext)); pollingContext[0]++; - cm.getGPRSRegistrationState( + cm.getDataRegistrationState( obtainMessage( EVENT_POLL_STATE_GPRS, pollingContext)); pollingContext[0]++; - cm.getRegistrationState( + cm.getVoiceRegistrationState( obtainMessage( EVENT_POLL_STATE_REGISTRATION, pollingContext)); @@ -894,7 +907,11 @@ final class GsmServiceStateTracker extends ServiceStateTracker { if (DBG) { Log.d(LOG_TAG, "Poll ServiceState done: " + " oldSS=[" + ss + "] newSS=[" + newSS + - "] oldGprs=" + gprsState + " newGprs=" + newGPRSState + + "] oldGprs=" + gprsState + " newData=" + newGPRSState + + " oldMaxDataCalls=" + mMaxDataCalls + + " mNewMaxDataCalls=" + mNewMaxDataCalls + + " oldReasonDataDenied=" + mReasonDataDenied + + " mNewReasonDataDenied=" + mNewReasonDataDenied + " oldType=" + networkTypeToString(networkType) + " newType=" + networkTypeToString(newNetworkType)); } @@ -956,6 +973,8 @@ final class GsmServiceStateTracker extends ServiceStateTracker { } gprsState = newGPRSState; + mReasonDataDenied = mNewReasonDataDenied; + mMaxDataCalls = mNewMaxDataCalls; networkType = newNetworkType; // this new state has been applied - forget it until we get a new new state newNetworkType = 0; @@ -1158,6 +1177,11 @@ final class GsmServiceStateTracker extends ServiceStateTracker { private void onSignalStrengthResult(AsyncResult ar) { SignalStrength oldSignalStrength = mSignalStrength; int rssi = 99; + int lteSignalStrength = -1; + int lteRsrp = -1; + int lteRsrq = -1; + int lteRssnr = -1; + int lteCqi = -1; if (ar.exception != null) { // -1 = unknown @@ -1169,6 +1193,11 @@ final class GsmServiceStateTracker extends ServiceStateTracker { // bug 658816 seems to be a case where the result is 0-length if (ints.length != 0) { rssi = ints[0]; + lteSignalStrength = ints[7]; + lteRsrp = ints[8]; + lteRsrq = ints[9]; + lteRssnr = ints[10]; + lteCqi = ints[11]; } else { Log.e(LOG_TAG, "Bogus signal strength response"); rssi = 99; @@ -1176,7 +1205,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker { } mSignalStrength = new SignalStrength(rssi, -1, -1, -1, - -1, -1, -1, true); + -1, -1, -1, lteSignalStrength, lteRsrp, lteRsrq, lteRssnr, lteCqi, true); if (!mSignalStrength.equals(oldSignalStrength)) { try { // This takes care of delayed EVENT_POLL_SIGNAL_STRENGTH (scheduled after diff --git a/telephony/java/com/android/internal/telephony/sip/SipCommandInterface.java b/telephony/java/com/android/internal/telephony/sip/SipCommandInterface.java index 1939f95..b6c3b67 100644 --- a/telephony/java/com/android/internal/telephony/sip/SipCommandInterface.java +++ b/telephony/java/com/android/internal/telephony/sip/SipCommandInterface.java @@ -144,10 +144,10 @@ class SipCommandInterface extends BaseCommands implements CommandsInterface { public void getSignalStrength (Message result) { } - public void getRegistrationState (Message result) { + public void getVoiceRegistrationState (Message result) { } - public void getGPRSRegistrationState (Message result) { + public void getDataRegistrationState (Message result) { } public void getOperator(Message result) { @@ -339,7 +339,7 @@ class SipCommandInterface extends BaseCommands implements CommandsInterface { public void setCdmaRoamingPreference(int cdmaRoamingType, Message response) { } - public void setCdmaSubscription(int cdmaSubscription , Message response) { + public void setCdmaSubscriptionSource(int cdmaSubscription , Message response) { } public void queryTTYMode(Message response) { @@ -362,4 +362,29 @@ class SipCommandInterface extends BaseCommands implements CommandsInterface { public void exitEmergencyCallbackMode(Message response) { } + + @Override + public void supplyIccPinForApp(String pin, String aid, Message response) { + } + + @Override + public void supplyIccPukForApp(String puk, String newPin, String aid, Message response) { + } + + @Override + public void supplyIccPin2ForApp(String pin2, String aid, Message response) { + } + + @Override + public void supplyIccPuk2ForApp(String puk2, String newPin2, String aid, Message response) { + } + + @Override + public void changeIccPinForApp(String oldPin, String newPin, String aidPtr, Message response) { + } + + @Override + public void changeIccPin2ForApp(String oldPin2, String newPin2, String aidPtr, + Message response) { + } } diff --git a/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java b/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java index 8b3a3ad..242d44f 100644 --- a/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java +++ b/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java @@ -825,7 +825,7 @@ public final class SimulatedCommands extends BaseCommands * Please note that registration state 4 ("unknown") is treated * as "out of service" above */ - public void getRegistrationState (Message result) { + public void getVoiceRegistrationState (Message result) { String ret[] = new String[14]; ret[0] = "5"; // registered roam @@ -863,7 +863,7 @@ public final class SimulatedCommands extends BaseCommands * Please note that registration state 4 ("unknown") is treated * as "out of service" in the Android telephony system */ - public void getGPRSRegistrationState (Message result) { + public void getDataRegistrationState (Message result) { String ret[] = new String[4]; ret[0] = "5"; // registered roam @@ -1361,7 +1361,7 @@ public final class SimulatedCommands extends BaseCommands } public void - setCdmaSubscription(int cdmaSubscriptionType, Message response) { + setCdmaSubscriptionSource(int cdmaSubscriptionType, Message response) { Log.w(LOG_TAG, "CDMA not implemented in SimulatedCommands"); unimplemented(response); } @@ -1468,4 +1468,35 @@ public final class SimulatedCommands extends BaseCommands public void getGsmBroadcastConfig(Message response) { unimplemented(response); } + + @Override + public void supplyIccPinForApp(String pin, String aid, Message response) { + unimplemented(response); + } + + @Override + public void supplyIccPukForApp(String puk, String newPin, String aid, Message response) { + unimplemented(response); + } + + @Override + public void supplyIccPin2ForApp(String pin2, String aid, Message response) { + unimplemented(response); + } + + @Override + public void supplyIccPuk2ForApp(String puk2, String newPin2, String aid, Message response) { + unimplemented(response); + } + + @Override + public void changeIccPinForApp(String oldPin, String newPin, String aidPtr, Message response) { + unimplemented(response); + } + + @Override + public void changeIccPin2ForApp(String oldPin2, String newPin2, String aidPtr, + Message response) { + unimplemented(response); + } } |