Fix issue of losing tab state
Browser makes a backup of tab state when adding visited history and
page finished. When browser is being destroyed at times there could
be an instance where a background load triggers to write state while
the browser is already in cleanup state. This causes to write empty
state that looses the previous saved status .
Change-Id: I760c36e376c816302f8635c8e73d8b3871faf0b4
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 457b1c4..454b25a 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -754,6 +754,12 @@
/* package */ Bundle createSaveState() {
Bundle saveState = new Bundle();
mTabControl.saveState(saveState);
+ // This method is called multiple times.Need to
+ // guard against TabControl not having any tabs
+ // during the destroy cycles which looses all the
+ // existing saved information.
+ if (saveState.isEmpty())
+ return null;
return saveState;
}