Remove obsolete GetKernelDevices() method.

update_engine daemon exposed a DBus method GetKernelDevices() returning
the list of available kernel block devices and whether they were
bootable or not. This method was a developer-only method, since it
can't be called from chrome, and no other daemon uses it, besides the
update_engine_client.

The update_engine daemon moved from managing root and kernel partitions
explicitly, to manage slots. So the notion of which block device is the
"kernel" device is now unknown. The information about the available
slots and their status, can be managed with the external tool bootctl
instead. Therefore, this patch removes the GetKernelDevices() method.

Bug: None
Test: emerge-link update_engine; `mma` on AOSP.

Change-Id: I715bdbb73ebbbca3dfb381b16043224a170a3832
diff --git a/UpdateEngine.conf b/UpdateEngine.conf
index e9fe2d5..8a91607 100644
--- a/UpdateEngine.conf
+++ b/UpdateEngine.conf
@@ -23,9 +23,6 @@
            send_member="GetRollbackPartition"/>
     <allow send_destination="org.chromium.UpdateEngine"
            send_interface="org.chromium.UpdateEngineInterface"
-           send_member="GetKernelDevices"/>
-    <allow send_destination="org.chromium.UpdateEngine"
-           send_interface="org.chromium.UpdateEngineInterface"
            send_member="ResetStatus"/>
     <allow send_destination="org.chromium.UpdateEngine"
            send_interface="org.chromium.UpdateEngineInterface"
diff --git a/dbus_bindings/org.chromium.UpdateEngineInterface.dbus-xml b/dbus_bindings/org.chromium.UpdateEngineInterface.dbus-xml
index deacabd..bc4ec36 100644
--- a/dbus_bindings/org.chromium.UpdateEngineInterface.dbus-xml
+++ b/dbus_bindings/org.chromium.UpdateEngineInterface.dbus-xml
@@ -77,9 +77,6 @@
     <method name="GetPrevVersion">
       <arg type="s" name="prev_version" direction="out" />
     </method>
-    <method name="GetKernelDevices">
-      <arg type="s" name="kernel_devices" direction="out" />
-    </method>
     <method name="GetRollbackPartition">
       <arg type="s" name="rollback_partition_name" direction="out" />
     </method>
diff --git a/dbus_service.cc b/dbus_service.cc
index 9f6a844..235b9c2 100644
--- a/dbus_service.cc
+++ b/dbus_service.cc
@@ -296,19 +296,6 @@
   return true;
 }
 
-bool UpdateEngineService::GetKernelDevices(ErrorPtr* /* error */,
-                                           string* out_kernel_devices) {
-  auto devices = system_state_->update_attempter()->GetKernelDevices();
-  string info;
-  for (const auto& device : devices) {
-    base::StringAppendF(&info, "%d:%s\n",
-                        device.second ? 1 : 0, device.first.c_str());
-  }
-  LOG(INFO) << "Available kernel devices: " << info;
-  *out_kernel_devices = info;
-  return true;
-}
-
 bool UpdateEngineService::GetRollbackPartition(
     ErrorPtr* /* error */,
     string* out_rollback_partition_name) {
diff --git a/dbus_service.h b/dbus_service.h
index 9c4f712..444ae64 100644
--- a/dbus_service.h
+++ b/dbus_service.h
@@ -129,11 +129,6 @@
   bool GetPrevVersion(chromeos::ErrorPtr* error,
                       std::string* out_prev_version) override;
 
-  // Returns a list of available kernel partitions and whether each of them
-  // can be booted from or not.
-  bool GetKernelDevices(chromeos::ErrorPtr* error,
-                        std::string* out_kernel_devices) override;
-
   // Returns the name of kernel partition that can be rolled back into.
   bool GetRollbackPartition(chromeos::ErrorPtr* error,
                             std::string* out_rollback_partition_name) override;
diff --git a/update_attempter.cc b/update_attempter.cc
index 76aaf39..6152992 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -804,28 +804,6 @@
   return BootControlInterface::kInvalidSlot;
 }
 
-vector<std::pair<string, bool>> UpdateAttempter::GetKernelDevices() const {
-  const unsigned int num_slots = system_state_->boot_control()->GetNumSlots();
-  const BootControlInterface::Slot current_slot =
-      system_state_->boot_control()->GetCurrentSlot();
-
-  vector<std::pair<string, bool>> info_list;
-  for (BootControlInterface::Slot slot = 0; slot < num_slots; slot++) {
-    bool bootable = system_state_->boot_control()->IsSlotBootable(slot);
-    string device_name;
-    if (!system_state_->boot_control()->GetPartitionDevice(
-            kLegacyPartitionNameKernel, slot, &device_name)) {
-      continue;
-    }
-    // Add '*' to the name of the partition we booted from.
-    if (slot == current_slot)
-      device_name += '*';
-    info_list.emplace_back(device_name, bootable);
-  }
-
-  return info_list;
-}
-
 void UpdateAttempter::CheckForUpdate(const string& app_version,
                                      const string& omaha_url,
                                      bool interactive) {
diff --git a/update_attempter.h b/update_attempter.h
index a884924..12da537 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -157,10 +157,6 @@
   // name or empty string if none is available.
   BootControlInterface::Slot GetRollbackSlot() const;
 
-  // Returns a list of available kernel partitions along with information
-  // whether it is possible to boot from it.
-  std::vector<std::pair<std::string, bool>> GetKernelDevices() const;
-
   // Initiates a reboot if the current state is
   // UPDATED_NEED_REBOOT. Returns true on sucess, false otherwise.
   bool RebootIfNeeded();
diff --git a/update_engine_client.cc b/update_engine_client.cc
index c6d4857..93c99e4 100644
--- a/update_engine_client.cc
+++ b/update_engine_client.cc
@@ -103,7 +103,6 @@
 
   void Rollback(bool rollback);
   string GetRollbackPartition();
-  string GetKernelDevices();
   void CheckForUpdates(const string& app_version,
                        const string& omaha_url,
                        bool interactive);
@@ -292,13 +291,6 @@
   return rollback_partition;
 }
 
-string UpdateEngineClient::GetKernelDevices() {
-  string kernel_devices;
-  bool ret = proxy_->GetKernelDevices(&kernel_devices, nullptr);
-  CHECK(ret) << "Error while getting a list of kernel devices";
-  return kernel_devices;
-}
-
 void UpdateEngineClient::CheckForUpdates(const string& app_version,
                                          const string& omaha_url,
                                          bool interactive) {
@@ -473,8 +465,6 @@
               "Listen for status updates and print them to the screen.");
   DEFINE_bool(prev_version, false,
               "Show the previous OS version used before the update reboot.");
-  DEFINE_bool(show_kernels, false, "Show the list of kernel patritions and "
-              "whether each of them is bootable or not");
 
   // Boilerplate init commands.
   base::CommandLine::Init(argc_, argv_);
@@ -638,11 +628,6 @@
     ShowPrevVersion();
   }
 
-  if (FLAGS_show_kernels) {
-    LOG(INFO) << "Kernel partitions:\n"
-              << GetKernelDevices();
-  }
-
   if (FLAGS_is_reboot_needed) {
     // In case of error GetIsRebootNeeded() will exit with 1.
     if (GetIsRebootNeeded()) {