Currently, Android uses a common thread chain for all threads with priority THREAD_PRIORITY_BACKGROUND or worse, and THREAD_PRIORITY_BACKGROUND is 10, and THREAD_PRIORITY_DEFAULT is 0 and THREAD_PRIORITY_FOREGROUND is -2.
If you switch to THREAD_PRIORITY_BACKGROUND + THREAD_PRIORITY_MORE_FAVORABLE (aka 9), your stream will be removed from the background group with a 10% limit, although it will not be important enough to interrupt UI threads too often.
protected final YourResult doInBackground(YourInputs... yis) { Process.setThreadPriority(THREAD_PRIORITY_BACKGROUND + THREAD_PRIORITY_MORE_FAVORABLE); ... }
but keep in mind that the underlying implementation can reuse the same Thread object for different tasks, for the next AsyncTask or any other. It seems that Android just resets the priority after doInBackground () returns. .
source share