aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChiao Cheng <chiaocheng@google.com>2013-07-11 18:08:28 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-07-11 18:08:28 +0000
commit6751a0dcf0814fd8c8eb8fdad6f57a0ed65653d0 (patch)
tree1a3d9f95614b2180d792f97e15720fb662230623
parent1b1da8a54b541a36fe5f23303d8b5ac3678695dd (diff)
parenteef11a95dc667923954fceb5e598011c04b19d1d (diff)
downloadContactsProvider-6751a0dcf0814fd8c8eb8fdad6f57a0ed65653d0.tar.gz
Merge "Do not allow updates to the _data column."
-rw-r--r--src/com/android/providers/contacts/VoicemailContentTable.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/com/android/providers/contacts/VoicemailContentTable.java b/src/com/android/providers/contacts/VoicemailContentTable.java
index 3f00b262..2047e12c 100644
--- a/src/com/android/providers/contacts/VoicemailContentTable.java
+++ b/src/com/android/providers/contacts/VoicemailContentTable.java
@@ -31,6 +31,7 @@ import android.net.Uri;
import android.os.ParcelFileDescriptor;
import android.provider.CallLog.Calls;
import android.provider.OpenableColumns;
+import android.provider.VoicemailContract;
import android.provider.VoicemailContract.Voicemails;
import android.util.Log;
@@ -213,6 +214,7 @@ public class VoicemailContentTable implements VoicemailTable.Delegate {
String[] selectionArgs) {
checkForSupportedColumns(mVoicemailProjectionMap, values);
checkUpdateSupported(uriData);
+ checkForUnsupportedColumnUpdates(values);
final SQLiteDatabase db = mDbHelper.getWritableDatabase();
// TODO: This implementation does not allow bulk update because it only accepts
// URI that include message Id. I think we do want to support bulk update.
@@ -222,6 +224,15 @@ public class VoicemailContentTable implements VoicemailTable.Delegate {
selectionArgs);
}
+ private void checkForUnsupportedColumnUpdates(ContentValues values) {
+ // Data column points to the voicemail audio file and is generated by the provider.
+ // Do not let applications update it.
+ if (values.containsKey(Voicemails._DATA)) {
+ throw new IllegalArgumentException("Updates to " + Voicemails._DATA +
+ " column are not allowed.");
+ }
+ }
+
private void checkUpdateSupported(UriData uriData) {
if (!uriData.hasId()) {
throw new UnsupportedOperationException(String.format(