summaryrefslogtreecommitdiff
path: root/src/com/android/mms/data/Conversation.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/mms/data/Conversation.java')
-rw-r--r--[-rwxr-xr-x]src/com/android/mms/data/Conversation.java58
1 files changed, 26 insertions, 32 deletions
diff --git a/src/com/android/mms/data/Conversation.java b/src/com/android/mms/data/Conversation.java
index a88f42d0..0ccdd9a2 100755..100644
--- a/src/com/android/mms/data/Conversation.java
+++ b/src/com/android/mms/data/Conversation.java
@@ -24,7 +24,6 @@ import android.provider.Telephony.Sms.Conversations;
import android.provider.Telephony.Threads;
import android.provider.Telephony.ThreadsColumns;
import android.telephony.PhoneNumberUtils;
-import android.telephony.SubscriptionManager;
import android.text.TextUtils;
import android.util.Log;
@@ -164,11 +163,9 @@ public class Conversation {
* Find the conversation matching the provided recipient set.
* When called with an empty recipient list, equivalent to {@link #createNew}.
*/
- public static Conversation get(Context context, ContactList recipients, boolean allowQuery,
- int subId) {
+ public static Conversation get(Context context, ContactList recipients, boolean allowQuery) {
if (DEBUG) {
- Log.v(TAG, "Conversation get by recipients: " +
- recipients.serialize(SubscriptionManager.getDefaultSmsSubId()));
+ Log.v(TAG, "Conversation get by recipients: " + recipients.serialize());
}
// If there are no recipients in the list, make a new conversation.
if (recipients.size() < 1) {
@@ -179,7 +176,7 @@ public class Conversation {
if (conv != null)
return conv;
- long threadId = getOrCreateThreadId(context, recipients, subId);
+ long threadId = getOrCreateThreadId(context, recipients);
conv = new Conversation(context, threadId, allowQuery);
Log.d(TAG, "Conversation.get: created new conversation " + /*conv.toString()*/ "xxxxxxx");
@@ -206,7 +203,7 @@ public class Conversation {
* {@value sms:+12124797990}.
* When called with a null Uri, equivalent to {@link #createNew}.
*/
- public static Conversation get(Context context, Uri uri, boolean allowQuery, int subId) {
+ public static Conversation get(Context context, Uri uri, boolean allowQuery) {
if (DEBUG) {
Log.v(TAG, "Conversation get by uri: " + uri);
}
@@ -232,14 +229,14 @@ public class Conversation {
String recipients = PhoneNumberUtils.replaceUnicodeDigits(getRecipients(uri))
.replace(',', ';');
return get(context, ContactList.getByNumbers(recipients,
- allowQuery /* don't block */, true /* replace number */, subId), allowQuery, subId);
+ allowQuery /* don't block */, true /* replace number */), allowQuery);
}
/**
* Returns true if the recipient in the uri matches the recipient list in this
* conversation.
*/
- public boolean sameRecipient(Uri uri, Context context, int subId) {
+ public boolean sameRecipient(Uri uri, Context context) {
int size = mRecipients.size();
if (size > 1) {
return false;
@@ -250,7 +247,7 @@ public class Conversation {
ContactList incomingRecipient = null;
if (uri.getPathSegments().size() >= 2) {
// it's a thread id for a conversation
- Conversation otherConv = get(context, uri, false, subId);
+ Conversation otherConv = get(context, uri, false);
if (otherConv == null) {
return false;
}
@@ -258,7 +255,7 @@ public class Conversation {
} else {
String recipient = getRecipients(uri);
incomingRecipient = ContactList.getByNumbers(recipient,
- false /* don't block */, false /* don't replace number */, subId);
+ false /* don't block */, false /* don't replace number */);
}
if (DEBUG) Log.v(TAG, "sameRecipient incomingRecipient: " + incomingRecipient +
" mRecipients: " + mRecipients);
@@ -317,7 +314,7 @@ public class Conversation {
}
final Cursor c = SqliteWrapper.query(context, context.getContentResolver(),
- Mms.Inbox.CONTENT_URI, new String[] {Mms._ID, Mms.MESSAGE_ID, Mms.SUB_ID},
+ Mms.Inbox.CONTENT_URI, new String[] {Mms._ID, Mms.MESSAGE_ID},
selection, null, null);
try {
@@ -331,7 +328,7 @@ public class Conversation {
LogTag.debug("sendReadReport: uri = " + uri);
}
MmsMessageSender.sendReadRec(context, AddressUtils.getFrom(context, uri),
- c.getString(1), status, c.getInt(2));
+ c.getString(1), status);
}
} finally {
if (c != null) {
@@ -466,12 +463,12 @@ public class Conversation {
*
* @return The thread ID of this conversation in the database
*/
- public synchronized long ensureThreadId(int subId) {
+ public synchronized long ensureThreadId() {
if (DEBUG || DELETEDEBUG) {
LogTag.debug("ensureThreadId before: " + mThreadId);
}
if (mThreadId <= 0) {
- mThreadId = getOrCreateThreadId(mContext, mRecipients, subId);
+ mThreadId = getOrCreateThreadId(mContext, mRecipients);
}
if (DEBUG || DELETEDEBUG) {
LogTag.debug("ensureThreadId after: " + mThreadId);
@@ -607,11 +604,11 @@ public class Conversation {
mIsChecked = isChecked;
}
- private static long getOrCreateThreadId(Context context, ContactList list, int subId) {
+ private static long getOrCreateThreadId(Context context, ContactList list) {
HashSet<String> recipients = new HashSet<String>();
Contact cacheContact = null;
for (Contact c : list) {
- cacheContact = Contact.get(c.getNumber(), false, subId);
+ cacheContact = Contact.get(c.getNumber(), false);
if (cacheContact != null) {
recipients.add(cacheContact.getNumber());
} else {
@@ -699,8 +696,7 @@ public class Conversation {
@Override
public synchronized String toString() {
- return String.format("[%s] (tid %d)",
- mRecipients.serialize(SubscriptionManager.getDefaultSmsSubId()), mThreadId);
+ return String.format("[%s] (tid %d)", mRecipients.serialize(), mThreadId);
}
/**
@@ -928,8 +924,7 @@ public class Conversation {
// Fill in as much of the conversation as we can before doing the slow stuff of looking
// up the contacts associated with this conversation.
String recipientIds = c.getString(RECIPIENT_IDS);
- ContactList recipients = ContactList.getByIds(recipientIds, allowQuery,
- SubscriptionManager.getDefaultSmsSubId());
+ ContactList recipients = ContactList.getByIds(recipientIds, allowQuery);
synchronized (conv) {
conv.mRecipients = recipients;
}
@@ -1310,7 +1305,7 @@ public class Conversation {
Cache.dumpCache();
}
- public static void dumpThreadsTable(Context context, int subId) {
+ public static void dumpThreadsTable(Context context) {
LogTag.debug("**** Dump of threads table ****");
Cursor c = context.getContentResolver().query(sAllThreadsUri,
ALL_THREADS_PROJECTION, null, null, "date ASC");
@@ -1327,9 +1322,8 @@ public class Conversation {
" " + ThreadsColumns.HAS_ATTACHMENT + " : " + c.getInt(HAS_ATTACHMENT) +
" " + ThreadsColumns.RECIPIENT_IDS + " : " + c.getString(RECIPIENT_IDS));
- ContactList recipients = ContactList.getByIds(c.getString(RECIPIENT_IDS), false,
- subId);
- Log.d(TAG, "----recipients: " + recipients.serialize(subId));
+ ContactList recipients = ContactList.getByIds(c.getString(RECIPIENT_IDS), false);
+ Log.d(TAG, "----recipients: " + recipients.serialize());
}
} finally {
c.close();
@@ -1397,10 +1391,10 @@ public class Conversation {
* @return the verified number or email of the recipient
*/
public static String verifySingleRecipient(final Context context,
- final long threadId, final String recipientStr, int subId) {
+ final long threadId, final String recipientStr) {
if (threadId <= 0) {
LogTag.error("verifySingleRecipient threadId is ZERO, recipient: " + recipientStr);
- LogTag.dumpInternalTables(context, subId);
+ LogTag.dumpInternalTables(context);
return recipientStr;
}
Cursor c = context.getContentResolver().query(sAllThreadsUri, ALL_THREADS_PROJECTION,
@@ -1408,7 +1402,7 @@ public class Conversation {
if (c == null) {
LogTag.error("verifySingleRecipient threadId: " + threadId +
" resulted in NULL cursor , recipient: " + recipientStr);
- LogTag.dumpInternalTables(context, subId);
+ LogTag.dumpInternalTables(context);
return recipientStr;
}
String address = recipientStr;
@@ -1417,7 +1411,7 @@ public class Conversation {
if (!c.moveToFirst()) {
LogTag.error("verifySingleRecipient threadId: " + threadId +
" can't moveToFirst , recipient: " + recipientStr);
- LogTag.dumpInternalTables(context, subId);
+ LogTag.dumpInternalTables(context);
return recipientStr;
}
recipientIds = c.getString(RECIPIENT_IDS);
@@ -1440,7 +1434,7 @@ public class Conversation {
LogTag.error("verifySingleRecipient threadId: " + threadId +
" getSingleNumberFromCanonicalAddresses returned empty number for: " +
ids[0] + " recipientIds: " + recipientIds);
- LogTag.dumpInternalTables(context, subId);
+ LogTag.dumpInternalTables(context);
return recipientStr;
}
if (PhoneNumberUtils.compareLoosely(recipientStr, address)) {
@@ -1456,9 +1450,9 @@ public class Conversation {
if (context instanceof Activity) {
LogTag.warnPossibleRecipientMismatch("verifySingleRecipient for threadId: " +
threadId + " original recipient: " + recipientStr +
- " recipient from DB: " + address, (Activity)context, subId);
+ " recipient from DB: " + address, (Activity)context);
}
- LogTag.dumpInternalTables(context, subId);
+ LogTag.dumpInternalTables(context);
if (Log.isLoggable(LogTag.THREAD_CACHE, Log.VERBOSE)) {
LogTag.debug("verifySingleRecipient for threadId: " +
threadId + " original recipient: " + recipientStr +