recovery: ui: Support hardware virtual keys

 * Also swipe left -> KEY_BACK

Change-Id: I6bd8054485d680df35abb86cb79f1dda683e4459
diff --git a/install/fuse_sdcard_install.cpp b/install/fuse_sdcard_install.cpp
index 1aa8768..e528e48 100644
--- a/install/fuse_sdcard_install.cpp
+++ b/install/fuse_sdcard_install.cpp
@@ -97,13 +97,16 @@
     if (chosen_item == static_cast<size_t>(RecoveryUI::KeyError::INTERRUPTED)) {
       return "";
     }
-
-    const std::string& item = entries[chosen_item];
-    if (chosen_item == 0) {
-      // Go up but continue browsing (if the caller is BrowseDirectory).
+    if (chosen_item == Device::kGoHome) {
+      return "@";
+    }
+    if (chosen_item == Device::kGoBack || chosen_item == 0) {
+      // Go up but continue browsing (if the caller is browse_directory).
       return "";
     }
 
+    const std::string& item = entries[chosen_item];
+
     std::string new_path = path + "/" + item;
     if (new_path.back() == '/') {
       // Recurse down into a subdirectory.
@@ -140,6 +143,9 @@
   }
 
   std::string path = BrowseDirectory(SDCARD_ROOT, device, ui);
+  if (path == "@") {
+    return INSTALL_NONE;
+  }
   if (path.empty()) {
     LOG(ERROR) << "\n-- No package file selected.\n";
     ensure_path_unmounted(SDCARD_ROOT);