summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-06-04 21:55:37 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-06-04 21:55:37 +0000
commit33914458b21089a1b1604b36037d5728aebd1f47 (patch)
tree4dc605fe76a96dc3e99f3a4e712d45f79e854120
parent25bbfe3e1979e87278c33194bded2d8543150745 (diff)
parent4dfa0cdaa7539d8d33f0a1df9c7b78ed6dbf00e6 (diff)
downloadUserDictionaryProvider-oreo-m2-s4-release.tar.gz
Merge cherrypicks of [4254030, 4254031, 4254032, 4254033, 4254082, 4254083, 4254084, 4254085, 4254601, 4254602, 4254086, 4254087, 4254088, 4254089, 4254090, 4254091, 4254092, 4254093, 4254621, 4254209, 4254105, 4254106, 4254107, 4254108, 4254109, 4254110, 4254111, 4254134, 4254135, 4254136, 4254137, 4254138, 4254139, 4254140, 4254661, 4254662, 4254663, 4254664, 4254094, 4254034, 4254035, 4254036, 4254681, 4253166, 4253167, 4254644, 4254210, 4254095, 4254701, 4254702, 4254112, 4254113, 4254114, 4254115, 4254116, 4254117, 4254118, 4254119, 4254120, 4254721, 4254722, 4254723, 4254724, 4254725, 4253345, 4253168, 4254573, 4253169, 4254211, 4254096, 4253346, 4253347, 4254212, 4254574, 4254575, 4254576, 4254577, 4254578] into sparse-4732990-L64400000179192834android-8.1.0_r35oreo-m2-s4-release
Change-Id: I77bc5d1aae6ba7e2185cfe488bdc2f5c8bb1a6e4
-rw-r--r--src/com/android/providers/userdictionary/UserDictionaryProvider.java30
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;