summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-08-17 10:15:16 -0700
committerJohn Reck <jreck@google.com>2011-08-17 10:15:16 -0700
commit56c1fcf7774d4ee943fbda808e37840459502e20 (patch)
treef725280af996ef8fbaa6ccf2f672460395c5a040 /src/com/android/browser
parent86bc0480945215da742f423cda4e35b858f53cea (diff)
downloadpackages_apps_Browser-56c1fcf7774d4ee943fbda808e37840459502e20.zip
packages_apps_Browser-56c1fcf7774d4ee943fbda808e37840459502e20.tar.gz
packages_apps_Browser-56c1fcf7774d4ee943fbda808e37840459502e20.tar.bz2
Faster all the things!
Bug: 5177959 Improve browser startup. Elinate IO access on UI thread during startup by removing the super legacy ClearThumbnails task. Also rework how the hardware acceleration debug setting works to remove the requirement for initialized BrowserSettings in onCreate Change-Id: I4c1014d380827af4833586e6a3ae842fd59aa48b
Diffstat (limited to 'src/com/android/browser')
-rw-r--r--src/com/android/browser/BrowserActivity.java18
-rw-r--r--src/com/android/browser/BrowserSettings.java1
-rw-r--r--src/com/android/browser/Controller.java20
-rw-r--r--src/com/android/browser/Tab.java11
-rw-r--r--src/com/android/browser/TabControl.java8
-rw-r--r--src/com/android/browser/preferences/DebugPreferencesFragment.java27
6 files changed, 18 insertions, 67 deletions
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 084ace0..690e29f 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -65,24 +65,6 @@ public class BrowserActivity extends Activity {
return;
}
- BrowserSettings settings = BrowserSettings.getInstance();
-
- // render the browser in OpenGL
- if (settings.isHardwareAccelerated()) {
- // Set the flag in the activity's window
- this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
- WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
- } else {
- // Clear the flag in the activity's window
- this.getWindow().setFlags(0, WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
- }
-
- AccessibilityManager accessibilityManager = (AccessibilityManager)
- getSystemService(ACCESSIBILITY_SERVICE);
- if (accessibilityManager != null && accessibilityManager.isEnabled()) {
- setDefaultKeyMode(DEFAULT_KEYS_DISABLE);
- }
-
mController = new Controller(this, icicle == null);
boolean xlarge = isTablet(this);
if (xlarge) {
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index ad42146..d4f1ba3 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -405,7 +405,6 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
}
public boolean isDebugEnabled() {
- requireInitialization();
return mPrefs.getBoolean(PREF_DEBUG_MENU, false);
}
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 24072c9..51bcda2 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -87,7 +87,6 @@ import com.android.browser.search.SearchEngine;
import com.android.common.Search;
import java.io.ByteArrayOutputStream;
-import java.io.File;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Calendar;
@@ -215,20 +214,6 @@ public class Controller
private boolean mBlockEvents;
- private static class ClearThumbnails extends AsyncTask<File, Void, Void> {
- @Override
- public Void doInBackground(File... files) {
- if (files != null) {
- for (File f : files) {
- if (!f.delete()) {
- Log.e(LOGTAG, f.getPath() + " was not deleted");
- }
- }
- }
- return null;
- }
- }
-
public Controller(Activity browser, boolean preloadCrashState) {
mActivity = browser;
mSettings = BrowserSettings.getInstance();
@@ -354,11 +339,6 @@ public class Controller
// Handle the intent
mIntentHandler.onNewIntent(intent);
}
- // clear up the thumbnail directory, which is no longer used;
- // ideally this should only be run once after an upgrade from
- // a previous version of the browser
- new ClearThumbnails().execute(mTabControl.getThumbnailDir()
- .listFiles());
// Read JavaScript flags if it exists.
String jsFlags = getSettings().getJsEngineFlags();
if (jsFlags.trim().length() != 0) {
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index abc2467..d7ce29b 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -1664,6 +1664,7 @@ class Tab implements PictureListener {
void resume() {
if (mMainView != null) {
+ setupHwAcceleration(mMainView);
mMainView.onResume();
if (mSubView != null) {
mSubView.onResume();
@@ -1671,6 +1672,16 @@ class Tab implements PictureListener {
}
}
+ private void setupHwAcceleration(View web) {
+ if (web == null) return;
+ BrowserSettings settings = BrowserSettings.getInstance();
+ if (settings.isHardwareAccelerated()) {
+ web.setLayerType(View.LAYER_TYPE_NONE, null);
+ } else {
+ web.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
+ }
+ }
+
void pause() {
if (mMainView != null) {
mMainView.onPause();
diff --git a/src/com/android/browser/TabControl.java b/src/com/android/browser/TabControl.java
index 38a46a8..e99071a 100644
--- a/src/com/android/browser/TabControl.java
+++ b/src/com/android/browser/TabControl.java
@@ -20,7 +20,6 @@ import android.os.Bundle;
import android.util.Log;
import android.webkit.WebView;
-import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -51,7 +50,6 @@ class TabControl {
// the main browser controller
private final Controller mController;
- private final File mThumbnailDir;
private OnThumbnailUpdatedListener mOnThumbnailUpdatedListener;
/**
@@ -59,8 +57,6 @@ class TabControl {
*/
TabControl(Controller controller) {
mController = controller;
- mThumbnailDir = mController.getActivity()
- .getDir("thumbnails", 0);
mMaxTabs = mController.getMaxTabs();
mTabs = new ArrayList<Tab>(mMaxTabs);
mTabQueue = new ArrayList<Tab>(mMaxTabs);
@@ -70,10 +66,6 @@ class TabControl {
return sNextId++;
}
- File getThumbnailDir() {
- return mThumbnailDir;
- }
-
/**
* Return the current tab's main WebView. This will always return the main
* WebView for a given tab and not a subwindow.
diff --git a/src/com/android/browser/preferences/DebugPreferencesFragment.java b/src/com/android/browser/preferences/DebugPreferencesFragment.java
index 566eee2..24821d1 100644
--- a/src/com/android/browser/preferences/DebugPreferencesFragment.java
+++ b/src/com/android/browser/preferences/DebugPreferencesFragment.java
@@ -16,21 +16,18 @@
package com.android.browser.preferences;
-import com.android.browser.BrowserActivity;
-import com.android.browser.BrowserSettings;
-import com.android.browser.GoogleAccountLogin;
-import com.android.browser.PreferenceKeys;
-import com.android.browser.R;
-
-import android.content.Intent;
import android.os.Bundle;
import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceFragment;
+import com.android.browser.BrowserSettings;
+import com.android.browser.GoogleAccountLogin;
+import com.android.browser.PreferenceKeys;
+import com.android.browser.R;
+
public class DebugPreferencesFragment extends PreferenceFragment
- implements OnPreferenceChangeListener, OnPreferenceClickListener {
+ implements OnPreferenceClickListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -38,21 +35,11 @@ public class DebugPreferencesFragment extends PreferenceFragment
// Load the XML preferences file
addPreferencesFromResource(R.xml.debug_preferences);
- Preference e = findPreference(PreferenceKeys.PREF_ENABLE_HARDWARE_ACCEL);
- e.setOnPreferenceChangeListener(this);
- e = findPreference(PreferenceKeys.PREF_RESET_PRELOGIN);
+ Preference e = findPreference(PreferenceKeys.PREF_RESET_PRELOGIN);
e.setOnPreferenceClickListener(this);
}
@Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- // Attempt to restart
- startActivity(new Intent(BrowserActivity.ACTION_RESTART, null,
- getActivity(), BrowserActivity.class));
- return true;
- }
-
- @Override
public boolean onPreferenceClick(Preference preference) {
if (PreferenceKeys.PREF_RESET_PRELOGIN.equals(preference.getKey())) {
BrowserSettings.getInstance().getPreferences().edit()