DO NOT MERGE Fix vanishing title/url in window picker
Bug: 2289137
This was caused by two bugs. The first is that when creating
picker data from a webview, it created a new instance of picker
data before checking if there was actually data to use.
The second is that when the webview of a tab was restored, it would
clear the old picker data, which it shouldn't have done.
Change-Id: Ib03a22e32d35f0f686dffc663adcbbddba28db9b
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index af0cdf8..6eaf4b1 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -43,6 +43,7 @@
import android.os.SystemClock;
import android.provider.Browser;
import android.speech.RecognizerResultsIntent;
+import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -1862,8 +1863,8 @@
// Populate the picker data using the given history item and the current top
// WebView.
private void populatePickerData(WebHistoryItem item) {
- mPickerData = new PickerData();
- if (item != null) {
+ if (item != null && !TextUtils.isEmpty(item.getUrl())) {
+ mPickerData = new PickerData();
mPickerData.mUrl = item.getUrl();
mPickerData.mTitle = item.getTitle();
mPickerData.mFavicon = item.getFavicon();
@@ -1950,7 +1951,6 @@
// Restore the internal state even if the WebView fails to restore.
// This will maintain the app id, original url and close-on-exit values.
mSavedState = null;
- mPickerData = null;
mCloseOnExit = b.getBoolean(CLOSEONEXIT);
mAppId = b.getString(APPID);
mOriginalUrl = b.getString(ORIGINALURL);