Android AAudio headphones problem

Hi, we have report from Google. Below is what they say. Do you know about such problem?

We've discovered a bug specific to your application running on Android 13 builds. Please see the following details:
 
Reproduce steps:
==============
1. Install the app
2. Open the app and play
3. Plug and unplug a headset
 
Expected results:
==============
Audio to work fine
 
Observed results:
==============
No audio, it becomes muted

Engineering Analysis : 
=================
The app does not properly handle the error code returned from AAudioStream_requestStart().

It is possible for a headset to become disconnected between the opening of a stream and the start of a stream. When that happens, AAudioStream_requestStart() will return an error code. If you see an error code it is important that you call AAudioStream_close(stream) and then reopen and start a new stream.

It is a very short time period between open and start. So it is hard to reproduce the error. But we are seeing it in repeated tests. You can reproduce this by putting this HACK in your code:

    // FIXME: Temporary HACK. Remove when finished testing.
    static bool sFirstTime = true;
    if (sFirstTime) {
        sFirstTime = false;
        return AAUDIO_ERROR_DISCONNECTED;
    } else {
        return AAudioStream_requestStart(stream);
    }

That will cause the audio in appto die. it should be able to recover.

I have not been able to reproduce this issue. What version ot the FMOD API are you using?
Have you implemented a system callback on FMOD_SYSTEM_CALLBACK_DEVICELISTCHANGED or FMOD_SYSTEM_CALLBACK_ALL?

We use 2.02.06 API version. And we don’t have any system callbacks set.

Thank you for the additional information- I haven’t been able to reproduce this issue naturally but I can see what they mean with the suggested hack reproduction. I have passed this onto the Dev team and they will look into handling such a failure internally.
Thank you for bringing this issue to our attention.