Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 68569644 authored by Adam Lesinski's avatar Adam Lesinski
Browse files

BatteryStats: Read /proc/wakelocks first before trying /d/wakeup_sources

Previously we tried to read /d/wakeup_sources to gather kernel wakelock data. If that
fails we used the older sys file /proc/wakelocks.
N7 has both /proc/wakelocks and /d/wakeup_sources, but /proc/wakelocks
has the actual data we need. All other devices are using /d/wakeup_sources, so
only N7 experienced a loss of kernel wakelock data.

The original regression was introduced here: ag/659258

Bug:22556242
Change-Id: I51ec68e957f587bc1466e24f0a1dbc8cd7753ac6
parent 4e9c63cb
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -67,13 +67,13 @@ public class KernelWakelockReader {

        try {
            FileInputStream is;
            try {
                is = new FileInputStream(sWakeupSourceFile);
                wakeup_sources = true;
            } catch (java.io.FileNotFoundException e) {
            try {
                is = new FileInputStream(sWakelockFile);
                wakeup_sources = false;
            } catch (java.io.FileNotFoundException e) {
                try {
                    is = new FileInputStream(sWakeupSourceFile);
                    wakeup_sources = true;
                } catch (java.io.FileNotFoundException e2) {
                    return null;
                }