blob: 6c7b3e51ff8d5d0885673c78340659c30492029a [file] [log] [blame]
Mathias Agopian627e7b52009-05-21 19:21:59 -07001/*
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
Keun-young Park721c9dc2017-05-19 17:13:04 -070019#include <stdint.h>
20#include <inttypes.h>
21
Mathias Agopianac31a3b2009-05-21 19:59:24 -070022#include <binder/IPCThreadState.h>
23#include <binder/ProcessState.h>
24#include <binder/IServiceManager.h>
Yabin Cui16104862015-01-26 19:43:58 -080025#include <cutils/properties.h>
26#include <sys/resource.h>
Mathias Agopian627e7b52009-05-21 19:21:59 -070027#include <utils/Log.h>
Keun-young Park721c9dc2017-05-19 17:13:04 -070028#include <utils/SystemClock.h>
Mathias Agopian627e7b52009-05-21 19:21:59 -070029
Mathias Agopian627e7b52009-05-21 19:21:59 -070030#include "BootAnimation.h"
Ed Coyne7464ac92017-06-08 12:26:48 -070031#include "BootAnimationUtil.h"
Ed Coyne2c9e94a2017-05-31 10:08:28 -070032#include "audioplay.h"
Mathias Agopian627e7b52009-05-21 19:21:59 -070033
34using namespace android;
35
Andreas Gampecfedceb2014-09-30 21:48:18 -070036int main()
Mathias Agopian627e7b52009-05-21 19:21:59 -070037{
Mathias Agopian627e7b52009-05-21 19:21:59 -070038 setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_DISPLAY);
Mathias Agopian627e7b52009-05-21 19:21:59 -070039
Ed Coyne7464ac92017-06-08 12:26:48 -070040 bool noBootAnimation = bootAnimationDisabled();
Steve Block6215d3f2012-01-04 20:05:49 +000041 ALOGI_IF(noBootAnimation, "boot animation disabled");
Mathias Agopiande363132009-07-28 15:27:39 -070042 if (!noBootAnimation) {
Mathias Agopian627e7b52009-05-21 19:21:59 -070043
Mathias Agopiande363132009-07-28 15:27:39 -070044 sp<ProcessState> proc(ProcessState::self());
45 ProcessState::self()->startThreadPool();
Mathias Agopian627e7b52009-05-21 19:21:59 -070046
Huihong Luo50a2f362018-08-11 09:27:57 -070047 // create the boot animation object (may take up to 200ms for 2MB zip)
48 sp<BootAnimation> boot = new BootAnimation(audioplay::createAnimationCallbacks());
49
Ed Coyne7464ac92017-06-08 12:26:48 -070050 waitForSurfaceFlinger();
Ed Coyne2c9e94a2017-05-31 10:08:28 -070051
Huihong Luo50a2f362018-08-11 09:27:57 -070052 boot->run("BootAnimation", PRIORITY_DISPLAY);
53
Kalle Raita88efa562017-07-14 16:18:16 -070054 ALOGV("Boot animation set up. Joining pool.");
Mathias Agopiande363132009-07-28 15:27:39 -070055
56 IPCThreadState::self()->joinThreadPool();
Mathias Agopiande363132009-07-28 15:27:39 -070057 }
Mathias Agopian627e7b52009-05-21 19:21:59 -070058 return 0;
59}