I have three android devices, a Samsung Galaxy Note 10 an HTC Desire C and a Sony Xperia E. As well i have a service that listens on a specific TCP port on these devices. The WIFI policy is set to "Always on" in all of my devices as well my service acquires a WIFI_MODE_FULL and a PARTIAL_WAKE_LOCK so the CPU and WIFI are always there. After some time when i want to connect to these devices from the server something bad happens.
- The Samsung Galaxy Note device always behaves correctly.
- HTC Desire becomes unreachable
- The Sony device is also unreachable
I Pinged these devices to see if they are there or not. The results is:
- The Samsung device always responds to ping requests immediately and normally.
- HTC and Sony device are unreachable for sometime and sometimes they respond but with a very long latency even when their screen is on (time column of ping is sometimes about 5000ms).
I know that there are some issues with the WIFI policy:
- https://code.google.com/p/android/issues/detail?id=9781
- https://code.google.com/p/android/issues/detail?id=6611
But why the ping time is like this?? Even when the screen is on?? As well i know that the CPU clock decreases when screen goes off, even if you hold a wake lock. Can this cause problems in the Service code that handles TCP connections??