Merge "Telephony: Fix the failure of copying SMS to SIM card for sub2"
am: 7eca824ce3
Change-Id: I153e490abc6a37fabfdb51fddc195ed15cec85fb
This commit is contained in:
@@ -463,9 +463,28 @@ public class SmsMessage {
|
||||
*/
|
||||
public static SubmitPdu getSubmitPdu(String scAddress,
|
||||
String destinationAddress, String message, boolean statusReportRequested) {
|
||||
SubmitPduBase spb;
|
||||
return getSubmitPdu(scAddress, destinationAddress, message, statusReportRequested,
|
||||
SubscriptionManager.getDefaultSmsSubscriptionId());
|
||||
}
|
||||
|
||||
if (useCdmaFormatForMoSms()) {
|
||||
/**
|
||||
* 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 destinationAddress the address of the destination for the message.
|
||||
* @param message String representation of the message payload.
|
||||
* @param statusReportRequested Indicates whether a report is requested for this message.
|
||||
* @param subId 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 subId) {
|
||||
SubmitPduBase spb;
|
||||
if (useCdmaFormatForMoSms(subId)) {
|
||||
spb = com.android.internal.telephony.cdma.SmsMessage.getSubmitPdu(scAddress,
|
||||
destinationAddress, message, statusReportRequested, null);
|
||||
} else {
|
||||
@@ -758,12 +777,27 @@ public class SmsMessage {
|
||||
* @return true if Cdma format should be used for MO SMS, false otherwise.
|
||||
*/
|
||||
private static boolean useCdmaFormatForMoSms() {
|
||||
if (!SmsManager.getDefault().isImsSmsSupported()) {
|
||||
// IMS is registered with SMS support, check the SMS format supported
|
||||
return useCdmaFormatForMoSms(SubscriptionManager.getDefaultSmsSubscriptionId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 subId Subscription for which phone type is returned.
|
||||
*
|
||||
* @return true if Cdma format should be used for MO SMS, false otherwise.
|
||||
*/
|
||||
private static boolean useCdmaFormatForMoSms(int subId) {
|
||||
SmsManager smsManager = SmsManager.getSmsManagerForSubscriptionId(subId);
|
||||
if (!smsManager.isImsSmsSupported()) {
|
||||
// use Voice technology to determine SMS format.
|
||||
return isCdmaVoice();
|
||||
return isCdmaVoice(subId);
|
||||
}
|
||||
// IMS is registered with SMS support, check the SMS format supported
|
||||
return (SmsConstants.FORMAT_3GPP2.equals(SmsManager.getDefault().getImsSmsFormat()));
|
||||
return (SmsConstants.FORMAT_3GPP2.equals(smsManager.getImsSmsFormat()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -772,10 +806,18 @@ public class SmsMessage {
|
||||
* @return true if current phone type is cdma, false otherwise.
|
||||
*/
|
||||
private static boolean isCdmaVoice() {
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
return (PHONE_TYPE_CDMA == activePhone);
|
||||
return isCdmaVoice(SubscriptionManager.getDefaultSmsSubscriptionId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether or not to current phone type is cdma
|
||||
*
|
||||
* @return true if current phone type is cdma, false otherwise.
|
||||
*/
|
||||
private static boolean isCdmaVoice(int subId) {
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType(subId);
|
||||
return (PHONE_TYPE_CDMA == activePhone);
|
||||
}
|
||||
/**
|
||||
* Decide if the carrier supports long SMS.
|
||||
* {@hide}
|
||||
|
||||
Reference in New Issue
Block a user