crash_reporter: Remove udev collector from Android build
Currently one of the udev collector tests is failing due to the lack
of gzip on the device. Since we don't have gzip nor udev in Android builds,
remove the udev collector (and tests) from Android builds.
See http://r.android.com/184708 for discussion on removing the udev
collector completely from the source.
Bug: 25779348
Test: `/data/nativetest/crash_reporter_tests/crash_reporter_tests` passes
Change-Id: I883359ac8219f2e1fa6a78927433dbc0be295fe7
diff --git a/crash_reporter/Android.mk b/crash_reporter/Android.mk
index bc023b0..4feb72a 100644
--- a/crash_reporter/Android.mk
+++ b/crash_reporter/Android.mk
@@ -19,7 +19,6 @@
crash_reporter_src := crash_collector.cc \
kernel_collector.cc \
kernel_warning_collector.cc \
- udev_collector.cc \
unclean_shutdown_collector.cc \
user_collector.cc
@@ -29,7 +28,6 @@
crash_reporter_logs_test.cc \
kernel_collector_test.cc \
testrunner.cc \
- udev_collector_test.cc \
unclean_shutdown_collector_test.cc \
user_collector_test.cc
diff --git a/crash_reporter/crash_reporter.cc b/crash_reporter/crash_reporter.cc
index 26ffa38..b69492a 100644
--- a/crash_reporter/crash_reporter.cc
+++ b/crash_reporter/crash_reporter.cc
@@ -35,10 +35,13 @@
#include "kernel_collector.h"
#include "kernel_warning_collector.h"
-#include "udev_collector.h"
#include "unclean_shutdown_collector.h"
#include "user_collector.h"
+#if !defined(__ANDROID__)
+#include "udev_collector.h"
+#endif
+
static const char kCrashCounterHistogram[] = "Logging.CrashCounter";
static const char kKernelCrashDetected[] = "/var/run/kernel-crash-detected";
static const char kUncleanShutdownDetected[] =
@@ -176,6 +179,7 @@
return 0;
}
+#if !defined(__ANDROID__)
static int HandleUdevCrash(UdevCollector *udev_collector,
const std::string& udev_event) {
// Handle a crash indicated by a udev event.
@@ -189,6 +193,7 @@
return 1;
return 0;
}
+#endif
static int HandleKernelWarning(KernelWarningCollector
*kernel_warning_collector) {
@@ -249,7 +254,11 @@
DEFINE_bool(crash_test, false, "Crash test");
DEFINE_string(user, "", "User crash info (pid:signal:exec_name)");
DEFINE_bool(unclean_check, true, "Check for unclean shutdown");
+
+#if !defined(__ANDROID__)
DEFINE_string(udev, "", "Udev event description (type:device:subsystem)");
+#endif
+
DEFINE_bool(kernel_warning, false, "Report collected kernel warning");
DEFINE_string(pid, "", "PID of crashing process");
DEFINE_string(uid, "", "UID of crashing process");
@@ -279,8 +288,11 @@
UncleanShutdownCollector unclean_shutdown_collector;
unclean_shutdown_collector.Initialize(CountUncleanShutdown,
IsFeedbackAllowed);
+
+#if !defined(__ANDROID__)
UdevCollector udev_collector;
udev_collector.Initialize(CountUdevCrash, IsFeedbackAllowed);
+#endif
KernelWarningCollector kernel_warning_collector;
kernel_warning_collector.Initialize(CountUdevCrash, IsFeedbackAllowed);
@@ -304,9 +316,11 @@
FLAGS_generate_kernel_signature);
}
+#if !defined(__ANDROID__)
if (!FLAGS_udev.empty()) {
return HandleUdevCrash(&udev_collector, FLAGS_udev);
}
+#endif
if (FLAGS_kernel_warning) {
return HandleKernelWarning(&kernel_warning_collector);