1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.android.providers.telephony; 17 18 import static android.provider.Telephony.RcsColumns.RcsThreadColumns.RCS_THREAD_URI_PART; 19 import static android.provider.Telephony.RcsColumns.TRANSACTION_FAILED; 20 21 import static com.android.providers.telephony.RcsProviderUtil.buildUriWithRowIdAppended; 22 import static com.android.providers.telephony.RcsProviderUtil.returnUriAsIsIfSuccessful; 23 24 import android.app.AppOpsManager; 25 import android.content.ContentProvider; 26 import android.content.ContentResolver; 27 import android.content.ContentValues; 28 import android.content.UriMatcher; 29 import android.database.Cursor; 30 import android.database.sqlite.SQLiteOpenHelper; 31 import android.net.Uri; 32 import android.os.Bundle; 33 import android.os.CancellationSignal; 34 import android.util.Log; 35 36 import com.android.internal.annotations.VisibleForTesting; 37 38 /** 39 * Content provider to handle RCS messages. The functionality here is similar to SmsProvider, 40 * MmsProvider etc. 41 * 42 * The provider has constraints around inserting, updating and deleting - the user needs to know 43 * whether they are inserting a message that is incoming/outgoing, or the thread they are inserting 44 * is a group or p2p etc. This is in order to keep the implementation simple and avoid complex 45 * queries. 46 * 47 * @hide 48 */ 49 public class RcsProvider extends ContentProvider { 50 static final String TAG = "RcsProvider"; 51 static final String AUTHORITY = "rcs"; 52 private static final String CONTENT_AUTHORITY = "content://" + AUTHORITY; 53 54 private static final Uri PARTICIPANT_URI_PREFIX = 55 Uri.parse(CONTENT_AUTHORITY + "/participant/"); 56 private static final Uri P2P_THREAD_URI_PREFIX = Uri.parse(CONTENT_AUTHORITY + "/p2p_thread/"); 57 private static final Uri FILE_TRANSFER_PREFIX = Uri.parse( 58 CONTENT_AUTHORITY + "/file_transfer/"); 59 static final Uri GROUP_THREAD_URI_PREFIX = Uri.parse(CONTENT_AUTHORITY + "/group_thread/"); 60 61 // Rcs table names 62 static final String RCS_THREAD_TABLE = "rcs_thread"; 63 static final String RCS_1_TO_1_THREAD_TABLE = "rcs_1_to_1_thread"; 64 static final String RCS_GROUP_THREAD_TABLE = "rcs_group_thread"; 65 static final String UNIFIED_RCS_THREAD_VIEW = "rcs_unified_rcs_thread_view"; 66 static final String RCS_PARTICIPANT_TABLE = "rcs_participant"; 67 static final String RCS_PARTICIPANT_THREAD_JUNCTION_TABLE = "rcs_thread_participant"; 68 static final String RCS_MESSAGE_TABLE = "rcs_message"; 69 static final String RCS_INCOMING_MESSAGE_TABLE = "rcs_incoming_message"; 70 static final String RCS_OUTGOING_MESSAGE_TABLE = "rcs_outgoing_message"; 71 static final String RCS_MESSAGE_DELIVERY_TABLE = "rcs_message_delivery"; 72 static final String UNIFIED_MESSAGE_VIEW = "rcs_unified_message_view"; 73 static final String RCS_FILE_TRANSFER_TABLE = "rcs_file_transfer"; 74 static final String RCS_THREAD_EVENT_TABLE = "rcs_thread_event"; 75 static final String RCS_PARTICIPANT_EVENT_TABLE = "rcs_participant_event"; 76 static final String RCS_UNIFIED_EVENT_VIEW = "rcs_unified_event_view"; 77 78 private static final UriMatcher URL_MATCHER = new UriMatcher(UriMatcher.NO_MATCH); 79 80 private static final int UNIFIED_RCS_THREAD = 1; 81 private static final int UNIFIED_RCS_THREAD_WITH_ID = 2; 82 private static final int PARTICIPANT = 3; 83 private static final int PARTICIPANT_WITH_ID = 4; 84 private static final int PARTICIPANT_ALIAS_CHANGE_EVENT = 5; 85 private static final int PARTICIPANT_ALIAS_CHANGE_EVENT_WITH_ID = 6; 86 private static final int P2P_THREAD = 7; 87 private static final int P2P_THREAD_WITH_ID = 8; 88 private static final int P2P_THREAD_PARTICIPANT = 9; 89 private static final int P2P_THREAD_PARTICIPANT_WITH_ID = 10; 90 private static final int GROUP_THREAD = 11; 91 private static final int GROUP_THREAD_WITH_ID = 12; 92 private static final int GROUP_THREAD_PARTICIPANT = 13; 93 private static final int GROUP_THREAD_PARTICIPANT_WITH_ID = 14; 94 private static final int GROUP_THREAD_PARTICIPANT_JOINED_EVENT = 15; 95 private static final int GROUP_THREAD_PARTICIPANT_JOINED_EVENT_WITH_ID = 16; 96 private static final int GROUP_THREAD_PARTICIPANT_LEFT_EVENT = 17; 97 private static final int GROUP_THREAD_PARTICIPANT_LEFT_EVENT_WITH_ID = 18; 98 private static final int GROUP_THREAD_NAME_CHANGE_EVENT = 19; 99 private static final int GROUP_THREAD_NAME_CHANGE_EVENT_WITH_ID = 20; 100 private static final int GROUP_THREAD_ICON_CHANGE_EVENT = 21; 101 private static final int GROUP_THREAD_ICON_CHANGE_EVENT_WITH_ID = 22; 102 private static final int UNIFIED_MESSAGE = 23; 103 private static final int UNIFIED_MESSAGE_WITH_ID = 24; 104 private static final int UNIFIED_MESSAGE_WITH_FILE_TRANSFER = 25; 105 private static final int INCOMING_MESSAGE = 26; 106 private static final int INCOMING_MESSAGE_WITH_ID = 27; 107 private static final int OUTGOING_MESSAGE = 28; 108 private static final int OUTGOING_MESSAGE_WITH_ID = 29; 109 private static final int OUTGOING_MESSAGE_DELIVERY = 30; 110 private static final int OUTGOING_MESSAGE_DELIVERY_WITH_ID = 31; 111 private static final int UNIFIED_MESSAGE_ON_THREAD = 32; 112 private static final int UNIFIED_MESSAGE_ON_THREAD_WITH_ID = 33; 113 private static final int INCOMING_MESSAGE_ON_P2P_THREAD = 34; 114 private static final int INCOMING_MESSAGE_ON_P2P_THREAD_WITH_ID = 35; 115 private static final int OUTGOING_MESSAGE_ON_P2P_THREAD = 36; 116 private static final int OUTGOING_MESSAGE_ON_P2P_THREAD_WITH_ID = 37; 117 private static final int INCOMING_MESSAGE_ON_GROUP_THREAD = 38; 118 private static final int INCOMING_MESSAGE_ON_GROUP_THREAD_WITH_ID = 39; 119 private static final int OUTGOING_MESSAGE_ON_GROUP_THREAD = 40; 120 private static final int OUTGOING_MESSAGE_ON_GROUP_THREAD_WITH_ID = 41; 121 private static final int FILE_TRANSFER_WITH_ID = 42; 122 private static final int EVENT = 43; 123 private static final int CANONICAL_ADDRESS = 44; 124 125 SQLiteOpenHelper mDbOpenHelper; 126 127 @VisibleForTesting 128 RcsProviderThreadHelper mThreadHelper; 129 @VisibleForTesting 130 RcsProviderParticipantHelper mParticipantHelper; 131 @VisibleForTesting 132 RcsProviderMessageHelper mMessageHelper; 133 @VisibleForTesting 134 RcsProviderEventHelper mEventHelper; 135 @VisibleForTesting 136 RcsProviderCanonicalAddressHelper mCanonicalAddressHelper; 137 138 static { 139 // example URI: content://rcs/thread URL_MATCHER.addURI(AUTHORITY, RCS_THREAD_URI_PART, UNIFIED_RCS_THREAD)140 URL_MATCHER.addURI(AUTHORITY, RCS_THREAD_URI_PART, UNIFIED_RCS_THREAD); 141 142 // example URI: content://rcs/thread/4, where 4 is the thread id. URL_MATCHER.addURI(AUTHORITY, "thread/#", UNIFIED_RCS_THREAD_WITH_ID)143 URL_MATCHER.addURI(AUTHORITY, "thread/#", UNIFIED_RCS_THREAD_WITH_ID); 144 145 // example URI: content://rcs/participant URL_MATCHER.addURI(AUTHORITY, "participant", PARTICIPANT)146 URL_MATCHER.addURI(AUTHORITY, "participant", PARTICIPANT); 147 148 // example URI: content://rcs/participant/12, where 12 is the participant id URL_MATCHER.addURI(AUTHORITY, "participant/#", PARTICIPANT_WITH_ID)149 URL_MATCHER.addURI(AUTHORITY, "participant/#", PARTICIPANT_WITH_ID); 150 151 // example URI: content://rcs/participant/12/alias_change_event, where 12 is the participant 152 // id. URL_MATCHER.addURI(AUTHORITY, "participant/#/alias_change_event", PARTICIPANT_ALIAS_CHANGE_EVENT)153 URL_MATCHER.addURI(AUTHORITY, "participant/#/alias_change_event", 154 PARTICIPANT_ALIAS_CHANGE_EVENT); 155 156 // example URI: content://rcs/participant/12/alias_change_event/4, where 12 is the 157 // participant id, and 4 is the event id URL_MATCHER.addURI(AUTHORITY, "participant/#/alias_change_event/#", PARTICIPANT_ALIAS_CHANGE_EVENT_WITH_ID)158 URL_MATCHER.addURI(AUTHORITY, "participant/#/alias_change_event/#", 159 PARTICIPANT_ALIAS_CHANGE_EVENT_WITH_ID); 160 161 // example URI: content://rcs/p2p_thread URL_MATCHER.addURI(AUTHORITY, "p2p_thread", P2P_THREAD)162 URL_MATCHER.addURI(AUTHORITY, "p2p_thread", P2P_THREAD); 163 164 // example URI: content://rcs/p2p_thread/4, where 4 is the thread id URL_MATCHER.addURI(AUTHORITY, "p2p_thread/#", P2P_THREAD_WITH_ID)165 URL_MATCHER.addURI(AUTHORITY, "p2p_thread/#", P2P_THREAD_WITH_ID); 166 167 // example URI: content://rcs/p2p_thread/4/participant, where 4 is the thread id URL_MATCHER.addURI(AUTHORITY, "p2p_thread/#/participant", P2P_THREAD_PARTICIPANT)168 URL_MATCHER.addURI(AUTHORITY, "p2p_thread/#/participant", P2P_THREAD_PARTICIPANT); 169 170 // example URI: content://rcs/p2p_thread/9/participant/3", only supports a 1 time insert. 171 // 9 is the thread ID, 3 is the participant ID. URL_MATCHER.addURI(AUTHORITY, "p2p_thread/#/participant/#", P2P_THREAD_PARTICIPANT_WITH_ID)172 URL_MATCHER.addURI(AUTHORITY, "p2p_thread/#/participant/#", P2P_THREAD_PARTICIPANT_WITH_ID); 173 174 // example URI: content://rcs/group_thread URL_MATCHER.addURI(AUTHORITY, "group_thread", GROUP_THREAD)175 URL_MATCHER.addURI(AUTHORITY, "group_thread", GROUP_THREAD); 176 177 // example URI: content://rcs/group_thread/13, where 13 is the _id in rcs_threads table. URL_MATCHER.addURI(AUTHORITY, "group_thread/#", GROUP_THREAD_WITH_ID)178 URL_MATCHER.addURI(AUTHORITY, "group_thread/#", GROUP_THREAD_WITH_ID); 179 180 // example URI: content://rcs/group_thread/13/participant_joined_event. Supports 181 // queries and inserts URL_MATCHER.addURI(AUTHORITY, "group_thread/#/participant_joined_event", GROUP_THREAD_PARTICIPANT_JOINED_EVENT)182 URL_MATCHER.addURI(AUTHORITY, "group_thread/#/participant_joined_event", 183 GROUP_THREAD_PARTICIPANT_JOINED_EVENT); 184 185 // example URI: content://rcs/group_thread/13/participant_joined_event/3. Supports deletes. URL_MATCHER.addURI(AUTHORITY, "group_thread/#/participant_joined_event/#", GROUP_THREAD_PARTICIPANT_JOINED_EVENT_WITH_ID)186 URL_MATCHER.addURI(AUTHORITY, "group_thread/#/participant_joined_event/#", 187 GROUP_THREAD_PARTICIPANT_JOINED_EVENT_WITH_ID); 188 189 // example URI: content://rcs/group_thread/13/participant_left_event. Supports queries 190 // and inserts URL_MATCHER.addURI(AUTHORITY, "group_thread/#/participant_left_event", GROUP_THREAD_PARTICIPANT_LEFT_EVENT)191 URL_MATCHER.addURI(AUTHORITY, "group_thread/#/participant_left_event", 192 GROUP_THREAD_PARTICIPANT_LEFT_EVENT); 193 194 // example URI: content://rcs/group_thread/13/participant_left_event/5. Supports deletes URL_MATCHER.addURI(AUTHORITY, "group_thread/#/participant_left_event/#", GROUP_THREAD_PARTICIPANT_LEFT_EVENT_WITH_ID)195 URL_MATCHER.addURI(AUTHORITY, "group_thread/#/participant_left_event/#", 196 GROUP_THREAD_PARTICIPANT_LEFT_EVENT_WITH_ID); 197 198 // example URI: content://rcs/group_thread/13/name_changed_event. Supports queries and 199 // inserts URL_MATCHER.addURI(AUTHORITY, "group_thread/#/name_changed_event", GROUP_THREAD_NAME_CHANGE_EVENT)200 URL_MATCHER.addURI(AUTHORITY, "group_thread/#/name_changed_event", 201 GROUP_THREAD_NAME_CHANGE_EVENT); 202 203 // example URI: content://rcs/group_thread/13/name_changed_event/7. Supports deletes URL_MATCHER.addURI(AUTHORITY, "group_thread/#/name_changed_event/#", GROUP_THREAD_NAME_CHANGE_EVENT_WITH_ID)204 URL_MATCHER.addURI(AUTHORITY, "group_thread/#/name_changed_event/#", 205 GROUP_THREAD_NAME_CHANGE_EVENT_WITH_ID); 206 207 // example URI: content://rcs/group_thread/13/icon_changed_event. Supports queries and 208 // inserts URL_MATCHER.addURI(AUTHORITY, "group_thread/#/icon_changed_event", GROUP_THREAD_ICON_CHANGE_EVENT)209 URL_MATCHER.addURI(AUTHORITY, "group_thread/#/icon_changed_event", 210 GROUP_THREAD_ICON_CHANGE_EVENT); 211 212 // example URI: content://rcs/group_thread/13/icon_changed_event/9. Supports deletes URL_MATCHER.addURI(AUTHORITY, "group_thread/#/icon_changed_event/#", GROUP_THREAD_ICON_CHANGE_EVENT_WITH_ID)213 URL_MATCHER.addURI(AUTHORITY, "group_thread/#/icon_changed_event/#", 214 GROUP_THREAD_ICON_CHANGE_EVENT_WITH_ID); 215 216 // example URI: content://rcs/group_thread/18/participant URL_MATCHER.addURI(AUTHORITY, "group_thread/#/participant", GROUP_THREAD_PARTICIPANT)217 URL_MATCHER.addURI(AUTHORITY, "group_thread/#/participant", 218 GROUP_THREAD_PARTICIPANT); 219 220 // example URI: content://rcs/group_thread/21/participant/4, only supports inserts and 221 // deletes URL_MATCHER.addURI(AUTHORITY, "group_thread/#/participant/#", GROUP_THREAD_PARTICIPANT_WITH_ID)222 URL_MATCHER.addURI(AUTHORITY, "group_thread/#/participant/#", 223 GROUP_THREAD_PARTICIPANT_WITH_ID); 224 225 // example URI: content://rcs/message URL_MATCHER.addURI(AUTHORITY, "message", UNIFIED_MESSAGE)226 URL_MATCHER.addURI(AUTHORITY, "message", UNIFIED_MESSAGE); 227 228 // example URI: content://rcs/message/4, where 4 is the message id. URL_MATCHER.addURI(AUTHORITY, "message/#", UNIFIED_MESSAGE_WITH_ID)229 URL_MATCHER.addURI(AUTHORITY, "message/#", UNIFIED_MESSAGE_WITH_ID); 230 231 // example URI: content://rcs/message/4/file_transfer, only supports inserts URL_MATCHER.addURI(AUTHORITY, "message/#/file_transfer", UNIFIED_MESSAGE_WITH_FILE_TRANSFER)232 URL_MATCHER.addURI(AUTHORITY, "message/#/file_transfer", 233 UNIFIED_MESSAGE_WITH_FILE_TRANSFER); 234 235 // example URI: content://rcs/incoming_message URL_MATCHER.addURI(AUTHORITY, "incoming_message", INCOMING_MESSAGE)236 URL_MATCHER.addURI(AUTHORITY, "incoming_message", INCOMING_MESSAGE); 237 238 // example URI: content://rcs/incoming_message/45 URL_MATCHER.addURI(AUTHORITY, "incoming_message/#", INCOMING_MESSAGE_WITH_ID)239 URL_MATCHER.addURI(AUTHORITY, "incoming_message/#", INCOMING_MESSAGE_WITH_ID); 240 241 // example URI: content://rcs/outgoing_message URL_MATCHER.addURI(AUTHORITY, "outgoing_message", OUTGOING_MESSAGE)242 URL_MATCHER.addURI(AUTHORITY, "outgoing_message", OUTGOING_MESSAGE); 243 244 // example URI: content://rcs/outgoing_message/54 URL_MATCHER.addURI(AUTHORITY, "outgoing_message/#", OUTGOING_MESSAGE_WITH_ID)245 URL_MATCHER.addURI(AUTHORITY, "outgoing_message/#", OUTGOING_MESSAGE_WITH_ID); 246 247 // example URI: content://rcs/outgoing_message/54/delivery. Only supports queries URL_MATCHER.addURI(AUTHORITY, "outgoing_message/#/delivery", OUTGOING_MESSAGE_DELIVERY)248 URL_MATCHER.addURI(AUTHORITY, "outgoing_message/#/delivery", OUTGOING_MESSAGE_DELIVERY); 249 250 // example URI: content://rcs/outgoing_message/9/delivery/4. Does not support queries URL_MATCHER.addURI(AUTHORITY, "outgoing_message/#/delivery/#", OUTGOING_MESSAGE_DELIVERY_WITH_ID)251 URL_MATCHER.addURI(AUTHORITY, "outgoing_message/#/delivery/#", 252 OUTGOING_MESSAGE_DELIVERY_WITH_ID); 253 254 // example URI: content://rcs/thread/5/message, only supports querying. URL_MATCHER.addURI(AUTHORITY, "thread/#/message", UNIFIED_MESSAGE_ON_THREAD)255 URL_MATCHER.addURI(AUTHORITY, "thread/#/message", UNIFIED_MESSAGE_ON_THREAD); 256 257 // example URI: content://rcs/thread/5/message/40, only supports querying. URL_MATCHER.addURI(AUTHORITY, "thread/#/message/#", UNIFIED_MESSAGE_ON_THREAD_WITH_ID)258 URL_MATCHER.addURI(AUTHORITY, "thread/#/message/#", UNIFIED_MESSAGE_ON_THREAD_WITH_ID); 259 260 // example URI: content://rcs/p2p_thread/3/incoming_message. Only available for inserting 261 // incoming messages onto a 1 to 1 thread. URL_MATCHER.addURI(AUTHORITY, "p2p_thread/#/incoming_message", INCOMING_MESSAGE_ON_P2P_THREAD)262 URL_MATCHER.addURI(AUTHORITY, "p2p_thread/#/incoming_message", 263 INCOMING_MESSAGE_ON_P2P_THREAD); 264 265 // example URI: content://rcs/p2p_thread/11/incoming_message/45. Only supports querying URL_MATCHER.addURI(AUTHORITY, "p2p_thread/#/incoming_message/#", INCOMING_MESSAGE_ON_P2P_THREAD_WITH_ID)266 URL_MATCHER.addURI(AUTHORITY, "p2p_thread/#/incoming_message/#", 267 INCOMING_MESSAGE_ON_P2P_THREAD_WITH_ID); 268 269 // example URI: content://rcs/p2p_thread/3/outgoing_message. Only available for inserting 270 // outgoing messages onto a 1 to 1 thread. URL_MATCHER.addURI(AUTHORITY, "p2p_thread/#/outgoing_message", OUTGOING_MESSAGE_ON_P2P_THREAD)271 URL_MATCHER.addURI(AUTHORITY, "p2p_thread/#/outgoing_message", 272 OUTGOING_MESSAGE_ON_P2P_THREAD); 273 274 // example URI: content://rcs/p2p_thread/11/outgoing_message/46. Only supports querying URL_MATCHER.addURI(AUTHORITY, "p2p_thread/#/outgoing_message/#", OUTGOING_MESSAGE_ON_P2P_THREAD_WITH_ID)275 URL_MATCHER.addURI(AUTHORITY, "p2p_thread/#/outgoing_message/#", 276 OUTGOING_MESSAGE_ON_P2P_THREAD_WITH_ID); 277 278 // example URI: content://rcs/group_thread/3/incoming_message. Only available for inserting 279 // incoming messages onto a group thread. URL_MATCHER.addURI(AUTHORITY, "group_thread/#/incoming_message", INCOMING_MESSAGE_ON_GROUP_THREAD)280 URL_MATCHER.addURI(AUTHORITY, "group_thread/#/incoming_message", 281 INCOMING_MESSAGE_ON_GROUP_THREAD); 282 283 // example URI: content://rcs/group_thread/3/incoming_message/71. Only supports querying URL_MATCHER.addURI(AUTHORITY, "group_thread/#/incoming_message/#", INCOMING_MESSAGE_ON_GROUP_THREAD_WITH_ID)284 URL_MATCHER.addURI(AUTHORITY, "group_thread/#/incoming_message/#", 285 INCOMING_MESSAGE_ON_GROUP_THREAD_WITH_ID); 286 287 // example URI: content://rcs/group_thread/3/outgoing_message. Only available for inserting 288 // outgoing messages onto a group thread. URL_MATCHER.addURI(AUTHORITY, "group_thread/#/outgoing_message", OUTGOING_MESSAGE_ON_GROUP_THREAD)289 URL_MATCHER.addURI(AUTHORITY, "group_thread/#/outgoing_message", 290 OUTGOING_MESSAGE_ON_GROUP_THREAD); 291 292 // example URI: content://rcs/group_thread/13/outgoing_message/72. Only supports querying URL_MATCHER.addURI(AUTHORITY, "group_thread/#/outgoing_message/#", OUTGOING_MESSAGE_ON_GROUP_THREAD_WITH_ID)293 URL_MATCHER.addURI(AUTHORITY, "group_thread/#/outgoing_message/#", 294 OUTGOING_MESSAGE_ON_GROUP_THREAD_WITH_ID); 295 296 // example URI: content://rcs/file_transfer/1. Does not support insertion URL_MATCHER.addURI(AUTHORITY, "file_transfer/#", FILE_TRANSFER_WITH_ID)297 URL_MATCHER.addURI(AUTHORITY, "file_transfer/#", FILE_TRANSFER_WITH_ID); 298 299 // example URI: content://rcs/event URL_MATCHER.addURI(AUTHORITY, "event", EVENT)300 URL_MATCHER.addURI(AUTHORITY, "event", EVENT); 301 URL_MATCHER.addURI(AUTHORITY, "canonical-address", CANONICAL_ADDRESS)302 URL_MATCHER.addURI(AUTHORITY, "canonical-address", CANONICAL_ADDRESS); 303 } 304 305 @Override onCreate()306 public boolean onCreate() { 307 // Use the credential encrypted mmssms.db for RCS messages. 308 mDbOpenHelper = MmsSmsDatabaseHelper.getInstanceForCe(getContext()); 309 mParticipantHelper = new RcsProviderParticipantHelper(mDbOpenHelper); 310 mThreadHelper = new RcsProviderThreadHelper(mDbOpenHelper); 311 mMessageHelper = new RcsProviderMessageHelper(mDbOpenHelper); 312 mEventHelper = new RcsProviderEventHelper(mDbOpenHelper); 313 mCanonicalAddressHelper = new RcsProviderCanonicalAddressHelper(mDbOpenHelper); 314 return true; 315 } 316 317 /** 318 * ContentResolver has a weird bug that if both query methods are overridden, it will always 319 * pick the bundle one to call, but will still require us to override this one as it is 320 * abstract. Work around by putting parameters in a bundle. 321 */ 322 @Override query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)323 public synchronized Cursor query(Uri uri, String[] projection, String selection, 324 String[] selectionArgs, String sortOrder) { 325 Bundle bundle = new Bundle(); 326 bundle.putString(ContentResolver.QUERY_ARG_SQL_SELECTION, selection); 327 bundle.putStringArray(ContentResolver.QUERY_ARG_SQL_SELECTION_ARGS, selectionArgs); 328 bundle.putString(ContentResolver.QUERY_ARG_SQL_SORT_ORDER, sortOrder); 329 return query(uri, projection, bundle, null); 330 } 331 332 @Override query(Uri uri, String[] projection, Bundle queryArgs, CancellationSignal unused)333 public synchronized Cursor query(Uri uri, String[] projection, Bundle queryArgs, 334 CancellationSignal unused) { 335 int match = URL_MATCHER.match(uri); 336 337 String selection = null; 338 String[] selectionArgs = null; 339 String sortOrder = null; 340 341 if (queryArgs != null) { 342 selection = queryArgs.getString(ContentResolver.QUERY_ARG_SQL_SELECTION); 343 selectionArgs = queryArgs.getStringArray( 344 ContentResolver.QUERY_ARG_SQL_SELECTION_ARGS); 345 sortOrder = queryArgs.getString(ContentResolver.QUERY_ARG_SQL_SORT_ORDER); 346 } 347 348 switch (match) { 349 case UNIFIED_RCS_THREAD: 350 return mThreadHelper.queryUnifiedThread(queryArgs); 351 case UNIFIED_RCS_THREAD_WITH_ID: 352 return mThreadHelper.queryUnifiedThreadUsingId(uri, projection); 353 case PARTICIPANT: 354 return mParticipantHelper.queryParticipant(queryArgs); 355 case PARTICIPANT_WITH_ID: 356 return mParticipantHelper.queryParticipantWithId(uri, projection); 357 case PARTICIPANT_ALIAS_CHANGE_EVENT: 358 Log.e(TAG, "Querying individual event types is not supported, uri: " + uri); 359 break; 360 case PARTICIPANT_ALIAS_CHANGE_EVENT_WITH_ID: 361 Log.e(TAG, "Querying participant events with id's is not supported, uri: " + uri); 362 break; 363 case P2P_THREAD: 364 return mThreadHelper.query1to1Thread(projection, selection, 365 selectionArgs, sortOrder); 366 case P2P_THREAD_WITH_ID: 367 return mThreadHelper.query1To1ThreadUsingId(uri, projection); 368 case P2P_THREAD_PARTICIPANT: 369 return mParticipantHelper.queryParticipantIn1To1Thread(uri); 370 case P2P_THREAD_PARTICIPANT_WITH_ID: 371 Log.e(TAG, 372 "Querying participants in 1 to 1 threads via id's is not supported, uri: " 373 + uri); 374 break; 375 case GROUP_THREAD: 376 return mThreadHelper.queryGroupThread(projection, selection, 377 selectionArgs, sortOrder); 378 case GROUP_THREAD_WITH_ID: 379 return mThreadHelper.queryGroupThreadUsingId(uri, projection); 380 case GROUP_THREAD_PARTICIPANT: 381 return mParticipantHelper.queryParticipantsInGroupThread(uri); 382 case GROUP_THREAD_PARTICIPANT_WITH_ID: 383 return mParticipantHelper.queryParticipantInGroupThreadWithId(uri); 384 case GROUP_THREAD_PARTICIPANT_JOINED_EVENT: 385 case GROUP_THREAD_PARTICIPANT_JOINED_EVENT_WITH_ID: 386 case GROUP_THREAD_PARTICIPANT_LEFT_EVENT: 387 case GROUP_THREAD_PARTICIPANT_LEFT_EVENT_WITH_ID: 388 case GROUP_THREAD_NAME_CHANGE_EVENT: 389 case GROUP_THREAD_NAME_CHANGE_EVENT_WITH_ID: 390 case GROUP_THREAD_ICON_CHANGE_EVENT: 391 case GROUP_THREAD_ICON_CHANGE_EVENT_WITH_ID: 392 Log.e(TAG, "Querying individual event types is not supported, uri: " + uri); 393 break; 394 case UNIFIED_MESSAGE: 395 return mMessageHelper.queryMessages(queryArgs); 396 case UNIFIED_MESSAGE_WITH_ID: 397 return mMessageHelper.queryUnifiedMessageWithId(uri); 398 case UNIFIED_MESSAGE_WITH_FILE_TRANSFER: 399 Log.e(TAG, 400 "Querying file transfers through messages is not supported, uri: " + uri); 401 case INCOMING_MESSAGE: 402 return mMessageHelper.queryIncomingMessageWithSelection(selection, selectionArgs); 403 case INCOMING_MESSAGE_WITH_ID: 404 return mMessageHelper.queryIncomingMessageWithId(uri); 405 case OUTGOING_MESSAGE: 406 return mMessageHelper.queryOutgoingMessageWithSelection(selection, selectionArgs); 407 case OUTGOING_MESSAGE_WITH_ID: 408 return mMessageHelper.queryOutgoingMessageWithId(uri); 409 case OUTGOING_MESSAGE_DELIVERY: 410 return mMessageHelper.queryOutgoingMessageDeliveries(uri); 411 case OUTGOING_MESSAGE_DELIVERY_WITH_ID: 412 Log.e(TAG, 413 "Querying deliveries with message and participant ids is not supported, " 414 + "uri: " 415 + uri); 416 case UNIFIED_MESSAGE_ON_THREAD: 417 return mMessageHelper.queryAllMessagesOnThread(uri, selection, selectionArgs); 418 case UNIFIED_MESSAGE_ON_THREAD_WITH_ID: 419 return mMessageHelper.queryUnifiedMessageWithIdInThread(uri); 420 case INCOMING_MESSAGE_ON_P2P_THREAD: 421 Log.e(TAG, 422 "Querying incoming messages on P2P thread with selection is not " 423 + "supported, uri: " 424 + uri); 425 break; 426 case INCOMING_MESSAGE_ON_P2P_THREAD_WITH_ID: 427 return mMessageHelper.queryUnifiedMessageWithIdInThread(uri); 428 case OUTGOING_MESSAGE_ON_P2P_THREAD: 429 Log.e(TAG, 430 "Querying outgoing messages on P2P thread with selection is not " 431 + "supported, uri: " 432 + uri); 433 break; 434 case OUTGOING_MESSAGE_ON_P2P_THREAD_WITH_ID: 435 return mMessageHelper.queryUnifiedMessageWithIdInThread(uri); 436 case INCOMING_MESSAGE_ON_GROUP_THREAD: 437 Log.e(TAG, 438 "Querying incoming messages on group thread with selection is not " 439 + "supported, uri: " 440 + uri); 441 break; 442 case INCOMING_MESSAGE_ON_GROUP_THREAD_WITH_ID: 443 return mMessageHelper.queryUnifiedMessageWithIdInThread(uri); 444 case OUTGOING_MESSAGE_ON_GROUP_THREAD: 445 Log.e(TAG, 446 "Querying outgoing messages on group thread with selection is not " 447 + "supported, uri: " 448 + uri); 449 break; 450 case OUTGOING_MESSAGE_ON_GROUP_THREAD_WITH_ID: 451 return mMessageHelper.queryUnifiedMessageWithIdInThread(uri); 452 case FILE_TRANSFER_WITH_ID: 453 return mMessageHelper.queryFileTransfer(uri); 454 case EVENT: 455 return mEventHelper.queryEvents(queryArgs); 456 case CANONICAL_ADDRESS: 457 String canonicalAddress = uri.getQueryParameter("address"); 458 return mCanonicalAddressHelper.getOrCreateCanonicalAddress(canonicalAddress); 459 default: 460 Log.e(TAG, "Invalid query: " + uri); 461 } 462 463 return null; 464 } 465 466 @Override getType(Uri uri)467 public String getType(Uri uri) { 468 return null; 469 } 470 471 @Override insert(Uri uri, ContentValues values)472 public synchronized Uri insert(Uri uri, ContentValues values) { 473 int match = URL_MATCHER.match(uri); 474 long rowId; 475 476 switch (match) { 477 case UNIFIED_RCS_THREAD: 478 case UNIFIED_RCS_THREAD_WITH_ID: 479 Log.e(TAG, "Inserting into unified thread view is not supported, uri: " + uri); 480 break; 481 case PARTICIPANT: 482 return buildUriWithRowIdAppended(PARTICIPANT_URI_PREFIX, 483 mParticipantHelper.insertParticipant(values)); 484 case PARTICIPANT_WITH_ID: 485 Log.e(TAG, "Inserting participant with a specified ID is not supported, uri: " 486 + uri); 487 break; 488 case PARTICIPANT_ALIAS_CHANGE_EVENT: 489 return buildUriWithRowIdAppended(uri, 490 mEventHelper.insertParticipantEvent(uri, values)); 491 case PARTICIPANT_ALIAS_CHANGE_EVENT_WITH_ID: 492 Log.e(TAG, "Inserting participant events with id's is not supported, uri: " + uri); 493 break; 494 case P2P_THREAD: 495 return buildUriWithRowIdAppended(P2P_THREAD_URI_PREFIX, 496 mThreadHelper.insert1To1Thread(values)); 497 case P2P_THREAD_WITH_ID: 498 Log.e(TAG, "Inserting a thread with a specified ID is not supported, uri: " + uri); 499 break; 500 case P2P_THREAD_PARTICIPANT: 501 Log.e(TAG, 502 "Inserting a participant into a thread via content values is not " 503 + "supported, uri: " 504 + uri); 505 break; 506 case P2P_THREAD_PARTICIPANT_WITH_ID: 507 Log.e(TAG, 508 "Inserting participant into a thread via URI is not supported, uri: " 509 + uri); 510 break; 511 case GROUP_THREAD: 512 return buildUriWithRowIdAppended(GROUP_THREAD_URI_PREFIX, 513 mThreadHelper.insertGroupThread(values)); 514 case GROUP_THREAD_WITH_ID: 515 Log.e(TAG, "Inserting a thread with a specified ID is not supported, uri: " + uri); 516 break; 517 case GROUP_THREAD_PARTICIPANT_JOINED_EVENT: 518 return buildUriWithRowIdAppended(uri, 519 mEventHelper.insertParticipantJoinedEvent(uri, values)); 520 case GROUP_THREAD_PARTICIPANT_JOINED_EVENT_WITH_ID: 521 Log.e(TAG, "Inserting thread events with id's is not supported, uri: " + uri); 522 break; 523 case GROUP_THREAD_PARTICIPANT_LEFT_EVENT: 524 return buildUriWithRowIdAppended(uri, 525 mEventHelper.insertParticipantLeftEvent(uri, values)); 526 case GROUP_THREAD_PARTICIPANT_LEFT_EVENT_WITH_ID: 527 Log.e(TAG, "Inserting thread events with id's is not supported, uri: " + uri); 528 break; 529 case GROUP_THREAD_NAME_CHANGE_EVENT: 530 return buildUriWithRowIdAppended(uri, 531 mEventHelper.insertThreadNameChangeEvent(uri, values)); 532 case GROUP_THREAD_NAME_CHANGE_EVENT_WITH_ID: 533 Log.e(TAG, "Inserting thread events with id's is not supported, uri: " + uri); 534 break; 535 case GROUP_THREAD_ICON_CHANGE_EVENT: 536 return buildUriWithRowIdAppended(uri, 537 mEventHelper.insertThreadIconChangeEvent(uri, values)); 538 case GROUP_THREAD_ICON_CHANGE_EVENT_WITH_ID: 539 Log.e(TAG, "Inserting thread events with id's is not supported, uri: " + uri); 540 break; 541 case GROUP_THREAD_PARTICIPANT: 542 rowId = mParticipantHelper.insertParticipantIntoGroupThread(values); 543 if (rowId == TRANSACTION_FAILED) { 544 return null; 545 } 546 return mParticipantHelper.getParticipantInThreadUri(values, rowId); 547 case GROUP_THREAD_PARTICIPANT_WITH_ID: 548 return returnUriAsIsIfSuccessful(uri, 549 mParticipantHelper.insertParticipantIntoGroupThreadWithId(uri)); 550 case UNIFIED_MESSAGE: 551 case UNIFIED_MESSAGE_WITH_ID: 552 Log.e(TAG, "Inserting into unified message view is not supported, uri: " + uri); 553 break; 554 case UNIFIED_MESSAGE_WITH_FILE_TRANSFER: 555 return buildUriWithRowIdAppended(FILE_TRANSFER_PREFIX, 556 mMessageHelper.insertFileTransferToMessage(uri, values)); 557 case INCOMING_MESSAGE: 558 case INCOMING_MESSAGE_WITH_ID: 559 case OUTGOING_MESSAGE: 560 case OUTGOING_MESSAGE_WITH_ID: 561 Log.e(TAG, "Inserting a message without a thread is not supported, uri: " 562 + uri); 563 break; 564 case OUTGOING_MESSAGE_DELIVERY: 565 Log.e(TAG, 566 "Inserting an outgoing message delivery without a participant is not " 567 + "supported, uri: " 568 + uri); 569 break; 570 case OUTGOING_MESSAGE_DELIVERY_WITH_ID: 571 return returnUriAsIsIfSuccessful(uri, 572 mMessageHelper.insertMessageDelivery(uri, values)); 573 case UNIFIED_MESSAGE_ON_THREAD: 574 case UNIFIED_MESSAGE_ON_THREAD_WITH_ID: 575 Log.e(TAG, 576 "Inserting a message on unified thread view is not supported, uri: " + uri); 577 break; 578 case INCOMING_MESSAGE_ON_P2P_THREAD: 579 return mMessageHelper.insertMessageOnThread(uri, values, /* isIncoming= */ 580 true, /* is1To1 */ true); 581 case OUTGOING_MESSAGE_ON_P2P_THREAD: 582 return mMessageHelper.insertMessageOnThread(uri, values, /* isIncoming= */ 583 false, /* is1To1 */ true); 584 case INCOMING_MESSAGE_ON_GROUP_THREAD: 585 return mMessageHelper.insertMessageOnThread(uri, values, /* isIncoming= */ 586 true, /* is1To1 */ false); 587 case OUTGOING_MESSAGE_ON_GROUP_THREAD: 588 return mMessageHelper.insertMessageOnThread(uri, values, /* isIncoming= */ 589 false, /* is1To1 */ false); 590 case INCOMING_MESSAGE_ON_P2P_THREAD_WITH_ID: 591 case OUTGOING_MESSAGE_ON_P2P_THREAD_WITH_ID: 592 case INCOMING_MESSAGE_ON_GROUP_THREAD_WITH_ID: 593 case OUTGOING_MESSAGE_ON_GROUP_THREAD_WITH_ID: 594 Log.e(TAG, "Inserting a message with a specific id is not supported, uri: " + uri); 595 break; 596 case FILE_TRANSFER_WITH_ID: 597 Log.e(TAG, "Inserting a file transfer without a message is not supported, uri: " 598 + uri); 599 break; 600 case EVENT: 601 Log.e(TAG, 602 "Inserting event using unified event query is not supported, uri: " + uri); 603 break; 604 default: 605 Log.e(TAG, "Invalid insert: " + uri); 606 } 607 608 return null; 609 } 610 611 @Override delete(Uri uri, String selection, String[] selectionArgs)612 public synchronized int delete(Uri uri, String selection, String[] selectionArgs) { 613 int match = URL_MATCHER.match(uri); 614 int deletedCount = 0; 615 616 switch (match) { 617 case UNIFIED_RCS_THREAD: 618 case UNIFIED_RCS_THREAD_WITH_ID: 619 Log.e(TAG, "Deleting entries from unified view is not allowed: " + uri); 620 break; 621 case PARTICIPANT: 622 Log.e(TAG, "Deleting participant with selection is not allowed: " + uri); 623 break; 624 case PARTICIPANT_WITH_ID: 625 return mParticipantHelper.deleteParticipantWithId(uri); 626 case PARTICIPANT_ALIAS_CHANGE_EVENT: 627 Log.e(TAG, "Deleting participant events without id is not allowed: " + uri); 628 break; 629 case PARTICIPANT_ALIAS_CHANGE_EVENT_WITH_ID: 630 return mEventHelper.deleteParticipantEvent(uri); 631 case P2P_THREAD: 632 return mThreadHelper.delete1To1Thread(selection, selectionArgs); 633 case P2P_THREAD_WITH_ID: 634 return mThreadHelper.delete1To1ThreadWithId(uri); 635 case P2P_THREAD_PARTICIPANT: 636 Log.e(TAG, "Removing participant from 1 to 1 thread is not allowed, uri: " + uri); 637 break; 638 case GROUP_THREAD: 639 return mThreadHelper.deleteGroupThread(selection, selectionArgs); 640 case GROUP_THREAD_WITH_ID: 641 return mThreadHelper.deleteGroupThreadWithId(uri); 642 case GROUP_THREAD_PARTICIPANT_JOINED_EVENT_WITH_ID: 643 return mEventHelper.deleteGroupThreadEvent(uri); 644 case GROUP_THREAD_PARTICIPANT_LEFT_EVENT_WITH_ID: 645 return mEventHelper.deleteGroupThreadEvent(uri); 646 case GROUP_THREAD_NAME_CHANGE_EVENT_WITH_ID: 647 return mEventHelper.deleteGroupThreadEvent(uri); 648 case GROUP_THREAD_PARTICIPANT_JOINED_EVENT: 649 case GROUP_THREAD_PARTICIPANT_LEFT_EVENT: 650 case GROUP_THREAD_NAME_CHANGE_EVENT: 651 case GROUP_THREAD_ICON_CHANGE_EVENT: 652 Log.e(TAG, "Deleting thread events via selection is not allowed, uri: " + uri); 653 break; 654 case GROUP_THREAD_ICON_CHANGE_EVENT_WITH_ID: 655 return mEventHelper.deleteGroupThreadEvent(uri); 656 case GROUP_THREAD_PARTICIPANT: 657 Log.e(TAG, 658 "Deleting a participant from group thread via selection is not allowed, " 659 + "uri: " 660 + uri); 661 break; 662 case GROUP_THREAD_PARTICIPANT_WITH_ID: 663 return mParticipantHelper.deleteParticipantFromGroupThread(uri); 664 case UNIFIED_MESSAGE: 665 Log.e(TAG, 666 "Deleting message from unified view with selection is not allowed: " + uri); 667 break; 668 case UNIFIED_MESSAGE_WITH_ID: 669 Log.e(TAG, "Deleting message from unified view with id is not allowed: " + uri); 670 break; 671 case UNIFIED_MESSAGE_WITH_FILE_TRANSFER: 672 Log.e(TAG, "Deleting file transfer using message uri is not allowed, uri: " + uri); 673 break; 674 case INCOMING_MESSAGE: 675 return mMessageHelper.deleteIncomingMessageWithSelection(selection, selectionArgs); 676 case INCOMING_MESSAGE_WITH_ID: 677 return mMessageHelper.deleteIncomingMessageWithId(uri); 678 case OUTGOING_MESSAGE: 679 return mMessageHelper.deleteOutgoingMessageWithSelection(selection, selectionArgs); 680 case OUTGOING_MESSAGE_WITH_ID: 681 return mMessageHelper.deleteOutgoingMessageWithId(uri); 682 case OUTGOING_MESSAGE_DELIVERY: 683 case OUTGOING_MESSAGE_DELIVERY_WITH_ID: 684 Log.e(TAG, "Deleting message deliveries is not supported, uri: " + uri); 685 break; 686 case UNIFIED_MESSAGE_ON_THREAD: 687 case UNIFIED_MESSAGE_ON_THREAD_WITH_ID: 688 case INCOMING_MESSAGE_ON_P2P_THREAD: 689 case INCOMING_MESSAGE_ON_P2P_THREAD_WITH_ID: 690 case OUTGOING_MESSAGE_ON_P2P_THREAD: 691 case OUTGOING_MESSAGE_ON_P2P_THREAD_WITH_ID: 692 case INCOMING_MESSAGE_ON_GROUP_THREAD: 693 case INCOMING_MESSAGE_ON_GROUP_THREAD_WITH_ID: 694 case OUTGOING_MESSAGE_ON_GROUP_THREAD: 695 case OUTGOING_MESSAGE_ON_GROUP_THREAD_WITH_ID: 696 Log.e(TAG, "Deleting messages using thread uris is not supported, uri: " + uri); 697 break; 698 case FILE_TRANSFER_WITH_ID: 699 return mMessageHelper.deleteFileTransfer(uri); 700 case EVENT: 701 Log.e(TAG, "Deleting events using unified event uri is not supported, uri: " + uri); 702 break; 703 default: 704 Log.e(TAG, "Invalid delete: " + uri); 705 } 706 707 return deletedCount; 708 } 709 710 @Override update(Uri uri, ContentValues values, String selection, String[] selectionArgs)711 public synchronized int update(Uri uri, ContentValues values, String selection, 712 String[] selectionArgs) { 713 int match = URL_MATCHER.match(uri); 714 int updatedCount = 0; 715 716 switch (match) { 717 case UNIFIED_RCS_THREAD: 718 case UNIFIED_RCS_THREAD_WITH_ID: 719 Log.e(TAG, "Updating unified thread view is not supported, uri: " + uri); 720 break; 721 case PARTICIPANT: 722 Log.e(TAG, "Updating participants with selection is not supported, uri: " + uri); 723 break; 724 case PARTICIPANT_WITH_ID: 725 return mParticipantHelper.updateParticipantWithId(values, uri); 726 case PARTICIPANT_ALIAS_CHANGE_EVENT: 727 case PARTICIPANT_ALIAS_CHANGE_EVENT_WITH_ID: 728 Log.e(TAG, "Updating events is not supported, uri: " + uri); 729 break; 730 case P2P_THREAD: 731 return mThreadHelper.update1To1Thread(values, selection, selectionArgs); 732 case P2P_THREAD_WITH_ID: 733 return mThreadHelper.update1To1ThreadWithId(values, uri); 734 case P2P_THREAD_PARTICIPANT: 735 Log.e(TAG, "Updating junction table entries is not supported, uri: " + uri); 736 break; 737 case GROUP_THREAD: 738 return mThreadHelper.updateGroupThread(values, selection, selectionArgs); 739 case GROUP_THREAD_WITH_ID: 740 return mThreadHelper.updateGroupThreadWithId(values, uri); 741 case GROUP_THREAD_PARTICIPANT_JOINED_EVENT: 742 case GROUP_THREAD_PARTICIPANT_JOINED_EVENT_WITH_ID: 743 case GROUP_THREAD_PARTICIPANT_LEFT_EVENT: 744 case GROUP_THREAD_PARTICIPANT_LEFT_EVENT_WITH_ID: 745 case GROUP_THREAD_NAME_CHANGE_EVENT: 746 case GROUP_THREAD_NAME_CHANGE_EVENT_WITH_ID: 747 case GROUP_THREAD_ICON_CHANGE_EVENT: 748 case GROUP_THREAD_ICON_CHANGE_EVENT_WITH_ID: 749 Log.e(TAG, "Updating thread events is not supported, uri: " + uri); 750 break; 751 case GROUP_THREAD_PARTICIPANT: 752 case GROUP_THREAD_PARTICIPANT_WITH_ID: 753 Log.e(TAG, "Updating junction table entries is not supported, uri: " + uri); 754 break; 755 case UNIFIED_MESSAGE: 756 case UNIFIED_MESSAGE_WITH_ID: 757 Log.e(TAG, "Updating unified message view is not supported, uri: " + uri); 758 break; 759 case UNIFIED_MESSAGE_WITH_FILE_TRANSFER: 760 Log.e(TAG, 761 "Updating file transfer using unified message uri is not supported, uri: " 762 + uri); 763 case INCOMING_MESSAGE: 764 Log.e(TAG, 765 "Updating an incoming message via selection is not supported, uri: " + uri); 766 break; 767 case INCOMING_MESSAGE_WITH_ID: 768 return mMessageHelper.updateIncomingMessage(uri, values); 769 case OUTGOING_MESSAGE: 770 Log.e(TAG, 771 "Updating an outgoing message via selection is not supported, uri: " + uri); 772 break; 773 case OUTGOING_MESSAGE_WITH_ID: 774 return mMessageHelper.updateOutgoingMessage(uri, values); 775 case OUTGOING_MESSAGE_DELIVERY: 776 Log.e(TAG, "Updating message deliveries using message uris is not supported, uri: " 777 + uri); 778 break; 779 case OUTGOING_MESSAGE_DELIVERY_WITH_ID: 780 return mMessageHelper.updateDelivery(uri, values); 781 case UNIFIED_MESSAGE_ON_THREAD: 782 case UNIFIED_MESSAGE_ON_THREAD_WITH_ID: 783 case INCOMING_MESSAGE_ON_P2P_THREAD: 784 case INCOMING_MESSAGE_ON_P2P_THREAD_WITH_ID: 785 case OUTGOING_MESSAGE_ON_P2P_THREAD: 786 case OUTGOING_MESSAGE_ON_P2P_THREAD_WITH_ID: 787 case INCOMING_MESSAGE_ON_GROUP_THREAD: 788 case INCOMING_MESSAGE_ON_GROUP_THREAD_WITH_ID: 789 case OUTGOING_MESSAGE_ON_GROUP_THREAD: 790 case OUTGOING_MESSAGE_ON_GROUP_THREAD_WITH_ID: 791 Log.e(TAG, "Updating messages using threads uris is not supported, uri: " + uri); 792 break; 793 case FILE_TRANSFER_WITH_ID: 794 return mMessageHelper.updateFileTransfer(uri, values); 795 case EVENT: 796 Log.e(TAG, "Updating events is not supported, uri: " + uri); 797 break; 798 default: 799 Log.e(TAG, "Invalid update: " + uri); 800 } 801 802 return updatedCount; 803 } 804 } 805