Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Android battery usage #1446

Open
faulker opened this issue Jan 22, 2025 · 34 comments
Open

[Bug]: Android battery usage #1446

faulker opened this issue Jan 22, 2025 · 34 comments
Labels
bug Something isn't working

Comments

@faulker
Copy link

faulker commented Jan 22, 2025

What was the Problem?

I'm having battery usage issues, the usage has been much higher than in previous app versions. After about two hours of playtime, it has been running in the background for 6+ hours and accounted for 35% of my battery usage, five times the usage of any other app.

Steps to Reproduce the Issue

Use the app on a similar phone

What was Expected?

Less battery usage

Phone Model

Pixel 7a

Phone OS

Android 15

Audiobookshelf App Version

Android App - 0.9.78

Installation Source

Google Play Store

Additional Notes

I do have the widget enabled, I've removed it to see if that makes any difference.

@faulker faulker added the bug Something isn't working label Jan 22, 2025
@nichwall
Copy link
Contributor

Was this with streaming or a downloaded book? Was the app connected to the server or listening in offline mode (not attempting to sync progress to the server)?

I just checked my usage, and a downloaded book took 16% of my battery after 7.4 hours on a Pixel 6a

@faulker
Copy link
Author

faulker commented Jan 22, 2025

It is an audiobook that I have previously downloaded from the server, I am not streaming anything from the server.
Removing the widget didn't help, today I listened for less than an hour yet the battery usage is around the same 37% of my used battery was from the app. The app is reporting that it has been running in the background for 3h 52m.

This time around I'm disabling the "pin media player" option to see if that helps at all

@Zibbp
Copy link

Zibbp commented Jan 22, 2025

I've also noticed this since the last last updated, 0.9.78. I'm listening to a downloaded book and it uses a significant amount of battery (something is using a lot of CPU as the phone warms up). Android claims 45% battery usage for ~5 hours of runtime.

@schinguhl
Copy link

schinguhl commented Jan 23, 2025

Its the same for me. After the last pixel 9 update (android 15, security patch of January) my audiobookshelf app uses up to 40% of my battery every day. Before this update it was not noticeable. Im listening to an downloaded audiobook and the network usage is almost 0.

Image

@TDderpy
Copy link

TDderpy commented Jan 23, 2025

Same issues for me also! One thing I've noticed is everyone who's stated a phone model all seem to have pixel devices?
I myself are in a pixel 7 pro, might just be representative of the community here I'm not sure, but could be pixel devices specifically effected?

@kingmike67
Copy link

Noticed the same with me on my P8P. Now I can almost confirm 100% it's something (not sure what) in the pixel stock ROM that is causing it. When running a custom ROM, I can listen for hours, nearly half the day and it's only 15-20% battery drain. On Stock ROM I lose about 15% batter an hour listening. All books are streaming for me.

@Vilhjalmr26
Copy link

Same issue on my Pixel 9 Pro, very recently started burning through battery while in background and not listening. Yesterday I listened to downloaded audiobook for about 2 hours total, and audiobookshelf accounted for 57% of my daily battery usage. And that was with my battery having run down to 10% at the point when I checked, so a very significant amount of the battery.

@Zibbp
Copy link

Zibbp commented Jan 23, 2025

Same issues for me also! One thing I've noticed is everyone who's stated a phone model all seem to have pixel devices?
I myself are in a pixel 7 pro, might just be representative of the community here I'm not sure, but could be pixel devices specifically effected?

I have a Samsung S22 running Android 14 so I don't believe it is limited to Pixels.

@theniwo
Copy link

theniwo commented Jan 23, 2025

I have a Samsung S22 running Android 14 so I don't believe it is limited to Pixels.

Samsung Galaxy S20 Pro / Android 13 / One UI 5.1 / Nova Launcher Prime 8.0.18

ABS Mobile Version: 0.9.78-beta
ABS Server Version: 2.18.1 docker

No significant increase of CPU Load while streaming over cell and wifi as well as local playback. Widget enabled. Foreground and Background playback.

(You can add and enable a CPU Load Widget in Androids Developer Settings -> GPU Watch)

@faulker
Copy link
Author

faulker commented Jan 23, 2025

Disabling "pin media player" had no effect, battery usage is still extremely high (41% over 7 hours today) with only 30 mins of listing time.

@theniwo
Copy link

theniwo commented Jan 23, 2025

Its the same for me. After the last pixel 9 update (android 15, security patch of January) my audiobookshelf app uses up to 40% of my battery every day. Before this update it was not noticeable. Im listening to an downloaded audiobook and the network usage is almost 0.

It doesn't even show up in my battery usage history of this week. But I have 60 minutes sleep timer enabled, though.

@kymahi
Copy link

kymahi commented Jan 23, 2025

Just wanted to say I'm also having this same experience.

Image

ROG Phone 6

app version 0.9.78-beta

listened to about 20 minutes of a (locally downloaded, not streamed) book this morning, did not download any other books or interact with the app outside of playing and pausing.

@theniwo
Copy link

theniwo commented Jan 23, 2025

It was active in the background for 6.5 hrs.

Can you check the battery setting of the app (App-Info -> Battery)?

Mine is set to optimized. The other two options translate to

  • Not limited: Allows the app to use the battery without limits. Can decrease battery lifespan.
  • Limited: Limits the use of battery in the background. App can misfunction etc.

Make sure, you don't have it on Not limited, or whatever the setting is called in english.

Image

@tdz262
Copy link

tdz262 commented Jan 24, 2025

Pixel 7 Pro. I am streaming and it's used 77% battery in 11 hours of background use. I had my phone playing through Bluetooth speaker most of the day, I've plugged my phone back in multiple times through out the day because battery was getting low. Audiobook shelf is on Optimized.

@Ich-Eben
Copy link

Have the same issue (Pixel 8a).
I did a few tests and figured out that it does not matter if you are listening locally or streaming. In fact, the app drains the battery even when it is only running in the background and you are not listening to anything at all.

I downgraded the app to version v0.9.77-beta and the problem was gone. So, there is definitely something wrong with version v0.9.78-beta.

@biuklija
Copy link
Contributor

Same issue, Samsung A55 (Android 14), ABS server at v2.18.1; v0.9.78-beta absolutely murders my battery life just by idling in the background after I stop playing an audiobook (local, streaming, makes no difference) even with screen off. I had to downgrade to 0.9.77 so can't provide battery usage stats, but they're similar to those seen in previous posts.

@advplyr
Copy link
Owner

advplyr commented Jan 27, 2025

I believe I found the culprit for the battery issue. The hopeful fix is in v0.9.79-beta that was just made available in the app stores.
Please let me know what your experience is.

@schinguhl
Copy link

works for me :-) The battery usage is back to normal (Pixel 9).

@kymahi
Copy link

kymahi commented Jan 28, 2025

Image

Still having high battery usage in the background on 0.9.79-beta.

I had it in my car playing through Android Auto, then disconnected it and started playing it immediately after through the speaker, playing for about 20 minutes. Then I paused it and haven't used it since

@Vilhjalmr26
Copy link

Mine has definitely been better. Was listening for about an hour on Android auto this morning, then paused and unused since. Drain since pausing has been minimal, it still pulled about double the power of Android auto, but not sure how those normally lines up.

So usage still seems a bit high, but background seems better at the least.

Image

@TDderpy
Copy link

TDderpy commented Jan 28, 2025

Things are certainly better for me now, but usage is still the highest usage of all the apps, at around 40-60% but much less draining then before.

@faulker
Copy link
Author

faulker commented Jan 28, 2025

Honestly, the battery usage seems worse for me with 0.9.79-beta, if not worse it is the same

@advplyr
Copy link
Owner

advplyr commented Jan 28, 2025

Thanks for reporting.

I'm pretty sure this is now isolated to android auto.

If users who don't use android auto at all can confirm they have seen improvement that would be helpful.

@jaredtodworkman
Copy link

jaredtodworkman commented Jan 28, 2025

I don't use Android Auto and my battery is back to normal.

Screenshot_20250128-164259.png

@lightheaded
Copy link

I'm using 0.9.79-beta and today my phone was so sluggish to respond (i.e. it responded to the power button press after 2-3 seconds) I had to restart. I did use Android Auto earlier today. Funnily enough, force closing Audiobookshelf didn't resolve the sluggishness of the phone. I had to restart.

Image

@theniwo
Copy link

theniwo commented Jan 30, 2025

Check if sluggishness is caused by high CPU usage:
You can add and enable a CPU Load Widget in Androids Developer Settings -> GPU Watch

@lightheaded
Copy link

Check if sluggishness is caused by high CPU usage: You can add and enable a CPU Load Widget in Androids Developer Settings -> GPU Watch

Thanks! Will check next time it occurs

@thoughtlessdestiny
Copy link

I've had high usage and just been streaming to Bluetooth earbuds. I'm on the 0.9.79-beta using a Pixel Fold.
Image

@codhopper
Copy link

I've noticed some pretty wild battery drain on my android client, even when it is idle in the background not playing anything. I did see it as high as ~60% total battery drain after listening to maybe 2 hours of locally downloaded audio book (pixel 6 pro). I did turn on debugging and couldn't see anything abnormal (initially I thought it might have been played status updates getting sent back).

tcpdump on the server side had a message coming back when the whole thing was backgrounded (the query stopped when the app was forced to quit). Before I started killing the app it was coming through about once every 4-5 seconds. Afterwards I couldn't get it to repeat at any sort of frequency. It seemed to be a reply with just "Loading...".

GET / HTTP/1.0
HTTP/1.1 200 OK
Content-Security-Policy: frame-ancestors 'self'
Accept-Ranges: bytes
Cache-Control: public, max-age=0
Last-Modified: Sun, 02 Feb 2025 21:42:10 GMT
ETag: W/"1028-194c89d2750"
Content-Type: text/html; charset=UTF-8
Content-Length: 4136
Date: Thu, 06 Feb 2025 12:30:44 GMT
Connection: close

<!doctype html>
<html lang="en" data-n-head="%7B%22lang%22:%7B%221%22:%22en%22%7D%7D">
  <head>
    <meta data-n-head="1" charset="utf-8"><meta data-n-head="1" name="viewport" content="width=device-width,initial-scale=1"><meta data-n-head="1" data-hid="description" name="description" content=""><meta data-n-head="1" data-hid="robots" name="robots" content="noindex"><meta data-n-head="1" data-hid="charset" charset="utf-8"><meta data-n-head="1" data-hid="mobile-web-app-capable" name="mobile-web-app-capable" content="yes"><meta data-n-head="1" data-hid="apple-mobile-web-app-capable" name="apple-mobile-web-app-capable" content="yes"><meta data-n-head="1" data-hid="apple-mobile-web-app-status-bar-style" name="apple-mobile-web-app-status-bar-style" content="black"><meta data-n-head="1" data-hid="apple-mobile-web-app-title" name="apple-mobile-web-app-title" content="Audiobookshelf"><meta data-n-head="1" data-hid="theme-color" name="theme-color" content="#232323"><meta data-n-head="1" data-hid="og:type" name="og:type" property="og:type" content="website"><meta data-n-head="1" data-hid="og:title" name="og:title" property="og:title" content="Audiobookshelf"><meta data-n-head="1" data-hid="og:site_name" name="og:site_name" property="og:site_name" content="Audiobookshelf"><title>Audiobookshelf</title><link data-n-head="1" rel="icon" type="image/x-icon" href="/audiobookshelf/favicon.ico"><link data-n-head="1" rel="apple-touch-icon" href="/audiobookshelf/ios_icon.png"><link data-n-head="1" data-hid="shortcut-icon" rel="shortcut icon" href="/audiobookshelf/icon.svg"><link data-n-head="1" data-hid="apple-touch-icon" rel="apple-touch-icon" href="/audiobookshelf/icon192.png" sizes="any"><link data-n-head="1" rel="manifest" href="/audiobookshelf/_nuxt/manifest.2f7e41c6.json" data-hid="manifest"><base href="/audiobookshelf/"><link rel="preload" href="/audiobookshelf/_nuxt/790ce0e.js" as="script"><link rel="preload" href="/audiobookshelf/_nuxt/a66bc33.js" as="script"><link rel="preload" href="/audiobookshelf/_nuxt/10761d5.js" as="script"><link rel="preload" href="/audiobookshelf/_nuxt/8fa8266.js" as="script">
  </head>
  <body>
    <div id="__nuxt"><style>#nuxt-loading{background:#fff;visibility:hidden;opacity:0;position:absolute;left:0;right:0;top:0;bottom:0;display:flex;justify-content:center;align-items:center;flex-direction:column;animation:nuxtLoadingIn 10s ease;-webkit-animation:nuxtLoadingIn 10s ease;animation-fill-mode:forwards;overflow:hidden}@keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}@-webkit-keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}#nuxt-loading>div,#nuxt-loading>div:after{border-radius:50%;width:5rem;height:5rem}#nuxt-loading>div{font-size:10px;position:relative;text-indent:-9999em;border:.5rem solid #f5f5f5;border-left:.5rem solid #000;-webkit-transform:translateZ(0);-ms-transform:translateZ(0);transform:translateZ(0);-webkit-animation:nuxtLoading 1.1s infinite linear;animation:nuxtLoading 1.1s infinite linear}#nuxt-loading.error>div{border-left:.5rem solid #ff4500;animation-duration:5s}@-webkit-keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}</style> <script>window.addEventListener("error",(function(){var e=document.getElementById("nuxt-loading");e&&(e.className+=" error")}))</script> <div id="nuxt-loading" aria-live="polite" role="status"><div>Loading...</div></div> </div><script>window.__NUXT__={config:{version:"2.19.0",routerBasePath:"/audiobookshelf",_app:{basePath:"/audiobookshelf/",assetsPath:"/audiobookshelf/_nuxt/",cdnURL:null}}}</script>
  <script src="/audiobookshelf/_nuxt/790ce0e.js"></script><script src="/audiobookshelf/_nuxt/a66bc33.js"></script><script src="/audiobookshelf/_nuxt/10761d5.js"></script><script src="/audiobookshelf/_nuxt/8fa8266.js"></script></body>
</html>

@advplyr
Copy link
Owner

advplyr commented Feb 6, 2025

I've noticed some pretty wild battery drain on my android client, even when it is idle in the background not playing anything. I did see it as high as ~60% total battery drain after listening to maybe 2 hours of locally downloaded audio book (pixel 6 pro). I did turn on debugging and couldn't see anything abnormal (initially I thought it might have been played status updates getting sent back).

tcpdump on the server side had a message coming back when the whole thing was backgrounded (the query stopped when the app was forced to quit). Before I started killing the app it was coming through about once every 4-5 seconds. Afterwards I couldn't get it to repeat at any sort of frequency. It seemed to be a reply with just "Loading...".

GET / HTTP/1.0
HTTP/1.1 200 OK
Content-Security-Policy: frame-ancestors 'self'
Accept-Ranges: bytes
Cache-Control: public, max-age=0
Last-Modified: Sun, 02 Feb 2025 21:42:10 GMT
ETag: W/"1028-194c89d2750"
Content-Type: text/html; charset=UTF-8
Content-Length: 4136
Date: Thu, 06 Feb 2025 12:30:44 GMT
Connection: close

<!doctype html>
<html lang="en" data-n-head="%7B%22lang%22:%7B%221%22:%22en%22%7D%7D">
  <head>
    <meta data-n-head="1" charset="utf-8"><meta data-n-head="1" name="viewport" content="width=device-width,initial-scale=1"><meta data-n-head="1" data-hid="description" name="description" content=""><meta data-n-head="1" data-hid="robots" name="robots" content="noindex"><meta data-n-head="1" data-hid="charset" charset="utf-8"><meta data-n-head="1" data-hid="mobile-web-app-capable" name="mobile-web-app-capable" content="yes"><meta data-n-head="1" data-hid="apple-mobile-web-app-capable" name="apple-mobile-web-app-capable" content="yes"><meta data-n-head="1" data-hid="apple-mobile-web-app-status-bar-style" name="apple-mobile-web-app-status-bar-style" content="black"><meta data-n-head="1" data-hid="apple-mobile-web-app-title" name="apple-mobile-web-app-title" content="Audiobookshelf"><meta data-n-head="1" data-hid="theme-color" name="theme-color" content="#232323"><meta data-n-head="1" data-hid="og:type" name="og:type" property="og:type" content="website"><meta data-n-head="1" data-hid="og:title" name="og:title" property="og:title" content="Audiobookshelf"><meta data-n-head="1" data-hid="og:site_name" name="og:site_name" property="og:site_name" content="Audiobookshelf"><title>Audiobookshelf</title><link data-n-head="1" rel="icon" type="image/x-icon" href="/audiobookshelf/favicon.ico"><link data-n-head="1" rel="apple-touch-icon" href="/audiobookshelf/ios_icon.png"><link data-n-head="1" data-hid="shortcut-icon" rel="shortcut icon" href="/audiobookshelf/icon.svg"><link data-n-head="1" data-hid="apple-touch-icon" rel="apple-touch-icon" href="/audiobookshelf/icon192.png" sizes="any"><link data-n-head="1" rel="manifest" href="/audiobookshelf/_nuxt/manifest.2f7e41c6.json" data-hid="manifest"><base href="/audiobookshelf/"><link rel="preload" href="/audiobookshelf/_nuxt/790ce0e.js" as="script"><link rel="preload" href="/audiobookshelf/_nuxt/a66bc33.js" as="script"><link rel="preload" href="/audiobookshelf/_nuxt/10761d5.js" as="script"><link rel="preload" href="/audiobookshelf/_nuxt/8fa8266.js" as="script">
  </head>
  <body>
    <div id="__nuxt"><style>#nuxt-loading{background:#fff;visibility:hidden;opacity:0;position:absolute;left:0;right:0;top:0;bottom:0;display:flex;justify-content:center;align-items:center;flex-direction:column;animation:nuxtLoadingIn 10s ease;-webkit-animation:nuxtLoadingIn 10s ease;animation-fill-mode:forwards;overflow:hidden}@keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}@-webkit-keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}#nuxt-loading>div,#nuxt-loading>div:after{border-radius:50%;width:5rem;height:5rem}#nuxt-loading>div{font-size:10px;position:relative;text-indent:-9999em;border:.5rem solid #f5f5f5;border-left:.5rem solid #000;-webkit-transform:translateZ(0);-ms-transform:translateZ(0);transform:translateZ(0);-webkit-animation:nuxtLoading 1.1s infinite linear;animation:nuxtLoading 1.1s infinite linear}#nuxt-loading.error>div{border-left:.5rem solid #ff4500;animation-duration:5s}@-webkit-keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}</style> <script>window.addEventListener("error",(function(){var e=document.getElementById("nuxt-loading");e&&(e.className+=" error")}))</script> <div id="nuxt-loading" aria-live="polite" role="status"><div>Loading...</div></div> </div><script>window.__NUXT__={config:{version:"2.19.0",routerBasePath:"/audiobookshelf",_app:{basePath:"/audiobookshelf/",assetsPath:"/audiobookshelf/_nuxt/",cdnURL:null}}}</script>
  <script src="/audiobookshelf/_nuxt/790ce0e.js"></script><script src="/audiobookshelf/_nuxt/a66bc33.js"></script><script src="/audiobookshelf/_nuxt/10761d5.js"></script><script src="/audiobookshelf/_nuxt/8fa8266.js"></script></body>
</html>

Can you confirm which version of the app you are on?
Also if you are listening through android auto

@codhopper
Copy link

Can you confirm which version of the app you are on? Also if you are listening through android auto

very rarely use android auto.

app 0.9.79-beta at the moment. Installed/updated through the google play store. If I had to make a guess the battery drain started mid-late December 2024. If anything I upgraded android OS, but also listening to downloaded books when on the local wifi.

Looking through the logs I went from Abs Android 0.9.65-beta to Abs Android 0.9.79-beta in July 2023.

Reading up on nuxt-loading it looks like there is an 'infinite linear' loading bar. It might be started as an async task and never stop, but can't see what sort of object is loading. The .js files are all quite generic looking to me.

I think it might be worth noting too I just (today) added some more ram to the computer running audiobookshelf and it does appear quite a lot snappier now. I could imagine ungracefully terminating a progress bar could accumulate a few tasks in the background looping.

@advplyr
Copy link
Owner

advplyr commented Feb 7, 2025

This issue was opened 2 days after v0.9.78-beta was released on 1/19/25 and the cause of the battery increase is this PR #1322.

In v0.9.79-beta released on 1/27/25 I made an update that confirmed it was #1322 which has solved this issue for users that don't use android auto. It still has to be solved for android auto. There may be some devices calling the problematic function when not using Android Auto. If are looking at logcat you can check if you see logs from that function.

You may be having a different issue unrelated to this one

@daiv92
Copy link

daiv92 commented Feb 8, 2025

I've got the same issue, but only started using the app a couple of days ago, so don't have context against older versions.

Pixel 9 pro, also used android auto, but haven't been using the app in the car.

Image

@TheZoker
Copy link

TheZoker commented Feb 8, 2025

For me (Samsung S23+ with Android 13) also the app has high system resource usage:
Screenshot_20250208_115452_Device care.jpg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests