xref: /aosp_15_r20/frameworks/base/cmds/bootanimation/bootanimation_main.cpp (revision d57664e9bc4670b3ecf6748a746a57c557b6bc9e)
1*d57664e9SAndroid Build Coastguard Worker /*
2*d57664e9SAndroid Build Coastguard Worker  * Copyright (C) 2007 The Android Open Source Project
3*d57664e9SAndroid Build Coastguard Worker  *
4*d57664e9SAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*d57664e9SAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*d57664e9SAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*d57664e9SAndroid Build Coastguard Worker  *
8*d57664e9SAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*d57664e9SAndroid Build Coastguard Worker  *
10*d57664e9SAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*d57664e9SAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*d57664e9SAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*d57664e9SAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*d57664e9SAndroid Build Coastguard Worker  * limitations under the License.
15*d57664e9SAndroid Build Coastguard Worker  */
16*d57664e9SAndroid Build Coastguard Worker 
17*d57664e9SAndroid Build Coastguard Worker #define LOG_TAG "BootAnimation"
18*d57664e9SAndroid Build Coastguard Worker 
19*d57664e9SAndroid Build Coastguard Worker #include <stdint.h>
20*d57664e9SAndroid Build Coastguard Worker #include <inttypes.h>
21*d57664e9SAndroid Build Coastguard Worker 
22*d57664e9SAndroid Build Coastguard Worker #include <binder/IPCThreadState.h>
23*d57664e9SAndroid Build Coastguard Worker #include <binder/ProcessState.h>
24*d57664e9SAndroid Build Coastguard Worker #include <binder/IServiceManager.h>
25*d57664e9SAndroid Build Coastguard Worker #include <cutils/properties.h>
26*d57664e9SAndroid Build Coastguard Worker #include <sys/resource.h>
27*d57664e9SAndroid Build Coastguard Worker #include <utils/Log.h>
28*d57664e9SAndroid Build Coastguard Worker #include <utils/SystemClock.h>
29*d57664e9SAndroid Build Coastguard Worker 
30*d57664e9SAndroid Build Coastguard Worker #include "BootAnimation.h"
31*d57664e9SAndroid Build Coastguard Worker #include "BootAnimationUtil.h"
32*d57664e9SAndroid Build Coastguard Worker #include "audioplay.h"
33*d57664e9SAndroid Build Coastguard Worker 
34*d57664e9SAndroid Build Coastguard Worker using namespace android;
35*d57664e9SAndroid Build Coastguard Worker 
main()36*d57664e9SAndroid Build Coastguard Worker int main()
37*d57664e9SAndroid Build Coastguard Worker {
38*d57664e9SAndroid Build Coastguard Worker     setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_DISPLAY);
39*d57664e9SAndroid Build Coastguard Worker 
40*d57664e9SAndroid Build Coastguard Worker     bool noBootAnimation = bootAnimationDisabled();
41*d57664e9SAndroid Build Coastguard Worker     ALOGI_IF(noBootAnimation,  "boot animation disabled");
42*d57664e9SAndroid Build Coastguard Worker     if (!noBootAnimation) {
43*d57664e9SAndroid Build Coastguard Worker 
44*d57664e9SAndroid Build Coastguard Worker         sp<ProcessState> proc(ProcessState::self());
45*d57664e9SAndroid Build Coastguard Worker         ProcessState::self()->startThreadPool();
46*d57664e9SAndroid Build Coastguard Worker 
47*d57664e9SAndroid Build Coastguard Worker         // create the boot animation object (may take up to 200ms for 2MB zip)
48*d57664e9SAndroid Build Coastguard Worker         sp<BootAnimation> boot = new BootAnimation(audioplay::createAnimationCallbacks());
49*d57664e9SAndroid Build Coastguard Worker 
50*d57664e9SAndroid Build Coastguard Worker         waitForSurfaceFlinger();
51*d57664e9SAndroid Build Coastguard Worker 
52*d57664e9SAndroid Build Coastguard Worker         boot->run("BootAnimation", PRIORITY_DISPLAY);
53*d57664e9SAndroid Build Coastguard Worker 
54*d57664e9SAndroid Build Coastguard Worker         ALOGV("Boot animation set up. Joining pool.");
55*d57664e9SAndroid Build Coastguard Worker 
56*d57664e9SAndroid Build Coastguard Worker         IPCThreadState::self()->joinThreadPool();
57*d57664e9SAndroid Build Coastguard Worker     }
58*d57664e9SAndroid Build Coastguard Worker     return 0;
59*d57664e9SAndroid Build Coastguard Worker }
60