Remove self-crashing logic.

update_engine used to report a crash when something with the omaha
response was really wrong. Nowadays the server side configuration is
automatic and these crashes trigger more on unrelated issues, such as
network problems. These extra crashes generate noise and hide the
volume on other more important crashes.

This patch disables this logic.

Bug: chromium:405375
TEST=m

Change-Id: I17b245c4b2892bf765af63005820e1fc2e7277b0
diff --git a/common/utils.cc b/common/utils.cc
index 5f062f5..2ac63b9 100644
--- a/common/utils.cc
+++ b/common/utils.cc
@@ -30,7 +30,6 @@
 #include <sys/resource.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-#include <sys/wait.h>
 #include <unistd.h>
 
 #include <algorithm>
@@ -51,7 +50,6 @@
 #include <base/strings/string_util.h>
 #include <base/strings/stringprintf.h>
 #include <brillo/data_encoding.h>
-#include <brillo/message_loops/message_loop.h>
 
 #include "update_engine/common/clock_interface.h"
 #include "update_engine/common/constants.h"
@@ -732,28 +730,6 @@
   return "data";
 }
 
-namespace {
-// Do the actual trigger. We do it as a main-loop callback to (try to) get a
-// consistent stack trace.
-void TriggerCrashReporterUpload() {
-  pid_t pid = fork();
-  CHECK_GE(pid, 0) << "fork failed";  // fork() failed. Something is very wrong.
-  if (pid == 0) {
-    // We are the child. Crash.
-    abort();  // never returns
-  }
-  // We are the parent. Wait for child to terminate.
-  pid_t result = waitpid(pid, nullptr, 0);
-  LOG_IF(ERROR, result < 0) << "waitpid() failed";
-}
-}  // namespace
-
-void ScheduleCrashReporterUpload() {
-  brillo::MessageLoop::current()->PostTask(
-      FROM_HERE,
-      base::Bind(&TriggerCrashReporterUpload));
-}
-
 int FuzzInt(int value, unsigned int range) {
   int min = value - range / 2;
   int max = value + range - range / 2;
diff --git a/common/utils.h b/common/utils.h
index b935ba7..2402995 100644
--- a/common/utils.h
+++ b/common/utils.h
@@ -198,10 +198,6 @@
 // Returns a string representation of the given enum.
 std::string ToString(PayloadType payload_type);
 
-// Schedules a Main Loop callback to trigger the crash reporter to perform an
-// upload as if this process had crashed.
-void ScheduleCrashReporterUpload();
-
 // Fuzzes an integer |value| randomly in the range:
 // [value - range / 2, value + range - range / 2]
 int FuzzInt(int value, unsigned int range);
diff --git a/common/utils_unittest.cc b/common/utils_unittest.cc
index 762e891..09d7f75 100644
--- a/common/utils_unittest.cc
+++ b/common/utils_unittest.cc
@@ -25,13 +25,10 @@
 
 #include <base/files/file_path.h>
 #include <base/files/file_util.h>
-#include <brillo/message_loops/fake_message_loop.h>
-#include <brillo/message_loops/message_loop_utils.h>
 #include <gtest/gtest.h>
 
 #include "update_engine/common/test_utils.h"
 
-using brillo::FakeMessageLoop;
 using std::string;
 using std::vector;
 
@@ -236,17 +233,6 @@
                       0xb0, 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00});
 }
 
-TEST(UtilsTest, ScheduleCrashReporterUploadTest) {
-  // Not much to test. At least this tests for memory leaks, crashes,
-  // log errors.
-  FakeMessageLoop loop(nullptr);
-  loop.SetAsCurrent();
-  utils::ScheduleCrashReporterUpload();
-  // Test that we scheduled one callback from the crash reporter.
-  EXPECT_EQ(1, brillo::MessageLoopRunMaxIterations(&loop, 100));
-  EXPECT_FALSE(loop.PendingTasks());
-}
-
 TEST(UtilsTest, FormatTimeDeltaTest) {
   // utils::FormatTimeDelta() is not locale-aware (it's only used for logging
   // which is not localized) so we only need to test the C locale
diff --git a/omaha_request_action.cc b/omaha_request_action.cc
index bc84c9f..e017675 100644
--- a/omaha_request_action.cc
+++ b/omaha_request_action.cc
@@ -904,11 +904,6 @@
   // Events are best effort transactions -- assume they always succeed.
   if (IsEvent()) {
     CHECK(!HasOutputPipe()) << "No output pipe allowed for event requests.";
-    if (event_->result == OmahaEvent::kResultError && successful &&
-        system_state_->hardware()->IsOfficialBuild()) {
-      LOG(INFO) << "Signalling Crash Reporter.";
-      utils::ScheduleCrashReporterUpload();
-    }
     completer.set_code(ErrorCode::kSuccess);
     return;
   }