Messaging: Remove unused code
Change-Id: I8093bb3e305ae323f7069bf42f9e83f8c8647cc7
This commit is contained in:
@@ -17,27 +17,19 @@
|
||||
|
||||
package com.android.messaging.sms;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.XmlResourceParser;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.provider.Telephony;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.messaging.R;
|
||||
import com.android.messaging.datamodel.data.ParticipantData;
|
||||
import com.android.messaging.util.LogUtil;
|
||||
import com.android.messaging.util.PhoneUtils;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
* Database helper class for looking up APNs. This database has a single table
|
||||
@@ -86,61 +78,7 @@ public class ApnDatabase extends SQLiteOpenHelper {
|
||||
Telephony.Carriers.MVNO_MATCH_DATA + " TEXT," +
|
||||
Telephony.Carriers.SUBSCRIPTION_ID + " INTEGER DEFAULT " +
|
||||
ParticipantData.DEFAULT_SELF_SUB_ID + ");";
|
||||
|
||||
public static final String[] APN_PROJECTION = {
|
||||
Telephony.Carriers.TYPE, // 0
|
||||
Telephony.Carriers.MMSC, // 1
|
||||
Telephony.Carriers.MMSPROXY, // 2
|
||||
Telephony.Carriers.MMSPORT, // 3
|
||||
Telephony.Carriers._ID, // 4
|
||||
Telephony.Carriers.CURRENT, // 5
|
||||
Telephony.Carriers.NUMERIC, // 6
|
||||
Telephony.Carriers.NAME, // 7
|
||||
Telephony.Carriers.MCC, // 8
|
||||
Telephony.Carriers.MNC, // 9
|
||||
Telephony.Carriers.APN, // 10
|
||||
Telephony.Carriers.SUBSCRIPTION_ID // 11
|
||||
};
|
||||
|
||||
public static final int COLUMN_TYPE = 0;
|
||||
public static final int COLUMN_MMSC = 1;
|
||||
public static final int COLUMN_MMSPROXY = 2;
|
||||
public static final int COLUMN_MMSPORT = 3;
|
||||
public static final int COLUMN_ID = 4;
|
||||
public static final int COLUMN_CURRENT = 5;
|
||||
public static final int COLUMN_NUMERIC = 6;
|
||||
public static final int COLUMN_NAME = 7;
|
||||
public static final int COLUMN_MCC = 8;
|
||||
public static final int COLUMN_MNC = 9;
|
||||
public static final int COLUMN_APN = 10;
|
||||
public static final int COLUMN_SUB_ID = 11;
|
||||
|
||||
public static final String[] APN_FULL_PROJECTION = {
|
||||
Telephony.Carriers.NAME,
|
||||
Telephony.Carriers.MCC,
|
||||
Telephony.Carriers.MNC,
|
||||
Telephony.Carriers.APN,
|
||||
Telephony.Carriers.USER,
|
||||
Telephony.Carriers.SERVER,
|
||||
Telephony.Carriers.PASSWORD,
|
||||
Telephony.Carriers.PROXY,
|
||||
Telephony.Carriers.PORT,
|
||||
Telephony.Carriers.MMSC,
|
||||
Telephony.Carriers.MMSPROXY,
|
||||
Telephony.Carriers.MMSPORT,
|
||||
Telephony.Carriers.AUTH_TYPE,
|
||||
Telephony.Carriers.TYPE,
|
||||
Telephony.Carriers.PROTOCOL,
|
||||
Telephony.Carriers.ROAMING_PROTOCOL,
|
||||
Telephony.Carriers.CARRIER_ENABLED,
|
||||
Telephony.Carriers.BEARER,
|
||||
Telephony.Carriers.MVNO_TYPE,
|
||||
Telephony.Carriers.MVNO_MATCH_DATA,
|
||||
Telephony.Carriers.CURRENT,
|
||||
Telephony.Carriers.SUBSCRIPTION_ID,
|
||||
};
|
||||
|
||||
private static final String CURRENT_SELECTION = Telephony.Carriers.CURRENT + " NOT NULL";
|
||||
public static final int COLUMN_ID = 4;
|
||||
|
||||
/**
|
||||
* ApnDatabase is initialized asynchronously from the application.onCreate
|
||||
@@ -178,105 +116,6 @@ public class ApnDatabase extends SQLiteOpenHelper {
|
||||
rebuildTables(db);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a copy of user changes in the old table
|
||||
*
|
||||
* @return The list of user changed apns
|
||||
*/
|
||||
public static List<ContentValues> loadUserDataFromOldTable(final SQLiteDatabase db) {
|
||||
try (Cursor cursor = db.query(APN_TABLE,
|
||||
APN_FULL_PROJECTION, CURRENT_SELECTION,
|
||||
null/*selectionArgs*/,
|
||||
null/*groupBy*/, null/*having*/, null/*orderBy*/)) {
|
||||
if (cursor != null) {
|
||||
final List<ContentValues> result = Lists.newArrayList();
|
||||
while (cursor.moveToNext()) {
|
||||
final ContentValues row = cursorToValues(cursor);
|
||||
if (row != null) {
|
||||
result.add(row);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
} catch (final SQLiteException e) {
|
||||
LogUtil.w(TAG, "ApnDatabase.loadUserDataFromOldTable: no old user data: " + e, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final String[] ID_PROJECTION = new String[]{Telephony.Carriers._ID};
|
||||
|
||||
private static final String ID_SELECTION = Telephony.Carriers._ID + "=?";
|
||||
|
||||
/**
|
||||
* Store use changes of old table into the new apn table
|
||||
*
|
||||
* @param data The user changes
|
||||
*/
|
||||
public static void saveUserDataFromOldTable(
|
||||
final SQLiteDatabase db, final List<ContentValues> data) {
|
||||
if (data == null || data.size() < 1) {
|
||||
return;
|
||||
}
|
||||
for (final ContentValues row : data) {
|
||||
// Build query from the row data. It is an exact match, column by column,
|
||||
// except the CURRENT column
|
||||
final StringBuilder selectionBuilder = new StringBuilder();
|
||||
final ArrayList<String> selectionArgs = Lists.newArrayList();
|
||||
for (final String key : row.keySet()) {
|
||||
if (!Telephony.Carriers.CURRENT.equals(key)) {
|
||||
if (selectionBuilder.length() > 0) {
|
||||
selectionBuilder.append(" AND ");
|
||||
}
|
||||
final String value = row.getAsString(key);
|
||||
if (TextUtils.isEmpty(value)) {
|
||||
selectionBuilder.append(key).append(" IS NULL");
|
||||
} else {
|
||||
selectionBuilder.append(key).append("=?");
|
||||
selectionArgs.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
try (Cursor cursor = db.query(APN_TABLE,
|
||||
ID_PROJECTION,
|
||||
selectionBuilder.toString(),
|
||||
selectionArgs.toArray(new String[0]),
|
||||
null/*groupBy*/, null/*having*/, null/*orderBy*/)) {
|
||||
/*groupBy*/
|
||||
/*having*/
|
||||
/*orderBy*/
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
db.update(APN_TABLE, row, ID_SELECTION, new String[]{cursor.getString(0)});
|
||||
} else {
|
||||
// User APN does not exist, insert into the new table
|
||||
row.put(Telephony.Carriers.NUMERIC,
|
||||
PhoneUtils.canonicalizeMccMnc(
|
||||
row.getAsString(Telephony.Carriers.MCC),
|
||||
row.getAsString(Telephony.Carriers.MNC))
|
||||
);
|
||||
db.insert(APN_TABLE, null/*nullColumnHack*/, row);
|
||||
}
|
||||
} catch (final SQLiteException e) {
|
||||
LogUtil.e(TAG, "ApnDatabase.saveUserDataFromOldTable: query error " + e, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Convert Cursor to ContentValues
|
||||
private static ContentValues cursorToValues(final Cursor cursor) {
|
||||
final int columnCount = cursor.getColumnCount();
|
||||
if (columnCount > 0) {
|
||||
final ContentValues result = new ContentValues();
|
||||
for (int i = 0; i < columnCount; i++) {
|
||||
final String name = cursor.getColumnName(i);
|
||||
final String value = cursor.getString(i);
|
||||
result.put(name, value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpen(final SQLiteDatabase db) {
|
||||
super.onOpen(db);
|
||||
@@ -350,13 +189,4 @@ public class ApnDatabase extends SQLiteOpenHelper {
|
||||
|
||||
loadApnTable(db);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all tables
|
||||
*/
|
||||
public static void clearTables() {
|
||||
final SQLiteDatabase db = getApnDatabase().getWritableDatabase();
|
||||
db.execSQL("DROP TABLE IF EXISTS " + APN_TABLE);
|
||||
db.execSQL(APN_TABLE_SQL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -595,19 +595,4 @@ public class BugleApnSettingsLoader implements ApnSettingsLoader {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ID of first APN to try
|
||||
*/
|
||||
public static String getFirstTryApn(final SQLiteDatabase database, final String mccMnc) {
|
||||
String key = null;
|
||||
try (Cursor cursor = queryLocalDatabase(database, mccMnc, null/*apnName*/)) {
|
||||
if (cursor.moveToFirst()) {
|
||||
key = cursor.getString(ApnDatabase.COLUMN_ID);
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
// Nothing to do
|
||||
}
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ package com.android.messaging.sms;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentUris;
|
||||
import android.content.Context;
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
@@ -734,32 +733,6 @@ public class DatabaseMessages {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get media file size
|
||||
*/
|
||||
private long getMediaFileSize() {
|
||||
final Context context = Factory.get().getApplicationContext();
|
||||
final Uri uri = getDataUri();
|
||||
AssetFileDescriptor fd = null;
|
||||
try {
|
||||
fd = context.getContentResolver().openAssetFileDescriptor(uri, "r");
|
||||
if (fd != null) {
|
||||
return fd.getParcelFileDescriptor().getStatSize();
|
||||
}
|
||||
} catch (final FileNotFoundException e) {
|
||||
LogUtil.e(TAG, "DatabaseMessages.MmsPart: cound not find media file: " + e, e);
|
||||
} finally {
|
||||
if (fd != null) {
|
||||
try {
|
||||
fd.close();
|
||||
} catch (final IOException e) {
|
||||
LogUtil.e(TAG, "DatabaseMessages.MmsPart: failed to close " + e, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return If the type is a text type that stores text embedded (i.e. in db table)
|
||||
*/
|
||||
|
||||
@@ -25,7 +25,6 @@ import android.content.Intent;
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
import android.content.res.Resources;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
import android.media.MediaMetadataRetriever;
|
||||
import android.net.Uri;
|
||||
@@ -38,8 +37,6 @@ import android.provider.Telephony.Threads;
|
||||
import android.telephony.SmsManager;
|
||||
import android.telephony.SmsMessage;
|
||||
import android.text.TextUtils;
|
||||
import android.text.util.Rfc822Token;
|
||||
import android.text.util.Rfc822Tokenizer;
|
||||
|
||||
import com.android.messaging.Factory;
|
||||
import com.android.messaging.R;
|
||||
@@ -1379,45 +1376,6 @@ public class MmsUtils {
|
||||
null/*selectionArgs*/);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the read status of a single MMS message by its URI
|
||||
*
|
||||
* @param mmsUri
|
||||
* @param read
|
||||
*/
|
||||
public static void updateReadStatusForMmsMessage(final Uri mmsUri, final boolean read) {
|
||||
final ContentResolver resolver = Factory.get().getApplicationContext().getContentResolver();
|
||||
final ContentValues values = new ContentValues();
|
||||
values.put(Mms.READ, read ? 1 : 0);
|
||||
resolver.update(mmsUri, values, null/*where*/, null/*selectionArgs*/);
|
||||
}
|
||||
|
||||
public static class AttachmentInfo {
|
||||
public String mUrl;
|
||||
public String mContentType;
|
||||
public int mWidth;
|
||||
public int mHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert byte array to Java String using a charset name
|
||||
*
|
||||
* @param bytes
|
||||
* @param charsetName
|
||||
* @return
|
||||
*/
|
||||
public static String bytesToString(final byte[] bytes, final String charsetName) {
|
||||
if (bytes == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return new String(bytes, charsetName);
|
||||
} catch (final UnsupportedEncodingException e) {
|
||||
LogUtil.e(TAG, "MmsUtils.bytesToString: " + e, e);
|
||||
return new String(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Java String to byte array using a charset name
|
||||
*
|
||||
@@ -1510,25 +1468,6 @@ public class MmsUtils {
|
||||
return sUseSystemApn;
|
||||
}
|
||||
|
||||
// For the internal debugger only
|
||||
public static void setUseSystemApnTable(final boolean turnOn) {
|
||||
if (!turnOn) {
|
||||
// We're turning on local APNs on a device where we wouldn't normally have the
|
||||
// local APN table. Build it here.
|
||||
final SQLiteDatabase database = ApnDatabase.getApnDatabase().getWritableDatabase();
|
||||
|
||||
// Do we already have the table?
|
||||
try (Cursor cursor = database.query(ApnDatabase.APN_TABLE,
|
||||
ApnDatabase.APN_PROJECTION,
|
||||
null, null, null, null, null, null)) {
|
||||
} catch (final Exception e) {
|
||||
// Apparently there's no table, create it now.
|
||||
ApnDatabase.forceBuildAndLoadApnTables();
|
||||
}
|
||||
}
|
||||
sUseSystemApn = turnOn;
|
||||
}
|
||||
|
||||
public static final Uri MMS_PART_CONTENT_URI = Uri.parse("content://mms/part");
|
||||
|
||||
/**
|
||||
@@ -2045,28 +1984,6 @@ public class MmsUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try parse the address using RFC822 format. If it fails to parse, then return the
|
||||
* original address
|
||||
*
|
||||
* @param address The MMS ind sender address to parse
|
||||
* @return The real address. If in RFC822 format, returns the correct email.
|
||||
*/
|
||||
private static String parsePotentialRfc822EmailAddress(final String address) {
|
||||
if (address == null || !address.contains("@") || !address.contains("<")) {
|
||||
return address;
|
||||
}
|
||||
final Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(address);
|
||||
if (tokens != null && tokens.length > 0) {
|
||||
for (final Rfc822Token token : tokens) {
|
||||
if (token != null && !TextUtils.isEmpty(token.getAddress())) {
|
||||
return token.getAddress();
|
||||
}
|
||||
}
|
||||
}
|
||||
return address;
|
||||
}
|
||||
|
||||
public static DatabaseMessages.MmsMessage processReceivedPdu(final Context context,
|
||||
final byte[] pushData, final int subId, final String subPhoneNumber) {
|
||||
// Parse data
|
||||
@@ -2089,20 +2006,6 @@ public class MmsUtils {
|
||||
switch (type) {
|
||||
case PduHeaders.MESSAGE_TYPE_DELIVERY_IND:
|
||||
case PduHeaders.MESSAGE_TYPE_READ_ORIG_IND: {
|
||||
// TODO: Should this be commented out?
|
||||
// threadId = findThreadId(context, pdu, type);
|
||||
// if (threadId == -1) {
|
||||
// // The associated SendReq isn't found, therefore skip
|
||||
// // processing this PDU.
|
||||
// break;
|
||||
// }
|
||||
|
||||
// Uri uri = p.persist(pdu, Inbox.CONTENT_URI, true,
|
||||
// MessagingPreferenceActivity.getIsGroupMmsEnabled(mContext), null);
|
||||
// // Update thread ID for ReadOrigInd & DeliveryInd.
|
||||
// ContentValues values = new ContentValues(1);
|
||||
// values.put(Mms.THREAD_ID, threadId);
|
||||
// SqliteWrapper.update(mContext, cr, uri, values, null, null);
|
||||
LogUtil.w(TAG, "Received unsupported WAP Push, type=" + type);
|
||||
break;
|
||||
}
|
||||
@@ -2125,24 +2028,6 @@ public class MmsUtils {
|
||||
}
|
||||
final String[] dups = getDupNotifications(context, nInd);
|
||||
if (dups == null) {
|
||||
// TODO: Do we handle Rfc822 Email Addresses?
|
||||
//final String contentLocation =
|
||||
// MmsUtils.bytesToString(nInd.getContentLocation(), "UTF-8");
|
||||
//final byte[] transactionId = nInd.getTransactionId();
|
||||
//final long messageSize = nInd.getMessageSize();
|
||||
//final long expiry = nInd.getExpiry();
|
||||
//final String transactionIdString =
|
||||
// MmsUtils.bytesToString(transactionId, "UTF-8");
|
||||
|
||||
//final EncodedStringValue fromEncoded = nInd.getFrom();
|
||||
// An mms ind received from email address will have from address shown as
|
||||
// "John Doe <johndoe@foobar.com>" but the actual received message will only
|
||||
// have the email address. So let's try to parse the RFC822 format to get the
|
||||
// real email. Otherwise we will create two conversations for the MMS
|
||||
// notification and the actual MMS message if auto retrieve is disabled.
|
||||
//final String from = parsePotentialRfc822EmailAddress(
|
||||
// fromEncoded != null ? fromEncoded.getString() : null);
|
||||
|
||||
Uri inboxUri = null;
|
||||
try {
|
||||
inboxUri = p.persist(pdu, Mms.Inbox.CONTENT_URI, subId, subPhoneNumber,
|
||||
@@ -2441,12 +2326,6 @@ public class MmsUtils {
|
||||
switch (rawStatus) {
|
||||
case PduHeaders.RESPONSE_STATUS_ERROR_SERVICE_DENIED:
|
||||
case PduHeaders.RESPONSE_STATUS_ERROR_PERMANENT_SERVICE_DENIED:
|
||||
//case PduHeaders.RESPONSE_STATUS_ERROR_PERMANENT_REPLY_CHARGING_LIMITATIONS_NOT_MET:
|
||||
//case PduHeaders.RESPONSE_STATUS_ERROR_PERMANENT_REPLY_CHARGING_REQUEST_NOT_ACCEPTED:
|
||||
//case PduHeaders.RESPONSE_STATUS_ERROR_PERMANENT_REPLY_CHARGING_FORWARDING_DENIED:
|
||||
//case PduHeaders.RESPONSE_STATUS_ERROR_PERMANENT_REPLY_CHARGING_NOT_SUPPORTED:
|
||||
//case PduHeaders.RESPONSE_STATUS_ERROR_PERMANENT_ADDRESS_HIDING_NOT_SUPPORTED:
|
||||
//case PduHeaders.RESPONSE_STATUS_ERROR_PERMANENT_LACK_OF_PREPAID:
|
||||
stringResId = R.string.mms_failure_outgoing_service;
|
||||
break;
|
||||
case PduHeaders.RESPONSE_STATUS_ERROR_SENDING_ADDRESS_UNRESOLVED:
|
||||
@@ -2463,8 +2342,6 @@ public class MmsUtils {
|
||||
stringResId = R.string.mms_failure_outgoing_content;
|
||||
break;
|
||||
case PduHeaders.RESPONSE_STATUS_ERROR_UNSUPPORTED_MESSAGE:
|
||||
//case PduHeaders.RESPONSE_STATUS_ERROR_MESSAGE_NOT_FOUND:
|
||||
//case PduHeaders.RESPONSE_STATUS_ERROR_TRANSIENT_MESSAGE_NOT_FOUND:
|
||||
stringResId = R.string.mms_failure_outgoing_unsupported;
|
||||
break;
|
||||
case MessageData.RAW_TELEPHONY_STATUS_MESSAGE_TOO_BIG:
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.messaging.sms;
|
||||
|
||||
/**
|
||||
* A generic Exception for errors in sending SMS
|
||||
*/
|
||||
class SmsException extends Exception {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates a new SmsException.
|
||||
*/
|
||||
public SmsException() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new SmsException with the specified detail message.
|
||||
*
|
||||
* @param message the detail message.
|
||||
*/
|
||||
public SmsException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new SmsException with the specified cause.
|
||||
*
|
||||
* @param cause the cause.
|
||||
*/
|
||||
public SmsException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new SmsException with the specified detail message and cause.
|
||||
*
|
||||
* @param message the detail message.
|
||||
* @param cause the cause.
|
||||
*/
|
||||
public SmsException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
@@ -182,7 +182,7 @@ public class SmsSender {
|
||||
// This should be called from a RequestWriter queue thread
|
||||
public static SendResult sendMessage(final Context context, final int subId, String dest,
|
||||
String message, final String serviceCenter, final boolean requireDeliveryReport,
|
||||
final Uri messageUri) throws SmsException {
|
||||
final Uri messageUri) throws Exception {
|
||||
if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
|
||||
LogUtil.v(TAG, "SmsSender: sending message. " +
|
||||
"dest=" + dest + " message=" + message +
|
||||
@@ -191,7 +191,7 @@ public class SmsSender {
|
||||
" requestId=" + messageUri);
|
||||
}
|
||||
if (TextUtils.isEmpty(message)) {
|
||||
throw new SmsException("SmsSender: empty text message");
|
||||
throw new Exception("SmsSender: empty text message");
|
||||
}
|
||||
// Get the real dest and message for email or alias if dest is email or alias
|
||||
// Or sanitize the dest if dest is a number
|
||||
@@ -208,13 +208,13 @@ public class SmsSender {
|
||||
dest = PhoneNumberUtils.stripSeparators(dest);
|
||||
}
|
||||
if (TextUtils.isEmpty(dest)) {
|
||||
throw new SmsException("SmsSender: empty destination address");
|
||||
throw new Exception("SmsSender: empty destination address");
|
||||
}
|
||||
// Divide the input message by SMS length limit
|
||||
final SmsManager smsManager = PhoneUtils.get(subId).getSmsManager();
|
||||
final ArrayList<String> messages = smsManager.divideMessage(message);
|
||||
if (messages == null || messages.size() < 1) {
|
||||
throw new SmsException("SmsSender: fails to divide message");
|
||||
throw new Exception("SmsSender: fails to divide message");
|
||||
}
|
||||
// Prepare the send result, which collects the send status for each part
|
||||
final SendResult pendingResult = new SendResult(messages.size());
|
||||
@@ -252,7 +252,7 @@ public class SmsSender {
|
||||
// Actually sending the message using SmsManager
|
||||
private static void sendInternal(final Context context, final int subId, String dest,
|
||||
final ArrayList<String> messages, final String serviceCenter,
|
||||
final boolean requireDeliveryReport, final Uri messageUri) throws SmsException {
|
||||
final boolean requireDeliveryReport, final Uri messageUri) throws Exception {
|
||||
Assert.notNull(context);
|
||||
final SmsManager smsManager = PhoneUtils.get(subId).getSmsManager();
|
||||
final int messageCount = messages.size();
|
||||
@@ -295,7 +295,7 @@ public class SmsSender {
|
||||
dest, serviceCenter, messages, sentIntents, deliveryIntents);
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
throw new SmsException("SmsSender: caught exception in sending " + e);
|
||||
throw new Exception("SmsSender: caught exception in sending " + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user