code logic:
1.frameworks/base/services/java/com/android/server/display
persist.debug.wfd.enable DisplayManagerService.java
One peer invites the other will call requestPeers function. It will judge the peer whether it belong a wifi device supports wifi display. About which device is wifi display device.
it is like the following:
private static boolean isWifiDisplay(WifiP2pDevice device) {
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;
}
if (isWifiDisplay(device)) {
mAvailableWifiDisplayPeers.add(device);
}
http://blog.csdn.net/mznewfacer/article/details/8230380