From eb190a8d9d42ab9e4c063babc14d3b0094008bf7 Mon Sep 17 00:00:00 2001 From: Yu Ping Hu Date: Wed, 14 Aug 2013 10:46:07 -0700 Subject: [PATCH] Don't crash when the policy service is unavailable. This isn't a great situation -- it suggests the PolicyService is having some sort of RemoteException -- but when it happens we should just treat it the same as if the policy is not enforced. Bug: 10315113 Change-Id: If2fbe1648a5c6f3df13cef02c8dc5bc6e858f2d9 --- .../com/android/emailcommon/service/PolicyServiceProxy.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/emailcommon/src/com/android/emailcommon/service/PolicyServiceProxy.java b/emailcommon/src/com/android/emailcommon/service/PolicyServiceProxy.java index e33d02c91..347768b10 100755 --- a/emailcommon/src/com/android/emailcommon/service/PolicyServiceProxy.java +++ b/emailcommon/src/com/android/emailcommon/service/PolicyServiceProxy.java @@ -58,7 +58,10 @@ public class PolicyServiceProxy extends ServiceProxy implements IPolicyService { LogUtils.v(TAG, "isActive: " + ((mReturn == null) ? "null" : mReturn)); } if (mReturn == null) { - throw new ServiceUnavailableException("isActive"); + // This is not a great situation, but it's better to act like the policy isn't enforced + // rather than crash. + LogUtils.e(TAG, "PolicyService unavailable in isActive; assuming false"); + return false; } else { return (Boolean)mReturn; }