OSDN Git Service

Changes for ril.h version 6.
authorWink Saville <wink@google.com>
Fri, 18 Feb 2011 20:40:47 +0000 (12:40 -0800)
committerWink Saville <wink@google.com>
Fri, 18 Feb 2011 20:40:47 +0000 (12:40 -0800)
Change-Id: Iacd9d362c4836546ac277cf3571227d426a721aa

21 files changed:
core/java/android/os/BatteryStats.java
core/java/com/android/internal/os/BatteryStatsImpl.java
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
telephony/java/android/telephony/SignalStrength.java
telephony/java/com/android/internal/telephony/BaseCommands.java
telephony/java/com/android/internal/telephony/CommandsInterface.java
telephony/java/com/android/internal/telephony/DataCallState.java
telephony/java/com/android/internal/telephony/DataConnection.java
telephony/java/com/android/internal/telephony/IccCardStatus.java
telephony/java/com/android/internal/telephony/PhoneBase.java
telephony/java/com/android/internal/telephony/PhoneStateIntentReceiver.java
telephony/java/com/android/internal/telephony/RIL.java
telephony/java/com/android/internal/telephony/RILConstants.java
telephony/java/com/android/internal/telephony/cdma/CdmaCallWaitingNotification.java
telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java
telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
telephony/java/com/android/internal/telephony/sip/SipCommandInterface.java
telephony/java/com/android/internal/telephony/test/SimulatedCommands.java

index 6e6731e..90e2e79 100644 (file)
@@ -23,6 +23,7 @@ import java.util.List;
 import java.util.Map;
 
 import android.content.pm.ApplicationInfo;
+import android.telephony.SignalStrength;
 import android.util.Log;
 import android.util.Printer;
 import android.util.SparseArray;
@@ -608,18 +609,6 @@ public abstract class BatteryStats implements Parcelable {
      * {@hide}
      */
     public abstract long getPhoneOnTime(long batteryRealtime, int which);
-
-    public static final int SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0;
-    public static final int SIGNAL_STRENGTH_POOR = 1;
-    public static final int SIGNAL_STRENGTH_MODERATE = 2;
-    public static final int SIGNAL_STRENGTH_GOOD = 3;
-    public static final int SIGNAL_STRENGTH_GREAT = 4;
-    
-    static final String[] SIGNAL_STRENGTH_NAMES = {
-        "none", "poor", "moderate", "good", "great"
-    };
-    
-    public static final int NUM_SIGNAL_STRENGTH_BINS = 5;
     
     /**
      * Returns the time in microseconds that the phone has been running with
@@ -710,7 +699,7 @@ public abstract class BatteryStats implements Parcelable {
                 SCREEN_BRIGHTNESS_NAMES),
         new BitDescription(HistoryItem.STATE_SIGNAL_STRENGTH_MASK,
                 HistoryItem.STATE_SIGNAL_STRENGTH_SHIFT, "signal_strength",
-                SIGNAL_STRENGTH_NAMES),
+                SignalStrength.SIGNAL_STRENGTH_NAMES),
         new BitDescription(HistoryItem.STATE_PHONE_STATE_MASK,
                 HistoryItem.STATE_PHONE_STATE_SHIFT, "phone_state",
                 new String[] {"in", "out", "emergency", "off"}),
@@ -1095,14 +1084,14 @@ public abstract class BatteryStats implements Parcelable {
         dumpLine(pw, 0 /* uid */, category, SCREEN_BRIGHTNESS_DATA, args);
         
         // Dump signal strength stats
-        args = new Object[NUM_SIGNAL_STRENGTH_BINS];
-        for (int i=0; i<NUM_SIGNAL_STRENGTH_BINS; i++) {
+        args = new Object[SignalStrength.NUM_SIGNAL_STRENGTH_BINS];
+        for (int i=0; i<SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
             args[i] = getPhoneSignalStrengthTime(i, batteryRealtime, which) / 1000;
         }
         dumpLine(pw, 0 /* uid */, category, SIGNAL_STRENGTH_TIME_DATA, args);
         dumpLine(pw, 0 /* uid */, category, SIGNAL_SCANNING_TIME_DATA,
                 getPhoneSignalScanningTime(batteryRealtime, which) / 1000);
-        for (int i=0; i<NUM_SIGNAL_STRENGTH_BINS; i++) {
+        for (int i=0; i<SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
             args[i] = getPhoneSignalStrengthCount(i, which);
         }
         dumpLine(pw, 0 /* uid */, category, SIGNAL_STRENGTH_COUNT_DATA, args);
@@ -1408,14 +1397,14 @@ public abstract class BatteryStats implements Parcelable {
         sb.append(prefix);
         sb.append("  Signal levels: ");
         didOne = false;
-        for (int i=0; i<NUM_SIGNAL_STRENGTH_BINS; i++) {
+        for (int i=0; i<SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
             final long time = getPhoneSignalStrengthTime(i, batteryRealtime, which);
             if (time == 0) {
                 continue;
             }
             if (didOne) sb.append(", ");
             didOne = true;
-            sb.append(SIGNAL_STRENGTH_NAMES[i]);
+            sb.append(SignalStrength.SIGNAL_STRENGTH_NAMES[i]);
             sb.append(" ");
             formatTimeMs(sb, time/1000);
             sb.append("(");
index b3b80f6..1cca21d 100644 (file)
@@ -194,7 +194,7 @@ public final class BatteryStatsImpl extends BatteryStats {
     int mPhoneSignalStrengthBin = -1;
     int mPhoneSignalStrengthBinRaw = -1;
     final StopwatchTimer[] mPhoneSignalStrengthsTimer = 
-            new StopwatchTimer[NUM_SIGNAL_STRENGTH_BINS];
+            new StopwatchTimer[SignalStrength.NUM_SIGNAL_STRENGTH_BINS];
 
     StopwatchTimer mPhoneSignalScanningTimer;
 
@@ -1659,7 +1659,7 @@ public final class BatteryStatsImpl extends BatteryStats {
     }
 
     void stopAllSignalStrengthTimersLocked(int except) {
-        for (int i = 0; i < NUM_SIGNAL_STRENGTH_BINS; i++) {
+        for (int i = 0; i < SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
             if (i == except) {
                 continue;
             }
@@ -1674,7 +1674,7 @@ public final class BatteryStatsImpl extends BatteryStats {
             // In this case we will always be STATE_OUT_OF_SERVICE, so need
             // to infer that we are scanning from other data.
             if (state == ServiceState.STATE_OUT_OF_SERVICE
-                    && signalBin > SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
+                    && signalBin > SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
                 state = ServiceState.STATE_IN_SERVICE;
             }
         }
@@ -1694,7 +1694,7 @@ public final class BatteryStatsImpl extends BatteryStats {
             // In this case we will always be STATE_OUT_OF_SERVICE, so need
             // to infer that we are scanning from other data.
             if (state == ServiceState.STATE_OUT_OF_SERVICE
-                    && bin > SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
+                    && bin > SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN) {
                 state = ServiceState.STATE_IN_SERVICE;
             }
         }
@@ -1711,7 +1711,7 @@ public final class BatteryStatsImpl extends BatteryStats {
         // bin and have the scanning bit set.
         } else if (state == ServiceState.STATE_OUT_OF_SERVICE) {
             scanning = true;
-            bin = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
+            bin = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
             if (!mPhoneSignalScanningTimer.isRunningLocked()) {
                 mHistoryCur.states |= HistoryItem.STATE_PHONE_SCANNING_FLAG;
                 newHistory = true;
@@ -1775,24 +1775,7 @@ public final class BatteryStatsImpl extends BatteryStats {
 
     public void notePhoneSignalStrengthLocked(SignalStrength signalStrength) {
         // Bin the strength.
-        int bin;
-
-        if (!signalStrength.isGsm()) {
-            int dBm = signalStrength.getCdmaDbm();
-            if (dBm >= -75) bin = SIGNAL_STRENGTH_GREAT;
-            else if (dBm >= -85) bin = SIGNAL_STRENGTH_GOOD;
-            else if (dBm >= -95)  bin = SIGNAL_STRENGTH_MODERATE;
-            else if (dBm >= -100)  bin = SIGNAL_STRENGTH_POOR;
-            else bin = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
-        } else {
-            int asu = signalStrength.getGsmSignalStrength();
-            if (asu < 0 || asu >= 99) bin = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
-            else if (asu >= 16) bin = SIGNAL_STRENGTH_GREAT;
-            else if (asu >= 8)  bin = SIGNAL_STRENGTH_GOOD;
-            else if (asu >= 4)  bin = SIGNAL_STRENGTH_MODERATE;
-            else bin = SIGNAL_STRENGTH_POOR;
-        }
-
+        int bin = signalStrength.getLevel();
         updateAllPhoneStateLocked(mPhoneServiceStateRaw, mPhoneSimStateRaw, bin);
     }
 
@@ -3903,7 +3886,7 @@ public final class BatteryStatsImpl extends BatteryStats {
         }
         mInputEventCounter = new Counter(mUnpluggables);
         mPhoneOnTimer = new StopwatchTimer(null, -2, null, mUnpluggables);
-        for (int i=0; i<NUM_SIGNAL_STRENGTH_BINS; i++) {
+        for (int i=0; i<SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
             mPhoneSignalStrengthsTimer[i] = new StopwatchTimer(null, -200-i, null, mUnpluggables);
         }
         mPhoneSignalScanningTimer = new StopwatchTimer(null, -200+1, null, mUnpluggables);
@@ -4017,7 +4000,7 @@ public final class BatteryStatsImpl extends BatteryStats {
         mPhoneOnTimer.reset(this, false);
         mAudioOnTimer.reset(this, false);
         mVideoOnTimer.reset(this, false);
-        for (int i=0; i<NUM_SIGNAL_STRENGTH_BINS; i++) {
+        for (int i=0; i<SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
             mPhoneSignalStrengthsTimer[i].reset(this, false);
         }
         mPhoneSignalScanningTimer.reset(this, false);
@@ -4780,7 +4763,7 @@ public final class BatteryStatsImpl extends BatteryStats {
         mInputEventCounter.readSummaryFromParcelLocked(in);
         mPhoneOn = false;
         mPhoneOnTimer.readSummaryFromParcelLocked(in);
-        for (int i=0; i<NUM_SIGNAL_STRENGTH_BINS; i++) {
+        for (int i=0; i<SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
             mPhoneSignalStrengthsTimer[i].readSummaryFromParcelLocked(in);
         }
         mPhoneSignalScanningTimer.readSummaryFromParcelLocked(in);
@@ -4973,7 +4956,7 @@ public final class BatteryStatsImpl extends BatteryStats {
         }
         mInputEventCounter.writeSummaryFromParcelLocked(out);
         mPhoneOnTimer.writeSummaryFromParcelLocked(out, NOWREAL);
-        for (int i=0; i<NUM_SIGNAL_STRENGTH_BINS; i++) {
+        for (int i=0; i<SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
             mPhoneSignalStrengthsTimer[i].writeSummaryFromParcelLocked(out, NOWREAL);
         }
         mPhoneSignalScanningTimer.writeSummaryFromParcelLocked(out, NOWREAL);
@@ -5172,7 +5155,7 @@ public final class BatteryStatsImpl extends BatteryStats {
         mInputEventCounter = new Counter(mUnpluggables, in);
         mPhoneOn = false;
         mPhoneOnTimer = new StopwatchTimer(null, -2, null, mUnpluggables, in);
-        for (int i=0; i<NUM_SIGNAL_STRENGTH_BINS; i++) {
+        for (int i=0; i<SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
             mPhoneSignalStrengthsTimer[i] = new StopwatchTimer(null, -200-i,
                     null, mUnpluggables, in);
         }
@@ -5285,7 +5268,7 @@ public final class BatteryStatsImpl extends BatteryStats {
         }
         mInputEventCounter.writeToParcel(out);
         mPhoneOnTimer.writeToParcel(out, batteryRealtime);
-        for (int i=0; i<NUM_SIGNAL_STRENGTH_BINS; i++) {
+        for (int i=0; i<SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
             mPhoneSignalStrengthsTimer[i].writeToParcel(out, batteryRealtime);
         }
         mPhoneSignalScanningTimer.writeToParcel(out, batteryRealtime);
@@ -5382,7 +5365,7 @@ public final class BatteryStatsImpl extends BatteryStats {
             mInputEventCounter.logState(pr, "  ");
             pr.println("*** Phone timer:");
             mPhoneOnTimer.logState(pr, "  ");
-            for (int i=0; i<NUM_SIGNAL_STRENGTH_BINS; i++) {
+            for (int i=0; i<SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
                 pr.println("*** Signal strength #" + i + ":");
                 mPhoneSignalStrengthsTimer[i].logState(pr, "  ");
             }
index dfe0262..0273a4c 100644 (file)
@@ -599,16 +599,6 @@ public class PhoneStatusBarPolicy {
         return (mSignalStrength != null) && !mSignalStrength.isGsm();
     }
 
-    private boolean isEvdo() {
-        return ( (mServiceState != null)
-                 && ((mServiceState.getRadioTechnology()
-                        == ServiceState.RADIO_TECHNOLOGY_EVDO_0)
-                     || (mServiceState.getRadioTechnology()
-                        == ServiceState.RADIO_TECHNOLOGY_EVDO_A)
-                     || (mServiceState.getRadioTechnology()
-                        == ServiceState.RADIO_TECHNOLOGY_EVDO_B)));
-    }
-
     private boolean hasService() {
         if (mServiceState != null) {
             switch (mServiceState.getState()) {
@@ -624,7 +614,6 @@ public class PhoneStatusBarPolicy {
     }
 
     private final void updateSignalStrength() {
-        int iconLevel = -1;
         int[] iconList;
 
         // Display signal strength while in "emergency calls only" mode
@@ -641,18 +630,6 @@ public class PhoneStatusBarPolicy {
         }
 
         if (!isCdma()) {
-            int asu = mSignalStrength.getGsmSignalStrength();
-
-            // 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.
-            if (asu <= 2 || asu == 99) iconLevel = 0;
-            else if (asu >= 12) iconLevel = 4;
-            else if (asu >= 8)  iconLevel = 3;
-            else if (asu >= 5)  iconLevel = 2;
-            else iconLevel = 1;
-
             // Though mPhone is a Manager, this call is not an IPC
             if (mPhone.isNetworkRoaming()) {
                 iconList = sSignalImages_r[mInetCondition];
@@ -661,67 +638,11 @@ public class PhoneStatusBarPolicy {
             }
         } else {
             iconList = sSignalImages[mInetCondition];
-
-            // If 3G(EV) and 1x network are available than 3G should be
-            // displayed, displayed RSSI should be from the EV side.
-            // If a voice call is made then RSSI should switch to 1x.
-            if ((mPhoneState == TelephonyManager.CALL_STATE_IDLE) && isEvdo()){
-                iconLevel = getEvdoLevel();
-                if (false) {
-                    Slog.d(TAG, "use Evdo level=" + iconLevel + " to replace Cdma Level="
-                            + getCdmaLevel());
-                }
-            } else {
-                iconLevel = getCdmaLevel();
-            }
         }
-        mPhoneSignalIconId = iconList[iconLevel];
+        mPhoneSignalIconId = iconList[mSignalStrength.getLevel()];
         mService.setIcon("phone_signal", mPhoneSignalIconId, 0);
     }
 
-    private int getCdmaLevel() {
-        final int cdmaDbm = mSignalStrength.getCdmaDbm();
-        final int cdmaEcio = mSignalStrength.getCdmaEcio();
-        int levelDbm = 0;
-        int levelEcio = 0;
-
-        if (cdmaDbm >= -75) levelDbm = 4;
-        else if (cdmaDbm >= -85) levelDbm = 3;
-        else if (cdmaDbm >= -95) levelDbm = 2;
-        else if (cdmaDbm >= -100) levelDbm = 1;
-        else levelDbm = 0;
-
-        // Ec/Io are in dB*10
-        if (cdmaEcio >= -90) levelEcio = 4;
-        else if (cdmaEcio >= -110) levelEcio = 3;
-        else if (cdmaEcio >= -130) levelEcio = 2;
-        else if (cdmaEcio >= -150) levelEcio = 1;
-        else levelEcio = 0;
-
-        return (levelDbm < levelEcio) ? levelDbm : levelEcio;
-    }
-
-    private int getEvdoLevel() {
-        int evdoDbm = mSignalStrength.getEvdoDbm();
-        int evdoSnr = mSignalStrength.getEvdoSnr();
-        int levelEvdoDbm = 0;
-        int levelEvdoSnr = 0;
-
-        if (evdoDbm >= -65) levelEvdoDbm = 4;
-        else if (evdoDbm >= -75) levelEvdoDbm = 3;
-        else if (evdoDbm >= -90) levelEvdoDbm = 2;
-        else if (evdoDbm >= -105) levelEvdoDbm = 1;
-        else levelEvdoDbm = 0;
-
-        if (evdoSnr >= 7) levelEvdoSnr = 4;
-        else if (evdoSnr >= 5) levelEvdoSnr = 3;
-        else if (evdoSnr >= 3) levelEvdoSnr = 2;
-        else if (evdoSnr >= 1) levelEvdoSnr = 1;
-        else levelEvdoSnr = 0;
-
-        return (levelEvdoDbm < levelEvdoSnr) ? levelEvdoDbm : levelEvdoSnr;
-    }
-
     private final void updateDataNetType(int net) {
         switch (net) {
         case TelephonyManager.NETWORK_TYPE_EDGE:
index ef37b4e..317490f 100644 (file)
@@ -200,6 +200,7 @@ public class NetworkController extends BroadcastReceiver {
         mLabelViews.add(v);
     }
 
+    @Override
     public void onReceive(Context context, Intent intent) {
         final String action = intent.getAction();
         if (action.equals(WifiManager.RSSI_CHANGED_ACTION)
@@ -315,13 +316,6 @@ public class NetworkController extends BroadcastReceiver {
         return (mSignalStrength != null) && !mSignalStrength.isGsm();
     }
 
-    private boolean isEvdo() {
-        return ((mServiceState != null)
-             && ((mServiceState.getRadioTechnology() == ServiceState.RADIO_TECHNOLOGY_EVDO_0)
-                 || (mServiceState.getRadioTechnology() == ServiceState.RADIO_TECHNOLOGY_EVDO_A)
-                 || (mServiceState.getRadioTechnology() == ServiceState.RADIO_TECHNOLOGY_EVDO_B)));
-    }
-
     private boolean hasService() {
         if (mServiceState != null) {
             switch (mServiceState.getState()) {
@@ -336,51 +330,6 @@ public class NetworkController extends BroadcastReceiver {
         }
     }
 
-    private int getCdmaLevel() {
-        if (mSignalStrength == null) return 0;
-        final int cdmaDbm = mSignalStrength.getCdmaDbm();
-        final int cdmaEcio = mSignalStrength.getCdmaEcio();
-        int levelDbm = 0;
-        int levelEcio = 0;
-
-        if (cdmaDbm >= -75) levelDbm = 4;
-        else if (cdmaDbm >= -85) levelDbm = 3;
-        else if (cdmaDbm >= -95) levelDbm = 2;
-        else if (cdmaDbm >= -100) levelDbm = 1;
-        else levelDbm = 0;
-
-        // Ec/Io are in dB*10
-        if (cdmaEcio >= -90) levelEcio = 4;
-        else if (cdmaEcio >= -110) levelEcio = 3;
-        else if (cdmaEcio >= -130) levelEcio = 2;
-        else if (cdmaEcio >= -150) levelEcio = 1;
-        else levelEcio = 0;
-
-        return (levelDbm < levelEcio) ? levelDbm : levelEcio;
-    }
-
-    private int getEvdoLevel() {
-        if (mSignalStrength == null) return 0;
-        int evdoDbm = mSignalStrength.getEvdoDbm();
-        int evdoSnr = mSignalStrength.getEvdoSnr();
-        int levelEvdoDbm = 0;
-        int levelEvdoSnr = 0;
-
-        if (evdoDbm >= -65) levelEvdoDbm = 4;
-        else if (evdoDbm >= -75) levelEvdoDbm = 3;
-        else if (evdoDbm >= -90) levelEvdoDbm = 2;
-        else if (evdoDbm >= -105) levelEvdoDbm = 1;
-        else levelEvdoDbm = 0;
-
-        if (evdoSnr >= 7) levelEvdoSnr = 4;
-        else if (evdoSnr >= 5) levelEvdoSnr = 3;
-        else if (evdoSnr >= 3) levelEvdoSnr = 2;
-        else if (evdoSnr >= 1) levelEvdoSnr = 1;
-        else levelEvdoSnr = 0;
-
-        return (levelEvdoDbm < levelEvdoSnr) ? levelEvdoDbm : levelEvdoSnr;
-    }
-
     private final void updateTelephonySignalStrength() {
         // Display signal strength while in "emergency calls only" mode
         if (mServiceState == null || (!hasService() && !mServiceState.isEmergencyOnly())) {
@@ -397,44 +346,23 @@ public class NetworkController extends BroadcastReceiver {
             if (mSignalStrength == null) {
                 mPhoneSignalIconId = R.drawable.stat_sys_signal_null;
                 mDataSignalIconId = R.drawable.stat_sys_signal_0; // note we use 0 instead of null
-            } else if (isCdma()) {
-                // If 3G(EV) and 1x network are available than 3G should be
-                // displayed, displayed RSSI should be from the EV side.
-                // If a voice call is made then RSSI should switch to 1x.
-                int iconLevel;
-                if ((mPhoneState == TelephonyManager.CALL_STATE_IDLE) && isEvdo()){
-                    iconLevel = getEvdoLevel();
-                } else {
-                    iconLevel = getCdmaLevel();
-                }
-                int[] iconList;
-                if (isCdmaEri()) {
-                    iconList = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING[mInetCondition];
-                } else {
-                    iconList = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[mInetCondition];
-                }
-                mPhoneSignalIconId = iconList[iconLevel];
-                mDataSignalIconId = TelephonyIcons.DATA_SIGNAL_STRENGTH[mInetCondition][iconLevel];
             } else {
-                int asu = mSignalStrength.getGsmSignalStrength();
-
-                // 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 iconLevel;
-                if (asu <= 2 || asu == 99) iconLevel = 0;
-                else if (asu >= 12) iconLevel = 4;
-                else if (asu >= 8)  iconLevel = 3;
-                else if (asu >= 5)  iconLevel = 2;
-                else iconLevel = 1;
-
-                // Though mPhone is a Manager, this call is not an IPC
                 int[] iconList;
-                if (mPhone.isNetworkRoaming()) {
-                    iconList = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING[mInetCondition];
+                iconLevel = mSignalStrength.getLevel();
+                if (isCdma()) {
+                    if (isCdmaEri()) {
+                        iconList = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING[mInetCondition];
+                    } else {
+                        iconList = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[mInetCondition];
+                    }
                 } else {
-                    iconList = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[mInetCondition];
+                    // Though mPhone is a Manager, this call is not an IPC
+                    if (mPhone.isNetworkRoaming()) {
+                        iconList = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING[mInetCondition];
+                    } else {
+                        iconList = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[mInetCondition];
+                    }
                 }
                 mPhoneSignalIconId = iconList[iconLevel];
                 mDataSignalIconId = TelephonyIcons.DATA_SIGNAL_STRENGTH[mInetCondition][iconLevel];
index c9e304a..98ab3d1 100644 (file)
@@ -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);
+    }
 }
index 815fbfb..9b19600 100644 (file)
@@ -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
index 259acdb..21e9e44 100644 (file)
@@ -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
index df12153..fda1e47 100644 (file)
@@ -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();
     }
index aa9c4a3..e0b9603 100644 (file)
@@ -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();
index 0e7bad7..7199616 100644 (file)
@@ -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);
     }
+
 }
index cbff130..54341b1 100644 (file)
@@ -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);
     }
 
     /**
index b31161c..898e624 100644 (file)
@@ -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) {
index 3ef1924..76c6229 100644 (file)
@@ -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);
     }
+
 }
index 9b21de8..cdf1977 100644 (file)
@@ -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;
 }
index f4119ad..81ff042 100644 (file)
@@ -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
index c324a71..8c36106 100644 (file)
@@ -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);
index b217f07..0debb42 100755 (executable)
@@ -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 {
index f2cdf0c..c57f2f1 100644 (file)
@@ -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);
index bb99e45..ac83808 100644 (file)
@@ -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
index 1939f95..b6c3b67 100644 (file)
@@ -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) {
+    }
 }
index 8b3a3ad..242d44f 100644 (file)
@@ -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);
+    }
 }