finamp icon indicating copy to clipboard operation
finamp copied to clipboard

Finamp consumes a lot of battery while pausing in the background

Open ha-ku opened this issue 1 year ago • 5 comments

I used Finamp to play music for a while during the day and kept Finamp in the background. That night I went to sleep with 53% battery on the phone and woke up with only 4%. The system's battery usage stats showed that Finamp used close to 40% of that power in the background that night, but I didn't use it to play anything all night. Finamp version: 0.9.7 Android version: 14 Screenshot_20240623-112611

ha-ku avatar Jun 24 '24 07:06 ha-ku

Also happens on 0.9.8

tibequadorian avatar Jul 18 '24 11:07 tibequadorian

That is probably because you have "Enter low-priority state on pause" disabled in the Audio Service settings (which is also the default). This is used to make sure Finamp is not killed in the background, so you can start playing even after having music paused for a few hours. I'm not sure why exactly it's draining so much battery in your case, but increased battery drain is definitely expected.
If you can upload logs of the issue I could try to figure out what's causing the massive battery drain, but if you don't mind re-opening Finamp after a few minutes of inactivity, I'd suggest you simply turn on the setting!

Chaphasilor avatar Jul 29 '24 14:07 Chaphasilor

It does not happen on the current stable version (0.6.23)

tibequadorian avatar Aug 02 '24 23:08 tibequadorian

It seems to me that enabling the "Enter low-priority state on pause" option has fixed the battery drain. I haven't ever had the issue again since turning it on. Is there a reason it isn't defaulted to on?

BBaoVanC avatar Sep 04 '24 04:09 BBaoVanC

The reason is that it was changed before Finamp had the ability to restore the queue, so keeping the app alive was the only way to keep the queue.
Also, it is only possible to resume music after a while via e.g. bluetooth headphones if the app is still active. Sometimes the app will get started after it was killed when you try to resume, but then you have to press resume a second time for it to actually start playing again.

But given the battery drain issues, I might change the default again :)

Chaphasilor avatar Sep 04 '24 06:09 Chaphasilor

The default for this setting will be changed with the next beta update, back to how it is on the regular/stable version.
For existing installations you'll have to manually turn on the setting (Settings > "Audio Service" > "Enter Low-Priority Mode on Pause")

Chaphasilor avatar Nov 22 '24 19:11 Chaphasilor

This is still happening on a Google Pixel 7 Pro, Samsung S22, Google Pixel 6, Google Pixel 3A and Google Pixel 3 All with Enter Low Priority Mode enabled

ravtakhar avatar Jan 04 '25 05:01 ravtakhar

@ravtakhar without any playback? Does the app have any exemptions from battery optimizations?

Chaphasilor avatar Mar 28 '25 19:03 Chaphasilor

Yeah, this is happening without playback but another thing I am noticing is that when the app is closed (multi-tasking) it will actually not turn off music. Still required to pause the music from the notification tray.

This is only happening on the Google Pixel 3A and Google Pixel 3 which have the same battery optimization as the Google Pixel 7 Pro & Google Pixel 6.

ravtakhar avatar Mar 29 '25 17:03 ravtakhar

This is still a problem on the 0.9.19 beta

Image

TheFeelTrain avatar Aug 15 '25 20:08 TheFeelTrain

First of all, the battery drain is estimation of actual battery drain. Android likely has no means of actually measuring energy consumption by processes.

This proposes the first question: is this anomaly simply this high number? Or it really drains the battery?

Actually I was suprised I am subscribed to this issue. I checked and yes, I am affected, but I see no battery drain, system successfully goes into deep sleep and all the essentials. So I completely forgot about this issue, most likely I was subscribed because "Enter Low-Priority Mode on Pause" being off prevents deep sleep, but anyway.

I have some vital observations. I have debug application build on my phone (one test is pending so I didn't delete it to avoid relogin). According to android battery drain screen, it drained 2% while release github build (which I use daily) used 29%. Debug build has no player (and no queue to restore, I opened it to check), while release build was ready to play at my command, no "finamp is running" etc (and this didn't prevent deep sleep in the last 8 minutes (time from last charging)). I have "Enter Low-Priority Mode on Pause" enabled and android kills the finamp sometimes, so this feature works normally.

So, the hypothesis: the player is foreground service. It is likely paused, but not destroyed (notification is visible and service is ready to playback). Battery measurement counts that as battery consumption but service doesn't do anything.

Btw, as I have discovered, it is definitely not Riverpod because it disables itself in background.


So, do someone really feel the battery drain? Does the situation change (including real battery drain) if playback is stopped entirely (i.e. no queue at all as opposed to having it on pause)? Don't other players show there having high drain too? Does stopping those players entirely fix this issue with them?

HeroBrine1st avatar Aug 15 '25 21:08 HeroBrine1st

For future reports. I think this info would be relevant:

  • For Finamp (open "App info" in android settings) you should have App battery usage -> Optimised (recommended for most apps)
  • Is player notification visible? (if so, is it an Android 12 "pinned media player" with only "Play" button or fully working notification?)
  • Does the phone go into deep sleep without problems? (I use AccuBattery to get that, something like 60% of screen off time given long standby is okay, but if it is finamp it will entirely prevent it)
  • If you see low deep sleep and if you know how to see wakelocks on your device (starting with Android 15 it is somewhat impossible without system (user 1000, a.k.a. adb shell) privileges), does Finamp keep a wakelock? Actually, it is either you didn't enable "Enter Low-Priority Mode on Pause" or it keeps a wakelock, so this may be excessive
  • Is your OS AOSP-like (can include Google Services) or it has heavy modifications? AOSP-like operating systems usually don't have unique names, it may be "Android One" or "Pure Android" (as opposed to MIUI, OxygenOS etc)
  • Actual battery usage by the whole system (approximately substract percentages from status bar) and the time phone was in standby

If you don't use finamp actively, I recommend starting the test with disconnecting the charger (so that AccuBattery or other measurement utility starts measurement from known point of time), playing something and then leaving the phone on standby.

Copy this template:

- [ ] Finamp battery usage setting is set to "optimised" (recommended for most apps)
- [ ] Player notification is there and does not have anything except "Play" button
- [ ] Player notification is gone
- [ ] Phone sleeps deeply without problems
  - [ ] (optional, remove if unanswered) Finamp keeps a wakelock and so prevents deep sleeping
  - [ ] "Enter Low-Priority Mode on Pause" is enabled in Finamp settings
- Operating system: 
- Period of time phone was standby (wall clock time): 
- Approximately, how much charge was drained by whole system while the phone was standby: 

If you can't provide all of that but still want to report, remove relevant items except last two items (they are used to determine if you have the problem at all).

@Chaphasilor pinging you because i may be scaring affected users with this. I think you have better experience at that if I did anything wrong

HeroBrine1st avatar Aug 16 '25 09:08 HeroBrine1st