Initialize bootanimation sound on separate thread
Blocks when it's time to play the first sound.
Bug: 30189706
Test: on marlin
Change-Id: Ib3666fbfb5f109c633ed59edad4a283b8ada8ae2
diff --git a/cmds/bootanimation/BootAnimation.h b/cmds/bootanimation/BootAnimation.h
index 7a2e4c2..f1fc98e 100644
--- a/cmds/bootanimation/BootAnimation.h
+++ b/cmds/bootanimation/BootAnimation.h
@@ -39,8 +39,7 @@
class BootAnimation : public Thread, public IBinder::DeathRecipient
{
public:
- BootAnimation();
- virtual ~BootAnimation();
+ BootAnimation();
sp<SurfaceComposerClient> session() const;
@@ -68,6 +67,16 @@
BootAnimation* mBootAnimation;
};
+ class InitAudioThread : public Thread {
+ public:
+ InitAudioThread(uint8_t* exampleAudioData, int mExampleAudioLength);
+ private:
+ virtual bool threadLoop();
+
+ uint8_t* mExampleAudioData;
+ int mExampleAudioLength;
+ };
+
struct Texture {
GLint w;
GLint h;
@@ -156,7 +165,8 @@
bool mSystemBoot;
String8 mZipFileName;
SortedVector<String8> mLoadedFiles;
- sp<TimeCheckThread> mTimeCheckThread;
+ sp<TimeCheckThread> mTimeCheckThread = nullptr;
+ sp<InitAudioThread> mInitAudioThread = nullptr;
};
// ---------------------------------------------------------------------------