Fix for ActionBarContextView not shown in landscape mode

- Revert commit 244dc4635f1a43673d3a5a716639db7b2ba6e6b3
  "Fix Url text not getting deleted on pressing delete key."
- Set UrlInputView text to full URL in HIGHLIGHTED state as
  opposed to NORMAL state to address issue with delete key.

Change-Id: I0d92937413d6c7c33e96f2134930179a64421316
diff --git a/src/com/android/browser/BrowserInputConnection.java b/src/com/android/browser/BrowserInputConnection.java
deleted file mode 100644
index 2fa0c8a..0000000
--- a/src/com/android/browser/BrowserInputConnection.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2014, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of The Linux Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-package com.android.browser;
-
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.inputmethod.BaseInputConnection;
-import android.text.Selection;
-import android.text.Editable;
-
-public class BrowserInputConnection extends BaseInputConnection {
-    //Basic constructor
-    public BrowserInputConnection(View targetView, boolean fullEditor) {
-        super(targetView, fullEditor);
-    }
-
-    // It seems in kitkat deleteSurroundingText(1, 0) gets called for keyboard
-    // backspace. We capture that and send 'KEYCODE_DEL' event.
-    @Override
-    public boolean deleteSurroundingText(int beforeLength, int afterLength) {
-        if(beforeLength == 1 && afterLength == 0) {
-            return super.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL))
-                && super.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DEL));
-        }
-        else {
-            return super.deleteSurroundingText(beforeLength, afterLength);
-        }
-    }
-}
-
diff --git a/src/com/android/browser/NavigationBarPhone.java b/src/com/android/browser/NavigationBarPhone.java
index 1bd9cad..796320a 100644
--- a/src/com/android/browser/NavigationBarPhone.java
+++ b/src/com/android/browser/NavigationBarPhone.java
@@ -210,14 +210,8 @@
 
     @Override
     public void onFocusChange(View view, boolean hasFocus) {
-        if (view == mUrlInput) {
-            if (hasFocus && !mUrlInput.getText().toString().equals(mUrlInput.getTag())) {
-                // only change text if different
-                mUrlInput.setText((String) mUrlInput.getTag(), false);
-                mUrlInput.selectAll();
-            } else {
-                setDisplayTitle(mUrlInput.getText().toString());
-            }
+        if (view == mUrlInput && !hasFocus) {
+            setDisplayTitle(mUrlInput.getText().toString());
         }
         super.onFocusChange(view, hasFocus);
     }
@@ -246,6 +240,11 @@
             mTabSwitcher.setVisibility(View.GONE);
             mMore.setVisibility(View.GONE);
             mTitleContainer.setBackgroundDrawable(mTextfieldBgDrawable);
+            if (!mUrlInput.getText().toString().equals(mUrlInput.getTag())) {
+                // only change text if different
+                mUrlInput.setText((String) mUrlInput.getTag(), false);
+                mUrlInput.selectAll();
+            }
             break;
         case StateListener.STATE_EDITED:
             mComboIcon.setVisibility(View.GONE);
diff --git a/src/com/android/browser/UrlInputView.java b/src/com/android/browser/UrlInputView.java
index c8f2d40..0ba05ef 100644
--- a/src/com/android/browser/UrlInputView.java
+++ b/src/com/android/browser/UrlInputView.java
@@ -16,14 +16,10 @@
 
 package com.android.browser;
 
-import android.content.ContentResolver;
 import android.content.Context;
 import android.content.res.Configuration;
 import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
-import android.inputmethodservice.InputMethodService;
-import android.provider.Settings.Secure;
-import android.os.Build;
 import android.text.Editable;
 import android.text.InputFilter;
 import android.text.InputFilter.LengthFilter;
@@ -36,12 +32,7 @@
 import android.view.KeyEvent;
 import android.view.MotionEvent;
 import android.view.View;
-import android.view.inputmethod.EditorInfo;
-import android.view.inputmethod.InputConnection;
-import android.view.inputmethod.InputMethodInfo;
 import android.view.inputmethod.InputMethodManager;
-import android.view.inputmethod.InputMethodSubtype;
-import android.text.InputType;
 import android.widget.AdapterView;
 import android.widget.AdapterView.OnItemClickListener;
 import android.widget.AutoCompleteTextView;
@@ -56,7 +47,6 @@
 import com.android.browser.search.SearchEngineInfo;
 import com.android.browser.search.SearchEngines;
 
-import java.util.List;
 /**
  * url/search input view
  * handling suggestions
@@ -115,34 +105,6 @@
         this(context, attrs, 0);
     }
 
-    private String getCurrentImeInfo(){
-        InputMethodManager imm =
-          (InputMethodManager) mContext.getSystemService(mContext.INPUT_METHOD_SERVICE);
-        List<InputMethodInfo> mInputMethodProperties = imm.getEnabledInputMethodList();
-
-        final int n = mInputMethodProperties.size();
-        for (int i = 0; i < n; i++) {
-            InputMethodInfo imeInfo = mInputMethodProperties.get(i);
-            if (imeInfo.getId().equals(Secure.getString(mContext.getContentResolver(),
-                    Secure.DEFAULT_INPUT_METHOD))) {
-                return imeInfo.getPackageName();
-            }
-        }
-        return null;
-    }
-
-    @Override
-    public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
-        String imeInfo = getCurrentImeInfo();
-        if(imeInfo != null && imeInfo.equals(LATIN_INPUTMETHOD_PACKAGE_NAME)
-            && (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2)) {
-            outAttrs.imeOptions = EditorInfo.IME_ACTION_GO;
-            return new BrowserInputConnection(this, false);
-        }
-        else
-            return super.onCreateInputConnection(outAttrs);
-    }
-
     public UrlInputView(Context context) {
         this(context, null);
     }