• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 package com.android.camera.async;
3 
4 /**
5  * A thread that runs at the given Android thread priority.
6  */
7 public class AndroidPriorityThread extends Thread {
8     private final int mAndroidThreadPriority;
9 
10     /**
11      * Constructs the new thread.
12      *
13      * @param androidThreadPriority the android priority the thread should run
14      *            at. This has to be one of the
15      *            android.os.Process.THREAD_PRIORITY_* values.
16      * @param runnable the runnable to run at this thread priority.
17      */
AndroidPriorityThread(int androidThreadPriority, Runnable runnable)18     public AndroidPriorityThread(int androidThreadPriority, Runnable runnable) {
19         super(runnable);
20         mAndroidThreadPriority = androidThreadPriority;
21     }
22 
23     @Override
run()24     public void run() {
25         android.os.Process.setThreadPriority(mAndroidThreadPriority);
26         super.run();
27     }
28 }
29