Implement susped, resume and cancel for the Postinstall action.

This patch sends SIGSTOP/SIGCONT to the running postinstall program to
suspend/resume the child process, and SIGKILL when cancelling it.

Bug: 27272144
TEST=Added unittest to check the signal being sent.

(cherry picked from commit d15c546ed794293d0a63770467a0f3c4c84c6214)

Change-Id: Ie99b406b4d7f73dda4189b7a5a7d627c866055d6
diff --git a/payload_consumer/postinstall_runner_action.h b/payload_consumer/postinstall_runner_action.h
index 08dedd2..a626ce6 100644
--- a/payload_consumer/postinstall_runner_action.h
+++ b/payload_consumer/postinstall_runner_action.h
@@ -34,10 +34,11 @@
   explicit PostinstallRunnerAction(BootControlInterface* boot_control)
       : PostinstallRunnerAction(boot_control, nullptr) {}
 
+  // InstallPlanAction overrides.
   void PerformAction() override;
-
-  // Note that there's no support for terminating this action currently.
-  void TerminateProcessing()  override { CHECK(false); }
+  void SuspendAction() override;
+  void ResumeAction() override;
+  void TerminateProcessing() override;
 
   // Debugging/logging
   static std::string StaticType() { return "PostinstallRunnerAction"; }
@@ -54,6 +55,9 @@
 
   void PerformPartitionPostinstall();
 
+  // Unmount and remove the mountpoint directory if needed.
+  void CleanupMount();
+
   // Subprocess::Exec callback.
   void CompletePartitionPostinstall(int return_code,
                                     const std::string& output);
@@ -82,6 +86,9 @@
   // file name; used for testing.
   const char* powerwash_marker_file_;
 
+  // Postinstall command currently running, or 0 if no program running.
+  pid_t current_command_{0};
+
   DISALLOW_COPY_AND_ASSIGN(PostinstallRunnerAction);
 };