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
diff --git a/src/com/android/browser/Browser.java b/src/com/android/browser/Browser.java
index 32cee67..524f789 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 @@
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 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 47f12e3..3f79a2d 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -86,7 +86,6 @@
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 @@
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 @@
s.loadFromDb(mContext);
pluginsPath = s.getPluginsPath();
}
- if (Config.LOGV) {
+ if (LOGV_ENABLED) {
Log.v(TAG, "Plugin path: " + pluginsPath);
}
}
@@ -400,7 +406,7 @@
* 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 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 @@
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 @@
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 @@
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 @@
outputFile.getParentFile().mkdirs();
if (outputFile.exists() && !mDoOverwrite) {
- if (Config.LOGV) {
+ if (LOGV_ENABLED) {
Log.v(TAG, path + " already extracted.");
}
} else {
@@ -548,7 +554,7 @@
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 @@
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 @@
}
@Override public void onCreate(Bundle icicle) {
- if (Config.LOGV) {
+ if (LOGV_ENABLED) {
Log.v(LOGTAG, this + " onStart");
}
super.onCreate(icicle);
@@ -990,7 +996,7 @@
@Override protected void onResume() {
super.onResume();
- if (Config.LOGV) {
+ if (LOGV_ENABLED) {
Log.v(LOGTAG, "BrowserActivity.onResume: this=" + this);
}
@@ -1037,7 +1043,7 @@
* 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 @@
}
@Override protected void onDestroy() {
- if (Config.LOGV) {
+ if (LOGV_ENABLED) {
Log.v(LOGTAG, "BrowserActivity.onDestroy: this=" + this);
}
super.onDestroy();
@@ -2346,7 +2352,7 @@
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 @@
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 @@
+ " 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 @@
} else if (newUrl.startsWith("https://")) {
newUrl = newUrl.substring(8);
}
- if (Config.LOGD) {
+ if (LOGD_ENABLED) {
Log.d(LOGTAG, newUrl + " loaded");
}
/*
@@ -2905,7 +2911,7 @@
// 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 @@
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 @@
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 @@
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 @@
mLockIconType = LOCK_ICON_UNSECURE;
- if (Config.LOGV) {
+ if (LOGV_ENABLED) {
Log.v(LOGTAG, "BrowserActivity.resetLockIcon:" +
" reset lock icon to " + mLockIconType);
}
@@ -4140,7 +4146,7 @@
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 ecf166d..b44ec2a 100644
--- a/src/com/android/browser/GearsNativeDialog.java
+++ b/src/com/android/browser/GearsNativeDialog.java
@@ -23,7 +23,6 @@
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 @@
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 9eccb16..9967f36 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 @@
* @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 ee63f2c..0b82676 100644
--- a/src/com/android/browser/TabControl.java
+++ b/src/com/android/browser/TabControl.java
@@ -20,7 +20,6 @@
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 @@
}
@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);