Loading packages/SystemUI/res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -2366,6 +2366,8 @@ <string name="media_transfer_failed">Something went wrong. Try again.</string> <!-- Text to indicate that a media transfer is currently in-progress, aka loading. [CHAR LIMIT=NONE] --> <string name="media_transfer_loading">Loading</string> <!-- Default name of the device. [CHAR LIMIT=30] --> <string name="media_ttt_default_device_type">tablet</string> <!-- Error message indicating that a control timed out while waiting for an update [CHAR_LIMIT=30] --> <string name="controls_error_timeout">Inactive, check app</string> Loading packages/SystemUI/src/com/android/systemui/media/taptotransfer/sender/MediaTttSenderCoordinator.kt +6 −1 Original line number Diff line number Diff line Loading @@ -150,7 +150,12 @@ constructor( logger: MediaTttLogger<ChipbarInfo>, ): ChipbarInfo { val packageName = routeInfo.clientPackageName val otherDeviceName = routeInfo.name.toString() val otherDeviceName = if (routeInfo.name.isBlank()) { context.getString(R.string.media_ttt_default_device_type) } else { routeInfo.name.toString() } return ChipbarInfo( // Display the app's icon as the start icon Loading packages/SystemUI/tests/src/com/android/systemui/media/taptotransfer/sender/MediaTttSenderCoordinatorTest.kt +37 −0 Original line number Diff line number Diff line Loading @@ -205,6 +205,21 @@ class MediaTttSenderCoordinatorTest : SysuiTestCase() { verify(vibratorHelper).vibrate(any<VibrationEffect>()) } @Test fun commandQueueCallback_almostCloseToStartCast_deviceNameBlank_showsDefaultDeviceName() { commandQueueCallback.updateMediaTapToTransferSenderDisplay( StatusBarManager.MEDIA_TRANSFER_SENDER_STATE_ALMOST_CLOSE_TO_START_CAST, routeInfoWithBlankDeviceName, null, ) val chipbarView = getChipbarView() assertThat(chipbarView.getChipText()) .contains(context.getString(R.string.media_ttt_default_device_type)) assertThat(chipbarView.getChipText()) .isNotEqualTo(ChipStateSender.ALMOST_CLOSE_TO_START_CAST.getExpectedStateText()) } @Test fun commandQueueCallback_almostCloseToEndCast_triggersCorrectChip() { commandQueueCallback.updateMediaTapToTransferSenderDisplay( Loading Loading @@ -247,6 +262,21 @@ class MediaTttSenderCoordinatorTest : SysuiTestCase() { verify(vibratorHelper).vibrate(any<VibrationEffect>()) } @Test fun commandQueueCallback_transferToReceiverTriggered_deviceNameBlank_showsDefaultDeviceName() { commandQueueCallback.updateMediaTapToTransferSenderDisplay( StatusBarManager.MEDIA_TRANSFER_SENDER_STATE_TRANSFER_TO_RECEIVER_TRIGGERED, routeInfoWithBlankDeviceName, null, ) val chipbarView = getChipbarView() assertThat(chipbarView.getChipText()) .contains(context.getString(R.string.media_ttt_default_device_type)) assertThat(chipbarView.getChipText()) .isNotEqualTo(ChipStateSender.TRANSFER_TO_RECEIVER_TRIGGERED.getExpectedStateText()) } @Test fun commandQueueCallback_transferToThisDeviceTriggered_triggersCorrectChip() { commandQueueCallback.updateMediaTapToTransferSenderDisplay( Loading Loading @@ -934,6 +964,7 @@ class MediaTttSenderCoordinatorTest : SysuiTestCase() { private const val APP_NAME = "Fake app name" private const val OTHER_DEVICE_NAME = "My Tablet" private const val BLANK_DEVICE_NAME = " " private const val PACKAGE_NAME = "com.android.systemui" private const val TIMEOUT = 10000 Loading @@ -942,3 +973,9 @@ private val routeInfo = .addFeature("feature") .setClientPackageName(PACKAGE_NAME) .build() private val routeInfoWithBlankDeviceName = MediaRoute2Info.Builder("id", BLANK_DEVICE_NAME) .addFeature("feature") .setClientPackageName(PACKAGE_NAME) .build() Loading
packages/SystemUI/res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -2366,6 +2366,8 @@ <string name="media_transfer_failed">Something went wrong. Try again.</string> <!-- Text to indicate that a media transfer is currently in-progress, aka loading. [CHAR LIMIT=NONE] --> <string name="media_transfer_loading">Loading</string> <!-- Default name of the device. [CHAR LIMIT=30] --> <string name="media_ttt_default_device_type">tablet</string> <!-- Error message indicating that a control timed out while waiting for an update [CHAR_LIMIT=30] --> <string name="controls_error_timeout">Inactive, check app</string> Loading
packages/SystemUI/src/com/android/systemui/media/taptotransfer/sender/MediaTttSenderCoordinator.kt +6 −1 Original line number Diff line number Diff line Loading @@ -150,7 +150,12 @@ constructor( logger: MediaTttLogger<ChipbarInfo>, ): ChipbarInfo { val packageName = routeInfo.clientPackageName val otherDeviceName = routeInfo.name.toString() val otherDeviceName = if (routeInfo.name.isBlank()) { context.getString(R.string.media_ttt_default_device_type) } else { routeInfo.name.toString() } return ChipbarInfo( // Display the app's icon as the start icon Loading
packages/SystemUI/tests/src/com/android/systemui/media/taptotransfer/sender/MediaTttSenderCoordinatorTest.kt +37 −0 Original line number Diff line number Diff line Loading @@ -205,6 +205,21 @@ class MediaTttSenderCoordinatorTest : SysuiTestCase() { verify(vibratorHelper).vibrate(any<VibrationEffect>()) } @Test fun commandQueueCallback_almostCloseToStartCast_deviceNameBlank_showsDefaultDeviceName() { commandQueueCallback.updateMediaTapToTransferSenderDisplay( StatusBarManager.MEDIA_TRANSFER_SENDER_STATE_ALMOST_CLOSE_TO_START_CAST, routeInfoWithBlankDeviceName, null, ) val chipbarView = getChipbarView() assertThat(chipbarView.getChipText()) .contains(context.getString(R.string.media_ttt_default_device_type)) assertThat(chipbarView.getChipText()) .isNotEqualTo(ChipStateSender.ALMOST_CLOSE_TO_START_CAST.getExpectedStateText()) } @Test fun commandQueueCallback_almostCloseToEndCast_triggersCorrectChip() { commandQueueCallback.updateMediaTapToTransferSenderDisplay( Loading Loading @@ -247,6 +262,21 @@ class MediaTttSenderCoordinatorTest : SysuiTestCase() { verify(vibratorHelper).vibrate(any<VibrationEffect>()) } @Test fun commandQueueCallback_transferToReceiverTriggered_deviceNameBlank_showsDefaultDeviceName() { commandQueueCallback.updateMediaTapToTransferSenderDisplay( StatusBarManager.MEDIA_TRANSFER_SENDER_STATE_TRANSFER_TO_RECEIVER_TRIGGERED, routeInfoWithBlankDeviceName, null, ) val chipbarView = getChipbarView() assertThat(chipbarView.getChipText()) .contains(context.getString(R.string.media_ttt_default_device_type)) assertThat(chipbarView.getChipText()) .isNotEqualTo(ChipStateSender.TRANSFER_TO_RECEIVER_TRIGGERED.getExpectedStateText()) } @Test fun commandQueueCallback_transferToThisDeviceTriggered_triggersCorrectChip() { commandQueueCallback.updateMediaTapToTransferSenderDisplay( Loading Loading @@ -934,6 +964,7 @@ class MediaTttSenderCoordinatorTest : SysuiTestCase() { private const val APP_NAME = "Fake app name" private const val OTHER_DEVICE_NAME = "My Tablet" private const val BLANK_DEVICE_NAME = " " private const val PACKAGE_NAME = "com.android.systemui" private const val TIMEOUT = 10000 Loading @@ -942,3 +973,9 @@ private val routeInfo = .addFeature("feature") .setClientPackageName(PACKAGE_NAME) .build() private val routeInfoWithBlankDeviceName = MediaRoute2Info.Builder("id", BLANK_DEVICE_NAME) .addFeature("feature") .setClientPackageName(PACKAGE_NAME) .build()