diff options
author | 2016-07-15 10:50:04 -0400 | |
---|---|---|
committer | 2016-07-15 10:50:04 -0400 | |
commit | 5613313533e28c1c95e91b52e9997d657bf2a479 (patch) | |
tree | bf92d96dea56b3de6d1aaa2a15a8ba877b5a659a | |
parent | 965a70628206f605b19cfd8732c4b7cf2f40a399 (diff) |
Play boot sound on the System stream.
Turning down the ring volume will also turn down boot sound.
BUG:30132711
Change-Id: I902e56b20f105c27209dd47f054e98085647ee85
-rw-r--r-- | cmds/bootanimation/audioplay.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/cmds/bootanimation/audioplay.cpp b/cmds/bootanimation/audioplay.cpp index 8a5c2c6d229c..dbb76dcd27cd 100644 --- a/cmds/bootanimation/audioplay.cpp +++ b/cmds/bootanimation/audioplay.cpp @@ -158,16 +158,32 @@ bool createBufferQueueAudioPlayer(const ChunkFormat* chunkFormat) { SLDataSink audioSnk = {&loc_outmix, NULL}; // create audio player - const SLInterfaceID ids[2] = {SL_IID_BUFFERQUEUE, SL_IID_VOLUME}; - const SLboolean req[2] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE}; + const SLInterfaceID ids[3] = {SL_IID_BUFFERQUEUE, SL_IID_VOLUME, SL_IID_ANDROIDCONFIGURATION}; + const SLboolean req[3] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE}; result = (*engineEngine)->CreateAudioPlayer(engineEngine, &bqPlayerObject, &audioSrc, &audioSnk, - 2, ids, req); + 3, ids, req); if (result != SL_RESULT_SUCCESS) { ALOGE("sl CreateAudioPlayer failed with result %d", result); return false; } (void)result; + // Use the System stream for boot sound playback. + SLAndroidConfigurationItf playerConfig; + result = (*bqPlayerObject)->GetInterface(bqPlayerObject, + SL_IID_ANDROIDCONFIGURATION, &playerConfig); + if (result != SL_RESULT_SUCCESS) { + ALOGE("config GetInterface failed with result %d", result); + return false; + } + SLint32 streamType = SL_ANDROID_STREAM_SYSTEM; + result = (*playerConfig)->SetConfiguration(playerConfig, + SL_ANDROID_KEY_STREAM_TYPE, &streamType, sizeof(SLint32)); + if (result != SL_RESULT_SUCCESS) { + ALOGE("SetConfiguration failed with result %d", result); + return false; + } + // realize the player result = (*bqPlayerObject)->Realize(bqPlayerObject, SL_BOOLEAN_FALSE); if (result != SL_RESULT_SUCCESS) { |