thetwom / Tuner

Tuner app
GNU General Public License v3.0
192 stars 16 forks source link

Android 14 April update breaks the app #85

Closed LucasGGamerM closed 1 month ago

LucasGGamerM commented 5 months ago

The microphone isn't being turned on, making the app effectively not work.

thetwom commented 5 months ago

Hi, thanks for the report. I am not aware of any deeper changes nor could I find any hints for that online. Can you check if the app still has permissions to use the microphone?

LucasGGamerM commented 5 months ago

It does, and it even asks. But it just does not use it

thetwom commented 5 months ago

Hm, this is difficult to debug. Is this issue only affecting the tuner app? I will try if I can get an update for the Android emulators to see, if this is reproducible.

In case, that I cannot reproduce it, would you theoretically be able to provide android log infos (logcat?). In this case, I could provide special builds, which would write some extra info which could give further hints.

thetwom commented 5 months ago

Unfortunately, the emulators did not really help me. The existing ones for Android 14 seem to be stuck at the September version. Then there is a Android 15 Preview, but also this seems to work fine. I fear without out deeper insight it is hard to find the error.

LucasGGamerM commented 5 months ago

I will make a debug build to see what went wrong there when I get time at home

PowerUser64 commented 2 months ago

I'm able to reproduce this. I'm on Android 14, running Lineage OS without google play services. When I open Tuner for the first time, it asks for microphone privileges, but then it doesn't actually open the microphone, and it draws nothing on the graphs. I have tried some other tuner apps available through f-droid and they seem to not have this issue.

thetwom commented 2 months ago

Thanks for reporting. It looks, like this is not a permission problem. Any chance to install a test build provide logcat info?

LucasGGamerM commented 2 months ago

Thanks for reporting. It looks, like this is not a permission problem. Any chance to install a test build provide logcat info?

Yes! Id be happy to help :D

thetwom commented 2 months ago

ok, perfect. I would be great to see the logs of v6.8.0-log01.

LucasGGamerM commented 2 months ago

ok, perfect. I would be great to see the logs of v6.8.0-log01.

Sorry for the late reply, I got entangled in life stuff and forgot to grab the logs. Here are the things that seem useful out of there.

createRecord_l(387383348): AudioFlinger could not create record track, status: -38
Error creating AudioRecord instance: initialization check failed with status -38.
Error code -20 when initializing native AudioRecord object.
PowerUser64 commented 2 months ago

I could also get logs, if it would be helpful. I have never done this before, but I am familiar with ADB and I can run shell commands on my device, so I could probably do it given a little direction.

thetwom commented 2 months ago

Thanks for lot. A bit unexpected error, but ok. Could you export all logs of the tuner app during startup? I will also try to provide an updated version with more log information tomorrow, but the current version might already provide some useful info.

@PowerUser64 basically you get logcat info with adb logcat or adb -d logcat for usb devices. I will be checking how to filter out the tuner messages. Maybe something like adb -d logcat de.moekadu.tuner could work.

Thanks a lot for the help!

thetwom commented 2 months ago

Ok, I added a few more logs here: v6.8.0-log02. Maybe you could try again to provide some logs. Ideally all tuner logs after starting the app. All logs are tagged with "Tuner", so in linux, with adb it sould work with adb -d logcat | grep Tuner. In windows I am not so sure, but something like adb -d logcat | findstr Tuner might work.

Based on the logs I got from @LucasGGamerM it seems that the recording can't start. Possible problems are missing permissions or that restarting the recording (which is done regularly in the app) does not correctly free resources. Also incorrect options when creating the "recorder" could be a problem. Maybe the logs can give some clue ...

PowerUser64 commented 2 months ago

Here's the output of adb -d logcat | grep Tuner: tuner.log - hopefully this helps!

thetwom commented 1 month ago

Thanks a lot. It simply seems that it fails to create the instance for recording audio.

So there are two things which could be evaluated:

Would be worth testing, but at the moment I don't have access to my keys for signing the app build. I will provide a test executable in a few days. For the time being, the additional testing code is in the android14-issue branch ... the code just iterates over several options and writes the results to the logs ...

thetwom commented 1 month ago

Could one of you install this: v6.8.0-log03 and report the logs. As said, this loops over different AudioRecord settings and writes infos about success and failure to the logs.

So simply start the app, then get the logs ...

This would be super helpful

PowerUser64 commented 1 month ago

Here you go: tuner.log

These logs are from right after a fresh reboot, like you suggested earlier. I also tried going into settings and enabling scientific mode and going back just to see if it would change anything, and it did not. Hope this helps! Feel free to send anything else over that you want me to test.

thetwom commented 1 month ago

Very good, thanks a lot! It seems that android 14 stopped support for recording microphone data with floating point numbers on some phones. There is nothing such mentioned anywhere in the release notes, so either there is a good reason without documentation or it is a bug.

But all this does not matter too much. Now, where we know the root cause of the problem it should be easy to find a way around. I will try to come up with a solution in the next few days.

Thanks again!

thetwom commented 1 month ago

Here is a test version, where I am using now PCM_16BIT instead of PCM_FLOAT: v6.8.0-log04. If I am not completely wrong, this should make the app work again on your phones. If this works, I will include this in the official version.

LucasGGamerM commented 1 month ago

It works again!

PowerUser64 commented 1 month ago

Can confirm, v6.8.0-log04 works! Thanks for your work to fix this, @thetwom!

thetwom commented 1 month ago

Great, thanks a lot for your help!

thetwom commented 1 month ago

Ok, here is the official version with the changes: v6.8.1. Should appear on fdroid and google play within the next days. Thanks again for the help!

thetwom commented 1 month ago

@LucasGGamerM For reporting the cause of the issue to android issue tracker, it would be helpful to get some information about your system. Are you using stock android or some other system? Maybe you could also name your phone? @PowerUser64 Maybe you can say, which phone you are using?

LucasGGamerM commented 1 month ago

@LucasGGamerM For reporting the cause of the issue to android issue tracker, it would be helpful to get some information about your system. Are you using stock android or some other system? Maybe you could also name your phone? @PowerUser64 Maybe you can say, which phone you are using?

It's a Google Pixel 3 running an AOSP based rom called CalyxOS.

PowerUser64 commented 1 month ago

I'm running LineageOS (Android 14) on a Pixel 3a (build number: lineage_sargo-userdebug 14 AP2A.240705.005 08008b815d).

thetwom commented 1 month ago

Thanks. I did report this issue to the android issue tracker for completeness. But for the tuner itself, it does not really matter, since this is now solved.

Thanks again for your help. Would have been impossible to solve without getting the deeper insights, you provided.