summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2018-06-08 11:08:10 -0700
committerXin Li <delphij@google.com>2018-06-08 11:08:10 -0700
commitf9714a64c8037c8584af9b7d6b6b40e81b6c20ac (patch)
treed068cd1fc671dd5d939b7d17cb2bfe6721f85976
parent658843062df93da3cea457a0fe87c175988f1b1f (diff)
parent1cfb81edbec053ea6a1c0bc6dfc9d870134cee81 (diff)
downloadUserDictionaryProvider-f9714a64c8037c8584af9b7d6b6b40e81b6c20ac.tar.gz
Merge pi-dev-plus-aosp-without-vendor into stage-aosp-mastertemp_p_merge
Bug: 79597307 Change-Id: I73e59b4d50c0c888c29e97d1a855cc274663bc24
-rw-r--r--Android.mk1
-rw-r--r--CleanSpec.mk1
-rw-r--r--res/values-en-rCA/strings.xml20
-rw-r--r--res/values-en-rXC/strings.xml20
-rw-r--r--src/com/android/providers/userdictionary/UserDictionaryProvider.java30
5 files changed, 57 insertions, 15 deletions
diff --git a/Android.mk b/Android.mk
index d9b5907..a92cd45 100644
--- a/Android.mk
+++ b/Android.mk
@@ -10,6 +10,7 @@ LOCAL_JAVA_LIBRARIES := ext
LOCAL_PACKAGE_NAME := UserDictionaryProvider
LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_CERTIFICATE := shared
+LOCAL_PRIVILEGED_MODULE := true
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
diff --git a/CleanSpec.mk b/CleanSpec.mk
index b84e1b6..f102b42 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -43,6 +43,7 @@
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/UserDictionaryProvider)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
diff --git a/res/values-en-rCA/strings.xml b/res/values-en-rCA/strings.xml
new file mode 100644
index 0000000..c45ab08
--- /dev/null
+++ b/res/values-en-rCA/strings.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="app_label" msgid="6696115254961108357">"User Dictionary"</string>
+</resources>
diff --git a/res/values-en-rXC/strings.xml b/res/values-en-rXC/strings.xml
new file mode 100644
index 0000000..1b620f0
--- /dev/null
+++ b/res/values-en-rXC/strings.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="app_label" msgid="6696115254961108357">"‎‏‎‎‎‎‎‏‎‏‏‏‎‎‎‎‎‏‏‎‏‎‏‏‏‏‏‏‏‏‏‏‏‎‏‏‏‎‎‏‏‏‎‏‏‎‏‎‏‏‎‎‎‎‏‎‏‎‏‏‎‎‎‏‏‎‎‏‎‏‏‎‎‎‎‎‏‏‏‏‏‏‏‎‏‎‏‏‎‎‎‎‏‎‏‎User Dictionary‎‏‎‎‏‎"</string>
+</resources>
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;