packages/apps/Settings
Revision | 44cc57cd9d964b04a01f27345b0c044d1cfc6c8c (tree) |
---|---|
Time | 2020-09-01 16:48:28 |
Author | timhypeng <timhypeng@goog...> |
Commiter | tim peng |
Display "pair new" only when local output device is available.
-If media app does not support cast->phone transferring, local output
audio device is unavailable. "pair new" is for Bluetooth which should be
also unavilable.
-These types are local output audio devices:
TYPE_BUILTIN_SPEAKER
TYPE_WIRED_HEADSET
TYPE_WIRED_HEADPHONES
TYPE_USB_DEVICE
TYPE_USB_HEADSET
TYPE_USB_ACCESSORY
TYPE_DOCK
TYPE_HDMI
Bug: 163095048
Test: make -j50 RunSettingsRoboTests
Change-Id: Ib844c7546e1946cb87fac04cb8b2b8f4acf06451
(cherry picked from commit 113ac8102aa1db6a1d901e6acbd41ca8f9cb934d)
@@ -106,10 +106,15 @@ public class MediaOutputSlice implements CustomSliceable { | ||
106 | 106 | final MediaDevice connectedDevice = worker.getCurrentConnectedMediaDevice(); |
107 | 107 | if (devices.size() == 1) { |
108 | 108 | // Zero state |
109 | - for (MediaDevice device : devices) { | |
110 | - addRow(device, device, listBuilder); | |
109 | + final MediaDevice device = devices.iterator().next(); | |
110 | + addRow(device, device, listBuilder); | |
111 | + // Add "pair new" only when local output device exists | |
112 | + final int type = device.getDeviceType(); | |
113 | + if (type == MediaDevice.MediaDeviceType.TYPE_PHONE_DEVICE | |
114 | + || type == MediaDevice.MediaDeviceType.TYPE_3POINT5_MM_AUDIO_DEVICE | |
115 | + || type == MediaDevice.MediaDeviceType.TYPE_USB_C_AUDIO_DEVICE) { | |
116 | + listBuilder.addRow(getPairNewRow()); | |
111 | 117 | } |
112 | - listBuilder.addRow(getPairNewRow()); | |
113 | 118 | } else { |
114 | 119 | final boolean isTouched = worker.getIsTouched(); |
115 | 120 | // Fix the last top device when user press device to transfer. |