Android app high CPU usage, no services or wakeloc

2019-08-30 12:05发布

I've forked the system messaging app and it is consuming the majority of my CPU, and others have reported the same. I cannot for the life of me determine why.

I figured the drainage could be possibly two things (because of how much it is draining): a wakelock that has not been released, or a service doing continuous computation.

Here's what I have tried:

adb shell dumpsys power

This shows Wake Locks: size=0 so I am assuming it is not a wakelock issue (the app uses wakelocks, of course, but I have not touched the code involving them). I have also used the app, WakeLock Detector, which also shows no wake locks for my application.

I have searched the logs tirelessly for something indicating a problem to no avail. I have also checked running services (via Settings > Apps > Running) and there are no services running for the app.

Does anyone know what may be causing this (enormous) battery drain?

EDIT: I downloaded an app called "Disable Service" that allows me to view all services an app has available. The main issue with my problem is it is impossible to replicate (that is, I don't know how to replicate it and it seems to happen randomly). I managed to encounter the battery drain today and tried disabling a service (TransactionService for those interested) and the problem stopped immediately. I don't think I can say for sure that this service is causing the problem but it is the first place to look. The code is available here.

1条回答
叛逆
2楼-- · 2019-08-30 12:53

Not sure what ever caused this problem. Started building with a different AOSP branch with a different fork and haven't seen it again.

查看更多
登录 后发表回答