summaryrefslogtreecommitdiff
path: root/cmds/content
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2019-11-15 12:45:15 -0700
committerJeff Sharkey <jsharkey@android.com>2019-11-15 13:46:31 -0700
commite9fe152f317bbce0bce63b657468867f0fc1f4a4 (patch)
treeec405d03c37c9795b18bfa87b5e91ca7ae6f940d /cmds/content
parentb500cb85ff779bd564f68d0a293bbf6b74f05b7b (diff)
Extend insert/update/delete to provide extras.
A few releases ago we added ContentResolver.QUERY_ARG_* constants to query() as a new best-practice that will help wean us off raw SQL arguments. (For example, a provider could add their own custom arguments like QUERY_ARG_INCLUDE_PENDING to cause the query to reveal pending items that would otherwise be hidden.) This change expands update() and delete() to accept those arguments. This change also expand insert() to accept extras too, as part of preparing to support an upcoming MediaProvider feature that will let apps place new media "adjacent" to an existing media item. (Sending that adjacent item through extras is cleaner than trying to send it through escaped query parameters.) Bug: 131643582 Test: atest CtsContentTestCases Change-Id: I436296155b9b5f371b4cbe661feaf42070285fcc
Diffstat (limited to 'cmds/content')
-rw-r--r--cmds/content/src/com/android/commands/content/Content.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/cmds/content/src/com/android/commands/content/Content.java b/cmds/content/src/com/android/commands/content/Content.java
index 7e278e964ab5..59544a971e5f 100644
--- a/cmds/content/src/com/android/commands/content/Content.java
+++ b/cmds/content/src/com/android/commands/content/Content.java
@@ -508,7 +508,7 @@ public class Content {
@Override
public void onExecute(IContentProvider provider) throws Exception {
- provider.insert(resolveCallingPackage(), null, mUri, mContentValues);
+ provider.insert(resolveCallingPackage(), null, mUri, mContentValues, null);
}
}
@@ -522,7 +522,8 @@ public class Content {
@Override
public void onExecute(IContentProvider provider) throws Exception {
- provider.delete(resolveCallingPackage(), null, mUri, mWhere, null);
+ provider.delete(resolveCallingPackage(), null, mUri,
+ ContentResolver.createSqlQueryBundle(mWhere, null));
}
}
@@ -679,7 +680,8 @@ public class Content {
@Override
public void onExecute(IContentProvider provider) throws Exception {
- provider.update(resolveCallingPackage(), null, mUri, mContentValues, mWhere, null);
+ provider.update(resolveCallingPackage(), null, mUri, mContentValues,
+ ContentResolver.createSqlQueryBundle(mWhere, null));
}
}