Simplify sleep() and fix overflow bug

The loop to repeatedly call monitor wait until the right time has
elapsed could be greatly simplified.

This used to fail for some ridiculously large millis arguments.
Simply round those up to MAX_VALUE, which corresponds to roughly
292 years. Sleeps of longer than 292 years may now wake up early
(or in a corner case a millisecond or two late).

Test: art/test/testrunner/testrunner.py --host -b --64; TreeHugger
Bug: 148625947
Change-Id: I5721a427b315fe21b7b077a552a0a615ad5a4732
1 file changed