abertschi / ad-free

A modularized audio ad blocker for Android
https://abertschi.ch/blog/2022/building-adfree/
Apache License 2.0
273 stars 19 forks source link

Ad is detected but the ad continues to play. #41

Closed debasish-patnaik closed 4 years ago

debasish-patnaik commented 4 years ago

I am using a OnePlus 7T, ad-free detects that an ad is being played but it does nothing about it, the ad continues to play.

PS: I'm using the mute plug-in.

abertschi commented 4 years ago

sounds like a device specific issue that requires debugging. as I don't own your device, I cannot investigate it.

abertschi commented 4 years ago

Does it happen all the time? What happens if you play music, open ad-free, navigate to the mute-plugin screen and test the plugin (tab onto the music note icon at the top right). Is the music muted?

debasish-patnaik commented 4 years ago

I was using a bluetooth earphone and it wasn't working at the time. After that I tried with my wired earphone and it worked and now when I reconnected my bluetooth earphone it seems to work. Don't know why it wasn't working the first time though.

debasish-patnaik commented 4 years ago

The issue still happens while using my bluetooth headset, disconnecting the headset and reconnecting it resolves the issue but it displays the same behaviour after some time.

bertolys commented 4 years ago

Hi Andrin, since I updated from Android 9 to 10, I have the same behavior. I did not try with cable tough, only Bluetooth, and the ads are just playing. Taping on the music note doesn't mute the music. I have an OnePlus 6T. Upgraded, uninstalled the app did nothing. Thanks for looking into this.

abertschi commented 4 years ago

I haven't tested the app on Android Q, as issues related to mute cannot be easily tested/debugged in a emulator and my devices are below Q. The behavior you described seems to be device specific as I do not have these issues on my devices. So unless someone debugs the issue on your device, it is likely that it will not get fixed.

abertschi commented 4 years ago

Hi Andrin, since I updated from Android 9 to 10, I have the same behavior. I did not try with cable tough, only Bluetooth, and the ads are just playing. Taping on the music note doesn't mute the music. I have an OnePlus 6T. Upgraded, uninstalled the app did nothing. Thanks for looking into this.

Sometimes ad-free's background service is killed by the OS to save battery. In this case re-enabling the notification listener in the settings can fix undetected ads. Also remove ad-free from the list of apps that run in battery saved mode can fix issues. Issues for which ad-free detects ads but does not mute need debugging to figure out what's wrong.

debasish-patnaik commented 4 years ago

Hello Andrin, upon tinkering around with your code (I've got only basic understanding of android app development) I changed the method you used to set volume from adjustStreamVolume to setStreamVolume and it worked. Upon unmuting, the volume kept resetting to max volume, so I set the volume to it's previous value before muting and it seems to be working as expected.

PS: I don't know why this fix works. Also, thanks for this amazing app.

abertschi commented 4 years ago

:+1: , will look into it. Probably on the weekend.

bertolys commented 4 years ago

Hi Andrin, since I updated from Android 9 to 10, I have the same behavior. I did not try with cable tough, only Bluetooth, and the ads are just playing. Taping on the music note doesn't mute the music. I have an OnePlus 6T. Upgraded, uninstalled the app did nothing. Thanks for looking into this.

Sometimes ad-free's background service is killed by the OS to save battery. In this case re-enabling the notification listener in the settings can fix undetected ads. Also remove ad-free from the list of apps that run in battery saved mode can fix issues. Issues for which ad-free detects ads but does not mute need debugging to figure out what's wrong.

Hi Ardin, thanks, I will try these and let you know.

debasish-patnaik commented 4 years ago

Hey Andrin, looking into the issue further, I found out that bluetooth absolute volume was causing the issue. Basically, when adjustStreamVolume method is used to mute the volume, my bluetooth earphones resets the volume back to what the device remembers as the last setting.

Upon disabling bluetooth absolute volume from developer options, this issue was fixed even with adjustStreamVolume. But this has the effect of requiring a user to control two (headphone and phone) volumes separately.

However as I have said above, if setStreamVolume is used in place of adjustStreamVolume it works as expected even if bluetooth absolute volume is turned on.

abertschi commented 4 years ago

setStreamVolume seems to work with my headset too. Im planning to add an option to switch back to the current way if it will introduce issues for some users. this will make it in the next major release.

abertschi commented 4 years ago

fixed in version #52