diff options
author | Android Build Merger (Role) <noreply-android-build-merger@google.com> | 2018-03-26 22:49:59 +0000 |
---|---|---|
committer | Android Build Merger (Role) <noreply-android-build-merger@google.com> | 2018-03-26 22:49:59 +0000 |
commit | 9d26fe82fe7bb2e7d316c2d5a2a0997b34045b19 (patch) | |
tree | 9b2b1eeafd74c25334c8db14c5113169b22afe00 | |
parent | 3a12b49a35fed7577eaeb0fba2120ebd019c24d1 (diff) | |
parent | ec648d09d6fd1c466808c61e9c02e46ad84e7bc2 (diff) | |
download | UserDictionaryProvider-9d26fe82fe7bb2e7d316c2d5a2a0997b34045b19.tar.gz |
[automerger] Check caller before accessing database am: 136dc9b3b6 am: d2f86ff19f am: ec648d09d6
Change-Id: I0b6df79045890f5d296c227c401fa1ac0103f63f
-rw-r--r-- | src/com/android/providers/userdictionary/UserDictionaryProvider.java | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/com/android/providers/userdictionary/UserDictionaryProvider.java b/src/com/android/providers/userdictionary/UserDictionaryProvider.java index e653047..a840ea9 100644 --- a/src/com/android/providers/userdictionary/UserDictionaryProvider.java +++ b/src/com/android/providers/userdictionary/UserDictionaryProvider.java @@ -147,6 +147,11 @@ public class UserDictionaryProvider extends ContentProvider { @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { + // Only the enabled IMEs and spell checkers can access this provider. + if (!canCallerAccessUserDictionary()) { + return getEmptyCursorOrThrow(projection); + } + SQLiteQueryBuilder qb = new SQLiteQueryBuilder(); switch (sUriMatcher.match(uri)) { @@ -165,11 +170,6 @@ public class UserDictionaryProvider extends ContentProvider { throw new IllegalArgumentException("Unknown URI " + uri); } - // Only the enabled IMEs and spell checkers can access this provider. - if (!canCallerAccessUserDictionary()) { - return getEmptyCursorOrThrow(projection); - } - // If no sort order is specified use the default String orderBy; if (TextUtils.isEmpty(sortOrder)) { @@ -252,6 +252,11 @@ public class UserDictionaryProvider extends ContentProvider { @Override public int delete(Uri uri, String where, String[] whereArgs) { + // Only the enabled IMEs and spell checkers can access this provider. + if (!canCallerAccessUserDictionary()) { + return 0; + } + SQLiteDatabase db = mOpenHelper.getWritableDatabase(); int count; switch (sUriMatcher.match(uri)) { @@ -269,11 +274,6 @@ public class UserDictionaryProvider extends ContentProvider { throw new IllegalArgumentException("Unknown URI " + uri); } - // Only the enabled IMEs and spell checkers can access this provider. - if (!canCallerAccessUserDictionary()) { - return 0; - } - getContext().getContentResolver().notifyChange(uri, null); mBackupManager.dataChanged(); return count; @@ -281,6 +281,11 @@ public class UserDictionaryProvider extends ContentProvider { @Override public int update(Uri uri, ContentValues values, String where, String[] whereArgs) { + // Only the enabled IMEs and spell checkers can access this provider. + if (!canCallerAccessUserDictionary()) { + return 0; + } + SQLiteDatabase db = mOpenHelper.getWritableDatabase(); int count; switch (sUriMatcher.match(uri)) { @@ -298,11 +303,6 @@ public class UserDictionaryProvider extends ContentProvider { throw new IllegalArgumentException("Unknown URI " + uri); } - // Only the enabled IMEs and spell checkers can access this provider. - if (!canCallerAccessUserDictionary()) { - return 0; - } - getContext().getContentResolver().notifyChange(uri, null); mBackupManager.dataChanged(); return count; |