jroal / a2dpvolume

Automatically exported from code.google.com/p/a2dpvolume
http://jimroal.com/slist.htm
95 stars 33 forks source link

2.12.10.6 changing my non-bt media volume on device disconnect #273

Open snowman386 opened 5 years ago

snowman386 commented 5 years ago

I have a nexus 6p with 8.1 dec 2018 security patch. The latest version 2.12.10.6 has been lowering my media volume after disconnecting from a BT device. Stopping the a2dp service eliminates the problem.

jroal commented 5 years ago

This is by design. It captures the volume before any devices connect and volume is restored to that level after all devices disconnect.

snowman386 commented 5 years ago

Sorry but this is not true. I have media volume set to 100%. Then I connect to my car's bt which is an a2dp device. A2dp ensures that the bt media volume is 100%. After disconnecting from my car's bt, the media volume is lowered to somewhere between 50-75%.

snowman386 commented 5 years ago

I have used a2dp for quite a while. This behavior is new since the last update. As I said, it appears to be an a2dp issue because if I disable the a2dp service, my media volume remains 100% after disconnecting from the bt device.

snowman386 commented 5 years ago

Please reopen.

cprhokie commented 5 years ago

I'll see if I can reproduce this issue with the latest version.

jroal commented 5 years ago

You can also simply install an older version if you preferred it. These are available here: https://1drv.ms/f/s!AgUbpiol3wYLux6pg4EQ-ee8sGci

Also I have had similar complaints recently and it appears many other apps and OS features are now also controlling the volume. This has been verified on some devices already.

One other thing, the timing of the volume change matters. Make sure you have a good volume adjustment delay. Try a few different settings.

As there are many different volumes on different devices and many OS and app feature also adjusting volume it gets very tricky to make this work correctly. Also, Pie handles the volume going forward so the volume adjustment features will be removed on Pie and up.

snowman386 commented 5 years ago

Updated to 2.12.11. Still the same. Set media volume to 100% Started car which caused bt to connect. Everything is fine. Turn off car and non bt media volume get set to ~60% Repeat the procedure with a2dp service stopped and media volume stays at 100%. I thought it may be the remember volume setting because I had it enabled on 1 device and the last bt volume was about the same level that my media volume keeps getting reset to but that didn't fix the issue either. Now no devices have the remember setting enabled. I will probably rollback for now. I use android auto via bt all the time but I don't like having the nav audio go through my speakers so I use the phone speakers for google maps. This uses the regular media volume which keeps getting lowered to barely audible levels by a2dp.

cprhokie commented 5 years ago

I can confirm this. It looks like a check for !mvolsLeft was added to getOldVol and this is keeping the previous volume from being captured. When I remove the mvolsLeft check it does set the volume to where it was before the connection. Not sure why the check was added there.

jroal commented 5 years ago

That was added to fix a problem I was having where I had 2 devices simultaneously connected. The first would connect, set the volume, then the second would connect but it would grab the now adjusted volume and capture that as the volume to use as old volume. Then the volume would always stay high because old volume was capture incorrectly. I added a check (as you described above) to ensure no devices were connected before capturing old volume. This makes me think the user with the issue has a device connected pretty much all the time so it can't capture an old volume.

@snowman386 what is your desired behavior? It is not clear from this thread. Do you always want your media volume to stay at 100%? Also, based on the description of this thread, it seem like your concern is that different volumes are being adjusted on connect versus disconnect? Is that the issue? Please explain your use case and desired behavior. By the way, Waze has a feature where you can have it set the volume to a desired level for navigation instructions and so does Google Maps. This was for the use case you describe actually. Have you tried that? .

snowman386 commented 5 years ago

I want the app to stop arbitrarily lowering my media volume. I don't have multiple Bluetooth devices connected simultaneously. I use a2dp to start apps on connect and to adjust the Bluetooth volume for specific devices. I don't want it to lower my media volume on device disconnect. It should leave my media volume unchanged on bt device disconnect.

jroal commented 5 years ago

@snowman386 OK well that is not how this app works. It sets the volume back after all devices disconnect by design. The only reason it was giving behavior you liked before was due to a bug in capturing old volumes. Now I fixed that.

You can clone the app and build a version that does what you want. By the way, On Android 9 an up I removed the volume control feature all together since Android now has this built in. As soon as you get Android 9 and up the volume adjust feature in this app is disabled. For now, just use an old version with the bug that gives the behavior you are happy with.

snowman386 commented 5 years ago

But it isn't doing that. Your "fix" broke the app as @cprhokie said. It is not returning my media volume to the previous volume. My previous volume was 100%. After disconnecting, it is ~60%. Your patch apparently did not work as expected. I am not running android p. I am running android 8.1.

jroal commented 5 years ago

@snowman386 you are correct. I finally looked into it and found the issue. It will capture the correct volume when the app starts, but never again until the app is shut down and starts again. I am working on a fix. Until then, exit the app (menu -> exit), set the disconnected volume where you want it, then start the app. I will push a beta soon.

jroal commented 5 years ago

2.12.11.1 release fixes the issue of not capturing old volumes except at app start. Please test on your device and confirm. I pushed this beta to the Play Store just now (should download in a few hours) and I also added it to the share drive here: https://1drv.ms/f/s!AgUbpiol3wYLux6pg4EQ-ee8sGci

snowman386 commented 5 years ago

Thanks @jroal

I look forward to your update. I will confirm once the beta hits the play store. Unfortunately my company admin (me) does not allow apks to be installed outside of the play store.

cprhokie commented 5 years ago

I tested the patch and it worked for me for the case of a single bluetooth connection

snowman386 commented 5 years ago

Works on my device as well. Thanks for the fix.

snowman386 commented 5 years ago

This issue has come back in the last few betas.

jroal commented 5 years ago

Capturing old volume is very tricky as many things play with volumes. I have restricted the capture of old volume while also trying to let it actually keep up. You are the only person who has requested it only raise the volume and not set it back on disconnect so that is not a feature I plan to directly support through configuration. Try stopping the service, set the media volume to 100%, and then restart the service. Even this may get reset under certain conditions though.

Some devices have a "feature" that is intended to prevent ear damage and they automatically limit the media volume and even give a warning when you try to crank it back up. You may have such a "feature" on your device. I do not have a way around that. You can try playing with different volume delays in A2DP Volume but this may not be something I can fix. A feature like this would likely cause A2DP Volume to capture that adjusted volume as the new base volume and then reset to it on later disconnects. Often these seem to only run once from boot. If this is the case, you might try waiting until boot is completely done + about 5 minutes. Then stop the A2DP Volume service. Set the media volume where you want (100% it sounds like) and then restart the service. You would need to do this after every reboot.

Once you get upgraded to Android 9 and up, it will manage the volume so that feature in A2DP Volume really becomes obsolete.

snowman386 commented 5 years ago

Is there a way I can just disable the volume adjustment on disconnect? The nexus has 2 separate media volumes: one for Bluetooth and one for the phone speaker. The issue is that my speaker media volume is getting changed unnecessarily on disconnect. There is really no need for the app to do that as it is not changed by any bluetooth volume changes so there is nothing that needs to be restored on device disconnect. That is really my only issue. Thanks

jroal commented 5 years ago

@snowman386 Sure, it would be possible to create another configuration, add it to the database, upgrade the database and all functions to support it, get all the strings translated, create a default for the update, and push the changes. However, that is a lot of work and with this feature being obsolete in Pie and up anyway it is just not worth it. I have not heard others wanting that functionality either. The media volume adjust feature should be removed eventually since Pie already manages it. Sure, I keep it in there for Oreo and down for now but eventually it is just not needed. Feel free to clone it though and make a version that you want. All you would have to do if you never want the volume set back is comment out the media volume adjust on the DoDisconnected function. Here is where you would comment out or add a "&& false" to the if statement: https://github.com/jroal/a2dpvolume/blob/master/app/src/main/java/a2dp/Vol/service.java#L1136

I really don't understand your use case. If you already have separate volumes for Bluetooth, why do you ever need to adjust the Bluetooth media volume anyway? It seems like that feature would already manage it fine.

I am not sure if there is a way I can set only the Bluetooth media volume version just the media volume. If there is, I will change that. That could fix your issue without all the headache of implementing additional configuration.

snowman386 commented 5 years ago

I use this app because I have more than 1 bluetooth device. I prefer to have a2dp remember the device BT volumes as my car should have the BT volume set to 100% all the time but 100% is way too loud on my other bluetooth speakers and headphones. This app helps prevent blown speakers in my car and blown eardrums. Not all sounds come via bluetooth though even when connected to a bt device. I have the media volume set to 100% so I can hear them. Then when I disconnect a BT device, the app is lowering that volume to an inaudible level. I have to constantly keep turning up the media volume after disconnect. This app worked fine for a long time until I opened this issue. It seems some change has caused the media volume to be incorrectly captured on connect at least on Nexus devices. Hopefully a new phone is in the cards for me soon but I appreciate your support in the meantime.