blob: 72cd62b150a68bb8ffcd014e782ed6c99dd426cf [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;
Jesse Hall083b84c2014-09-22 10:51:09 -070074 float backgroundColor[3];
Mathias Agopiana8826d62009-10-01 03:10:14 -070075 };
76 int fps;
77 int width;
78 int height;
79 Vector<Part> parts;
80 };
81
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080082 status_t initTexture(Texture* texture, AssetManager& asset, const char* name);
Mykola Kondratenko0c1eeb32014-04-15 09:35:44 +020083 status_t initTexture(const Animation::Frame& frame);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080084 bool android();
Mathias Agopiana8826d62009-10-01 03:10:14 -070085 bool movie();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080086
Kevin Hesterd3782b22012-04-26 10:38:55 -070087 void checkExit();
88
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080089 sp<SurfaceComposerClient> mSession;
90 AssetManager mAssets;
Mathias Agopianb2cf9542009-03-24 18:34:16 -070091 Texture mAndroid[2];
92 int mWidth;
93 int mHeight;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080094 EGLDisplay mDisplay;
95 EGLDisplay mContext;
96 EGLDisplay mSurface;
Mathias Agopian17f638b2009-04-16 20:04:08 -070097 sp<SurfaceControl> mFlingerSurfaceControl;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080098 sp<Surface> mFlingerSurface;
Narayan Kamathafd31e02013-12-03 13:16:03 +000099 ZipFileRO *mZip;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800100};
101
102// ---------------------------------------------------------------------------
103
104}; // namespace android
105
106#endif // ANDROID_BOOTANIMATION_H