Have SmsMessage use getCurrentPhoneType
Although our first tablet doesn't support SMS messages there are testing scenarios where they can be used. To preserve proper behavior now that getPhoneType can return PHONE_TYPE_NONE use getCurrentPhoneType. bug: 3198435 Change-Id: I48ef294f563351c66971b4e89e6dcb3326b0ae92
This commit is contained in:
@@ -124,7 +124,7 @@ public class SmsMessage {
|
||||
*/
|
||||
public static SmsMessage createFromPdu(byte[] pdu) {
|
||||
SmsMessageBase wrappedMessage;
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.createFromPdu(pdu);
|
||||
@@ -146,7 +146,7 @@ public class SmsMessage {
|
||||
*/
|
||||
public static SmsMessage newFromCMT(String[] lines){
|
||||
SmsMessageBase wrappedMessage;
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.newFromCMT(lines);
|
||||
@@ -160,7 +160,7 @@ public class SmsMessage {
|
||||
/** @hide */
|
||||
protected static SmsMessage newFromCMTI(String line) {
|
||||
SmsMessageBase wrappedMessage;
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.newFromCMTI(line);
|
||||
@@ -174,7 +174,7 @@ public class SmsMessage {
|
||||
/** @hide */
|
||||
public static SmsMessage newFromCDS(String line) {
|
||||
SmsMessageBase wrappedMessage;
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.newFromCDS(line);
|
||||
@@ -188,7 +188,7 @@ public class SmsMessage {
|
||||
/** @hide */
|
||||
public static SmsMessage newFromParcel(Parcel p) {
|
||||
SmsMessageBase wrappedMessage;
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.newFromParcel(p);
|
||||
@@ -211,7 +211,7 @@ public class SmsMessage {
|
||||
*/
|
||||
public static SmsMessage createFromEfRecord(int index, byte[] data) {
|
||||
SmsMessageBase wrappedMessage;
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.createFromEfRecord(
|
||||
@@ -229,7 +229,7 @@ public class SmsMessage {
|
||||
* length in bytes (not hex chars) less the SMSC header
|
||||
*/
|
||||
public static int getTPLayerLengthForPDU(String pdu) {
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
return com.android.internal.telephony.cdma.SmsMessage.getTPLayerLengthForPDU(pdu);
|
||||
@@ -265,7 +265,7 @@ public class SmsMessage {
|
||||
* class).
|
||||
*/
|
||||
public static int[] calculateLength(CharSequence msgBody, boolean use7bitOnly) {
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
TextEncodingDetails ted = (PHONE_TYPE_CDMA == activePhone) ?
|
||||
com.android.internal.telephony.cdma.SmsMessage.calculateLength(msgBody, use7bitOnly) :
|
||||
com.android.internal.telephony.gsm.SmsMessage.calculateLength(msgBody, use7bitOnly);
|
||||
@@ -288,7 +288,7 @@ public class SmsMessage {
|
||||
* @hide
|
||||
*/
|
||||
public static ArrayList<String> fragmentText(String text) {
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
TextEncodingDetails ted = (PHONE_TYPE_CDMA == activePhone) ?
|
||||
com.android.internal.telephony.cdma.SmsMessage.calculateLength(text, false) :
|
||||
com.android.internal.telephony.gsm.SmsMessage.calculateLength(text, false);
|
||||
@@ -385,7 +385,7 @@ public class SmsMessage {
|
||||
String destinationAddress, String message,
|
||||
boolean statusReportRequested, byte[] header) {
|
||||
SubmitPduBase spb;
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
spb = com.android.internal.telephony.cdma.SmsMessage.getSubmitPdu(scAddress,
|
||||
@@ -410,7 +410,7 @@ public class SmsMessage {
|
||||
public static SubmitPdu getSubmitPdu(String scAddress,
|
||||
String destinationAddress, String message, boolean statusReportRequested) {
|
||||
SubmitPduBase spb;
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
spb = com.android.internal.telephony.cdma.SmsMessage.getSubmitPdu(scAddress,
|
||||
@@ -439,7 +439,7 @@ public class SmsMessage {
|
||||
String destinationAddress, short destinationPort, byte[] data,
|
||||
boolean statusReportRequested) {
|
||||
SubmitPduBase spb;
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
spb = com.android.internal.telephony.cdma.SmsMessage.getSubmitPdu(scAddress,
|
||||
@@ -708,7 +708,7 @@ public class SmsMessage {
|
||||
* @hide
|
||||
*/
|
||||
private static final SmsMessageBase getSmsFacility(){
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
return new com.android.internal.telephony.cdma.SmsMessage();
|
||||
} else {
|
||||
|
||||
@@ -154,7 +154,7 @@ public class SmsMessage {
|
||||
@Deprecated
|
||||
public static SmsMessage createFromPdu(byte[] pdu) {
|
||||
SmsMessageBase wrappedMessage;
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.createFromPdu(pdu);
|
||||
@@ -177,7 +177,7 @@ public class SmsMessage {
|
||||
@Deprecated
|
||||
public static SmsMessage newFromCMT(String[] lines){
|
||||
SmsMessageBase wrappedMessage;
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.newFromCMT(lines);
|
||||
@@ -193,7 +193,7 @@ public class SmsMessage {
|
||||
@Deprecated
|
||||
protected static SmsMessage newFromCMTI(String line) {
|
||||
SmsMessageBase wrappedMessage;
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.newFromCMTI(line);
|
||||
@@ -209,7 +209,7 @@ public class SmsMessage {
|
||||
@Deprecated
|
||||
public static SmsMessage newFromCDS(String line) {
|
||||
SmsMessageBase wrappedMessage;
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.newFromCDS(line);
|
||||
@@ -225,7 +225,7 @@ public class SmsMessage {
|
||||
@Deprecated
|
||||
public static SmsMessage newFromParcel(Parcel p) {
|
||||
SmsMessageBase wrappedMessage;
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.newFromParcel(p);
|
||||
@@ -250,7 +250,7 @@ public class SmsMessage {
|
||||
@Deprecated
|
||||
public static SmsMessage createFromEfRecord(int index, byte[] data) {
|
||||
SmsMessageBase wrappedMessage;
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
wrappedMessage = com.android.internal.telephony.cdma.SmsMessage.createFromEfRecord(
|
||||
@@ -270,7 +270,7 @@ public class SmsMessage {
|
||||
*/
|
||||
@Deprecated
|
||||
public static int getTPLayerLengthForPDU(String pdu) {
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
return com.android.internal.telephony.cdma.SmsMessage.getTPLayerLengthForPDU(pdu);
|
||||
@@ -367,7 +367,7 @@ public class SmsMessage {
|
||||
String destinationAddress, String message,
|
||||
boolean statusReportRequested, byte[] header) {
|
||||
SubmitPduBase spb;
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
spb = com.android.internal.telephony.cdma.SmsMessage.getSubmitPdu(scAddress,
|
||||
@@ -394,7 +394,7 @@ public class SmsMessage {
|
||||
public static SubmitPdu getSubmitPdu(String scAddress,
|
||||
String destinationAddress, String message, boolean statusReportRequested) {
|
||||
SubmitPduBase spb;
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
spb = com.android.internal.telephony.cdma.SmsMessage.getSubmitPdu(scAddress,
|
||||
@@ -425,7 +425,7 @@ public class SmsMessage {
|
||||
String destinationAddress, short destinationPort, byte[] data,
|
||||
boolean statusReportRequested) {
|
||||
SubmitPduBase spb;
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
spb = com.android.internal.telephony.cdma.SmsMessage.getSubmitPdu(scAddress,
|
||||
@@ -739,7 +739,7 @@ public class SmsMessage {
|
||||
* @deprecated Use android.telephony.SmsMessage.
|
||||
*/
|
||||
private static final SmsMessageBase getSmsFacility(){
|
||||
int activePhone = TelephonyManager.getDefault().getPhoneType();
|
||||
int activePhone = TelephonyManager.getDefault().getCurrentPhoneType();
|
||||
if (PHONE_TYPE_CDMA == activePhone) {
|
||||
return new com.android.internal.telephony.cdma.SmsMessage();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user