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;
* {@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
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"}),
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);
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("(");
int mPhoneSignalStrengthBin = -1;
int mPhoneSignalStrengthBinRaw = -1;
final StopwatchTimer[] mPhoneSignalStrengthsTimer =
- new StopwatchTimer[NUM_SIGNAL_STRENGTH_BINS];
+ new StopwatchTimer[SignalStrength.NUM_SIGNAL_STRENGTH_BINS];
StopwatchTimer mPhoneSignalScanningTimer;
}
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;
}
// 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;
}
}
// 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;
}
}
// 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;
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);
}
}
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);
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);
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);
}
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);
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);
}
}
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);
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, " ");
}
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()) {
}
private final void updateSignalStrength() {
- int iconLevel = -1;
int[] iconList;
// Display signal strength while in "emergency calls only" mode
}
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];
}
} 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:
mLabelViews.add(v);
}
+ @Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if (action.equals(WifiManager.RSSI_CHANGED_ACTION)
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()) {
}
}
- 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())) {
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];
*/
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
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
mEvdoDbm = -1;
mEvdoEcio = -1;
mEvdoSnr = -1;
+ mLteSignalStrength = -1;
+ mLteRsrp = -1;
+ mLteRsrq = -1;
+ mLteRssnr = -1;
+ mLteCqi = -1;
isGsm = true;
}
*/
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;
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
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;
}
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);
}
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);
}
}
/**
+ * 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() {
*/
@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));
}
&& 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);
}
+ " " + 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"));
}
/**
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");
}
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);
+ }
}
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();
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;
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) {
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
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);
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
*
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
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
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
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);
* 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]
* 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]
* @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
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() {
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();
}
// 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 {
}
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)) {
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();
boolean isCardPresent() {
return this == CARDSTATE_PRESENT;
}
- };
+ }
public enum PinState {
PINSTATE_UNKNOWN,
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 =
}
}
+ public PinState getUniversalPinState() {
+ return mUniversalPinState;
+ }
+
public void setUniversalPinState(int state) {
switch(state) {
case 0:
mCdmaSubscriptionAppIndex = cdmaSubscriptionAppIndex;
}
+ public int getImsSubscriptionAppIndex() {
+ return mImsSubscriptionAppIndex;
+ }
+
+ public void setImsSubscriptionAppIndex(int imsSubscriptionAppIndex) {
+ mImsSubscriptionAppIndex = imsSubscriptionAppIndex;
+ }
+
public int getNumApplications() {
return mNumApplications;
}
public IccCardApplication getApplication(int index) {
return mApplications.get(index);
}
+
}
* Set the status of the CDMA subscription mode
*/
public void setCdmaSubscription(int cdmaSubscriptionType, Message response) {
- mCM.setCdmaSubscription(cdmaSubscriptionType, response);
+ mCM.setCdmaSubscriptionSource(cdmaSubscriptionType, response);
}
/**
}
/**
- * 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();
}
/**
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) {
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
mRequestMessagesPending = 0;
mRequestMessagesWaiting = 0;
- mContext = context;
-
mSenderThread = new HandlerThread("RILSender");
mSenderThread.start();
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);
}
}
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));
}
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));
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() + "> "
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;
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;
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;
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;
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);
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: {
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:
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;
}
}
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
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
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");
}
}
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(" ");
if (!TextUtils.isEmpty(dnses)) {
dataCall.dnses = dnses.split(" ");
}
+ String gateways = p.readString();
+ if (!TextUtils.isEmpty(gateways)) {
+ dataCall.gateways = gateways.split(" ");
+ }
}
return dataCall;
}
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++) {
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;
}
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(
private Object
responseSignalStrength(Parcel p) {
- int numInts = 7;
+ int numInts = 12;
int response[];
/* TODO: Add SignalStrength class to match RIL_SignalStrength */
notification.signalType = p.readInt();
notification.alertPitch = p.readInt();
notification.signal = p.readInt();
+ notification.numberType = p.readInt();
+ notification.numberPlan = p.readInt();
return notification;
}
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";
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";
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>";
}
}
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";
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>";
}
}
/**
* {@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);
/**
* {@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);
send(rr);
}
+
}
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;
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;
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;
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;
}
*/
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;
+ " numberPresentation: " + numberPresentation
+ " name: " + name
+ " namePresentation: " + namePresentation
+ + " numberType: " + numberType
+ + " numberPlan: " + numberPlan
+ " isPresent: " + isPresent
+ " signalType: " + signalType
+ " alertPitch: " + alertPitch
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);
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);
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);
// 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);
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;
}
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);
}
/**
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;
//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 {
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);
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);
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.
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);
// Unregister for all events.
cm.unregisterForAvailable(this);
cm.unregisterForRadioStateChanged(this);
- cm.unregisterForNetworkStateChanged(this);
+ cm.unregisterForVoiceNetworkStateChanged(this);
cm.unregisterForSIMReady(this);
phone.mSIMRecords.unregisterForRecordsLoaded(this);
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;
int lac = -1;
int cid = -1;
int regState = -1;
+ int reasonRegStateDenied = -1;
int psc = -1;
if (states.length > 0) {
try {
int type = 0;
regState = -1;
+ mNewReasonDataDenied = -1;
+ mNewMaxDataCalls = 1;
if (states.length > 0) {
try {
regState = Integer.parseInt(states[0]);
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);
}
}
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);
}
/**
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));
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));
}
}
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;
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
// 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;
}
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
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) {
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) {
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) {
+ }
}
* 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
* 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
}
public void
- setCdmaSubscription(int cdmaSubscriptionType, Message response) {
+ setCdmaSubscriptionSource(int cdmaSubscriptionType, Message response) {
Log.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
unimplemented(response);
}
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);
+ }
}