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

Commit 46691064 authored by Santiago Seifert's avatar Santiago Seifert
Browse files

Use group icon in device chip for group routing sessions

This change extends ag/27342016 by also overriding the icon when the
number of selected routes is greater than one. In which case we use the
group icon.

Note: This issue was not caused by ag/27342016. But it's also unclear
when it was introduced.

Bug: b/288915598
Test: Manually using music playing apps.
Flag: com.android.settingslib.media.flags.use_playback_info_for_routing_controls
Change-Id: Ic7a15362f7ed51ee1b1da40ee4c30722d1e7f7b3
parent 0c1aab59
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -354,10 +354,21 @@ constructor(

                    activeDevice =
                        routingSession?.let {
                            val icon = if (it.selectedRoutes.size > 1) {
                                context.getDrawable(
                                        com.android.settingslib.R.drawable.ic_media_group_device)
                            } else {
                                connectedDevice?.icon // Single route. We don't change the icon.
                            }
                            // For a remote session, always use the current device from
                            // LocalMediaManager. Override with routing session name if available to
                            // show dynamic group name.
                            connectedDevice?.copy(name = it.name ?: connectedDevice.name)
                            // LocalMediaManager. Override with routing session information if
                            // available:
                            //   - Name: To show the dynamic group name.
                            //   - Icon: To show the group icon if there's more than one selected
                            //           route.
                            connectedDevice?.copy(
                                    name = it.name ?: connectedDevice.name,
                                    icon = icon)
                        } ?: MediaDeviceData(
                            enabled = false,
                            icon = context.getDrawable(R.drawable.ic_media_home_devices),