blob: 30fe5649c394a3cc4ca9fd2d10406288d9e417f5 [file] [log] [blame]
Alex Ray8a84c712013-07-23 17:04:24 -07001/*
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 <sys/cdefs.h>
21#include "graphics.h"
22
23__BEGIN_DECLS
24
25enum {
26 /*
27 * ***********************************************
28 * ** Keep in sync with android.os.Process.java **
29 * ***********************************************
30 *
31 * This maps directly to the "nice" priorities we use in Android.
32 * A thread priority should be chosen inverse-proportionally to
33 * the amount of work the thread is expected to do. The more work
34 * a thread will do, the less favorable priority it should get so that
35 * it doesn't starve the system. Threads not behaving properly might
36 * be "punished" by the kernel.
37 * Use the levels below when appropriate. Intermediate values are
38 * acceptable, preferably use the {MORE|LESS}_FAVORABLE constants below.
39 */
40 ANDROID_PRIORITY_LOWEST = 19,
41
42 /* use for background tasks */
43 ANDROID_PRIORITY_BACKGROUND = 10,
44
45 /* most threads run at normal priority */
46 ANDROID_PRIORITY_NORMAL = 0,
47
48 /* threads currently running a UI that the user is interacting with */
49 ANDROID_PRIORITY_FOREGROUND = -2,
50
51 /* the main UI thread has a slightly more favorable priority */
52 ANDROID_PRIORITY_DISPLAY = -4,
53
54 /* ui service treads might want to run at a urgent display (uncommon) */
55 ANDROID_PRIORITY_URGENT_DISPLAY = HAL_PRIORITY_URGENT_DISPLAY,
56
57 /* all normal audio threads */
58 ANDROID_PRIORITY_AUDIO = -16,
59
60 /* service audio threads (uncommon) */
61 ANDROID_PRIORITY_URGENT_AUDIO = -19,
62
63 /* should never be used in practice. regular process might not
64 * be allowed to use this level */
65 ANDROID_PRIORITY_HIGHEST = -20,
66
67 ANDROID_PRIORITY_DEFAULT = ANDROID_PRIORITY_NORMAL,
68 ANDROID_PRIORITY_MORE_FAVORABLE = -1,
69 ANDROID_PRIORITY_LESS_FAVORABLE = +1,
70};
71
72__END_DECLS
73
74#endif /* ANDROID_THREAD_DEFS_H */