Support niceness-based priority calls
Cache niceness values rather than Java priorities, so that we can also
cache priorities set by frameworks code. Add the necessary priority
to niceness and vice-versa conversion infrastructure.
Cache the correct niceness value for system daemons, ensuring that with
the normal priority assignments this still reads back as the same
Java priority value.
Add an API to access the niceness value directly, instead of via Java
priorities.
Preserve the old Thread.priority field, but only to support apps that
read it directly via reflection.
See also go/thread-priorities-in-android and aosp/3287177 .
This is intended to be followed by aosp/3312350 and an updated version
of aosp/3314070 .
Test: Treehugger
Test: atest CtsLibcoreTestCases:libcore.java.lang.ThreadTest
Bug: 389104950
Change-Id: I9497c6c5b1d46402ff747e6f20166385e211dc75
7 files changed