Catch SecurityException and rethrow as ApiException.

Supposedly a SecurityException may be thrown on some devices when they
switch from an IPv4 network to IPv6 and vice versa.  This will rethrow it
as an ApiException, so that the app will treat it as a network error, and
allow the user to retry, instead of crashing.

Bug: 67948
Change-Id: I6ec4a67208e0eda57772b9af832dda6f1789cc9e