diff options
author | Fyodor Kupolov <fkupolov@google.com> | 2018-04-02 23:07:48 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-04-02 23:07:48 +0000 |
commit | 4a3d421438ddb2d8af730c7606ccc8baf796c551 (patch) | |
tree | 2fb1f9aa70d04c1ff01f81e0ffb95be06172ad33 | |
parent | 65f4e7a7c726421bcfa468a9a2d7f661f45443af (diff) | |
parent | 45a8d290b8ad51ae56c035115f12d0b72abc2a5c (diff) | |
download | UserDictionaryProvider-4a3d421438ddb2d8af730c7606ccc8baf796c551.tar.gz |
[automerger] Check caller before accessing database am: 136dc9b3b6 am: d2f86ff19f am: ec648d09d6 am: 9d26fe82fe am: 12c6104a1e am: cad6843da3 am: e75438ba7f am: a663c7f4f5 am: 9ebb07d656 am: 271c30f3c1 am: a98e35b889android-9.0.0_r35android-9.0.0_r34android-9.0.0_r33android-9.0.0_r32android-9.0.0_r31android-9.0.0_r30android-9.0.0_r22android-9.0.0_r21android-9.0.0_r20android-9.0.0_r19android-9.0.0_r16android-9.0.0_r12android-9.0.0_r11pie-qpr2-releasepie-qpr1-s3-releasepie-qpr1-s2-releasepie-qpr1-s1-releasepie-qpr1-releasepie-dr1-releasepie-dr1-devpie-dev
am: 45a8d290b8
Change-Id: I19efe1b6c645b158d0a916fa364b072c573376b3
-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 c0f67e9..5abeefa 100644 --- a/src/com/android/providers/userdictionary/UserDictionaryProvider.java +++ b/src/com/android/providers/userdictionary/UserDictionaryProvider.java @@ -152,6 +152,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)) { @@ -170,11 +175,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)) { @@ -257,6 +257,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)) { @@ -274,11 +279,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; @@ -286,6 +286,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)) { @@ -303,11 +308,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; |