Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 292ff0c5 authored by Tom Taylor's avatar Tom Taylor Committed by The Android Automerger
Browse files

Thread with no recipients getting created

Bug 6453254

Don't allow a thread to be created with no recipients, by not calling
Threads.getOrCreateThreadId when there are no recipients.

Change-Id: Ia9b1e944db6da83a3e6caf2dcebece9fc52740b0
parent 38d32d7e
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -1058,9 +1058,10 @@ public class PduPersister {
                }
            }
        }

        if (!recipients.isEmpty()) {
            long threadId = Threads.getOrCreateThreadId(mContext, recipients);
            values.put(Mms.THREAD_ID, threadId);
        }

        SqliteWrapper.update(mContext, mContentResolver, uri, values, null, null);
    }
@@ -1299,7 +1300,6 @@ public class PduPersister {
        }

        HashSet<String> recipients = new HashSet<String>();
        long threadId = DUMMY_THREAD_ID;
        int msgType = pdu.getMessageType();
        // Here we only allocate thread ID for M-Notification.ind,
        // M-Retrieve.conf and M-Send.req.
@@ -1326,9 +1326,11 @@ public class PduPersister {
                    }
                }
            }
            threadId = Threads.getOrCreateThreadId(mContext, recipients);
        }
            if (!recipients.isEmpty()) {
                long threadId = Threads.getOrCreateThreadId(mContext, recipients);
                values.put(Mms.THREAD_ID, threadId);
            }
        }

        // Save parts first to avoid inconsistent message is loaded
        // while saving the parts.