hardware keyboard support

	 http://b/issue?id=3368141
	 http://b/issue?id=3368100
	 Removed duplicate key handling
	 added focus transition from page to url bar
	 once framework bug http://b/issue?id=3381411
	 is fixed, focus transitions in url bar will be fixed

Change-Id: Id5011e78bf70d51a25a4e01cf31d9e6ad95ceab7
diff --git a/src/com/android/browser/XLargeUi.java b/src/com/android/browser/XLargeUi.java
index a9cc9fe..2f27aa1 100644
--- a/src/com/android/browser/XLargeUi.java
+++ b/src/com/android/browser/XLargeUi.java
@@ -24,6 +24,7 @@
 import android.util.Log;
 import android.view.ActionMode;
 import android.view.Gravity;
+import android.view.KeyEvent;
 import android.view.View;
 import android.webkit.WebChromeClient.CustomViewCallback;
 import android.webkit.WebView;
@@ -396,4 +397,24 @@
             mActivity.getActionBar().show();
         }
     }
+
+    @Override
+    public boolean dispatchKey(int code, KeyEvent event) {
+        WebView web = getActiveTab().getWebView();
+        switch (code) {
+            case KeyEvent.KEYCODE_TAB:
+            case KeyEvent.KEYCODE_DPAD_UP:
+            case KeyEvent.KEYCODE_DPAD_LEFT:
+                if ((web != null) && web.hasFocus()) {
+                    editUrl(true);
+                    return true;
+                }
+        }
+        if (event.isPrintingKey() && !mFakeTitleBar.isEditingUrl()) {
+            editUrl(true);
+            return mContentView.dispatchKeyEvent(event);
+        }
+        return false;
+    }
+
 }