Catch a permission exception

This change catches a SecurityException if the DictionaryProvider is
unavailable.

Change-Id: I4f2d87327c40765383d8847fd4e934b3cf799488
main
Kurt Partridge 2013-05-29 17:23:07 -07:00
parent 8eb214d7e1
commit d63f756013
1 changed files with 7 additions and 1 deletions

View File

@ -363,8 +363,14 @@ public final class BinaryDictionaryFileDumper {
*/
public static void cacheWordListsFromContentProvider(final Locale locale,
final Context context, final boolean hasDefaultWordList) {
final ContentProviderClient providerClient = context.getContentResolver().
final ContentProviderClient providerClient;
try {
providerClient = context.getContentResolver().
acquireContentProviderClient(getProviderUriBuilder("").build());
} catch (final SecurityException e) {
Log.e(TAG, "No permission to communicate with the dictionary provider", e);
return;
}
if (null == providerClient) {
Log.e(TAG, "Can't establish communication with the dictionary provider");
return;