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
This commit is contained in:
Yu Ping Hu 2013-08-14 10:46:07 -07:00
parent 66ac290b35
commit eb190a8d9d
1 changed files with 4 additions and 1 deletions

View File

@ -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;
}