• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

packages/apps/Settings


Commit MetaInfo

Revision44cc57cd9d964b04a01f27345b0c044d1cfc6c8c (tree)
Time2020-09-01 16:48:28
Authortimhypeng <timhypeng@goog...>
Commitertim peng

Log Message

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)

Change Summary

Incremental Difference

--- a/src/com/android/settings/media/MediaOutputSlice.java
+++ b/src/com/android/settings/media/MediaOutputSlice.java
@@ -106,10 +106,15 @@ public class MediaOutputSlice implements CustomSliceable {
106106 final MediaDevice connectedDevice = worker.getCurrentConnectedMediaDevice();
107107 if (devices.size() == 1) {
108108 // 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());
111117 }
112- listBuilder.addRow(getPairNewRow());
113118 } else {
114119 final boolean isTouched = worker.getIsTouched();
115120 // Fix the last top device when user press device to transfer.