High CPU load in java.nio using poll

Sometimes when phone goes out of coverage CPU is
stuck at high load when it should not.

System.os.poll() returns the number of file descriptors
ready to be processed, but since they all have
revent=POLLERR, they are not handled/sent to the
application. Next time application does Selector.select(),
native will not block since there are FDs which have to
be processed and Java will discard them again.

As a result, Selector.select() gets called again and again,
producing 100% CPU load per thread that polls for FDs with
POLLERR set.

The fix is to add POLLERR handling (POLLHUP is being
handled already).

Bug: 17456151

(cherry picked from commit f41df4f9710dafffdedb5fa6c40550532069036a)

Change-Id: I3de249f5cac575da76cc16cdc7b986fb66417e04
1 file changed