Fix issue #18827122: system server crashed on broadcasting...
...an intent with invalid or null package uri
Also tweak battery stats to record in the history when we shut
down, to understand when restarts are due to clean shutdowns or
crashes.
Change-Id: I6443dafc23e356be9f569906f6081152d4f92d2b
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 8ceee20..20bb95e 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -6955,6 +6955,17 @@
}
}
+ private void recordShutdownLocked(final long elapsedRealtimeMs, final long uptimeMs) {
+ if (mRecordingHistory) {
+ mHistoryCur.currentTime = System.currentTimeMillis();
+ mLastRecordedClockTime = mHistoryCur.currentTime;
+ mLastRecordedClockRealtime = elapsedRealtimeMs;
+ addHistoryBufferLocked(elapsedRealtimeMs, uptimeMs, HistoryItem.CMD_SHUTDOWN,
+ mHistoryCur);
+ mHistoryCur.currentTime = 0;
+ }
+ }
+
// This should probably be exposed in the API, though it's not critical
private static final int BATTERY_PLUGGED_NONE = 0;
@@ -7627,6 +7638,7 @@
}
public void shutdownLocked() {
+ recordShutdownLocked(SystemClock.elapsedRealtime(), SystemClock.uptimeMillis());
writeSyncLocked();
mShuttingDown = true;
}