bootanimation_main.cpp revision de36313b0b80c019c2784edd9d41f6761fe80685
1/*
2 * Copyright (C) 2007 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#define LOG_TAG "BootAnimation"
18
19#include <cutils/properties.h>
20
21#include <utils/IPCThreadState.h>
22#include <utils/ProcessState.h>
23#include <utils/IServiceManager.h>
24#include <utils/Log.h>
25#include <utils/threads.h>
26
27#include <ui/ISurfaceComposer.h>
28
29#if defined(HAVE_PTHREADS)
30# include <pthread.h>
31# include <sys/resource.h>
32#endif
33
34#include "BootAnimation.h"
35
36using namespace android;
37
38// ---------------------------------------------------------------------------
39
40int main(int argc, char** argv)
41{
42#if defined(HAVE_PTHREADS)
43    setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_DISPLAY);
44#endif
45
46    char value[PROPERTY_VALUE_MAX];
47    property_get("debug.sf.nobootanimation", value, "0");
48    int noBootAnimation = atoi(value);
49    LOGI_IF(noBootAnimation,  "boot animation disabled");
50    if (!noBootAnimation) {
51
52        sp<ProcessState> proc(ProcessState::self());
53        ProcessState::self()->startThreadPool();
54
55        // create the boot animation object
56        sp<BootAnimation> boot = new BootAnimation();
57
58        IPCThreadState::self()->joinThreadPool();
59
60    }
61    return 0;
62}
63