summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/Controller.java
diff options
context:
space:
mode:
authorMattias Falk <mattias.falk@sonyericsson.com>2012-05-25 09:40:31 +0200
committerKenneth Andersson <kenneth.andersson@sonymobile.com>2012-09-03 09:22:37 +0200
commit9cc2d03bddf3d11804fa5ac06662220f1e21b3ce (patch)
tree49c76602cd617c29630694b83092093cf5c488f9 /src/com/android/browser/Controller.java
parent3d2e213ce176cb320ac52c71b00cb591beae8e04 (diff)
downloadpackages_apps_browser-9cc2d03bddf3d11804fa5ac06662220f1e21b3ce.zip
packages_apps_browser-9cc2d03bddf3d11804fa5ac06662220f1e21b3ce.tar.gz
packages_apps_browser-9cc2d03bddf3d11804fa5ac06662220f1e21b3ce.tar.bz2
Pause WebView timer when Browser is paused
If the Browser is paused while loading a page it shall finish loading the page before the WebView timer is paused. The WebView timer shall be paused in onProgressChanged when the progress has reached 100 not from onPageFinished since onPageFinished is called when the main frame is loaded and at that time subframe and other resources might haven't been finished loaded i.e. the page is still in load, which the result in WebView timers are not paused. With this patch the Browser won't consume system resources if it's minimized while doing a page load. Change-Id: Id971dbcedfbedb5b0e56cba4076cd724d590ac85
Diffstat (limited to 'src/com/android/browser/Controller.java')
-rw-r--r--src/com/android/browser/Controller.java9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index ebfd56f..ec7ff48 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -860,11 +860,6 @@ public class Controller
public void onPageFinished(Tab tab) {
mCrashRecoveryHandler.backupState();
mUi.onTabDataChanged(tab);
- // pause the WebView timer and release the wake lock if it is finished
- // while BrowserActivity is in pause state.
- if (mActivityPaused && pauseWebViewTimers(tab)) {
- releaseWakeLock();
- }
// Performance probe
if (false) {
@@ -889,6 +884,10 @@ public class Controller
// onPageFinished has executed)
if (tab.inPageLoad()) {
updateInLoadMenuItems(mCachedMenu, tab);
+ } else if (mActivityPaused && pauseWebViewTimers(tab)) {
+ // pause the WebView timer and release the wake lock if it is
+ // finished while BrowserActivity is in pause state.
+ releaseWakeLock();
}
if (!tab.isPrivateBrowsingEnabled()
&& !TextUtils.isEmpty(tab.getUrl())