From d63f756013de6455a9a8b0c3675de214bb95a430 Mon Sep 17 00:00:00 2001 From: Kurt Partridge Date: Wed, 29 May 2013 17:23:07 -0700 Subject: [PATCH] Catch a permission exception This change catches a SecurityException if the DictionaryProvider is unavailable. Change-Id: I4f2d87327c40765383d8847fd4e934b3cf799488 --- .../inputmethod/latin/BinaryDictionaryFileDumper.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java b/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java index a9b58de44..d6de17122 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java @@ -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;