blob: ba1c507d778cbbb25980a5e39c6deb79d0a61593 [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;
Kevin Hesterd3782b22012-04-26 10:38:55 -070073 bool playUntilComplete;
Mathias Agopiana8826d62009-10-01 03:10:14 -070074 };
75 int fps;
76 int width;
77 int height;
78 Vector<Part> parts;
79 };
80
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080081 status_t initTexture(Texture* texture, AssetManager& asset, const char* name);
Mykola Kondratenko0c1eeb32014-04-15 09:35:44 +020082 status_t initTexture(const Animation::Frame& frame);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080083 bool android();
Mathias Agopiana8826d62009-10-01 03:10:14 -070084 bool movie();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085
Kevin Hesterd3782b22012-04-26 10:38:55 -070086 void checkExit();
87
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080088 sp<SurfaceComposerClient> mSession;
89 AssetManager mAssets;
Mathias Agopianb2cf9542009-03-24 18:34:16 -070090 Texture mAndroid[2];
91 int mWidth;
92 int mHeight;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093 EGLDisplay mDisplay;
94 EGLDisplay mContext;
95 EGLDisplay mSurface;
Mathias Agopian17f638b2009-04-16 20:04:08 -070096 sp<SurfaceControl> mFlingerSurfaceControl;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080097 sp<Surface> mFlingerSurface;
Narayan Kamathafd31e02013-12-03 13:16:03 +000098 ZipFileRO *mZip;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080099};
100
101// ---------------------------------------------------------------------------
102
103}; // namespace android
104
105#endif // ANDROID_BOOTANIMATION_H