OSDN Git Service

DO NOT MERGE - fix truncated boot sound
authorEric Laurent <elaurent@google.com>
Fri, 23 Sep 2016 20:10:18 +0000 (13:10 -0700)
committerEric Laurent <elaurent@google.com>
Fri, 23 Sep 2016 21:23:27 +0000 (21:23 +0000)
Wait for audioserver service initialization to complete
before playing the sound

Bug: 31651778
Change-Id: I988de549d20468a090c939a1c624ee47d4036cd3

cmds/bootanimation/Android.mk
cmds/bootanimation/AudioPlayer.cpp

index 7c8842c..7f3fe22 100644 (file)
@@ -23,7 +23,8 @@ LOCAL_SHARED_LIBRARIES := \
     libEGL \
     libGLESv1_CM \
     libgui \
-    libtinyalsa
+    libtinyalsa \
+    libmedia
 
 LOCAL_MODULE:= bootanimation
 
index 2932130..f5acac4 100644 (file)
@@ -23,6 +23,7 @@
 #include <tinyalsa/asoundlib.h>
 #include <utils/Log.h>
 #include <utils/String8.h>
+#include <media/AudioSystem.h>
 
 #define ID_RIFF 0x46464952
 #define ID_WAVE 0x45564157
@@ -143,6 +144,9 @@ bool AudioPlayer::init(const char* config)
     struct mixer* mixer = NULL;
     char    name[MAX_LINE_LENGTH];
 
+    // Fake call to wait for audio HAL initialization completion
+    AudioSystem::getParameters(String8(""));
+
     for (;;) {
         const char* endl = strstr(config, "\n");
         if (!endl) break;