remove save/restore picture from browser app

These pictures may be arbitrarily large, and with the
newer caching mechanism, are rarely used.

Also, remove any old pictures when the Browser starts.

Change-Id: I08e1720a198b159733fda819304dc6af6811390a
http://b/2650945
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 1c32ecd..ad82fd0 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -368,6 +368,15 @@
             attachTabToContentView(mTabControl.getCurrentTab());
         }
 
+        // Delete old thumbnails to save space
+        File dir = mTabControl.getThumbnailDir();
+        if (dir.exists()) {
+            for (String child : dir.list()) {
+                File f = new File(dir, child);
+                f.delete();
+            }
+        }
+
         // Read JavaScript flags if it exists.
         String jsFlags = mSettings.getJsFlags();
         if (jsFlags.trim().length() != 0) {
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index ebbb055..6b74a6c 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -151,7 +151,6 @@
     static final String CURRTAB = "currentTab";
     static final String CURRURL = "currentUrl";
     static final String CURRTITLE = "currentTitle";
-    static final String CURRPICTURE = "currentPicture";
     static final String CLOSEONEXIT = "closeonexit";
     static final String PARENTTAB = "parentTab";
     static final String APPID = "appid";
@@ -1912,17 +1911,6 @@
 
         mSavedState = new Bundle();
         final WebBackForwardList list = mMainView.saveState(mSavedState);
-        if (list != null) {
-            final File f = new File(mActivity.getTabControl().getThumbnailDir(),
-                    mMainView.hashCode() + "_pic.save");
-            if (mMainView.savePicture(mSavedState, f)) {
-                mSavedState.putString(CURRPICTURE, f.getPath());
-            } else {
-                // if savePicture returned false, we can't trust the contents,
-                // and it may be large, so we delete it right away
-                f.delete();
-            }
-        }
 
         // Store some extra info for displaying the tab in the picker.
         final WebHistoryItem item = list != null ? list.getCurrentItem() : null;
@@ -1968,11 +1956,6 @@
         if (list == null) {
             return false;
         }
-        if (b.containsKey(CURRPICTURE)) {
-            final File f = new File(b.getString(CURRPICTURE));
-            mMainView.restorePicture(b, f);
-            f.delete();
-        }
         return true;
     }
 
diff --git a/src/com/android/browser/TabControl.java b/src/com/android/browser/TabControl.java
index 7cd2ccb..afd4ea8 100644
--- a/src/com/android/browser/TabControl.java
+++ b/src/com/android/browser/TabControl.java
@@ -229,15 +229,6 @@
             }
         }
 
-        // This tab may have been pushed in to the background and then closed.
-        // If the saved state contains a picture file, delete the file.
-        Bundle savedState = t.getSavedState();
-        if (savedState != null) {
-            if (savedState.containsKey(Tab.CURRPICTURE)) {
-                new File(savedState.getString(Tab.CURRPICTURE)).delete();
-            }
-        }
-
         // Remove it from the queue of viewed tabs.
         mTabQueue.remove(t);
         return true;