1 /* Copyright (C) 2007 The Android Open Source Project
2 
3 Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
4 
5 Not a Contribution, Apache license notifications and license are retained
6 for attribution purposes only.
7 
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 
21 #define LOG_TAG "AudioDaemonMain"
22 #define LOG_NDEBUG 0
23 #define LOG_NDDEBUG 0
24 
25 #include <cutils/properties.h>
26 
27 #include <binder/IPCThreadState.h>
28 #include <binder/ProcessState.h>
29 #include <binder/IServiceManager.h>
30 
31 #include <utils/Log.h>
32 #include <utils/threads.h>
33 
34 #if defined(HAVE_PTHREADS)
35 # include <pthread.h>
36 # include <sys/resource.h>
37 #endif
38 
39 #include "AudioDaemon.h"
40 
41 using namespace android;
42 
43 // ---------------------------------------------------------------------------
44 
main(int argc,char ** argv)45 int main(int argc, char** argv)
46 {
47 #if defined(HAVE_PTHREADS)
48     setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_AUDIO);
49 #endif
50 
51 
52     ALOGV("Audio daemon starting sequence..");
53     sp<ProcessState> proc(ProcessState::self());
54     ProcessState::self()->startThreadPool();
55 
56     sp<AudioDaemon> audioService = new AudioDaemon();
57     IPCThreadState::self()->joinThreadPool();
58 
59     return 0;
60 }
61