blob: b2f9f1f59ed510be3a733f780ff19cb74801dc38 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
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#ifndef ANDROID_BOOTANIMATION_H
18#define ANDROID_BOOTANIMATION_H
19
20#include <stdint.h>
21#include <sys/types.h>
22
Mathias Agopianb13b9bd2012-02-17 18:27:36 -080023#include <androidfw/AssetManager.h>
Mike Lockwoodebf9a0d2014-10-02 16:08:47 -070024#include <utils/Thread.h>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026#include <EGL/egl.h>
27#include <GLES/gl.h>
28
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080029class SkBitmap;
30
31namespace android {
32
Mike Lockwoodebf9a0d2014-10-02 16:08:47 -070033class AudioPlayer;
Mathias Agopian8335f1c2012-02-25 18:48:35 -080034class Surface;
35class SurfaceComposerClient;
36class SurfaceControl;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080037
38// ---------------------------------------------------------------------------
39
Mathias Agopianbc726112009-09-23 15:44:05 -070040class BootAnimation : public Thread, public IBinder::DeathRecipient
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080041{
42public:
Mathias Agopian627e7b52009-05-21 19:21:59 -070043 BootAnimation();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080044 virtual ~BootAnimation();
45
Mathias Agopianbc726112009-09-23 15:44:05 -070046 sp<SurfaceComposerClient> session() const;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080047
48private:
49 virtual bool threadLoop();
50 virtual status_t readyToRun();
51 virtual void onFirstRef();
Mathias Agopianbc726112009-09-23 15:44:05 -070052 virtual void binderDied(const wp<IBinder>& who);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053
Ramakant Singhcd905362015-10-06 14:05:17 +053054 enum {
55 eOrientationDefault = 0,
56 eOrientation90 = 1,
57 eOrientation180 = 2,
58 eOrientation270 = 3,
59 };
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080060 struct Texture {
61 GLint w;
62 GLint h;
63 GLuint name;
64 };
65
Mathias Agopiana8826d62009-10-01 03:10:14 -070066 struct Animation {
67 struct Frame {
68 String8 name;
69 FileMap* map;
70 mutable GLuint tid;
71 bool operator < (const Frame& rhs) const {
72 return name < rhs.name;
73 }
74 };
75 struct Part {
76 int count;
77 int pause;
78 String8 path;
79 SortedVector<Frame> frames;
Kevin Hesterd3782b22012-04-26 10:38:55 -070080 bool playUntilComplete;
Jesse Hall083b84c2014-09-22 10:51:09 -070081 float backgroundColor[3];
Mike Lockwoodebf9a0d2014-10-02 16:08:47 -070082 FileMap* audioFile;
Mathias Agopiana8826d62009-10-01 03:10:14 -070083 };
84 int fps;
85 int width;
86 int height;
87 Vector<Part> parts;
88 };
89
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080090 status_t initTexture(Texture* texture, AssetManager& asset, const char* name);
Mykola Kondratenko0c1eeb32014-04-15 09:35:44 +020091 status_t initTexture(const Animation::Frame& frame);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080092 bool android();
Mike Lockwoodebf9a0d2014-10-02 16:08:47 -070093 bool readFile(const char* name, String8& outString);
Mathias Agopiana8826d62009-10-01 03:10:14 -070094 bool movie();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080095
Kevin Hesterd3782b22012-04-26 10:38:55 -070096 void checkExit();
97
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080098 sp<SurfaceComposerClient> mSession;
Mike Lockwoodebf9a0d2014-10-02 16:08:47 -070099 sp<AudioPlayer> mAudioPlayer;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800100 AssetManager mAssets;
Mathias Agopianb2cf9542009-03-24 18:34:16 -0700101 Texture mAndroid[2];
102 int mWidth;
103 int mHeight;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800104 EGLDisplay mDisplay;
105 EGLDisplay mContext;
106 EGLDisplay mSurface;
Mathias Agopian17f638b2009-04-16 20:04:08 -0700107 sp<SurfaceControl> mFlingerSurfaceControl;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800108 sp<Surface> mFlingerSurface;
Narayan Kamathafd31e02013-12-03 13:16:03 +0000109 ZipFileRO *mZip;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110};
111
112// ---------------------------------------------------------------------------
113
114}; // namespace android
115
116#endif // ANDROID_BOOTANIMATION_H