Loading src/java/android/telephony/MSimSmsManager.java +25 −3 Original line number Diff line number Diff line Loading @@ -550,7 +550,7 @@ public class MSimSmsManager { // ignore it } return createMessageListFromRawRecords(records); return createMessageListFromRawRecords(records, subscription); } /** Loading Loading @@ -702,7 +702,8 @@ public class MSimSmsManager { * <code>getAllMessagesFromIcc</code> * @return <code>ArrayList</code> of <code>SmsMessage</code> objects. */ private static ArrayList<SmsMessage> createMessageListFromRawRecords(List<SmsRawData> records) { private static ArrayList<SmsMessage> createMessageListFromRawRecords(List<SmsRawData> records, int subscription) { ArrayList<SmsMessage> messages = new ArrayList<SmsMessage>(); if (records != null) { int count = records.size(); Loading @@ -710,7 +711,8 @@ public class MSimSmsManager { SmsRawData data = records.get(i); // List contains all records, including "free" records (null) if (data != null) { SmsMessage sms = SmsMessage.createFromEfRecord(i+1, data.getBytes()); SmsMessage sms = SmsMessage.createFromEfRecord(i+1, data.getBytes(), subscription); if (sms != null) { messages.add(sms); } Loading Loading @@ -802,6 +804,26 @@ public class MSimSmsManager { return false; } } /** * Get the capacity count of sms on Icc card * * @return the capacity count of sms on Icc card * @hide */ public static int getSmsCapacityOnIcc(int subscription) { int ret = -1; try { ISmsMSim iccISms = ISmsMSim.Stub.asInterface(ServiceManager.getService("isms_msim")); if (iccISms != null) { ret = iccISms.getSmsCapacityOnIcc(subscription); } } catch (RemoteException ex) { //ignore it } return ret; } // see SmsMessage.getStatusOnIcc /** Free space (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). */ Loading src/java/android/telephony/SmsManager.java +19 −0 Original line number Diff line number Diff line Loading @@ -787,6 +787,25 @@ public final class SmsManager { return format; } /** * Get the capacity count of sms on Icc card * * @return the capacity count of sms on Icc card * @hide */ public static int getSmsCapacityOnIcc() { int ret = -1; try { ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms")); if (iccISms != null) { ret = iccISms.getSmsCapacityOnIcc(); } } catch (RemoteException ex) { //ignore it } return ret; } // see SmsMessage.getStatusOnIcc /** Free space (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). */ Loading src/java/android/telephony/SmsMessage.java +94 −0 Original line number Diff line number Diff line Loading @@ -264,6 +264,31 @@ public class SmsMessage { return wrappedMessage != null ? new SmsMessage(wrappedMessage) : null; } /** * Create an SmsMessage from an SMS EF record. * * @param index Index of SMS record. This should be index in ArrayList * returned by SmsManager.getAllMessagesFromSim + 1. * @param data Record data. * @param sub Subscription index of the SMS * @return An SmsMessage representing the record. * * @hide */ public static SmsMessage createFromEfRecord(int index, byte[] data, int sub) { SmsMessageBase wrappedMessage; if (isCdmaVoice(sub)) { wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.createFromEfRecord( index, data); } else { wrappedMessage = com.android.internal.telephony.gsm.SmsMessage.createFromEfRecord( index, data); } return wrappedMessage != null ? new SmsMessage(wrappedMessage) : null; } /** * Get the TP-Layer-Length for the given SMS-SUBMIT PDU Basically, the * length in bytes (not hex chars) less the SMSC header Loading Loading @@ -456,6 +481,33 @@ public class SmsMessage { return new SubmitPdu(spb); } /** * Get an SMS-SUBMIT PDU for a destination address and a message. * This method will not attempt to use any GSM national language 7 bit encodings. * * @param scAddress Service Centre address. Null means use default. * @param sub Subscription of the message * @return a <code>SubmitPdu</code> containing the encoded SC * address, if applicable, and the encoded message. * Returns null on encode error. * * @hide */ public static SubmitPdu getSubmitPdu(String scAddress, String destinationAddress, String message, boolean statusReportRequested, int sub) { SubmitPduBase spb; if (useCdmaFormatForMoSms(sub)) { spb = com.android.internal.telephony.cdma.SmsMessage.getSubmitPdu(scAddress, destinationAddress, message, statusReportRequested, null); } else { spb = com.android.internal.telephony.gsm.SmsMessage.getSubmitPdu(scAddress, destinationAddress, message, statusReportRequested); } return new SubmitPdu(spb); } /** * Get an SMS-SUBMIT PDU for a data message to a destination address & port. * This method will not attempt to use any GSM national language 7 bit encodings. Loading Loading @@ -746,6 +798,26 @@ public class SmsMessage { return (SmsConstants.FORMAT_3GPP2.equals(SmsManager.getDefault().getImsSmsFormat())); } /** * Determines whether or not to use CDMA format for MO SMS. * If SMS over IMS is supported, then format is based on IMS SMS format, * otherwise format is based on current phone type. * * @param sub Subscription for which phone type is returned. * * @return true if Cdma format should be used for MO SMS, false otherwise. * * @hide */ private static boolean useCdmaFormatForMoSms(int sub) { if (!MSimSmsManager.getDefault().isImsSmsSupported(sub)) { // use Voice technology to determine SMS format. return isCdmaVoice(sub); } // IMS is registered with SMS support, check the SMS format supported return (SmsConstants.FORMAT_3GPP2.equals(MSimSmsManager.getDefault().getImsSmsFormat(sub))); } /** * Determines whether or not to current phone type is cdma. * Loading @@ -755,4 +827,26 @@ public class SmsMessage { int activePhone = TelephonyManager.getDefault().getCurrentPhoneType(); return (PHONE_TYPE_CDMA == activePhone); } /** * Determines whether or not to current phone type is cdma for given susbcription. * * @param subscription Subscription for which phone type is returned * @return true if current phone type is cdma, false otherwise. * * @hide */ private static boolean isCdmaVoice(int subscription) { int activePhone = MSimTelephonyManager.getDefault().getCurrentPhoneType(subscription); return (PHONE_TYPE_CDMA == activePhone); } /** * {@hide} * Returns the recipient address(receiver) of this SMS message in String form or null if * unavailable. */ public String getRecipientAddress() { return mWrappedSmsMessage.getRecipientAddress(); } } src/java/com/android/internal/telephony/CallManager.java +15 −2 Original line number Diff line number Diff line Loading @@ -2282,7 +2282,20 @@ public class CallManager { return false; } public void deactivateLchState(int sub) { Rlog.e(LOG_TAG, " deactivateLchState not supported"); public void startDtmf(char c, int subscription) { Rlog.e(LOG_TAG, " startDtmf not supported for subscription"); } public void stopDtmf(int subscription) { Rlog.e(LOG_TAG, " stopDtmf not supported for subscription"); } public void setSubInConversation(int subscription) { Rlog.e(LOG_TAG, " setSubInConversation not supported"); } public int getSubInConversation() { Rlog.e(LOG_TAG, " getSubInConversation not supported"); return 0; } } src/java/com/android/internal/telephony/CommandException.java +11 −1 Original line number Diff line number Diff line Loading @@ -42,6 +42,9 @@ public class CommandException extends RuntimeException { MODE_NOT_SUPPORTED, FDN_CHECK_FAILURE, ILLEGAL_SIM_OR_ME, MISSING_RESOURCE, NO_SUCH_ELEMENT, INVALID_PARAMETER, DIAL_MODIFIED_TO_USSD, DIAL_MODIFIED_TO_SS, DIAL_MODIFIED_TO_DIAL, Loading @@ -62,7 +65,8 @@ public class CommandException extends RuntimeException { public static CommandException fromRilErrno(int ril_errno) { switch(ril_errno) { case RILConstants.SUCCESS: return null; case RILConstants.SUCCESS: return null; case RILConstants.RIL_ERRNO_INVALID_RESPONSE: return new CommandException(Error.INVALID_RESPONSE); case RILConstants.RADIO_NOT_AVAILABLE: Loading Loading @@ -93,6 +97,12 @@ public class CommandException extends RuntimeException { return new CommandException(Error.FDN_CHECK_FAILURE); case RILConstants.ILLEGAL_SIM_OR_ME: return new CommandException(Error.ILLEGAL_SIM_OR_ME); case RILConstants.MISSING_RESOURCE: return new CommandException(Error.MISSING_RESOURCE); case RILConstants.NO_SUCH_ELEMENT: return new CommandException(Error.NO_SUCH_ELEMENT); case RILConstants.INVALID_PARAMETER: return new CommandException(Error.INVALID_PARAMETER); case RILConstants.DIAL_MODIFIED_TO_USSD: return new CommandException(Error.DIAL_MODIFIED_TO_USSD); case RILConstants.DIAL_MODIFIED_TO_SS: Loading Loading
src/java/android/telephony/MSimSmsManager.java +25 −3 Original line number Diff line number Diff line Loading @@ -550,7 +550,7 @@ public class MSimSmsManager { // ignore it } return createMessageListFromRawRecords(records); return createMessageListFromRawRecords(records, subscription); } /** Loading Loading @@ -702,7 +702,8 @@ public class MSimSmsManager { * <code>getAllMessagesFromIcc</code> * @return <code>ArrayList</code> of <code>SmsMessage</code> objects. */ private static ArrayList<SmsMessage> createMessageListFromRawRecords(List<SmsRawData> records) { private static ArrayList<SmsMessage> createMessageListFromRawRecords(List<SmsRawData> records, int subscription) { ArrayList<SmsMessage> messages = new ArrayList<SmsMessage>(); if (records != null) { int count = records.size(); Loading @@ -710,7 +711,8 @@ public class MSimSmsManager { SmsRawData data = records.get(i); // List contains all records, including "free" records (null) if (data != null) { SmsMessage sms = SmsMessage.createFromEfRecord(i+1, data.getBytes()); SmsMessage sms = SmsMessage.createFromEfRecord(i+1, data.getBytes(), subscription); if (sms != null) { messages.add(sms); } Loading Loading @@ -802,6 +804,26 @@ public class MSimSmsManager { return false; } } /** * Get the capacity count of sms on Icc card * * @return the capacity count of sms on Icc card * @hide */ public static int getSmsCapacityOnIcc(int subscription) { int ret = -1; try { ISmsMSim iccISms = ISmsMSim.Stub.asInterface(ServiceManager.getService("isms_msim")); if (iccISms != null) { ret = iccISms.getSmsCapacityOnIcc(subscription); } } catch (RemoteException ex) { //ignore it } return ret; } // see SmsMessage.getStatusOnIcc /** Free space (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). */ Loading
src/java/android/telephony/SmsManager.java +19 −0 Original line number Diff line number Diff line Loading @@ -787,6 +787,25 @@ public final class SmsManager { return format; } /** * Get the capacity count of sms on Icc card * * @return the capacity count of sms on Icc card * @hide */ public static int getSmsCapacityOnIcc() { int ret = -1; try { ISms iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms")); if (iccISms != null) { ret = iccISms.getSmsCapacityOnIcc(); } } catch (RemoteException ex) { //ignore it } return ret; } // see SmsMessage.getStatusOnIcc /** Free space (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). */ Loading
src/java/android/telephony/SmsMessage.java +94 −0 Original line number Diff line number Diff line Loading @@ -264,6 +264,31 @@ public class SmsMessage { return wrappedMessage != null ? new SmsMessage(wrappedMessage) : null; } /** * Create an SmsMessage from an SMS EF record. * * @param index Index of SMS record. This should be index in ArrayList * returned by SmsManager.getAllMessagesFromSim + 1. * @param data Record data. * @param sub Subscription index of the SMS * @return An SmsMessage representing the record. * * @hide */ public static SmsMessage createFromEfRecord(int index, byte[] data, int sub) { SmsMessageBase wrappedMessage; if (isCdmaVoice(sub)) { wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.createFromEfRecord( index, data); } else { wrappedMessage = com.android.internal.telephony.gsm.SmsMessage.createFromEfRecord( index, data); } return wrappedMessage != null ? new SmsMessage(wrappedMessage) : null; } /** * Get the TP-Layer-Length for the given SMS-SUBMIT PDU Basically, the * length in bytes (not hex chars) less the SMSC header Loading Loading @@ -456,6 +481,33 @@ public class SmsMessage { return new SubmitPdu(spb); } /** * Get an SMS-SUBMIT PDU for a destination address and a message. * This method will not attempt to use any GSM national language 7 bit encodings. * * @param scAddress Service Centre address. Null means use default. * @param sub Subscription of the message * @return a <code>SubmitPdu</code> containing the encoded SC * address, if applicable, and the encoded message. * Returns null on encode error. * * @hide */ public static SubmitPdu getSubmitPdu(String scAddress, String destinationAddress, String message, boolean statusReportRequested, int sub) { SubmitPduBase spb; if (useCdmaFormatForMoSms(sub)) { spb = com.android.internal.telephony.cdma.SmsMessage.getSubmitPdu(scAddress, destinationAddress, message, statusReportRequested, null); } else { spb = com.android.internal.telephony.gsm.SmsMessage.getSubmitPdu(scAddress, destinationAddress, message, statusReportRequested); } return new SubmitPdu(spb); } /** * Get an SMS-SUBMIT PDU for a data message to a destination address & port. * This method will not attempt to use any GSM national language 7 bit encodings. Loading Loading @@ -746,6 +798,26 @@ public class SmsMessage { return (SmsConstants.FORMAT_3GPP2.equals(SmsManager.getDefault().getImsSmsFormat())); } /** * Determines whether or not to use CDMA format for MO SMS. * If SMS over IMS is supported, then format is based on IMS SMS format, * otherwise format is based on current phone type. * * @param sub Subscription for which phone type is returned. * * @return true if Cdma format should be used for MO SMS, false otherwise. * * @hide */ private static boolean useCdmaFormatForMoSms(int sub) { if (!MSimSmsManager.getDefault().isImsSmsSupported(sub)) { // use Voice technology to determine SMS format. return isCdmaVoice(sub); } // IMS is registered with SMS support, check the SMS format supported return (SmsConstants.FORMAT_3GPP2.equals(MSimSmsManager.getDefault().getImsSmsFormat(sub))); } /** * Determines whether or not to current phone type is cdma. * Loading @@ -755,4 +827,26 @@ public class SmsMessage { int activePhone = TelephonyManager.getDefault().getCurrentPhoneType(); return (PHONE_TYPE_CDMA == activePhone); } /** * Determines whether or not to current phone type is cdma for given susbcription. * * @param subscription Subscription for which phone type is returned * @return true if current phone type is cdma, false otherwise. * * @hide */ private static boolean isCdmaVoice(int subscription) { int activePhone = MSimTelephonyManager.getDefault().getCurrentPhoneType(subscription); return (PHONE_TYPE_CDMA == activePhone); } /** * {@hide} * Returns the recipient address(receiver) of this SMS message in String form or null if * unavailable. */ public String getRecipientAddress() { return mWrappedSmsMessage.getRecipientAddress(); } }
src/java/com/android/internal/telephony/CallManager.java +15 −2 Original line number Diff line number Diff line Loading @@ -2282,7 +2282,20 @@ public class CallManager { return false; } public void deactivateLchState(int sub) { Rlog.e(LOG_TAG, " deactivateLchState not supported"); public void startDtmf(char c, int subscription) { Rlog.e(LOG_TAG, " startDtmf not supported for subscription"); } public void stopDtmf(int subscription) { Rlog.e(LOG_TAG, " stopDtmf not supported for subscription"); } public void setSubInConversation(int subscription) { Rlog.e(LOG_TAG, " setSubInConversation not supported"); } public int getSubInConversation() { Rlog.e(LOG_TAG, " getSubInConversation not supported"); return 0; } }
src/java/com/android/internal/telephony/CommandException.java +11 −1 Original line number Diff line number Diff line Loading @@ -42,6 +42,9 @@ public class CommandException extends RuntimeException { MODE_NOT_SUPPORTED, FDN_CHECK_FAILURE, ILLEGAL_SIM_OR_ME, MISSING_RESOURCE, NO_SUCH_ELEMENT, INVALID_PARAMETER, DIAL_MODIFIED_TO_USSD, DIAL_MODIFIED_TO_SS, DIAL_MODIFIED_TO_DIAL, Loading @@ -62,7 +65,8 @@ public class CommandException extends RuntimeException { public static CommandException fromRilErrno(int ril_errno) { switch(ril_errno) { case RILConstants.SUCCESS: return null; case RILConstants.SUCCESS: return null; case RILConstants.RIL_ERRNO_INVALID_RESPONSE: return new CommandException(Error.INVALID_RESPONSE); case RILConstants.RADIO_NOT_AVAILABLE: Loading Loading @@ -93,6 +97,12 @@ public class CommandException extends RuntimeException { return new CommandException(Error.FDN_CHECK_FAILURE); case RILConstants.ILLEGAL_SIM_OR_ME: return new CommandException(Error.ILLEGAL_SIM_OR_ME); case RILConstants.MISSING_RESOURCE: return new CommandException(Error.MISSING_RESOURCE); case RILConstants.NO_SUCH_ELEMENT: return new CommandException(Error.NO_SUCH_ELEMENT); case RILConstants.INVALID_PARAMETER: return new CommandException(Error.INVALID_PARAMETER); case RILConstants.DIAL_MODIFIED_TO_USSD: return new CommandException(Error.DIAL_MODIFIED_TO_USSD); case RILConstants.DIAL_MODIFIED_TO_SS: Loading