recovery: Correct touch position with overscan

Change-Id: I9739040cf968961944f9e1e6eae4929b57f51d41
diff --git a/recovery_ui/screen_ui.cpp b/recovery_ui/screen_ui.cpp
index f4dc2c5..95fce25 100644
--- a/recovery_ui/screen_ui.cpp
+++ b/recovery_ui/screen_ui.cpp
@@ -1357,7 +1357,10 @@
   return sel;
 }
 
-int ScreenRecoveryUI::SelectMenu(const Point& point) {
+int ScreenRecoveryUI::SelectMenu(const Point& p) {
+  // Correct position for overscan
+  const Point point(p.x() - gr_overscan_offset_x(), p.y() - gr_overscan_offset_y());
+
   int new_sel = Device::kNoAction;
   std::lock_guard<std::mutex> lg(updateMutex);
   if (menu_) {
diff --git a/recovery_ui/ui.cpp b/recovery_ui/ui.cpp
index 6aa08f1..8561120 100644
--- a/recovery_ui/ui.cpp
+++ b/recovery_ui/ui.cpp
@@ -265,7 +265,7 @@
 }
 
 void RecoveryUI::OnTouchTrack() {
-  if (touch_pos_.y() <= gr_fb_height()) {
+  if (touch_pos_.y() <= gr_fb_height_real()) {
     while (abs(touch_pos_.y() - touch_track_.y()) >= MenuItemHeight()) {
       int dy = touch_pos_.y() - touch_track_.y();
       int key = (dy < 0) ? KEY_SCROLLDOWN : KEY_SCROLLUP;
@@ -285,7 +285,7 @@
   }
 
   // Check vkeys.  Only report if touch both starts and ends in the vkey.
-  if (touch_start_.y() > gr_fb_height() && touch_pos_.y() > gr_fb_height()) {
+  if (touch_start_.y() > gr_fb_height_real() && touch_pos_.y() > gr_fb_height_real()) {
     for (const auto& vk : virtual_keys_) {
       if (vk.inside(touch_start_) && vk.inside(touch_pos_)) {
         ProcessKey(vk.keycode, 1);  // press key
@@ -377,7 +377,7 @@
       case ABS_MT_POSITION_X:
         touch_finger_down_ = true;
         touch_saw_x_ = true;
-        touch_pos_.x(ev.value * gr_fb_width() / (touch_max_.x() - touch_min_.x()));
+        touch_pos_.x(ev.value * gr_fb_width_real() / (touch_max_.x() - touch_min_.x()));
         if (touch_reported_ && touch_saw_y_) {
           OnTouchTrack();
           touch_saw_x_ = touch_saw_y_ = false;
@@ -387,7 +387,7 @@
       case ABS_MT_POSITION_Y:
         touch_finger_down_ = true;
         touch_saw_y_ = true;
-        touch_pos_.y(ev.value * gr_fb_height() / (touch_max_.y() - touch_min_.y()));
+        touch_pos_.y(ev.value * gr_fb_height_real() / (touch_max_.y() - touch_min_.y()));
         if (touch_reported_ && touch_saw_x_) {
           OnTouchTrack();
           touch_saw_x_ = touch_saw_y_ = false;