Merge "Browser: Screen will garbage after rotate the phone."
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index 3ba3182..959d2ec 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -876,4 +876,7 @@
         mNavigationBar.onVoiceResult(result);
     }
 
+    protected UiController getUiController() {
+        return mUiController;
+    }
 }
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index c548322..fe472c5 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -59,6 +59,20 @@
     private ActivityController mController = NullController.INSTANCE;
     private Handler mHandler = new Handler();
 
+    private UiController mUiController;
+    private Handler mHandlerEx = new Handler();
+    private Runnable runnable = new Runnable() {
+        @Override
+        public void run() {
+           if (mUiController != null) {
+               WebView current = mUiController.getCurrentWebView();
+               if (current != null) {
+                   current.postInvalidate();
+               }
+           }
+        }
+    };
+
     @Override
     public void onCreate(Bundle icicle) {
         if (LOGV_ENABLED) {
@@ -93,9 +107,13 @@
         boolean xlarge = isTablet(this);
         UI ui = null;
         if (xlarge) {
-            ui = new XLargeUi(this, controller);
+            XLargeUi tablet = new XLargeUi(this, controller);
+            ui = tablet;
+            mUiController = tablet.getUiController();
         } else {
-            ui = new PhoneUi(this, controller);
+            PhoneUi phone = new PhoneUi(this, controller);
+            ui = phone;
+            mUiController = phone.getUiController();
         }
         controller.setUi(ui);
         return controller;
@@ -202,6 +220,9 @@
     public void onConfigurationChanged(Configuration newConfig) {
         super.onConfigurationChanged(newConfig);
         mController.onConfgurationChanged(newConfig);
+
+        //For avoiding bug CR520353 temporarily, delay 300ms to refresh WebView.
+        mHandlerEx.postDelayed(runnable, 300);
     }
 
     @Override