diff options
| author | 2009-07-23 16:40:48 -0700 | |
|---|---|---|
| committer | 2009-07-23 16:40:48 -0700 | |
| commit | d3eb53114675b6a692106b31e0737e04be1c0b05 (patch) | |
| tree | 60e00cf3bd947ff5873f6ca7bc7183c2207c6d2d | |
| parent | 97c747b85d92bc0ba73b3ee99dc643854d44f532 (diff) | |
| parent | 62e7cbf0b2696594ba36b625758eef626e4abeac (diff) | |
Merge change 8287
* changes:
Add some more (off by default) logging to trace what's happening with UrlRules
| -rw-r--r-- | core/java/com/google/android/net/UrlRules.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/core/java/com/google/android/net/UrlRules.java b/core/java/com/google/android/net/UrlRules.java index c269d1b94190..54d139d5e1f5 100644 --- a/core/java/com/google/android/net/UrlRules.java +++ b/core/java/com/google/android/net/UrlRules.java @@ -20,6 +20,7 @@ import android.content.ContentResolver; import android.database.Cursor; import android.provider.Checkin; import android.provider.Settings; +import android.util.Config; import android.util.Log; import java.util.ArrayList; @@ -53,6 +54,9 @@ import java.util.regex.Pattern; * </pre> */ public class UrlRules { + public static final String TAG = "UrlRules"; + public static final boolean LOCAL_LOGV = Config.LOGV || false; + /** Thrown when the rewrite rules can't be parsed. */ public static class RuleFormatException extends Exception { public RuleFormatException(String msg) { super(msg); } @@ -192,10 +196,11 @@ public class UrlRules { Settings.Gservices.PROVISIONING_DIGEST); if (sCachedDigest != null && sCachedDigest.equals(digest)) { // The digest is the same, so the rules are the same. + if (LOCAL_LOGV) Log.v(TAG, "Using cached rules for digest: " + digest); return sCachedRules; } - // Get all the Gservices settings with names starting with "url:". + if (LOCAL_LOGV) Log.v(TAG, "Scanning for Gservices \"url:*\" rules"); Cursor cursor = resolver.query(Settings.Gservices.CONTENT_URI, new String[] { Settings.Gservices.NAME, @@ -210,16 +215,18 @@ public class UrlRules { String name = cursor.getString(0).substring(4); // "url:X" String value = cursor.getString(1); if (value == null || value.length() == 0) continue; + if (LOCAL_LOGV) Log.v(TAG, " Rule " + name + ": " + value); rules.add(new Rule(name, value)); } catch (RuleFormatException e) { // Oops, Gservices has an invalid rule! Skip it. - Log.e("UrlRules", "Invalid rule from Gservices", e); + Log.e(TAG, "Invalid rule from Gservices", e); Checkin.logEvent(resolver, Checkin.Events.Tag.GSERVICES_ERROR, e.toString()); } } sCachedRules = new UrlRules(rules.toArray(new Rule[rules.size()])); sCachedDigest = digest; + if (LOCAL_LOGV) Log.v(TAG, "New rules stored for digest: " + digest); } finally { cursor.close(); } |