adolfintel / OpenPods

The Free and Open Source app for monitoring your AirPods on Android
https://fdossena.com/?p=openPods/index.frag
GNU General Public License v3.0
969 stars 164 forks source link

Bugfix: Recreate RemoteViews on every iteration #112

Closed Reflexe closed 3 years ago

Reflexe commented 3 years ago

Fix a memory leak caused by trying to update the same RemoteViews. Instead of trying to update them, create them from scratch on every iteration.

The memory leak on RemoteViews caused the Parcel to get very big and therefore undeliverable by the Samsung NotificationService.

See https://stackoverflow.com/a/4484693/6797552

Fixes #107

adolfintel commented 3 years ago

@Electric1447 I think in one of your previous commits you did something similar, where the RemoteViews were recreated with every update, right? Did it have any adverse effects for you? I remember switching to updating the RemoteViews because it made my phone laggy, but that was during the initial development in 2019.

Reflexe commented 3 years ago

Maybe this answer is more informative: https://stackoverflow.com/a/53222877

Electric1447 commented 3 years ago

@Electric1447 I think in one of your previous commits you did something similar, where the RemoteViews were recreated with every update, right? Did it have any adverse effects for you? I remember switching to updating the RemoteViews because it made my phone laggy, but that was during the initial development in 2019.

I did not test enough to remember any effects, however I will test the changes in this PR as I am experiencing #107 a lot.

Reflexe commented 3 years ago

@Electric1447 Have you managed to reproduce the issue after this PR?

adolfintel commented 3 years ago

Any updates on this?

Reflexe commented 3 years ago

At least on my device, I never saw any issue after this PR. Anyway, maybe it worth comparing CPU usage and make sure it won't affect other phones.

adolfintel commented 3 years ago

This has been open for a while so I'm going to merge it. Fingers crossed

adolfintel commented 3 years ago

Here's an APK for y'all to test if you want app-release.zip

Let me know how it works.