Android's stock battery menu is pretty decent. You can see which apps have been using the most power, and you can tell when your CPU was awake or asleep, among other things. But a lot of times, battery-sucking services will get lumped under the generic "Android System" header, and even though you can see when your CPU was awake, you can't exactly see why.
Understanding this, Google created a tool called Battery Historian that interprets data from a bug report to give you tons of information about battery drain. But this utility is incredibly hard to use, as it requires several complicated terminal commands to even get running.
That's when developer bobobo1618 stepped in and created a tool of his own to handle the complicated backend stuff. This utility has finally made Google's Battery Historian accessible to the masses with an easy-to-use interface, which means we can now get an insane amount of battery data to ultimately pinpoint the cause of Android battery drain.
To start, you'll need to capture a bug report. So head to the Developer options menu in Settings, then tap the "Take bug report" option. After verifying your choice, your phone will buzz—this means it's working on the bug report, but it won't be ready for about five minutes.
So sit back and wait for a bit, and when your bug report is ready, you'll get a notification. Next, just tap the notification, then you'll be prompted to share the bug report with any compatible service. The bug report is a ZIP file, and you'll ultimately need to transfer this to your computer, so choose any service that makes this process easier.
Once you've shared the bug report via any compatible service, make sure to transfer the ZIP to a folder on your computer that you can access easily.
Next, from your computer, head to the following link to visit bobobo1618's Battery Historian tool, then click the "Browse" button.
From here, use the browser window that pops up to locate and select the bug report ZIP file that you transferred earlier, then click "Open."
Finally, click the "Submit" button towards the right edge of the page to upload your bug report. At this point, just give the utility about 15 seconds to finish uploading and processing the data.
Once your bug report has been processed, you'll see a page that is absolutely packed to the brim with battery usage data. There's a graph across the top of the screen, then a set of tables that occupy the bottom half.
Focusing in on the graph, it's important to note that the vertical axis represents battery percentage, while the horizontal axis represents time. You'll see a sloping black bar that indicates your battery percentage throughout the day, then colored line segments that represent the various apps, services, and other elements that have used battery life.
When you hover your mouse pointer over any of the line segments, you'll see a pop-up message that contains details about this battery-sucker. One of the main things to note here is the package name at the bottom of this popup, as this information can be Googled to find the specific app or service behind the battery drain.
Then, on the bottom half of the page, you can batch-select categories in the Tables section to view information about wakelocks, CPU usage, and other similar topics. Once you've selected any categories here, the right-hand pane will display details for each.
Then, if you'd like to investigate the battery usage of a particular app, click the drop-down menu beneath the App Selection header, then choose the app from the list. At this point, you'll see all of this app's battery usage details in the pane on the right.
There's so much information in Battery Historian that you could spend hours tracking down the various sources of Android battery drain. For a few more tips, you can read the developer's thread on Reddit, but once you've found the source of your problems, you may want to look into apps and utilities like Greenify and Amplify to get your battery life in check.