Introduce checks for integer overflow during division.

Historically, Android would refuse to
perform calculations on memory grounds for large values
or would cast to an int and produce incorrect result for
diffScales outside of the int range.

This change adds a check to prevent scale overflow for
large scale division.

Bug: 17393664
Change-Id: I090c271bb02379f35d3c4392aa38be2bb0cf431f
SelectorImpl: Clean up import

Change-Id: I70123b3b0c57b5b08e26a75209314877d0d84e4f
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
Change-Id: I04bbb8e64bf64aee1e95ea7a1a2e1d16c6e1c990
Conflicts:
	luni/src/main/java/java/nio/SelectorImpl.java