Browser: Screen will garbage after rotate the phone.
This is Google's original bug and can also be reproduced on
Samsung Nexus phone(4.3).
The current phenomenon has a tremendous impact on User
Experience, but it's difficult to get the root cause quickly.
Therefore, for avoiding this issue temporarily, let Browser
wait about 300ms and then refresh WebView in onConfigurationChanged
method when rotate DUT.
CRs-Fixed: 520353
Change-Id: I4e4b0aaea6e7f306eda1b31069f5b737ef76e030
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