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 <stdint.h>
20 #include <inttypes.h>
21 
22 #include <binder/IPCThreadState.h>
23 #include <binder/ProcessState.h>
24 #include <binder/IServiceManager.h>
25 #include <cutils/properties.h>
26 #include <sys/resource.h>
27 #include <utils/Log.h>
28 #include <utils/SystemClock.h>
29 
30 #include "BootAnimation.h"
31 #include "BootAnimationUtil.h"
32 #include "audioplay.h"
33 
34 using namespace android;
35 
main()36 int main()
37 {
38     setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_DISPLAY);
39 
40     bool noBootAnimation = bootAnimationDisabled();
41     ALOGI_IF(noBootAnimation,  "boot animation disabled");
42     if (!noBootAnimation) {
43 
44         sp<ProcessState> proc(ProcessState::self());
45         ProcessState::self()->startThreadPool();
46 
47         // create the boot animation object (may take up to 200ms for 2MB zip)
48         sp<BootAnimation> boot = new BootAnimation(audioplay::createAnimationCallbacks());
49 
50         waitForSurfaceFlinger();
51 
52         boot->run("BootAnimation", PRIORITY_DISPLAY);
53 
54         ALOGV("Boot animation set up. Joining pool.");
55 
56         IPCThreadState::self()->joinThreadPool();
57     }
58     return 0;
59 }
60