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
Test: not obviously practical
Change-Id: I542fb9641bb4d699ca79caf9faca93412c236a44
This commit is contained in:
Elliott Hughes
2021-09-09 12:05:38 -07:00
parent 70e7dd44b4
commit 4964d99029

View File

@@ -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) {