Set FOREGROUND thread priority to 'fonts' thread.

'fonts' thread will block UI thread, so it should have a higher priority
than DEFAULT.

Bug: 178195682
Test: adb shell "ps -A -l -T" | grep fonts
Change-Id: I4fd67389abcfd7d1b78a3db3dc86422a7a837024
This commit is contained in:
Kohsuke Yatoh
2021-01-21 12:37:32 -08:00
parent ede25d217e
commit b18a57cbc1

View File

@@ -362,7 +362,8 @@ public class FontsContract {
// the font provider takes too much time. For now, request the font data to ensure
// it is in the cache next time and return.
if (sHandler == null) {
sThread = new HandlerThread("fonts", Process.THREAD_PRIORITY_BACKGROUND);
// Use FOREGROUND priority as this thread will block UI thread.
sThread = new HandlerThread("fonts", Process.THREAD_PRIORITY_FOREGROUND);
sThread.start();
sHandler = new Handler(sThread.getLooper());
}