From ba78b2bcc73565b68394764ef8a302df64d60fc5 Mon Sep 17 00:00:00 2001 From: Bookatz Date: Tue, 10 Oct 2017 11:06:33 -0700 Subject: [PATCH] Fix parcelling of Kernel Wakelock/reason In BatteryStatsImpl.java: Previously, if inclUid == false, then kernelWakelockStats and wakeupReasonStats were not printed to the parcel, but only a single 0 was written in their place. In the parcel-reading code, their sizes are read, so if they are not present, there should be a 0 for each of them. In other words, two 0s should be written if they are not present, instead of just 1. Test: none Change-Id: I1d443e9659646f0d30063f275a6a9db42b0a3906 --- core/java/com/android/internal/os/BatteryStatsImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java index 36fd991cc78dc..dc062f39f72fe 100644 --- a/core/java/com/android/internal/os/BatteryStatsImpl.java +++ b/core/java/com/android/internal/os/BatteryStatsImpl.java @@ -119,7 +119,7 @@ public class BatteryStatsImpl extends BatteryStats { private static final int MAGIC = 0xBA757475; // 'BATSTATS' // Current on-disk Parcel version - private static final int VERSION = 167 + (USE_OLD_HISTORY ? 1000 : 0); + private static final int VERSION = 168 + (USE_OLD_HISTORY ? 1000 : 0); // Maximum number of items we will record in the history. private static final int MAX_HISTORY_ITEMS; @@ -13090,7 +13090,7 @@ public class BatteryStatsImpl extends BatteryStats { } } } else { - // TODO: There should be two 0's printed here, not just one. + out.writeInt(0); out.writeInt(0); }