diff options
Diffstat (limited to 'telephony')
9 files changed, 94 insertions, 6 deletions
diff --git a/telephony/java/com/android/internal/telephony/CommandsInterface.java b/telephony/java/com/android/internal/telephony/CommandsInterface.java index d6e6ae0..dbef7f6 100644 --- a/telephony/java/com/android/internal/telephony/CommandsInterface.java +++ b/telephony/java/com/android/internal/telephony/CommandsInterface.java @@ -1641,4 +1641,9 @@ public interface CommandsInterface { * @param response a callback message with the String response in the obj field */ public void requestIsimAuthentication(String nonce, Message response); + /** + * @hide + * CM-specific: Ask the RIL about the presence of back-compat flags + */ + public boolean needsOldRilFeature(String feature); } diff --git a/telephony/java/com/android/internal/telephony/IccCard.java b/telephony/java/com/android/internal/telephony/IccCard.java index 88da408..288fc7a 100644 --- a/telephony/java/com/android/internal/telephony/IccCard.java +++ b/telephony/java/com/android/internal/telephony/IccCard.java @@ -765,7 +765,7 @@ public abstract class IccCard { return IccCard.State.PUK_REQUIRED; } if (app.app_state.isSubscriptionPersoEnabled() && - (!(this.mPhone.mCM.getClass() == HuaweiRIL.class) || + (!(this.mPhone.mCM.needsOldRilFeature("qcomuiccstack")) || app.perso_substate.isPersoSubStateNetworkLocked())) { return IccCard.State.NETWORK_LOCKED; } diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java index 8de4798..7468cd4 100644 --- a/telephony/java/com/android/internal/telephony/RIL.java +++ b/telephony/java/com/android/internal/telephony/RIL.java @@ -2966,7 +2966,8 @@ public class RIL extends BaseCommands implements CommandsInterface { return new IccIoResult(sw1, sw2, s); } - protected boolean needsOldRilFeature(String feature) { + @Override + public boolean needsOldRilFeature(String feature) { String[] features = SystemProperties.get("ro.telephony.ril.v3", "").split(","); for (String found: features) { if (found.equals(feature)) diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java b/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java index ca8d9ae..4387a17 100755 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java @@ -45,6 +45,7 @@ import com.android.internal.telephony.TelephonyProperties; import com.android.internal.telephony.WspTypeDecoder; import com.android.internal.telephony.cdma.sms.SmsEnvelope; import com.android.internal.telephony.cdma.sms.UserData; +import com.android.internal.util.BitwiseInputStream; import com.android.internal.util.HexDump; import java.io.ByteArrayOutputStream; @@ -181,10 +182,78 @@ final class CdmaSMSDispatcher extends SMSDispatcher { (SmsEnvelope.MESSAGE_TYPE_BROADCAST != sms.getMessageType())) { return Intents.RESULT_SMS_UNSUPPORTED; } - + /* + * Check to see if we have a Virgin Mobile MMS + * If so, do extra processsing for Virgin Mobile's non-standard format. + * Otherwise, dispatch normal message. + */ + if (sms.getOriginatingAddress().equals("9999999999")) { + Log.d(TAG, "Got a suspect SMS from the Virgin MMS originator"); + byte virginMMSPayload[] = null; + try { + int[] ourMessageRef = new int[1]; + virginMMSPayload = getVirginMMS(sms.getUserData(), ourMessageRef); + if (virginMMSPayload == null) { + Log.e(TAG, "Not a virgin MMS like we were expecting"); + throw new Exception("Not a Virgin MMS like we were expecting"); + } else { + Log.d(TAG, "Sending our deflowered MMS to processCdmaWapPdu"); + return processCdmaWapPdu(virginMMSPayload, ourMessageRef[0], "9999999999"); + } + } catch (Exception ourException) { + Log.e(TAG, "Got an exception trying to get VMUS MMS data " + ourException); + } + } return dispatchNormalMessage(smsb); } + private synchronized byte[] getVirginMMS(final byte[] someEncodedMMSData, int[] aMessageRef) throws Exception { + if ((aMessageRef == null) || (aMessageRef.length != 1)) { + throw new Exception("aMessageRef is not usable. Must be an int array with one element."); + } + BitwiseInputStream ourInputStream; + int i1=0; + int desiredBitLength; + Log.d(TAG, "mmsVirginGetMsgId"); + Log.d(TAG, "EncodedMMS: " + someEncodedMMSData); + try { + ourInputStream = new BitwiseInputStream(someEncodedMMSData); + ourInputStream.skip(20); + final int j = ourInputStream.read(8) << 8; + final int k = ourInputStream.read(8); + aMessageRef[0] = j | k; + Log.d(TAG, "MSGREF IS : " + aMessageRef[0]); + ourInputStream.skip(12); + i1 = ourInputStream.read(8) + -2; + ourInputStream.skip(13); + byte abyte1[] = new byte[i1]; + for (int j1 = 0; j1 < i1; j1++) { + abyte1[j1] = 0; + } + desiredBitLength = i1 * 8; + if (ourInputStream.available() < desiredBitLength) { + int availableBitLength = ourInputStream.available(); + Log.e(TAG, "mmsVirginGetMsgId inStream.available() = " + availableBitLength + " wantedBits = " + desiredBitLength); + throw new Exception("insufficient data (wanted " + desiredBitLength + " bits, but only have " + availableBitLength + ")"); + } + } catch (com.android.internal.util.BitwiseInputStream.AccessException ourException) { + final String ourExceptionText = "mmsVirginGetMsgId failed: " + ourException; + Log.e(TAG, ourExceptionText); + throw new Exception(ourExceptionText); + } + byte ret[] = null; + try { + ret = ourInputStream.readByteArray(desiredBitLength); + Log.d(TAG, "mmsVirginGetMsgId user_length = " + i1 + " msgid = " + aMessageRef[0]); + Log.d(TAG, "mmsVirginGetMsgId userdata = " + ret.toString()); + } catch (com.android.internal.util.BitwiseInputStream.AccessException ourException) { + final String ourExceptionText = "mmsVirginGetMsgId failed: " + ourException; + Log.e(TAG, ourExceptionText); + throw new Exception(ourExceptionText); + } + return ret; + } + /** * Processes inbound messages that are in the WAP-WDP PDU format. See * wap-259-wdp-20010614-a section 6.5 for details on the WAP-WDP PDU format. diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java index 963db2c..cbcedb4 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java @@ -475,6 +475,12 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { if (DBG) log("enableApnType: return APN_ALREADY_ACTIVE"); return Phone.APN_ALREADY_ACTIVE; } + if (mPhone.mCM.needsOldRilFeature("singlepdp") && !Phone.APN_TYPE_DEFAULT.equals(apnType)) { + ApnContext defContext = mApnContexts.get(Phone.APN_TYPE_DEFAULT); + if (defContext.isEnabled()) { + setEnabled(apnTypeToId(Phone.APN_TYPE_DEFAULT), false); + } + } setEnabled(apnTypeToId(apnType), true); if (DBG) { log("enableApnType: new apn request for type " + apnType + @@ -509,6 +515,9 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { if (apnContext != null) { setEnabled(apnTypeToId(type), false); + if (mPhone.mCM.needsOldRilFeature("singlepdp") && !Phone.APN_TYPE_DEFAULT.equals(type)) { + setEnabled(apnTypeToId(Phone.APN_TYPE_DEFAULT), true); + } if (apnContext.getState() != State.IDLE && apnContext.getState() != State.FAILED) { if (DBG) log("diableApnType: return APN_REQUEST_STARTED"); return Phone.APN_REQUEST_STARTED; @@ -2458,4 +2467,5 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { protected void loge(String s) { Log.e(LOG_TAG, "[GsmDCT] " + s); } + } diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java index 9e8a830..8ddbc5c 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java @@ -610,7 +610,7 @@ final class GsmServiceStateTracker extends ServiceStateTracker { regState = Integer.parseInt(states[0]); // states[3] (if present) is the current radio technology - if (states.length >= 4 && states[3] != null) { + if (states.length >= 4 && states[3] != null && !states[3].equals("")) { type = Integer.parseInt(states[3]); } if ((states.length >= 5 ) && (regState == 3)) { diff --git a/telephony/java/com/android/internal/telephony/gsm/SIMFileHandler.java b/telephony/java/com/android/internal/telephony/gsm/SIMFileHandler.java index 2fdf670..3a5af31 100644 --- a/telephony/java/com/android/internal/telephony/gsm/SIMFileHandler.java +++ b/telephony/java/com/android/internal/telephony/gsm/SIMFileHandler.java @@ -19,7 +19,6 @@ package com.android.internal.telephony.gsm; import android.os.Message; import android.util.Log; -import com.android.internal.telephony.HuaweiRIL; import com.android.internal.telephony.IccCard; import com.android.internal.telephony.IccCardApplication; import com.android.internal.telephony.IccConstants; @@ -58,7 +57,7 @@ public final class SIMFileHandler extends IccFileHandler implements IccConstants } protected String getEFPath(int efid) { - if (phone.mCM.getClass() == HuaweiRIL.class) { + if (phone.mCM.needsOldRilFeature("qcomuiccstack")) { IccCard icccard = phone.getIccCard(); if (icccard != null && icccard.isApplicationOnIcc(IccCardApplication.AppType.APPTYPE_USIM)) return getEFPathForUICC(efid); diff --git a/telephony/java/com/android/internal/telephony/sip/SipCommandInterface.java b/telephony/java/com/android/internal/telephony/sip/SipCommandInterface.java index ab01012..583b1a5 100644 --- a/telephony/java/com/android/internal/telephony/sip/SipCommandInterface.java +++ b/telephony/java/com/android/internal/telephony/sip/SipCommandInterface.java @@ -412,4 +412,6 @@ class SipCommandInterface extends BaseCommands implements CommandsInterface { public void requestIsimAuthentication(String nonce, Message response) { } + + public boolean needsOldRilFeature(String feature) { return false; } } diff --git a/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java b/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java index a0c7d5d..710faa6 100644 --- a/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java +++ b/telephony/java/com/android/internal/telephony/test/SimulatedCommands.java @@ -1517,4 +1517,6 @@ public final class SimulatedCommands extends BaseCommands public void requestIsimAuthentication(String nonce, Message response) { unimplemented(response); } + + public boolean needsOldRilFeature(String feature) { return false; } } |