diff options
author | Jeff Brown <jeffbrown@google.com> | 2012-09-11 12:18:15 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2012-09-11 12:18:15 -0700 |
commit | 0f68d166e6ca45fe27410ea520967275e0733757 (patch) | |
tree | 4cf47e803d6271bbd5f63502ed0fdb1f2a8dad6c /services/java/com/android/server/display | |
parent | 43aa15912891930833edfc101615a9c881de54a1 (diff) | |
download | frameworks_base-0f68d166e6ca45fe27410ea520967275e0733757.zip frameworks_base-0f68d166e6ca45fe27410ea520967275e0733757.tar.gz frameworks_base-0f68d166e6ca45fe27410ea520967275e0733757.tar.bz2 |
Use wfdInfo to filter available sinks.
Change-Id: If056267738f70835af645a8c6e7a91c0c5407816
Diffstat (limited to 'services/java/com/android/server/display')
-rw-r--r-- | services/java/com/android/server/display/WifiDisplayController.java | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/services/java/com/android/server/display/WifiDisplayController.java b/services/java/com/android/server/display/WifiDisplayController.java index 67691df..f5ec0b7 100644 --- a/services/java/com/android/server/display/WifiDisplayController.java +++ b/services/java/com/android/server/display/WifiDisplayController.java @@ -493,14 +493,8 @@ final class WifiDisplayController implements DumpUtils.Dump { return; // done } - int port = DEFAULT_CONTROL_PORT; - if (mConnectedDevice.deviceName.startsWith("DIRECT-") - && mConnectedDevice.deviceName.endsWith("Broadcom")) { - // These dongles ignore the port we broadcast in our WFD IE. - port = 8554; - } - final WifiDisplay display = createWifiDisplay(mConnectedDevice); + final int port = getPortNumber(mConnectedDevice); final String iface = addr.getHostAddress() + ":" + port; mPublishedDevice = mConnectedDevice; @@ -647,12 +641,24 @@ final class WifiDisplayController implements DumpUtils.Dump { return null; } + private static int getPortNumber(WifiP2pDevice device) { + if (device.deviceName.startsWith("DIRECT-") + && device.deviceName.endsWith("Broadcom")) { + // These dongles ignore the port we broadcast in our WFD IE. + return 8554; + } + return DEFAULT_CONTROL_PORT; + } + private static boolean isWifiDisplay(WifiP2pDevice device) { - // FIXME: the wfdInfo API doesn't work yet - return device.deviceName.startsWith("DWD-") - || device.deviceName.startsWith("DIRECT-") - || device.deviceName.startsWith("CAVM-"); - //device.wfdInfo != null && device.wfdInfo.isWfdEnabled(); + return device.wfdInfo != null + && device.wfdInfo.isWfdEnabled() + && isPrimarySinkDeviceType(device.wfdInfo.getDeviceType()); + } + + private static boolean isPrimarySinkDeviceType(int deviceType) { + return deviceType == WifiP2pWfdInfo.PRIMARY_SINK + || deviceType == WifiP2pWfdInfo.SOURCE_OR_PRIMARY_SINK; } private static String describeWifiP2pDevice(WifiP2pDevice device) { |