summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2021-09-09 12:05:38 -0700
committerElliott Hughes <enh@google.com>2021-09-17 23:11:04 +0000
commitef620e85227df66c3ba763e622d1063de5f1825e (patch)
tree32b9227b765b485fe765b1644a24e4af7681ad10
parent1f0126502460201ec38ce06c1cc4c2a52b9fe242 (diff)
Fix NPE in BootReceiver.addTombstoneToDropBox.
If we have a native crash before the DropBoxManager starts, don't try to send the tombstone. Bug: http://b/199333694 Bug: http://b/194131417 Test: not obviously practical Change-Id: I542fb9641bb4d699ca79caf9faca93412c236a44
-rw-r--r--services/core/java/com/android/server/BootReceiver.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/BootReceiver.java b/services/core/java/com/android/server/BootReceiver.java
index fdba098e6b80..48f5b51a8404 100644
--- a/services/core/java/com/android/server/BootReceiver.java
+++ b/services/core/java/com/android/server/BootReceiver.java
@@ -476,7 +476,11 @@ public class BootReceiver extends BroadcastReceiver {
*/
public static void addTombstoneToDropBox(Context ctx, File tombstone, boolean proto) {
final DropBoxManager db = ctx.getSystemService(DropBoxManager.class);
- final String bootReason = SystemProperties.get("ro.boot.bootreason", null);
+ if (db == null) {
+ Slog.e(TAG, "Can't log tombstone: DropBoxManager not available");
+ return;
+ }
+
HashMap<String, Long> timestamps = readTimestamps();
try {
if (proto) {
@@ -484,7 +488,7 @@ public class BootReceiver extends BroadcastReceiver {
} else {
final String headers = getBootHeadersToLogAndUpdate();
addFileToDropBox(db, timestamps, headers, tombstone.getPath(), LOG_SIZE,
- TAG_TOMBSTONE);
+ TAG_TOMBSTONE);
}
} catch (IOException e) {
Slog.e(TAG, "Can't log tombstone", e);