Merge "Faster all the things!"
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 51bcda2..551be38 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -2583,12 +2583,7 @@
                 break;
 //          case KeyEvent.KEYCODE_U:    // in Chrome: opens source of page
 //          case KeyEvent.KEYCODE_V:    // text view intercepts to paste
-            case KeyEvent.KEYCODE_W:    // in Chrome: close tab
-                if (ctrl) {
-                    closeCurrentTab();
-                    return true;
-                }
-                break;
+//          case KeyEvent.KEYCODE_W:    // menu
 //          case KeyEvent.KEYCODE_X:    // text view intercepts to cut
 //          case KeyEvent.KEYCODE_Y:    // unused
 //          case KeyEvent.KEYCODE_Z:    // unused
diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java
index 49419aa..009989b 100644
--- a/src/com/android/browser/PhoneUi.java
+++ b/src/com/android/browser/PhoneUi.java
@@ -21,7 +21,6 @@
 import android.animation.AnimatorSet;
 import android.animation.ObjectAnimator;
 import android.app.Activity;
-import android.app.ActivityManager;
 import android.content.Context;
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
@@ -34,6 +33,7 @@
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
+import android.view.ViewGroup;
 import android.view.accessibility.AccessibilityEvent;
 import android.view.animation.DecelerateInterpolator;
 import android.webkit.WebView;
@@ -246,6 +246,10 @@
             }
             WebView web = getWebView();
             if (web != null) {
+                // make sure we can re-parent titlebar
+                if ((mTitleBar != null) && (mTitleBar.getParent() != null)) {
+                    ((ViewGroup) mTitleBar.getParent()).removeView(mTitleBar);
+                }
                 web.setEmbeddedTitleBar(mTitleBar);
             }
             setTitleGravity(Gravity.NO_GRAVITY);
@@ -319,9 +323,11 @@
     }
 
     private void finishAnimationIn() {
-        // notify accessibility manager about the screen change
-        mNavScreen.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
-        mTabControl.setOnThumbnailUpdatedListener(mNavScreen);
+        if (mNavScreen != null) {
+            // notify accessibility manager about the screen change
+            mNavScreen.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
+            mTabControl.setOnThumbnailUpdatedListener(mNavScreen);
+        }
     }
 
     void hideNavScreen(boolean animate) {