blob: 62da82f134baf2c847b969e755d416449aaf4ee7 [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>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024#include <utils/threads.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
Mathias Agopian8335f1c2012-02-25 18:48:35 -080033class Surface;
34class SurfaceComposerClient;
35class SurfaceControl;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036
37// ---------------------------------------------------------------------------
38
Mathias Agopianbc726112009-09-23 15:44:05 -070039class BootAnimation : public Thread, public IBinder::DeathRecipient
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080040{
41public:
Mathias Agopian627e7b52009-05-21 19:21:59 -070042 BootAnimation();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080043 virtual ~BootAnimation();
44
Mathias Agopianbc726112009-09-23 15:44:05 -070045 sp<SurfaceComposerClient> session() const;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080046
47private:
48 virtual bool threadLoop();
49 virtual status_t readyToRun();
50 virtual void onFirstRef();
Mathias Agopianbc726112009-09-23 15:44:05 -070051 virtual void binderDied(const wp<IBinder>& who);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052
53 struct Texture {
54 GLint w;
55 GLint h;
56 GLuint name;
57 };
58
Mathias Agopiana8826d62009-10-01 03:10:14 -070059 struct Animation {
60 struct Frame {
61 String8 name;
62 FileMap* map;
63 mutable GLuint tid;
64 bool operator < (const Frame& rhs) const {
65 return name < rhs.name;
66 }
67 };
68 struct Part {
69 int count;
70 int pause;
71 String8 path;
72 SortedVector<Frame> frames;
73 };
74 int fps;
75 int width;
76 int height;
77 Vector<Part> parts;
78 };
79
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080080 status_t initTexture(Texture* texture, AssetManager& asset, const char* name);
Mathias Agopiana8826d62009-10-01 03:10:14 -070081 status_t initTexture(void* buffer, size_t len);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080082 bool android();
Mathias Agopiana8826d62009-10-01 03:10:14 -070083 bool movie();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080084
85 sp<SurfaceComposerClient> mSession;
86 AssetManager mAssets;
Mathias Agopianb2cf9542009-03-24 18:34:16 -070087 Texture mAndroid[2];
88 int mWidth;
89 int mHeight;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080090 EGLDisplay mDisplay;
91 EGLDisplay mContext;
92 EGLDisplay mSurface;
Mathias Agopian17f638b2009-04-16 20:04:08 -070093 sp<SurfaceControl> mFlingerSurfaceControl;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080094 sp<Surface> mFlingerSurface;
Mathias Agopiana8826d62009-10-01 03:10:14 -070095 bool mAndroidAnimation;
96 ZipFileRO mZip;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080097};
98
99// ---------------------------------------------------------------------------
100
101}; // namespace android
102
103#endif // ANDROID_BOOTANIMATION_H