• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2013 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ANDROID_THREAD_DEFS_H
18 #define ANDROID_THREAD_DEFS_H
19 
20 #include "graphics.h"
21 
22 #if defined(__cplusplus)
23 extern "C" {
24 #endif
25 
26 enum {
27     /*
28      * ***********************************************
29      * ** Keep in sync with android.os.Process.java **
30      * ***********************************************
31      *
32      * This maps directly to the "nice" priorities we use in Android.
33      * A thread priority should be chosen inverse-proportionally to
34      * the amount of work the thread is expected to do. The more work
35      * a thread will do, the less favorable priority it should get so that
36      * it doesn't starve the system. Threads not behaving properly might
37      * be "punished" by the kernel.
38      * Use the levels below when appropriate. Intermediate values are
39      * acceptable, preferably use the {MORE|LESS}_FAVORABLE constants below.
40      */
41     ANDROID_PRIORITY_LOWEST         =  19,
42 
43     /* use for background tasks */
44     ANDROID_PRIORITY_BACKGROUND     =  10,
45 
46     /* most threads run at normal priority */
47     ANDROID_PRIORITY_NORMAL         =   0,
48 
49     /* threads currently running a UI that the user is interacting with */
50     ANDROID_PRIORITY_FOREGROUND     =  -2,
51 
52     /* the main UI thread has a slightly more favorable priority */
53     ANDROID_PRIORITY_DISPLAY        =  -4,
54 
55     /* ui service treads might want to run at a urgent display (uncommon) */
56     ANDROID_PRIORITY_URGENT_DISPLAY =  HAL_PRIORITY_URGENT_DISPLAY,
57 
58     /* all normal video threads */
59     ANDROID_PRIORITY_VIDEO          = -10,
60 
61     /* all normal audio threads */
62     ANDROID_PRIORITY_AUDIO          = -16,
63 
64     /* service audio threads (uncommon) */
65     ANDROID_PRIORITY_URGENT_AUDIO   = -19,
66 
67     /* should never be used in practice. regular process might not
68      * be allowed to use this level */
69     ANDROID_PRIORITY_HIGHEST        = -20,
70 
71     ANDROID_PRIORITY_DEFAULT        = ANDROID_PRIORITY_NORMAL,
72     ANDROID_PRIORITY_MORE_FAVORABLE = -1,
73     ANDROID_PRIORITY_LESS_FAVORABLE = +1,
74 };
75 
76 #if defined(__cplusplus)
77 }
78 #endif
79 
80 #endif /* ANDROID_THREAD_DEFS_H */
81