Fix for incognito tabs being restored as regular
Preserve Tab's incognito property when the associated WebView is
destoyed by MemoryMonitor and restored later by TabControl.
Change-Id: I2a8029e646f1cc0197b11f19730c170ee770d20f
diff --git a/src/com/android/swe/browser/Tab.java b/src/com/android/swe/browser/Tab.java
index 91cb2d2..446c070 100644
--- a/src/com/android/swe/browser/Tab.java
+++ b/src/com/android/swe/browser/Tab.java
@@ -1352,7 +1352,7 @@
if (w != null) {
syncCurrentState(w, null);
} else {
- mCurrentState = new PageState(mContext, false);
+ mCurrentState = new PageState(mContext, mMainView.isPrivateBrowsingEnabled());
}
}
// set the new one
diff --git a/src/com/android/swe/browser/TabControl.java b/src/com/android/swe/browser/TabControl.java
index 7030c10..1f16846 100644
--- a/src/com/android/swe/browser/TabControl.java
+++ b/src/com/android/swe/browser/TabControl.java
@@ -637,7 +637,7 @@
}
// Create a new WebView. If this tab is the current tab, we need to put
// back all the clients so force it to be the current tab.
- t.setWebView(createNewWebView(), false);
+ t.setWebView(createNewWebView(t.isPrivateBrowsingEnabled()), false);
if (getCurrentTab() == t) {
setCurrentTab(t, true);
}
@@ -697,7 +697,7 @@
boolean needRestore = !newTab.isSnapshot() && (mainView == null);
if (needRestore) {
// Same work as in createNewTab() except don't do new Tab()
- mainView = createNewWebView();
+ mainView = createNewWebView(newTab.isPrivateBrowsingEnabled());
newTab.setWebView(mainView);
}
newTab.putInForeground();