Modern Apps git

← Modern-Apps.git

communicate: RCS conversations appear in the car's thread list

Commit
76ebec15f487512e79a1ed1f0b4aa921a541719b
Author
Vayun Mathur <[email protected]>
When
2026-12-01 11:12 UTC (5 days ago)
Parents
850e8eb
The sectioned car template iterated a hand-maintained line
list [Sim, GoogleVoice, WhatsApp, Signal] — RCS missing —
and built a RowSection per listed line, so RCS threads from
the merged loader were silently dropped before reaching the
host: an RCS-only inbox rendered zero sections on API >= 8
while the legacy flat list showed them (host-version-
dependent loss). The rest of the car layer already handled
RCS (session mapping, reply), unreachable since the row
never rendered.

Rcs joins LINE_ORDER, and the grouping is extracted to
sectionsFor with the invariant explicit: every merged line
must appear or its threads are dropped. Three tests pin the
RCS section, full line coverage with no thread dropped, and
empty-line omission (order preserved). Call handling,
voicemail and drafts were audited and cleared. Verified:
:communicate:testDevUnitTest 1468 tests, 0 failures (the
known box-specific failures did not occur this run);
:communicate:lint BUILD SUCCESSFUL.

Diff

communicate/src/main/java/com/vayunmathur/communicate/service/car/CommunicateCarThreadListScreen.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/service/car/CommunicateCarThreadListScreen.kt b/communicate/src/main/java/com/vayunmathur/communicate/service/car/CommunicateCarThreadListScreen.ktindex 7fbb652b9f..bac33cb0a5 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/service/car/CommunicateCarThreadListScreen.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/service/car/CommunicateCarThreadListScreen.kt@@ -23,7 +23,7 @@ import com.vayunmathur.communicate.data.SmsThread  *  * Component choice (car design guide):  * - API 8+: [SectionedItemTemplate] with one [RowSection] per line (SIM,- *   Google Voice, WhatsApp, Signal) — section headers label each group, so+ *   Google Voice, WhatsApp, Signal, RCS) — section headers label each group, so  *   the driver sees where each thread lives without opening it.  * - Older hosts: the flat [ListTemplate] fallback.  *@@ -67,16 +67,13 @@ class CommunicateCarThreadListScreen(             )             .setLoading(loading)         if (!loading) {-            for ((line, label) in LINE_ORDER) {-                val rows = threads.filter { it.line == line }.map { threadRow(it) }-                if (rows.isNotEmpty()) {-                    builder.addSection(-                        RowSection.Builder()-                            .setTitle(label)-                            .setItems(rows)-                            .build(),-                    )-                }+            for ((label, sectionThreads) in sectionsFor(threads)) {+                builder.addSection(+                    RowSection.Builder()+                        .setTitle(label)+                        .setItems(sectionThreads.map { threadRow(it) })+                        .build(),+                )             }         }         return builder.build()@@ -151,7 +148,7 @@ class CommunicateCarThreadListScreen(         return bitmap     } -    private companion object {+    internal companion object {         const val CAR_API_SECTIONED_LIST = 8         const val AVATAR_SIZE_PX = 128         const val INT_POSITIVE_MASK = 0x7fffffff@@ -163,11 +160,25 @@ class CommunicateCarThreadListScreen(             0xFFAB47BC.toInt(),             0xFF66BB6A.toInt(),             0xFFFFA726.toInt())-        val LINE_ORDER: List<Pair<CommunicateLine, String>> = listOf(+        internal val LINE_ORDER: List<Pair<CommunicateLine, String>> = listOf(             CommunicateLine.Sim to "SIM",             CommunicateLine.GoogleVoice to "Google Voice",             CommunicateLine.WhatsApp to "WhatsApp",             CommunicateLine.Signal to "Signal",+            CommunicateLine.Rcs to "RCS",         )++        /**+         * Non-empty per-line sections in [LINE_ORDER] order. Every line the+         * merged loader can return must appear in [LINE_ORDER], otherwise+         * its threads are silently dropped from the sectioned car list+         * (the legacy flat list shows every thread regardless of line).+         */+        internal fun sectionsFor(+            threads: List<SmsThread>,+        ): List<Pair<String, List<SmsThread>>> = LINE_ORDER.mapNotNull { (line, label) ->+            val section = threads.filter { it.line == line }+            if (section.isEmpty()) null else label to section+        }     } }
communicate/src/test/java/com/vayunmathur/communicate/service/car/CommunicateCarThreadListSectionsTest.kt
diff --git a/communicate/src/test/java/com/vayunmathur/communicate/service/car/CommunicateCarThreadListSectionsTest.kt b/communicate/src/test/java/com/vayunmathur/communicate/service/car/CommunicateCarThreadListSectionsTest.ktnew file mode 100644index 0000000000..0fd5afe4aa--- /dev/null+++ b/communicate/src/test/java/com/vayunmathur/communicate/service/car/CommunicateCarThreadListSectionsTest.kt@@ -0,0 +1,58 @@+package com.vayunmathur.communicate.service.car++import com.vayunmathur.communicate.data.CommunicateLine+import com.vayunmathur.communicate.data.SmsThread+import kotlin.test.Test+import kotlin.test.assertEquals+import kotlin.test.assertTrue++/**+ * Regression: the sectioned (API 8+) car thread list grouped by a fixed+ * line order that omitted RCS, so RCS threads returned by+ * `loadSmsThreadsMerged` never reached the car — while the legacy flat+ * list (and the phone list) showed them, and the car session already+ * mapped RCS threads to a replyable line choice.+ */+class CommunicateCarThreadListSectionsTest {++    private fun thread(line: CommunicateLine, id: Long) = SmsThread(+        threadId = id,+        address = "+14155550102",+        displayName = "Alice",+        snippet = "hi",+        timestampMillis = id,+        unreadCount = 0,+        line = line,+        remoteId = "remote-$id",+    )++    @Test+    fun `rcs thread gets its own section instead of being dropped`() {+        val rcs = thread(CommunicateLine.Rcs, 1L)+        val sections = CommunicateCarThreadListScreen.sectionsFor(listOf(rcs))+        assertEquals(listOf("RCS" to listOf(rcs)), sections)+    }++    @Test+    fun `every merged line is represented and no thread is dropped`() {+        val threads = CommunicateLine.entries.mapIndexed { index, line ->+            thread(line, (index + 1).toLong())+        }+        val sections = CommunicateCarThreadListScreen.sectionsFor(threads)+        assertEquals(CommunicateLine.entries.size, sections.size)+        assertEquals(+            CommunicateCarThreadListScreen.LINE_ORDER.map { it.second },+            sections.map { it.first },+        )+        assertEquals(threads.toSet(), sections.flatMap { it.second }.toSet())+    }++    @Test+    fun `empty lines are omitted and section order follows line order`() {+        val signal = thread(CommunicateLine.Signal, 2L)+        val sim = thread(CommunicateLine.Sim, 1L)+        val sections = CommunicateCarThreadListScreen.sectionsFor(listOf(signal, sim))+        assertEquals(listOf("SIM", "Signal"), sections.map { it.first })+        assertTrue(sections.all { it.second.isNotEmpty() })+    }+}