Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AAudio] [Android Pie] Error callback not received on switching audio device #252

Closed
abhi-foss opened this issue Oct 26, 2018 · 5 comments
Closed

Comments

@abhi-foss
Copy link

I am trying to used the AAudio Sample Application, following is the behavior which I am observing
Step 1. Open the App, play the Audio (tap on screen) -> Works fine, audio is being played back via Device Speaker
Step 2. Connect the Wired Headphone, again play the Audio -> Works fine, audio is now being played via connected Headphones.
Step 3. Remove the Wired Headphone, and again play the Audio -> No audio this time.
I expect the Audio Device to switch back to "Device Speaker"

I am also seeing this behavior in the App on which we are working on, i.e Audio Device switching is not working properly. Also please note that the same Application is working fine on Oreo, but not working on Pie
Is there any change with respect to API's that we are missing ?

@dturner
Copy link
Collaborator

dturner commented Oct 29, 2018

Unfortunately this is a bug in Android Pie (internal id: 111711159) which will be fixed in the next release of Android.

A workaround would be to use the (Java) AudioManager API to listen for device changes, then use JNI to pass those changes down to your app.

@abhi-foss
Copy link
Author

Thanks Don for sharing this. Also, If possible, could you please tell, when is the next Android release planned ?

@zombiedeveloper
Copy link

Also, are there any plans to fix this in the current release as a patch?

@stereomatch
Copy link

I tested on a Nokia 6.1 running Android Pie 9.0.

The AAudio echo sample app worked ok - could not replicate the behavior mentioned by abhi-foss (original poster). Both with and without headset, and trying different Recording device and Playback device, things work as expected.

However having problems with our own app:

https://play.google.com/store/apps/details?id=com.stereomatch.hearing.aid.oreo.demo
Super Hearing Oreo 8.1+ Free - Amplifier Eq PSAP

which is not playing output, whether with headset plugged in or not. Though sometimes oddly it starts to work if remove headset etc. - but couldn't replicate that behavior, so is not reproducable.

The same app works well in Android Oreo 8.1.

I will add more once I have more information.

@philburk
Copy link
Collaborator

philburk commented Nov 4, 2018

Also, are there any plans to fix this in the current release as a patch?

It may be in a future patch release for Pie.
Also some OEMs cherry pick specific patches when building for their devices.

Also, If possible, could you please tell, when is the next Android release planned ?

Sorry. We cannot predict when the next release will be or what will be in it. It can change up to the last minute.

I tested on a Nokia 6.1 running Android Pie 9.0.
The AAudio echo sample app worked ok - could not replicate the behavior mentioned by abhi-foss

The bug only affected devices running MMAP, which includes Pixel devices. Some Huawei devices now support MMAP. But they seem to do headphone switching in their DSP and may not be affected.

However having problems with our own app [snip] which is not playing output,
whether with headset plugged in or not.

That sounds like a different issue. Please file a separate Issue and include more details and a LOGCAT of when the audio starts. Also check volume levels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants