From b18a57cbc158d9540e388ab6e694b2dad9e7676d Mon Sep 17 00:00:00 2001 From: Kohsuke Yatoh Date: Thu, 21 Jan 2021 12:37:32 -0800 Subject: [PATCH] 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 --- core/java/android/provider/FontsContract.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/java/android/provider/FontsContract.java b/core/java/android/provider/FontsContract.java index a15f3aeedf676..faa90d93719f2 100644 --- a/core/java/android/provider/FontsContract.java +++ b/core/java/android/provider/FontsContract.java @@ -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()); }