WiFi is disabled when I enable WiFi Direct I have a Sony Ericsson Arc S, running on Android 4.0.4

I rooted my cellphone and added android.hardware.wifi.direct.xml in /system/etc/permissions/.

I can see the WiFi Direct option in my Settings. When I enable WiFi Direct, it shows that WiFi Direct is opened, but the WiFi is disabled. If I enable WiFi, my WiFi Direct changes to disabled.

When I run WiFiDirectDemo, it fails when I enable WiFi Direct. Once it reaches discoverPeers, WifiP2pManager.ActionListener returns 'Discovery Failed : reason Code is 0'.

I don't know what happened. Does anybody know how to enable WiFi Direct for my phone? Or is it impossible? Why?
Very possibly my solution has nothing to do with the real problem of this person, but the topic is the same, so I consider this answer may help someone:

It is very common nowadays for AP's (access points) to have dual-band frequency 2,4Ghz and 5Ghz and to assign same SSID for both bands. Not all devices have 5Ghz support and, even having it, they may choose the 2,4Ghz band, since they may have bad signal at their current spot for the 5Ghz. The point is that if you are accessing your LAN from a different AP, or using different bands in the same AP with each device, your devices won't be able to use wifi-direct without engaging an adhoc connection between them,  thus they will disable the wifi connection to your AP. The simple solution is to use different SSIDs for each band, and connect with both devices to the same SSID (if both can connect to 5Ghz, go for it).

Different combinations:


A) different AP's same local network - wifi turned off to adhoc
between devices 
B) same AP different band - wifi turned off to adhoc
between devices 
C) same AP same band - bingo! wifi stays on in
infraestructure with my AP