From c445b2b98bb322afde2e598c132e412783b1c932 Mon Sep 17 00:00:00 2001 From: Leland Miller Date: Wed, 9 Jan 2019 17:00:09 -0800 Subject: Add thread ID reuse to API contract This make explicit that thread IDs should not be reused to point to new threads as this may cause issues in applications that expect threads to remain consistent. Test: Tested by CTS test in CtsTelephonyProviderTestCases Bug: 122616805 Change-Id: I068943c402084c524f7e7002044a7efc59ef796d --- telephony/java/android/provider/Telephony.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/telephony/java/android/provider/Telephony.java b/telephony/java/android/provider/Telephony.java index 3e4482e91d2b..51532bc8ca5c 100644 --- a/telephony/java/android/provider/Telephony.java +++ b/telephony/java/android/provider/Telephony.java @@ -1955,6 +1955,12 @@ public final class Telephony { /** * Helper functions for the "threads" table used by MMS and SMS. + * + * Thread IDs are determined by the participants in a conversation and can be used to match + * both SMS and MMS messages. + * + * To avoid issues where applications might cache a thread ID, the thread ID of a deleted thread + * must not be reused to point at a new thread. */ public static final class Threads implements ThreadsColumns { @@ -2008,14 +2014,10 @@ public final class Telephony { } /** - * Given the recipients list and subject of an unsaved message, - * return its thread ID. If the message starts a new thread, - * allocate a new thread ID. Otherwise, use the appropriate - * existing thread ID. - * - *

Find the thread ID of the same set of recipients (in any order, - * without any additions). If one is found, return it. Otherwise, - * return a unique thread ID.

+ * Given a set of recipients return its thread ID. + *

+ * If a thread exists containing the provided participants, return its thread ID. Otherwise, + * this will create a new thread containing the provided participants and return its ID. */ public static long getOrCreateThreadId( Context context, Set recipients) { -- cgit v1.2.3-59-g8ed1b