Restore Snapshot Tab feature

When tabs were getting killed the state
of the Snapshot Tab was not getting saved
or restored.

Change-Id: I7bddb045b15a7c23fd210158389cf779c633fba6
diff --git a/src/com/android/browser/SnapshotTab.java b/src/com/android/browser/SnapshotTab.java
index 7f87cf2..13e94b8 100644
--- a/src/com/android/browser/SnapshotTab.java
+++ b/src/com/android/browser/SnapshotTab.java
@@ -49,6 +49,10 @@
     private long mDateCreated;
     private boolean mIsLive;
     private String mLiveUrl;
+    private Bundle mSavedState;
+
+    // Used for saving and restoring each Tab
+    static final String SNAPSHOT_ID = "snapshotId";
 
     public SnapshotTab(WebViewController wvcontroller, long snapshotId) {
         super(wvcontroller, null, null);
@@ -116,7 +120,11 @@
         if (mIsLive) {
             return super.saveState();
         }
-        return null;
+
+        mSavedState = new Bundle();
+        mSavedState.putLong(SNAPSHOT_ID, mSnapshotId);
+
+        return mSavedState;
     }
 
     public long getDateCreated() {
diff --git a/src/com/android/browser/TabControl.java b/src/com/android/browser/TabControl.java
index 73c6a1f..2488ec2 100644
--- a/src/com/android/browser/TabControl.java
+++ b/src/com/android/browser/TabControl.java
@@ -438,7 +438,15 @@
                     && state.getBoolean(Tab.INCOGNITO)) {
                 // ignore tab
             } else if (id == currentId || restoreAll) {
-                Tab t = createNewTab(state, false);
+                Tab t = null;
+                // Add special check to restore Snapshot Tab if needed
+                if (state.getLong(SnapshotTab.SNAPSHOT_ID, -1) != -1 ) {
+                  t = (SnapshotTab) createSnapshotTab( state.getLong(SnapshotTab.SNAPSHOT_ID) );
+                } else {
+                    // presume its a normal Tab
+                    t = createNewTab(state, false);
+                }
+
                 if (t == null) {
                     // We could "break" at this point, but we want
                     // sNextId to be set correctly.