Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
07d55f8
Fix predictive back
RankoR Sep 11, 2026
4cd7581
Run one notification pass at a time
RankoR Sep 12, 2026
8c5768e
Transcode each notification image once
RankoR Sep 12, 2026
4d8edba
Stop holding the SMS_DELIVER broadcast open past its deadline
RankoR Sep 12, 2026
d8f406e
Fix new chat background color
RankoR Sep 12, 2026
92048f0
Capitalize sentences in the message and caption fields
RankoR Sep 12, 2026
9d637dd
Restore the short message keyboard type
RankoR Sep 12, 2026
b2e35ef
Resolve the settings SIM the same way the composer does
RankoR Sep 13, 2026
c2f1199
Pin the new group button above the contact list
RankoR Sep 13, 2026
8b1f762
Collapse the settings header only when the list can scroll far enough
RankoR Sep 13, 2026
4e5386f
Fix the settings top bar title never fading in
RankoR Sep 13, 2026
db2106f
Fail an MMS send cleanly when an attachment URI is no longer readable
RankoR Sep 14, 2026
a5084d6
Drop legacy MediaStore attachments from restored drafts
RankoR Sep 13, 2026
35a1a6d
Drop the media read permissions and the dead gallery picker
RankoR Sep 13, 2026
ace13f9
Merge the message details row semantics so TalkBack offers its copy a…
RankoR Sep 14, 2026
4dde9b0
Announce who sent a message so screen readers can tell incoming from …
RankoR Sep 14, 2026
a6e0cbe
Drop the doubled bottom margin under the New group button
RankoR Sep 14, 2026
0c657e7
Stop the recipient card losing its bottom padding when chips appear
RankoR Sep 14, 2026
b978057
Stop both screens drawing at once when back interrupts an opening ani…
RankoR Sep 16, 2026
2b2fa0c
Map conversation list rows off the main thread
RankoR Sep 17, 2026
ea49e30
Fix dark theme for Debug menu
RankoR Sep 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge the message details row semantics so TalkBack offers its copy a…
…ction
  • Loading branch information
RankoR committed Sep 16, 2026
commit ace13f9abfa7eaf2d40c37e353400a531bc4f55f
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
package com.android.messaging.ui.conversation.messagedetails

import android.view.accessibility.AccessibilityNodeInfo
import androidx.activity.ComponentActivity
import androidx.compose.ui.test.junit4.v2.createAndroidComposeRule
import androidx.test.platform.app.InstrumentationRegistry
import com.android.messaging.R
import com.android.messaging.ui.core.AppTheme
import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test

internal class MessageDetailsCopyActionA11yTest {

@get:Rule
val composeTestRule = createAndroidComposeRule<ComponentActivity>()

@Test
fun copyActionSitsOnAScreenReaderFocusableNode() {
composeTestRule.setContent {
AppTheme {
MessageDetailsStatusSection(
sentTimestamp = null,
receivedTimestamp = RECEIVED_TIMESTAMP,
onCopy = {},
)
}
}
composeTestRule.waitForIdle()

val context = InstrumentationRegistry.getInstrumentation().targetContext
val copyLabel = context.getString(R.string.copy_to_clipboard)
val receivedLabel = context.getString(R.string.message_details_received_label)

val nodesOfferingCopy = awaitNodesOfferingCopy(copyLabel = copyLabel)

assertTrue(
"No accessibility node exposes the \"$copyLabel\" custom action at all",
nodesOfferingCopy.isNotEmpty(),
)

val focusableNodes = nodesOfferingCopy.filter { it.isScreenReaderFocusable }

assertTrue(
"The \"$copyLabel\" action exists on ${nodesOfferingCopy.size} node(s) but none is " +
"screen reader focusable, so TalkBack never offers it: " +
nodesOfferingCopy.joinToString { it.describe() },
focusableNodes.isNotEmpty(),
)

val receivedValue = formatMessageDetailsTimestamp(timestampMillis = RECEIVED_TIMESTAMP)

assertTrue(
"The focusable node offering \"$copyLabel\" announces nothing about the row it " +
"copies: " + focusableNodes.joinToString { it.dumpSubtree() },
focusableNodes.any { node ->
node.subtreeText().let {
it.contains(receivedLabel) && it.contains(receivedValue)
}
},
)
}

private fun AccessibilityNodeInfo.subtreeText(): String {
return collectNodes().joinToString(separator = " ") { node ->
listOfNotNull(node.text, node.contentDescription).joinToString(separator = " ")
}
}

private fun AccessibilityNodeInfo.dumpSubtree(): String {
return collectNodes().joinToString(separator = " / ") { it.describe() }
}

private fun awaitNodesOfferingCopy(copyLabel: String): List<AccessibilityNodeInfo> {
val uiAutomation = InstrumentationRegistry.getInstrumentation().uiAutomation
repeat(A11Y_TREE_POLL_ATTEMPTS) {
val root = uiAutomation.rootInActiveWindow
val matches = root?.collectNodes().orEmpty().filter { node ->
node.actionList.any { it.label == copyLabel }
}
if (matches.isNotEmpty()) {
return matches
}
Thread.sleep(A11Y_TREE_POLL_INTERVAL_MILLIS)
}
return emptyList()
}

private fun AccessibilityNodeInfo.collectNodes(): List<AccessibilityNodeInfo> {
return buildList {
add(this@collectNodes)
repeat(childCount) { index ->
getChild(index)?.let { addAll(it.collectNodes()) }
}
}
}

private fun AccessibilityNodeInfo.describe(): String {
return "[text=$text, contentDescription=$contentDescription, " +
"screenReaderFocusable=$isScreenReaderFocusable, " +
"actions=${actionList.mapNotNull { it.label }}]"
}

private companion object {
private const val RECEIVED_TIMESTAMP = 1_700_000_000_000L
private const val A11Y_TREE_POLL_ATTEMPTS = 20
private const val A11Y_TREE_POLL_INTERVAL_MILLIS = 250L
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package com.android.messaging.ui.conversation.messagedetails

import androidx.compose.ui.semantics.SemanticsActions
import androidx.compose.ui.semantics.getOrNull
import androidx.compose.ui.test.junit4.v2.createComposeRule
import androidx.compose.ui.test.onNodeWithText
import com.android.common.test.helpers.targetContext
import com.android.messaging.FactoryTestAccess
import com.android.messaging.R
import com.android.messaging.testutil.installTestFactory
import com.android.messaging.ui.core.AppTheme
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner

@RunWith(RobolectricTestRunner::class)
internal class MessageDetailsCopyActionTest {

@get:Rule
val composeTestRule = createComposeRule()

@Before
fun setUp() {
installTestFactory(context = targetContext)
}

@After
fun tearDown() {
FactoryTestAccess.reset()
}

@Test
fun copyActionIsOfferedOnTheNodeAScreenReaderFocuses() {
val copied = mutableListOf<String>()

composeTestRule.setContent {
AppTheme {
MessageDetailsStatusSection(
sentTimestamp = null,
receivedTimestamp = RECEIVED_TIMESTAMP,
onCopy = { copied += it },
)
}
}

val label = targetContext.getString(R.string.message_details_received_label)
val focusedNode = composeTestRule.onNodeWithText(label).fetchSemanticsNode()

val customActions = focusedNode.config.getOrNull(SemanticsActions.CustomActions)
assertNotNull("No custom action on the node holding the row text", customActions)

assertEquals(
targetContext.getString(R.string.copy_to_clipboard),
customActions!!.single().label,
)

customActions.single().action()

assertEquals(
listOf(formatMessageDetailsTimestamp(timestampMillis = RECEIVED_TIMESTAMP)),
copied,
)
}

private companion object {
private const val RECEIVED_TIMESTAMP = 1_700_000_000_000L
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ private fun Modifier.copyOnLongPress(
.pointerInput(value) {
detectTapGestures(onLongPress = { onCopy(value) })
}
.semantics {
.semantics(mergeDescendants = true) {
customActions = listOf(
CustomAccessibilityAction(label = copyLabel) {
onCopy(value)
Expand Down
⌂