1627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian/*
2627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian * Copyright (C) 2007 The Android Open Source Project
3627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian *
4627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian * Licensed under the Apache License, Version 2.0 (the "License");
5627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian * you may not use this file except in compliance with the License.
6627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian * You may obtain a copy of the License at
7627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian *
8627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian *      http://www.apache.org/licenses/LICENSE-2.0
9627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian *
10627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian * Unless required by applicable law or agreed to in writing, software
11627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian * distributed under the License is distributed on an "AS IS" BASIS,
12627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian * See the License for the specific language governing permissions and
14627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian * limitations under the License.
15627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian */
16627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian
17627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian#define LOG_TAG "BootAnimation"
18627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian
19de36313b0b80c019c2784edd9d41f6761fe80685Mathias Agopian#include <cutils/properties.h>
20de36313b0b80c019c2784edd9d41f6761fe80685Mathias Agopian
21ac31a3b8b09aba1c5ebc73f0cf65cac2210aa6b7Mathias Agopian#include <binder/IPCThreadState.h>
22ac31a3b8b09aba1c5ebc73f0cf65cac2210aa6b7Mathias Agopian#include <binder/ProcessState.h>
23ac31a3b8b09aba1c5ebc73f0cf65cac2210aa6b7Mathias Agopian#include <binder/IServiceManager.h>
24a0d128c8c601750dcbcf97342ffca7865b8a6f9eMathias Agopian
25627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian#include <utils/Log.h>
26627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian#include <utils/threads.h>
27627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian
28627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian#if defined(HAVE_PTHREADS)
29627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian# include <pthread.h>
30627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian# include <sys/resource.h>
31627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian#endif
32627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian
33627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian#include "BootAnimation.h"
34627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian
35627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopianusing namespace android;
36627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian
37627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian// ---------------------------------------------------------------------------
38627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian
39627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopianint main(int argc, char** argv)
40627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian{
41627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian#if defined(HAVE_PTHREADS)
42627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian    setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_DISPLAY);
43627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian#endif
44627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian
45de36313b0b80c019c2784edd9d41f6761fe80685Mathias Agopian    char value[PROPERTY_VALUE_MAX];
46de36313b0b80c019c2784edd9d41f6761fe80685Mathias Agopian    property_get("debug.sf.nobootanimation", value, "0");
47de36313b0b80c019c2784edd9d41f6761fe80685Mathias Agopian    int noBootAnimation = atoi(value);
486215d3ff4b5dfa52a5d8b9a42e343051f31066a5Steve Block    ALOGI_IF(noBootAnimation,  "boot animation disabled");
49de36313b0b80c019c2784edd9d41f6761fe80685Mathias Agopian    if (!noBootAnimation) {
50de36313b0b80c019c2784edd9d41f6761fe80685Mathias Agopian
51de36313b0b80c019c2784edd9d41f6761fe80685Mathias Agopian        sp<ProcessState> proc(ProcessState::self());
52de36313b0b80c019c2784edd9d41f6761fe80685Mathias Agopian        ProcessState::self()->startThreadPool();
53de36313b0b80c019c2784edd9d41f6761fe80685Mathias Agopian
54de36313b0b80c019c2784edd9d41f6761fe80685Mathias Agopian        // create the boot animation object
55de36313b0b80c019c2784edd9d41f6761fe80685Mathias Agopian        sp<BootAnimation> boot = new BootAnimation();
56627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian
57de36313b0b80c019c2784edd9d41f6761fe80685Mathias Agopian        IPCThreadState::self()->joinThreadPool();
58627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian
59de36313b0b80c019c2784edd9d41f6761fe80685Mathias Agopian    }
60627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian    return 0;
61627e7b50be41e4fdee758a1bfad3a55de56b4e27Mathias Agopian}
62