Add test coverage for Thread.setPriority().

Libcore wasn't carrying comprehensive tests for the effects of
Thread.setPriority() on subsequent result of Thread.getPriority().

This CL adds coverage for setting priority:
 - of unstarted, starting, started, and joined threads
 - every possible value from MIN_PRIORITY to MAX_PRIORITY inclusive
 - attempt to set a priority outside of the allowed bounds

Note that just Thread.getPriority() returning a particular value
doesn't necessarily prove that the runtime is using that priority
in scheduling the thread.

I'm adding this test coverage now because the code added by
https://r.android.com/1193855 has the potential to start throwing
AIOOBE if the value of MIN_PRIORITY or MAX_PRIORITY ever changes,
so we should have test coverage.

Bug: 139521784
Test: atest CtsLibcoreTestCases:libcore.java.lang.ThreadTest

Change-Id: Ia1b4da8f52aa963517c2b7882ac23a1da4a0754b
1 file changed