diff options
author | Cary Clark <cary@android.com> | 2010-07-01 12:36:56 -0400 |
---|---|---|
committer | Cary Clark <cary@android.com> | 2010-07-27 11:01:46 -0400 |
commit | b4b83182219908210d4554466367736692faf6ce (patch) | |
tree | b1776b08d23bcc26fbb5f110091fdd4af9146eb6 /src/com | |
parent | 3d62f8411bf45bf4904092e5bfd7562703dd5963 (diff) | |
download | packages_apps_browser-b4b83182219908210d4554466367736692faf6ce.zip packages_apps_browser-b4b83182219908210d4554466367736692faf6ce.tar.gz packages_apps_browser-b4b83182219908210d4554466367736692faf6ce.tar.bz2 |
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
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/browser/BrowserActivity.java | 9 | ||||
-rw-r--r-- | src/com/android/browser/Tab.java | 17 | ||||
-rw-r--r-- | src/com/android/browser/TabControl.java | 9 |
3 files changed, 9 insertions, 26 deletions
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 @@ public class BrowserActivity extends Activity 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 @@ class Tab { 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 @@ class Tab { 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 @@ class Tab { 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 @@ class TabControl { } } - // 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; |