summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java3
-rw-r--r--src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java7
-rwxr-xr-xsrc/java/com/android/internal/telephony/gsm/SIMRecords.java32
-rw-r--r--src/java/com/android/internal/telephony/gsm/SmsCbHeader.java75
4 files changed, 74 insertions, 43 deletions
diff --git a/src/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/src/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
index c2546d8..4e68450 100644
--- a/src/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
+++ b/src/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
@@ -692,7 +692,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
apnContext.setState(DctConstants.State.IDLE);
}
if (apnContext.isReady()) {
- if (apnContext.getState() == DctConstants.State.IDLE) {
+ if (apnContext.getState() == DctConstants.State.IDLE ||
+ apnContext.getState() == DctConstants.State.SCANNING) {
apnContext.setReason(reason);
trySetupData(apnContext);
}
diff --git a/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
index 9bde9fa..6110bd1 100644
--- a/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
+++ b/src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
@@ -696,6 +696,13 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
loge("Exception while polling service state. Probably malformed RIL response." + ex);
}
+ final boolean voice_capable = phone.getContext().getResources().getBoolean(
+ com.android.internal.R.bool.config_voice_capable);
+
+ if (!voice_capable && newGPRSState == ServiceState.STATE_IN_SERVICE) {
+ newSS.setState (newGPRSState);
+ }
+
pollingContext[0]--;
if (pollingContext[0] == 0) {
diff --git a/src/java/com/android/internal/telephony/gsm/SIMRecords.java b/src/java/com/android/internal/telephony/gsm/SIMRecords.java
index ddaf4b9..0e2ba1d 100755
--- a/src/java/com/android/internal/telephony/gsm/SIMRecords.java
+++ b/src/java/com/android/internal/telephony/gsm/SIMRecords.java
@@ -421,6 +421,12 @@ public class SIMRecords extends IccRecords {
}
}
+ // Validate data is !null and the MSP (Multiple Subscriber Profile)
+ // byte is between 1 and 4. See ETSI TS 131 102 v11.3.0 section 4.2.64.
+ private boolean validEfCfis(byte[] data) {
+ return ((data != null) && (data[0] >= 1) && (data[0] <= 4));
+ }
+
/**
* {@inheritDoc}
*/
@@ -442,7 +448,7 @@ public class SIMRecords extends IccRecords {
mRecordsEventsRegistrants.notifyResult(EVENT_CFI);
try {
- if (mEfCfis != null) {
+ if (validEfCfis(mEfCfis)) {
// lsb is of byte 1 is voice status
if (enable) {
mEfCfis[1] |= 1;
@@ -450,12 +456,18 @@ public class SIMRecords extends IccRecords {
mEfCfis[1] &= 0xfe;
}
+ log("setVoiceCallForwardingFlag: enable=" + enable
+ + " mEfCfis=" + IccUtils.bytesToHexString(mEfCfis));
+
// TODO: Should really update other fields in EF_CFIS, eg,
// dialing number. We don't read or use it right now.
mFh.updateEFLinearFixed(
EF_CFIS, 1, mEfCfis, null,
obtainMessage (EVENT_UPDATE_DONE, EF_CFIS));
+ } else {
+ log("setVoiceCallForwardingFlag: ignoring enable=" + enable
+ + " invalid mEfCfis=" + IccUtils.bytesToHexString(mEfCfis));
}
if (mEfCff != null) {
@@ -867,11 +879,14 @@ public class SIMRecords extends IccRecords {
log("EF_CFF_CPHS: " + IccUtils.bytesToHexString(data));
mEfCff = data;
- if (mEfCfis == null) {
+ if (validEfCfis(mEfCfis)) {
callForwardingEnabled =
((data[0] & CFF_LINE1_MASK) == CFF_UNCONDITIONAL_ACTIVE);
mRecordsEventsRegistrants.notifyResult(EVENT_CFI);
+ } else {
+ log("EVENT_GET_CFF_DONE: invalid mEfCfis="
+ + IccUtils.bytesToHexString(mEfCfis));
}
break;
@@ -1065,12 +1080,17 @@ public class SIMRecords extends IccRecords {
log("EF_CFIS: " + IccUtils.bytesToHexString(data));
- mEfCfis = data;
+ if (validEfCfis(data)) {
+ mEfCfis = data;
- // Refer TS 51.011 Section 10.3.46 for the content description
- callForwardingEnabled = ((data[1] & 0x01) != 0);
+ // Refer TS 51.011 Section 10.3.46 for the content description
+ callForwardingEnabled = ((data[1] & 0x01) != 0);
+ log("EF_CFIS: callFordwardingEnabled=" + callForwardingEnabled);
- mRecordsEventsRegistrants.notifyResult(EVENT_CFI);
+ mRecordsEventsRegistrants.notifyResult(EVENT_CFI);
+ } else {
+ log("EF_CFIS: invalid data=" + IccUtils.bytesToHexString(data));
+ }
break;
case EVENT_GET_CSP_CPHS_DONE:
diff --git a/src/java/com/android/internal/telephony/gsm/SmsCbHeader.java b/src/java/com/android/internal/telephony/gsm/SmsCbHeader.java
index 5692044..995f5b1 100644
--- a/src/java/com/android/internal/telephony/gsm/SmsCbHeader.java
+++ b/src/java/com/android/internal/telephony/gsm/SmsCbHeader.java
@@ -95,47 +95,50 @@ class SmsCbHeader {
throw new IllegalArgumentException("Illegal PDU");
}
- if (pdu.length <= PDU_LENGTH_ETWS) {
- format = FORMAT_ETWS_PRIMARY;
- geographicalScope = (pdu[0] & 0xc0) >> 6;
+ if (pdu.length <= PDU_LENGTH_GSM) {
+ // can be ETWS or GSM format.
+ // Per TS23.041 9.4.1.2 and 9.4.1.3.2, GSM and ETWS format both
+ // contain serial number which contains GS, Message Code, and Update Number
+ // per 9.4.1.2.1, and message identifier in same octets
+ geographicalScope = (pdu[0] & 0xc0) >>> 6;
serialNumber = ((pdu[0] & 0xff) << 8) | (pdu[1] & 0xff);
messageIdentifier = ((pdu[2] & 0xff) << 8) | (pdu[3] & 0xff);
- dataCodingScheme = -1;
- pageIndex = -1;
- nrOfPages = -1;
- boolean emergencyUserAlert = (pdu[4] & 0x1) != 0;
- boolean activatePopup = (pdu[5] & 0x80) != 0;
- int warningType = (pdu[4] & 0xfe) >> 1;
- byte[] warningSecurityInfo;
- // copy the Warning-Security-Information, if present
- if (pdu.length > PDU_HEADER_LENGTH) {
- warningSecurityInfo = Arrays.copyOfRange(pdu, 6, pdu.length);
+ if (isEtwsMessage() && pdu.length <= PDU_LENGTH_ETWS) {
+ format = FORMAT_ETWS_PRIMARY;
+ dataCodingScheme = -1;
+ pageIndex = -1;
+ nrOfPages = -1;
+ boolean emergencyUserAlert = (pdu[4] & 0x1) != 0;
+ boolean activatePopup = (pdu[5] & 0x80) != 0;
+ int warningType = (pdu[4] & 0xfe) >>> 1;
+ byte[] warningSecurityInfo;
+ // copy the Warning-Security-Information, if present
+ if (pdu.length > PDU_HEADER_LENGTH) {
+ warningSecurityInfo = Arrays.copyOfRange(pdu, 6, pdu.length);
+ } else {
+ warningSecurityInfo = null;
+ }
+ mEtwsInfo = new SmsCbEtwsInfo(warningType, emergencyUserAlert, activatePopup,
+ warningSecurityInfo);
+ mCmasInfo = null;
+ return; // skip the ETWS/CMAS initialization code for regular notifications
} else {
- warningSecurityInfo = null;
- }
- mEtwsInfo = new SmsCbEtwsInfo(warningType, emergencyUserAlert, activatePopup,
- warningSecurityInfo);
- mCmasInfo = null;
- return; // skip the ETWS/CMAS initialization code for regular notifications
- } else if (pdu.length <= PDU_LENGTH_GSM) {
- // GSM pdus are no more than 88 bytes
- format = FORMAT_GSM;
- geographicalScope = (pdu[0] & 0xc0) >> 6;
- serialNumber = ((pdu[0] & 0xff) << 8) | (pdu[1] & 0xff);
- messageIdentifier = ((pdu[2] & 0xff) << 8) | (pdu[3] & 0xff);
- dataCodingScheme = pdu[4] & 0xff;
+ // GSM pdus are no more than 88 bytes
+ format = FORMAT_GSM;
+ dataCodingScheme = pdu[4] & 0xff;
- // Check for invalid page parameter
- int pageIndex = (pdu[5] & 0xf0) >> 4;
- int nrOfPages = pdu[5] & 0x0f;
+ // Check for invalid page parameter
+ int pageIndex = (pdu[5] & 0xf0) >>> 4;
+ int nrOfPages = pdu[5] & 0x0f;
- if (pageIndex == 0 || nrOfPages == 0 || pageIndex > nrOfPages) {
- pageIndex = 1;
- nrOfPages = 1;
- }
+ if (pageIndex == 0 || nrOfPages == 0 || pageIndex > nrOfPages) {
+ pageIndex = 1;
+ nrOfPages = 1;
+ }
- this.pageIndex = pageIndex;
- this.nrOfPages = nrOfPages;
+ this.pageIndex = pageIndex;
+ this.nrOfPages = nrOfPages;
+ }
} else {
// UMTS pdus are always at least 90 bytes since the payload includes
// a number-of-pages octet and also one length octet per page
@@ -148,7 +151,7 @@ class SmsCbHeader {
}
messageIdentifier = ((pdu[1] & 0xff) << 8) | pdu[2] & 0xff;
- geographicalScope = (pdu[3] & 0xc0) >> 6;
+ geographicalScope = (pdu[3] & 0xc0) >>> 6;
serialNumber = ((pdu[3] & 0xff) << 8) | (pdu[4] & 0xff);
dataCodingScheme = pdu[5] & 0xff;