diff options
| author | Dave Bort <dbort@android.com> | 2009-04-13 15:56:49 -0700 |
|---|---|---|
| committer | Dave Bort <dbort@android.com> | 2009-04-13 15:58:41 -0700 |
| commit | 31a6d1cb63a513712bad717a6239919fd5428fd1 (patch) | |
| tree | f11ff985e2de83a456900f2eca21a1816c9880e7 /src/com/android/browser | |
| parent | 90790a1d4d2b8d37aa9acd1e5e34bd62549f9784 (diff) | |
| download | packages_apps_Browser-31a6d1cb63a513712bad717a6239919fd5428fd1.tar.gz packages_apps_Browser-31a6d1cb63a513712bad717a6239919fd5428fd1.tar.bz2 packages_apps_Browser-31a6d1cb63a513712bad717a6239919fd5428fd1.zip | |
Browser: Remove references to android.util.Config
The semantics of Config.DEBUG will be changing soon, and all other
Config.* fields will become deprecated/hidden.
BUG=1780938
Diffstat (limited to 'src/com/android/browser')
| -rw-r--r-- | src/com/android/browser/Browser.java | 12 | ||||
| -rw-r--r-- | src/com/android/browser/BrowserActivity.java | 54 | ||||
| -rw-r--r-- | src/com/android/browser/GearsNativeDialog.java | 3 | ||||
| -rw-r--r-- | src/com/android/browser/ImageGrid.java | 3 | ||||
| -rw-r--r-- | src/com/android/browser/TabControl.java | 3 |
5 files changed, 43 insertions, 32 deletions
diff --git a/src/com/android/browser/Browser.java b/src/com/android/browser/Browser.java index 32cee6700..524f78962 100644 --- a/src/com/android/browser/Browser.java +++ b/src/com/android/browser/Browser.java @@ -16,7 +16,6 @@ package com.android.browser; -import android.util.Config; import android.util.Log; import android.app.Application; @@ -30,6 +29,15 @@ public class Browser extends Application { private final static String LOGTAG = "browser"; + // Set to true to enable extra debugging. + final static boolean DEBUG = false; + + // Set to true to enable verbose logging. + final static boolean LOGV_ENABLED = DEBUG; + + // Set to true to enable extra debug logging. + final static boolean LOGD_ENABLED = true; + /** * Specifies a heap utilization ratio that works better * for the browser than the default ratio does. @@ -40,7 +48,7 @@ public class Browser extends Application { } public void onCreate() { - if (Config.LOGV) + if (LOGV_ENABLED) Log.v(LOGTAG, "Browser.onCreate: this=" + this); // Fix heap utilization for better heap size characteristics. VMRuntime.getRuntime().setTargetHeapUtilization( diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java index 47f12e3d2..3f79a2daf 100644 --- a/src/com/android/browser/BrowserActivity.java +++ b/src/com/android/browser/BrowserActivity.java @@ -86,7 +86,6 @@ import android.text.IClipboard; import android.text.TextUtils; import android.text.format.DateFormat; import android.text.util.Regex; -import android.util.Config; import android.util.Log; import android.view.ContextMenu; import android.view.Gravity; @@ -151,6 +150,13 @@ public class BrowserActivity extends Activity View.OnCreateContextMenuListener, DownloadListener { + /* Define some aliases to make these debugging flags easier to refer to. + * This file imports android.provider.Browser, so we can't just refer to "Browser.DEBUG". + */ + private final static boolean DEBUG = com.android.browser.Browser.DEBUG; + private final static boolean LOGV_ENABLED = com.android.browser.Browser.LOGV_ENABLED; + private final static boolean LOGD_ENABLED = com.android.browser.Browser.LOGD_ENABLED; + private IGoogleLoginService mGls = null; private ServiceConnection mGlsConnection = null; @@ -373,7 +379,7 @@ public class BrowserActivity extends Activity s.loadFromDb(mContext); pluginsPath = s.getPluginsPath(); } - if (Config.LOGV) { + if (LOGV_ENABLED) { Log.v(TAG, "Plugin path: " + pluginsPath); } } @@ -400,7 +406,7 @@ public class BrowserActivity extends Activity * We delete the directory, then recreate it. */ public void cleanPluginsDirectory() { - if (Config.LOGV) { + if (LOGV_ENABLED) { Log.v(TAG, "delete plugins directory: " + pluginsPath); } File pluginsDirectory = new File(pluginsPath); @@ -416,7 +422,7 @@ public class BrowserActivity extends Activity */ public void copyBuildInfos() { try { - if (Config.LOGV) { + if (LOGV_ENABLED) { Log.v(TAG, "Copy build infos to the plugins directory"); } File buildInfoFile = new File(SYSTEM_BUILD_INFOS_FILE); @@ -448,7 +454,7 @@ public class BrowserActivity extends Activity File buildInfoFile = new File(SYSTEM_BUILD_INFOS_FILE); File buildInfoPlugins = new File(pluginsPath, BUILD_INFOS_FILE); if (!buildInfoPlugins.exists()) { - if (Config.LOGV) { + if (LOGV_ENABLED) { Log.v(TAG, "build.prop in plugins directory " + pluginsPath + " does not exist, therefore it's a new system image"); } @@ -458,7 +464,7 @@ public class BrowserActivity extends Activity String buildInfoPlugin = contentsOfFile(buildInfoPlugins); if (buildInfo == null || buildInfoPlugin == null || buildInfo.compareTo(buildInfoPlugin) != 0) { - if (Config.LOGV) { + if (LOGV_ENABLED) { Log.v(TAG, "build.prop are different, " + " therefore it's a new system image"); } @@ -491,7 +497,7 @@ public class BrowserActivity extends Activity String path = entry.getName().substring(zipFilterLength); File outputFile = new File(pluginsPath, path); if (!outputFile.exists()) { - if (Config.LOGV) { + if (LOGV_ENABLED) { Log.v(TAG, "checkIsDifferentVersions(): extracted file " + path + " does not exist, we have a different version"); } @@ -536,7 +542,7 @@ public class BrowserActivity extends Activity outputFile.getParentFile().mkdirs(); if (outputFile.exists() && !mDoOverwrite) { - if (Config.LOGV) { + if (LOGV_ENABLED) { Log.v(TAG, path + " already extracted."); } } else { @@ -548,7 +554,7 @@ public class BrowserActivity extends Activity path + TEMPORARY_EXTENSION); } FileOutputStream fos = new FileOutputStream(outputFile); - if (Config.LOGV) { + if (LOGV_ENABLED) { Log.v(TAG, "copy " + entry + " to " + pluginsPath + "/" + path); } @@ -563,7 +569,7 @@ public class BrowserActivity extends Activity File renamedFile = (File) elems.nextElement(); File sourceFile = new File(renamedFile.getPath() + TEMPORARY_EXTENSION); - if (Config.LOGV) { + if (LOGV_ENABLED) { Log.v(TAG, "rename " + sourceFile.getPath() + " to " + renamedFile.getPath()); } @@ -623,7 +629,7 @@ public class BrowserActivity extends Activity } @Override public void onCreate(Bundle icicle) { - if (Config.LOGV) { + if (LOGV_ENABLED) { Log.v(LOGTAG, this + " onStart"); } super.onCreate(icicle); @@ -990,7 +996,7 @@ public class BrowserActivity extends Activity @Override protected void onResume() { super.onResume(); - if (Config.LOGV) { + if (LOGV_ENABLED) { Log.v(LOGTAG, "BrowserActivity.onResume: this=" + this); } @@ -1037,7 +1043,7 @@ public class BrowserActivity extends Activity * the saved state. */ @Override protected void onSaveInstanceState(Bundle outState) { - if (Config.LOGV) { + if (LOGV_ENABLED) { Log.v(LOGTAG, "BrowserActivity.onSaveInstanceState: this=" + this); } // the default implementation requires each view to have an id. As the @@ -1083,7 +1089,7 @@ public class BrowserActivity extends Activity } @Override protected void onDestroy() { - if (Config.LOGV) { + if (LOGV_ENABLED) { Log.v(LOGTAG, "BrowserActivity.onDestroy: this=" + this); } super.onDestroy(); @@ -2346,7 +2352,7 @@ public class BrowserActivity extends Activity private void revertLockIcon() { mLockIconType = mPrevLockType; - if (Config.LOGV) { + if (LOGV_ENABLED) { Log.v(LOGTAG, "BrowserActivity.revertLockIcon:" + " revert lock icon to " + mLockIconType); } @@ -2741,7 +2747,7 @@ public class BrowserActivity extends Activity String uiInfo = "UI thread used " + (SystemClock.currentThreadTimeMillis() - mUiStart) + " ms"; - if (Config.LOGD) { + if (LOGD_ENABLED) { Log.d(LOGTAG, uiInfo); } //The string that gets written to the log @@ -2758,7 +2764,7 @@ public class BrowserActivity extends Activity + " ms and irq took " + (sysCpu[4] + sysCpu[5] + sysCpu[6] - mIrqStart) * 10 + " ms, " + uiInfo; - if (Config.LOGD) { + if (LOGD_ENABLED) { Log.d(LOGTAG, performanceString + "\nWebpage: " + url); } if (url != null) { @@ -2773,7 +2779,7 @@ public class BrowserActivity extends Activity } else if (newUrl.startsWith("https://")) { newUrl = newUrl.substring(8); } - if (Config.LOGD) { + if (LOGD_ENABLED) { Log.d(LOGTAG, newUrl + " loaded"); } /* @@ -2905,7 +2911,7 @@ public class BrowserActivity extends Activity // If NOT a 'safe' url, change the lock to mixed content! if (!(URLUtil.isHttpsUrl(url) || URLUtil.isDataUrl(url) || URLUtil.isAboutUrl(url))) { mLockIconType = LOCK_ICON_MIXED; - if (Config.LOGV) { + if (LOGV_ENABLED) { Log.v(LOGTAG, "BrowserActivity.updateLockIcon:" + " updated lock icon to " + mLockIconType + " due to " + url); } @@ -3388,7 +3394,7 @@ public class BrowserActivity extends Activity Cursor c = mResolver.query(Browser.BOOKMARKS_URI, Browser.HISTORY_PROJECTION, where, selArgs, null); if (c.moveToFirst()) { - if (Config.LOGV) { + if (LOGV_ENABLED) { Log.v(LOGTAG, "updating cursor"); } // Current implementation of database only has one entry per @@ -3438,7 +3444,7 @@ public class BrowserActivity extends Activity startActivity(intent); return; } catch (ActivityNotFoundException ex) { - if (Config.LOGD) { + if (LOGD_ENABLED) { Log.d(LOGTAG, "activity not found for " + mimetype + " over " + Uri.parse(url).getScheme(), ex); } @@ -3562,7 +3568,7 @@ public class BrowserActivity extends Activity mLockIconType = LOCK_ICON_UNSECURE; if (URLUtil.isHttpsUrl(url)) { mLockIconType = LOCK_ICON_SECURE; - if (Config.LOGV) { + if (LOGV_ENABLED) { Log.v(LOGTAG, "BrowserActivity.resetLockIcon:" + " reset lock icon to " + mLockIconType); } @@ -3582,7 +3588,7 @@ public class BrowserActivity extends Activity mLockIconType = LOCK_ICON_UNSECURE; - if (Config.LOGV) { + if (LOGV_ENABLED) { Log.v(LOGTAG, "BrowserActivity.resetLockIcon:" + " reset lock icon to " + mLockIconType); } @@ -4140,7 +4146,7 @@ public class BrowserActivity extends Activity private class TabListener implements ImageGrid.Listener { public void remove(int position) { // Note: Remove is not enabled if we have only one tab. - if (Config.DEBUG && mTabControl.getTabCount() == 1) { + if (DEBUG && mTabControl.getTabCount() == 1) { throw new AssertionError(); } diff --git a/src/com/android/browser/GearsNativeDialog.java b/src/com/android/browser/GearsNativeDialog.java index ecf166dfb..b44ec2a88 100644 --- a/src/com/android/browser/GearsNativeDialog.java +++ b/src/com/android/browser/GearsNativeDialog.java @@ -23,7 +23,6 @@ import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.Message; -import android.util.Config; import android.util.Log; import android.view.Gravity; import android.view.KeyEvent; @@ -137,7 +136,7 @@ public class GearsNativeDialog extends Activity { return; } - if (Config.LOGV) { + if (Browser.LOGV_ENABLED) { Log.v(TAG, "dialogtype: " + dialogTypeString); } diff --git a/src/com/android/browser/ImageGrid.java b/src/com/android/browser/ImageGrid.java index 9eccb1620..9967f369b 100644 --- a/src/com/android/browser/ImageGrid.java +++ b/src/com/android/browser/ImageGrid.java @@ -17,7 +17,6 @@ package com.android.browser; import android.content.Context; -import android.util.Config; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.KeyEvent; @@ -109,7 +108,7 @@ class ImageGrid extends GridView implements OnItemClickListener, * @param index Window to remove, from 0 to MAX_TABS-1 */ public void remove(int index) { - if (Config.DEBUG && (index < 0 || index >= TabControl.MAX_TABS)) { + if (Browser.DEBUG && (index < 0 || index >= TabControl.MAX_TABS)) { throw new AssertionError(); } mAdapter.remove(index); diff --git a/src/com/android/browser/TabControl.java b/src/com/android/browser/TabControl.java index ee63f2cbf..0b826761e 100644 --- a/src/com/android/browser/TabControl.java +++ b/src/com/android/browser/TabControl.java @@ -20,7 +20,6 @@ import android.content.Context; import android.net.http.SslError; import android.os.Bundle; import android.os.Message; -import android.util.Config; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; @@ -126,7 +125,7 @@ class TabControl { } @Override public void onCloseWindow(WebView window) { - if (Config.DEBUG && window != mTab.mSubView) { + if (Browser.DEBUG && window != mTab.mSubView) { throw new AssertionError("Can't close the window"); } mActivity.dismissSubWindow(mTab); |
