openxc / openxc-android

Android library for accessing vehicle data from an OpenXC vehicle interface
BSD 3-Clause "New" or "Revised" License
235 stars 115 forks source link

Enabler App indirectly causing wakelocks in android 4.4.2 #120

Closed jkitch20 closed 10 years ago

jkitch20 commented 10 years ago

This might be new with 4.4.2, but OpenXC Enabler is, indirectly, causing a HUGE number of wakelocks and massive battery drain on my phone when running. Whenever it attempts to start the serial connection to the VI, which is constantly, android uses a wakelock to wake up the CPU to perform the check. This is causing a near 100% awake-time on my device. I haven't tested other devices yet. As soon as I force-stop the enabler, the wakelocks go away. tested using the WakeLock Detector app (running an Xposed module to fix it for 4.4).

See #115 for a related issue.

peplin commented 10 years ago

Well that's annoying - wake lock detector doesn't work without root access in 4.4!

jkitch20 commented 10 years ago

Yeah, sorry, should’ve mentioned that. Google made battery stats a system-app-only read in 4.4, so you need root to get to them. I’ll try and see if the wakelocks are occurring in 4.3 so we can confirm whether the issue is strictly related to something that might’ve changed in 4.4.

Once the issue 115 solution gets implemented, I’ll be sure to test this on 4.4 as well since I think that solution will also resolve this problem.

From: Christopher Peplin [mailto:notifications@github.com] Sent: Tuesday, February 11, 2014 5:07 PM To: openxc/openxc-android Cc: Kitchens, Joshua (J.D.) Subject: Re: [openxc-android] Enabler App indirectly causing wakelocks in android 4.4.2 (#120)

Well that's annoying - wake lock detector doesn't work without root access in 4.4!

— Reply to this email directly or view it on GitHubhttps://github.com/openxc/openxc-android/issues/120#issuecomment-34813953.

peplin commented 10 years ago

With the slight improvements I just added, can you try building from the 'next' branch and seeing if it effects your battery life? I just tested it overnight and there wasn't significant battery attributed to the Enabler.

jkitch20 commented 10 years ago

Will do. I’ll give it a try today. Will I need your modified VI firmware to form the connection?

From: Christopher Peplin [mailto:notifications@github.com] Sent: Friday, February 14, 2014 9:04 AM To: openxc/openxc-android Cc: Kitchens, Joshua (J.D.) Subject: Re: [openxc-android] Enabler App indirectly causing wakelocks in android 4.4.2 (#120)

With the slight improvements I just added, can you try building from the 'next' branch and seeing if it effects your battery life? I just tested it overnight and there wasn't significant battery attributed to the Enabler.

— Reply to this email directly or view it on GitHubhttps://github.com/openxc/openxc-android/issues/120#issuecomment-35085674.

peplin commented 10 years ago

No, I haven't changed anything in the VI yet, just made the Android side a little less aggressive.

jkitch20 commented 10 years ago

Chris,

This seemed to have helped quite a bit. I'm still seeing wakelocks (msm_hsic_host is the bluetooth wakelock android uses), it's still the highest on the list with 5m21s out of 45m since last being unplugged, but that's only 17%, vs. the 70% I was seeing before.

I'll test this again after the VI-side pairing is ready to test out. That should solve this issue completely.

peplin commented 10 years ago

Leaving the wake locks aside, does it or did it before have a significant percentage in the simpler Android battery stats? Because we do grab a wake lock, but we don't really do any computationally intensive work, so it really just keeps the CPU out of super low power mode for a brief moment.

jkitch20 commented 10 years ago

No, I don't see the enabler even in that list actually. But I think that's occurring because the wakelock that's causing problems seems to be part of the Android Service. Android is what appears to be issuing the wakelock, based on something the Enabler is calling when it tries (and fails) to connect to a BT device.