Fix issues with state save/restore
Bug: 5144214
Tracked down the issue with messed up state to a bug where
tab ids were not unique, and would actually get messed up in restore.
Switched it to the tab's responsibility to assign an id to itself
in the ctor to make sure all possible paths where a tab is created
are fixed as well as the tab being the best informed about whether
or not it has an ID to restore from. Added some checks to watch for
a similar problem in the future as well.
Change-Id: Icd8333232a0baca7a3639323538886ea595de05a
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 92cb743..1e89af1 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -332,6 +332,9 @@
restoredTabs.add(t.getId());
}
BackgroundHandler.execute(new PruneThumbnails(mActivity, restoredTabs));
+ if (tabs.size() == 0) {
+ openTabToHomePage();
+ }
mUi.updateTabs(tabs);
// TabControl.restoreState() will create a new tab even if
// restoring the state fails.
@@ -1207,13 +1210,6 @@
// combo view callbacks
- /**
- * callback from ComboPage when clear history is requested
- */
- public void onRemoveParentChildRelationships() {
- mTabControl.removeParentChildRelationShips();
- }
-
// key handling
protected void onBackKey() {
if (!mUi.onBackKey()) {