summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2012-10-03 19:31:40 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-10-03 19:31:40 -0700
commit35dd752238d3ce3b83e78eb4b00a85ea3d067088 (patch)
tree6deffb8c2c0fd218b15a8548b6ef4d3bec1d3b30 /packages
parenta6cab32d68692f69729195ac69b7f9e9c8d2001f (diff)
parentc221d2be7d2bf57373d43457b18483266f88f9a6 (diff)
downloadframeworks_base-35dd752238d3ce3b83e78eb4b00a85ea3d067088.zip
frameworks_base-35dd752238d3ce3b83e78eb4b00a85ea3d067088.tar.gz
frameworks_base-35dd752238d3ce3b83e78eb4b00a85ea3d067088.tar.bz2
Merge "Rewrite raw insert()s and some raw query()s of moved-to-global keys" into jb-mr1-dev
Diffstat (limited to 'packages')
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java23
1 files changed, 22 insertions, 1 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index c42272b..1701f6e 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -135,6 +135,7 @@ public class SettingsProvider extends ContentProvider {
/** Operate on existing rows. */
SqlArguments(Uri url, String where, String[] args) {
if (url.getPathSegments().size() == 1) {
+ // of the form content://settings/secure, arbitrary where clause
this.table = url.getPathSegments().get(0);
if (!DatabaseHelper.isValidTable(this.table)) {
throw new IllegalArgumentException("Bad root path: " + this.table);
@@ -146,6 +147,7 @@ public class SettingsProvider extends ContentProvider {
} else if (!TextUtils.isEmpty(where)) {
throw new UnsupportedOperationException("WHERE clause not supported: " + url);
} else {
+ // of the form content://settings/secure/element_name, no where clause
this.table = url.getPathSegments().get(0);
if (!DatabaseHelper.isValidTable(this.table)) {
throw new IllegalArgumentException("Bad root path: " + this.table);
@@ -153,8 +155,16 @@ public class SettingsProvider extends ContentProvider {
if (TABLE_SYSTEM.equals(this.table) || TABLE_SECURE.equals(this.table) ||
TABLE_GLOBAL.equals(this.table)) {
this.where = Settings.NameValueTable.NAME + "=?";
- this.args = new String[] { url.getPathSegments().get(1) };
+ final String name = url.getPathSegments().get(1);
+ this.args = new String[] { name };
+ // Rewrite the table for known-migrated names
+ if (TABLE_SYSTEM.equals(this.table) || TABLE_SECURE.equals(this.table)) {
+ if (sSecureGlobalKeys.contains(name) || sSystemGlobalKeys.contains(name)) {
+ this.table = TABLE_GLOBAL;
+ }
+ }
} else {
+ // of the form content://bookmarks/19
this.where = "_id=" + ContentUris.parseId(url);
this.args = null;
}
@@ -848,6 +858,17 @@ public class SettingsProvider extends ContentProvider {
if (!parseProviderList(url, initialValues)) return null;
}
+ // If this is an insert() of a key that has been migrated to the global store,
+ // redirect the operation to that store
+ if (name != null) {
+ if (sSecureGlobalKeys.contains(name) || sSystemGlobalKeys.contains(name)) {
+ if (!TABLE_GLOBAL.equals(args.table)) {
+ if (LOCAL_LOGV) Slog.i(TAG, "Rewrite of insert() of now-global key " + name);
+ }
+ args.table = TABLE_GLOBAL; // next condition will rewrite the user handle
+ }
+ }
+
// The global table is stored under the owner, always
if (TABLE_GLOBAL.equals(args.table)) {
desiredUserHandle = UserHandle.USER_OWNER;