Merge change 2766 into donut
* changes: Manually merge a few fixes from cupcake and cupcake_dcm.
This commit is contained in:
@@ -103,9 +103,9 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
/** Slow poll when attempting connection recovery. */
|
/** Slow poll when attempting connection recovery. */
|
||||||
protected static final int POLL_NETSTAT_SLOW_MILLIS = 5000;
|
protected static final int POLL_NETSTAT_SLOW_MILLIS = 5000;
|
||||||
/** Default ping deadline, in seconds. */
|
/** Default ping deadline, in seconds. */
|
||||||
protected final int DEFAULT_PING_DEADLINE = 5;
|
protected static final int DEFAULT_PING_DEADLINE = 5;
|
||||||
/** Default max failure count before attempting to network re-registration. */
|
/** Default max failure count before attempting to network re-registration. */
|
||||||
protected final int DEFAULT_MAX_PDP_RESET_FAIL = 3;
|
protected static final int DEFAULT_MAX_PDP_RESET_FAIL = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* After detecting a potential connection problem, this is the max number
|
* After detecting a potential connection problem, this is the max number
|
||||||
@@ -217,7 +217,7 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// abstract handler methods
|
// abstract handler methods
|
||||||
protected abstract void onTrySetupData();
|
protected abstract void onTrySetupData(String reason);
|
||||||
protected abstract void onRoamingOff();
|
protected abstract void onRoamingOff();
|
||||||
protected abstract void onRoamingOn();
|
protected abstract void onRoamingOn();
|
||||||
protected abstract void onRadioAvailable();
|
protected abstract void onRadioAvailable();
|
||||||
@@ -232,7 +232,11 @@ public abstract class DataConnectionTracker extends Handler {
|
|||||||
switch (msg.what) {
|
switch (msg.what) {
|
||||||
|
|
||||||
case EVENT_TRY_SETUP_DATA:
|
case EVENT_TRY_SETUP_DATA:
|
||||||
onTrySetupData();
|
String reason = null;
|
||||||
|
if (msg.obj instanceof String) {
|
||||||
|
reason = (String)msg.obj;
|
||||||
|
}
|
||||||
|
onTrySetupData(reason);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EVENT_ROAMING_OFF:
|
case EVENT_ROAMING_OFF:
|
||||||
|
|||||||
@@ -312,7 +312,9 @@ public abstract class SmsMessageBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void parseMessageBody() {
|
protected void parseMessageBody() {
|
||||||
if (originatingAddress.couldBeEmailGateway()) {
|
// originatingAddress could be null if this message is from a status
|
||||||
|
// report.
|
||||||
|
if (originatingAddress != null && originatingAddress.couldBeEmailGateway()) {
|
||||||
extractEmailAddressFromMessageBody();
|
extractEmailAddressFromMessageBody();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -675,7 +675,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
if (state == State.FAILED) {
|
if (state == State.FAILED) {
|
||||||
cleanUpConnection(false, null);
|
cleanUpConnection(false, null);
|
||||||
}
|
}
|
||||||
sendMessage(obtainMessage(EVENT_TRY_SETUP_DATA));
|
sendMessage(obtainMessage(EVENT_TRY_SETUP_DATA, Phone.REASON_SIM_LOADED));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onNVReady() {
|
protected void onNVReady() {
|
||||||
@@ -688,8 +688,8 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
/**
|
/**
|
||||||
* @override com.android.internal.telephony.DataConnectionTracker
|
* @override com.android.internal.telephony.DataConnectionTracker
|
||||||
*/
|
*/
|
||||||
protected void onTrySetupData() {
|
protected void onTrySetupData(String reason) {
|
||||||
trySetupData(null);
|
trySetupData(reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -769,7 +769,10 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tryAgain(cause)) {
|
if (tryAgain(cause)) {
|
||||||
trySetupData(reason);
|
// Wait a bit before trying again, so that
|
||||||
|
// we're not tying up the RIL command channel
|
||||||
|
sendMessageDelayed(obtainMessage(EVENT_TRY_SETUP_DATA, reason),
|
||||||
|
RECONNECT_DELAY_INITIAL_MILLIS);
|
||||||
} else {
|
} else {
|
||||||
startDelayedRetry(cause, reason);
|
startDelayedRetry(cause, reason);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -585,8 +585,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
if ((state == State.IDLE || state == State.SCANNING)
|
if ((state == State.IDLE || state == State.SCANNING)
|
||||||
&& (gprsState == ServiceState.STATE_IN_SERVICE || noAutoAttach)
|
&& (gprsState == ServiceState.STATE_IN_SERVICE || noAutoAttach)
|
||||||
&& ((GSMPhone) phone).mSIMRecords.getRecordsLoaded()
|
&& ((GSMPhone) phone).mSIMRecords.getRecordsLoaded()
|
||||||
&& ( ((GSMPhone) phone).mSST.isConcurrentVoiceAndData() ||
|
&& phone.getState() == Phone.State.IDLE
|
||||||
phone.getState() == Phone.State.IDLE )
|
|
||||||
&& isDataAllowed()
|
&& isDataAllowed()
|
||||||
&& !mIsPsRestricted
|
&& !mIsPsRestricted
|
||||||
&& desiredPowerState ) {
|
&& desiredPowerState ) {
|
||||||
@@ -1221,7 +1220,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
if (state == State.FAILED) {
|
if (state == State.FAILED) {
|
||||||
cleanUpConnection(false, null);
|
cleanUpConnection(false, null);
|
||||||
}
|
}
|
||||||
sendMessage(obtainMessage(EVENT_TRY_SETUP_DATA));
|
sendMessage(obtainMessage(EVENT_TRY_SETUP_DATA, Phone.REASON_SIM_LOADED));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onEnableNewApn() {
|
protected void onEnableNewApn() {
|
||||||
@@ -1230,8 +1229,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
cleanUpConnection(true, Phone.REASON_APN_SWITCHED);
|
cleanUpConnection(true, Phone.REASON_APN_SWITCHED);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onTrySetupData() {
|
protected void onTrySetupData(String reason) {
|
||||||
trySetupData(null);
|
trySetupData(reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onRestoreDefaultApn() {
|
protected void onRestoreDefaultApn() {
|
||||||
@@ -1363,7 +1362,10 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
} else {
|
} else {
|
||||||
// we still have more apns to try
|
// we still have more apns to try
|
||||||
setState(State.SCANNING);
|
setState(State.SCANNING);
|
||||||
trySetupData(reason);
|
// Wait a bit before trying the next APN, so that
|
||||||
|
// we're not tying up the RIL command channel
|
||||||
|
sendMessageDelayed(obtainMessage(EVENT_TRY_SETUP_DATA, reason),
|
||||||
|
RECONNECT_DELAY_INITIAL_MILLIS);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
startDelayedRetry(cause, reason);
|
startDelayedRetry(cause, reason);
|
||||||
|
|||||||
@@ -250,6 +250,12 @@ public class SmsMessage extends SmsMessageBase{
|
|||||||
|
|
||||||
// TP-Data-Coding-Scheme
|
// TP-Data-Coding-Scheme
|
||||||
// Default encoding, uncompressed
|
// Default encoding, uncompressed
|
||||||
|
// To test writing messages to the SIM card, change this value 0x00
|
||||||
|
// to 0x12, which means "bits 1 and 0 contain message class, and the
|
||||||
|
// class is 2". Note that this takes effect for the sender. In other
|
||||||
|
// words, messages sent by the phone with this change will end up on
|
||||||
|
// the receiver's SIM card. You can then send messages to yourself
|
||||||
|
// (on a phone with this change) and they'll end up on the SIM card.
|
||||||
bo.write(0x00);
|
bo.write(0x00);
|
||||||
|
|
||||||
// (no TP-Validity-Period)
|
// (no TP-Validity-Period)
|
||||||
@@ -558,9 +564,10 @@ public class SmsMessage extends SmsMessageBase{
|
|||||||
int offset = cur;
|
int offset = cur;
|
||||||
int userDataLength = pdu[offset++] & 0xff;
|
int userDataLength = pdu[offset++] & 0xff;
|
||||||
int headerSeptets = 0;
|
int headerSeptets = 0;
|
||||||
|
int userDataHeaderLength = 0;
|
||||||
|
|
||||||
if (hasUserDataHeader) {
|
if (hasUserDataHeader) {
|
||||||
int userDataHeaderLength = pdu[offset++] & 0xff;
|
userDataHeaderLength = pdu[offset++] & 0xff;
|
||||||
|
|
||||||
byte[] udh = new byte[userDataHeaderLength];
|
byte[] udh = new byte[userDataHeaderLength];
|
||||||
System.arraycopy(pdu, offset, udh, 0, userDataHeaderLength);
|
System.arraycopy(pdu, offset, udh, 0, userDataHeaderLength);
|
||||||
@@ -573,19 +580,34 @@ public class SmsMessage extends SmsMessageBase{
|
|||||||
mUserDataSeptetPadding = (headerSeptets * 7) - headerBits;
|
mUserDataSeptetPadding = (headerSeptets * 7) - headerBits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int bufferLen;
|
||||||
|
if (dataInSeptets) {
|
||||||
/*
|
/*
|
||||||
* Here we just create the user data length to be the remainder of
|
* Here we just create the user data length to be the remainder of
|
||||||
* the pdu minus the user data hearder. This is because the count
|
* the pdu minus the user data header, since userDataLength means
|
||||||
* could mean the number of uncompressed sepets if the userdata is
|
* the number of uncompressed sepets.
|
||||||
* encoded in 7-bit.
|
|
||||||
*/
|
*/
|
||||||
userData = new byte[pdu.length - offset];
|
bufferLen = pdu.length - offset;
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* userDataLength is the count of octets, so just subtract the
|
||||||
|
* user data header.
|
||||||
|
*/
|
||||||
|
bufferLen = userDataLength - (hasUserDataHeader ? (userDataHeaderLength + 1) : 0);
|
||||||
|
if (bufferLen < 0) {
|
||||||
|
bufferLen = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
userData = new byte[bufferLen];
|
||||||
System.arraycopy(pdu, offset, userData, 0, userData.length);
|
System.arraycopy(pdu, offset, userData, 0, userData.length);
|
||||||
cur = offset;
|
cur = offset;
|
||||||
|
|
||||||
if (dataInSeptets) {
|
if (dataInSeptets) {
|
||||||
// Return the number of septets
|
// Return the number of septets
|
||||||
return userDataLength - headerSeptets;
|
int count = userDataLength - headerSeptets;
|
||||||
|
// If count < 0, return 0 (means UDL was probably incorrect)
|
||||||
|
return count < 0 ? 0 : count;
|
||||||
} else {
|
} else {
|
||||||
// Return the number of octets
|
// Return the number of octets
|
||||||
return userData.length;
|
return userData.length;
|
||||||
|
|||||||
Reference in New Issue
Block a user