The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 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 Agopian | b13b9bd | 2012-02-17 18:27:36 -0800 | [diff] [blame] | 23 | #include <androidfw/AssetManager.h> |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 24 | #include <utils/threads.h> |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 25 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 26 | #include <EGL/egl.h> |
| 27 | #include <GLES/gl.h> |
| 28 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 29 | class SkBitmap; |
| 30 | |
| 31 | namespace android { |
| 32 | |
Mathias Agopian | 8335f1c | 2012-02-25 18:48:35 -0800 | [diff] [blame] | 33 | class Surface; |
| 34 | class SurfaceComposerClient; |
| 35 | class SurfaceControl; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 36 | |
| 37 | // --------------------------------------------------------------------------- |
| 38 | |
Mathias Agopian | bc72611 | 2009-09-23 15:44:05 -0700 | [diff] [blame] | 39 | class BootAnimation : public Thread, public IBinder::DeathRecipient |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 40 | { |
| 41 | public: |
Mathias Agopian | 627e7b5 | 2009-05-21 19:21:59 -0700 | [diff] [blame] | 42 | BootAnimation(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 43 | virtual ~BootAnimation(); |
| 44 | |
Mathias Agopian | bc72611 | 2009-09-23 15:44:05 -0700 | [diff] [blame] | 45 | sp<SurfaceComposerClient> session() const; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 46 | |
| 47 | private: |
| 48 | virtual bool threadLoop(); |
| 49 | virtual status_t readyToRun(); |
| 50 | virtual void onFirstRef(); |
Mathias Agopian | bc72611 | 2009-09-23 15:44:05 -0700 | [diff] [blame] | 51 | virtual void binderDied(const wp<IBinder>& who); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 52 | |
| 53 | struct Texture { |
| 54 | GLint w; |
| 55 | GLint h; |
| 56 | GLuint name; |
| 57 | }; |
| 58 | |
Mathias Agopian | a8826d6 | 2009-10-01 03:10:14 -0700 | [diff] [blame] | 59 | 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 Hester | d3782b2 | 2012-04-26 10:38:55 -0700 | [diff] [blame] | 73 | bool playUntilComplete; |
Mathias Agopian | a8826d6 | 2009-10-01 03:10:14 -0700 | [diff] [blame] | 74 | }; |
| 75 | int fps; |
| 76 | int width; |
| 77 | int height; |
| 78 | Vector<Part> parts; |
| 79 | }; |
| 80 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 81 | status_t initTexture(Texture* texture, AssetManager& asset, const char* name); |
Mykola Kondratenko | 0c1eeb3 | 2014-04-15 09:35:44 +0200 | [diff] [blame] | 82 | status_t initTexture(const Animation::Frame& frame); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 83 | bool android(); |
Mathias Agopian | a8826d6 | 2009-10-01 03:10:14 -0700 | [diff] [blame] | 84 | bool movie(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 85 | |
Kevin Hester | d3782b2 | 2012-04-26 10:38:55 -0700 | [diff] [blame] | 86 | void checkExit(); |
| 87 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 88 | sp<SurfaceComposerClient> mSession; |
| 89 | AssetManager mAssets; |
Mathias Agopian | b2cf954 | 2009-03-24 18:34:16 -0700 | [diff] [blame] | 90 | Texture mAndroid[2]; |
| 91 | int mWidth; |
| 92 | int mHeight; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 93 | EGLDisplay mDisplay; |
| 94 | EGLDisplay mContext; |
| 95 | EGLDisplay mSurface; |
Mathias Agopian | 17f638b | 2009-04-16 20:04:08 -0700 | [diff] [blame] | 96 | sp<SurfaceControl> mFlingerSurfaceControl; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 97 | sp<Surface> mFlingerSurface; |
Narayan Kamath | afd31e0 | 2013-12-03 13:16:03 +0000 | [diff] [blame] | 98 | ZipFileRO *mZip; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 99 | }; |
| 100 | |
| 101 | // --------------------------------------------------------------------------- |
| 102 | |
| 103 | }; // namespace android |
| 104 | |
| 105 | #endif // ANDROID_BOOTANIMATION_H |