Move InstallPlan partitions to a list of partitions.

This patch changes the InstallPlan instance from having hard-coded
rootfs and kernel paritions to have a list of partitions with a
name, source and target information.

The FilesystemVerifierAction, DeltaPerformer and PostInstallAction were
adapter to use the list of partitions instead.

In delta payloads (only supported in the current major version 1) the
list of operations is still fixed: the rootfs first and the kernel.
This list is now populated by the FilesystemVerifierAction including
the size of these partitions, until the whole source partition hash
checking is deprecated (b/23182225).

The PostIntallAction now relies on the DeltaPerformer to populate the
post-install information from the payload. This means that in rollback
we won't run any device-specific post-install operation, and will
simply flip the slots in the bootloader.

Bug: 24667689
Test: Updated unittests. Tested on a dragonboard and a link.

Change-Id: I8277e3190ac74e57832a58dc0730e3713f48af8a
diff --git a/download_action.cc b/download_action.cc
index a31c8a3..97bdd12 100644
--- a/download_action.cc
+++ b/download_action.cc
@@ -17,6 +17,7 @@
 #include "update_engine/download_action.h"
 
 #include <errno.h>
+
 #include <algorithm>
 #include <string>
 #include <vector>
@@ -185,24 +186,6 @@
                                               &install_plan_));
     writer_ = delta_performer_.get();
   }
-  int rc = writer_->Open(install_plan_.install_path.c_str(),
-                         O_TRUNC | O_WRONLY | O_CREAT | O_LARGEFILE,
-                         0644);
-  if (rc < 0) {
-    LOG(ERROR) << "Unable to open output file " << install_plan_.install_path;
-    // report error to processor
-    processor_->ActionComplete(this, ErrorCode::kInstallDeviceOpenError);
-    return;
-  }
-  if (delta_performer_.get() &&
-      !delta_performer_->OpenKernel(
-          install_plan_.kernel_install_path.c_str())) {
-    LOG(ERROR) << "Unable to open kernel file "
-               << install_plan_.kernel_install_path.c_str();
-    writer_->Close();
-    processor_->ActionComplete(this, ErrorCode::kKernelDeviceOpenError);
-    return;
-  }
   if (delegate_) {
     delegate_->SetDownloadStatus(true);  // Set to active.
   }
@@ -319,13 +302,6 @@
       // Delete p2p file, if applicable.
       if (!p2p_file_id_.empty())
         CloseP2PSharingFd(true);
-    } else if (!delta_performer_->GetNewPartitionInfo(
-        &install_plan_.kernel_size,
-        &install_plan_.kernel_hash,
-        &install_plan_.rootfs_size,
-        &install_plan_.rootfs_hash)) {
-      LOG(ERROR) << "Unable to get new partition hash info.";
-      code = ErrorCode::kDownloadNewPartitionInfoError;
     }
   }