diff options
author | Brad Fitzpatrick <bradfitz@android.com> | 2010-07-15 14:03:55 -0700 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@android.com> | 2010-07-15 14:03:55 -0700 |
commit | dcaba04c224cb5a5ed6af89251ac876ec2f48dfe (patch) | |
tree | 1f409089b2e83a573bdcb508cad5d4477b092fbf /dalvik | |
parent | de1d22525aaaa3eaafc2920acbeb8bd8ec013bcd (diff) | |
download | libcore-dcaba04c224cb5a5ed6af89251ac876ec2f48dfe.zip libcore-dcaba04c224cb5a5ed6af89251ac876ec2f48dfe.tar.gz libcore-dcaba04c224cb5a5ed6af89251ac876ec2f48dfe.tar.bz2 |
Few tweaks to BlockGuard's BlockGuardPolicyException.
Needed for work on StrictMode across binder calls. Will likely be
cleaned up more in the future, removing the magical stringification.
But this is currently needed at this stage.
Change-Id: I4b2b3e6a242ac62fa9847fc969749b4f2467bc71
Diffstat (limited to 'dalvik')
-rw-r--r-- | dalvik/src/main/java/dalvik/system/BlockGuard.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/dalvik/src/main/java/dalvik/system/BlockGuard.java b/dalvik/src/main/java/dalvik/system/BlockGuard.java index 50ccb5f..43d3d9a 100644 --- a/dalvik/src/main/java/dalvik/system/BlockGuard.java +++ b/dalvik/src/main/java/dalvik/system/BlockGuard.java @@ -78,14 +78,15 @@ public final class BlockGuard { int getPolicyMask(); } - public static final class BlockGuardPolicyException extends RuntimeException { + public static class BlockGuardPolicyException extends RuntimeException { // bitmask of DISALLOW_*, PENALTY_*, etc flags - public final int mPolicyState; - public final int mPolicyViolated; + private final int mPolicyState; + private final int mPolicyViolated; public BlockGuardPolicyException(int policyState, int policyViolated) { mPolicyState = policyState; mPolicyViolated = policyViolated; + fillInStackTrace(); } public int getPolicy() { @@ -96,7 +97,15 @@ public final class BlockGuard { return mPolicyViolated; } - // TODO: toString() and stringify the bitmasks above + public String getMessage() { + // Note: do not change this format casually. It's + // somewhat unfortunately Parceled and passed around + // Binder calls and parsed back into an Exception by + // Android's StrictMode. This was the least invasive + // option and avoided a gross mix of Java Serialization + // combined with Parcels. + return "policy=" + mPolicyState + " violation=" + mPolicyViolated; + } } /** |