Loading src/java/com/android/internal/telephony/ims/RcsMessageStoreController.java +1 −31 Original line number Diff line number Diff line Loading @@ -57,7 +57,6 @@ import static android.provider.Telephony.RcsColumns.RcsParticipantColumns.CANONI import static android.provider.Telephony.RcsColumns.RcsParticipantColumns.RCS_ALIAS_COLUMN; import static android.provider.Telephony.RcsColumns.RcsParticipantColumns.RCS_PARTICIPANT_ID_COLUMN; import static android.provider.Telephony.RcsColumns.RcsParticipantColumns.RCS_PARTICIPANT_URI; import static android.provider.Telephony.RcsColumns.RcsParticipantColumns.RCS_PARTICIPANT_URI_PART; import static android.provider.Telephony.RcsColumns.RcsParticipantEventColumns.NEW_ALIAS_COLUMN; import static android.provider.Telephony.RcsColumns.RcsThreadColumns.RCS_THREAD_ID_COLUMN; import static android.provider.Telephony.RcsColumns.RcsThreadEventColumns.DESTINATION_PARTICIPANT_ID_COLUMN; Loading Loading @@ -99,7 +98,6 @@ import android.telephony.ims.RcsMessageQueryResult; import android.telephony.ims.RcsMessageSnippet; import android.telephony.ims.RcsMessageStore; import android.telephony.ims.RcsOutgoingMessageCreationParams; import android.telephony.ims.RcsParticipant; import android.telephony.ims.RcsParticipantQueryParams; import android.telephony.ims.RcsParticipantQueryResult; import android.telephony.ims.RcsQueryContinuationToken; Loading Loading @@ -244,35 +242,7 @@ public class RcsMessageStoreController extends IRcs.Stub { @Override public int createRcs1To1Thread(int recipientId) throws RemoteException { // Look up if a similar thread exists. Fail the call if it does RcsParticipant participant = mParticipantQueryHelper.getParticipantFromId(recipientId); if (participant == null) { throw new RemoteException( "RcsParticipant with id: " + recipientId + " does not exist."); } RcsThreadQueryParams queryParameters = new RcsThreadQueryParams.Builder() .setThreadType(RcsThreadQueryParams.THREAD_TYPE_1_TO_1).setParticipant( participant).build(); RcsThreadQueryResult queryResult = getRcsThreads(queryParameters); if (queryResult.getThreads().size() > 0) { throw new RemoteException( "Rcs1To1Thread with recipient " + recipientId + " already exists."); } int rcs1To1ThreadId = mThreadQueryHelper.create1To1Thread(); // add the recipient Uri recipientUri = RCS_1_TO_1_THREAD_URI.buildUpon().appendPath( Integer.toString(rcs1To1ThreadId)).appendPath( RCS_PARTICIPANT_URI_PART).appendPath(Integer.toString(recipientId)).build(); Uri insertionResult = mContentResolver.insert(recipientUri, null); if (insertionResult.equals(recipientUri)) { // insertion successful, return the created thread return rcs1To1ThreadId; } throw new RemoteException("Creating Rcs1To1Thread failed"); return mThreadQueryHelper.create1To1Thread(recipientId); } @Override Loading src/java/com/android/internal/telephony/ims/RcsParticipantQueryHelper.java +2 −2 Original line number Diff line number Diff line Loading @@ -43,8 +43,8 @@ class RcsParticipantQueryHelper { RcsParticipant participant = null; try (Cursor cursor = mContentResolver.query( Uri.withAppendedPath(RCS_PARTICIPANT_URI, Integer.toString(participantId)), null, null, null)) { if (cursor == null && !cursor.moveToNext()) { new String[]{RCS_PARTICIPANT_ID_COLUMN}, null, null)) { if (cursor == null || !cursor.moveToNext()) { throw new RemoteException("Could not find participant with id: " + participantId); } Loading src/java/com/android/internal/telephony/ims/RcsThreadQueryHelper.java +6 −5 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import static android.provider.Telephony.RcsColumns.Rcs1To1ThreadColumns.RCS_1_T import static android.provider.Telephony.RcsColumns.RcsGroupThreadColumns.GROUP_ICON_COLUMN; import static android.provider.Telephony.RcsColumns.RcsGroupThreadColumns.GROUP_NAME_COLUMN; import static android.provider.Telephony.RcsColumns.RcsGroupThreadColumns.RCS_GROUP_THREAD_URI; import static android.provider.Telephony.RcsColumns.RcsParticipantColumns.RCS_PARTICIPANT_ID_COLUMN; import static android.provider.Telephony.RcsColumns.RcsParticipantColumns.RCS_PARTICIPANT_URI_PART; import static android.provider.Telephony.RcsColumns.RcsThreadColumns.RCS_THREAD_ID_COLUMN; import static android.provider.Telephony.RcsColumns.RcsThreadColumns.RCS_THREAD_URI; Loading Loading @@ -89,16 +90,16 @@ class RcsThreadQueryHelper { return new RcsThreadQueryResult(continuationToken, rcsThreadIdList); } int create1To1Thread() throws RemoteException { ContentValues contentValues = new ContentValues(0); Uri insertionUri = mContentResolver.insert(RCS_THREAD_URI, contentValues); int create1To1Thread(int participantId) throws RemoteException { ContentValues contentValues = new ContentValues(1); contentValues.put(RCS_PARTICIPANT_ID_COLUMN, participantId); Uri insertionUri = mContentResolver.insert(RCS_1_TO_1_THREAD_URI, contentValues); if (insertionUri == null) { throw new RemoteException("Rcs1To1Thread creation failed"); } String threadIdAsString = insertionUri.getPathSegments().get( THREAD_ID_INDEX_IN_INSERTION_URI); String threadIdAsString = insertionUri.getLastPathSegment(); int threadId = Integer.parseInt(threadIdAsString); if (threadId <= 0) { Loading Loading
src/java/com/android/internal/telephony/ims/RcsMessageStoreController.java +1 −31 Original line number Diff line number Diff line Loading @@ -57,7 +57,6 @@ import static android.provider.Telephony.RcsColumns.RcsParticipantColumns.CANONI import static android.provider.Telephony.RcsColumns.RcsParticipantColumns.RCS_ALIAS_COLUMN; import static android.provider.Telephony.RcsColumns.RcsParticipantColumns.RCS_PARTICIPANT_ID_COLUMN; import static android.provider.Telephony.RcsColumns.RcsParticipantColumns.RCS_PARTICIPANT_URI; import static android.provider.Telephony.RcsColumns.RcsParticipantColumns.RCS_PARTICIPANT_URI_PART; import static android.provider.Telephony.RcsColumns.RcsParticipantEventColumns.NEW_ALIAS_COLUMN; import static android.provider.Telephony.RcsColumns.RcsThreadColumns.RCS_THREAD_ID_COLUMN; import static android.provider.Telephony.RcsColumns.RcsThreadEventColumns.DESTINATION_PARTICIPANT_ID_COLUMN; Loading Loading @@ -99,7 +98,6 @@ import android.telephony.ims.RcsMessageQueryResult; import android.telephony.ims.RcsMessageSnippet; import android.telephony.ims.RcsMessageStore; import android.telephony.ims.RcsOutgoingMessageCreationParams; import android.telephony.ims.RcsParticipant; import android.telephony.ims.RcsParticipantQueryParams; import android.telephony.ims.RcsParticipantQueryResult; import android.telephony.ims.RcsQueryContinuationToken; Loading Loading @@ -244,35 +242,7 @@ public class RcsMessageStoreController extends IRcs.Stub { @Override public int createRcs1To1Thread(int recipientId) throws RemoteException { // Look up if a similar thread exists. Fail the call if it does RcsParticipant participant = mParticipantQueryHelper.getParticipantFromId(recipientId); if (participant == null) { throw new RemoteException( "RcsParticipant with id: " + recipientId + " does not exist."); } RcsThreadQueryParams queryParameters = new RcsThreadQueryParams.Builder() .setThreadType(RcsThreadQueryParams.THREAD_TYPE_1_TO_1).setParticipant( participant).build(); RcsThreadQueryResult queryResult = getRcsThreads(queryParameters); if (queryResult.getThreads().size() > 0) { throw new RemoteException( "Rcs1To1Thread with recipient " + recipientId + " already exists."); } int rcs1To1ThreadId = mThreadQueryHelper.create1To1Thread(); // add the recipient Uri recipientUri = RCS_1_TO_1_THREAD_URI.buildUpon().appendPath( Integer.toString(rcs1To1ThreadId)).appendPath( RCS_PARTICIPANT_URI_PART).appendPath(Integer.toString(recipientId)).build(); Uri insertionResult = mContentResolver.insert(recipientUri, null); if (insertionResult.equals(recipientUri)) { // insertion successful, return the created thread return rcs1To1ThreadId; } throw new RemoteException("Creating Rcs1To1Thread failed"); return mThreadQueryHelper.create1To1Thread(recipientId); } @Override Loading
src/java/com/android/internal/telephony/ims/RcsParticipantQueryHelper.java +2 −2 Original line number Diff line number Diff line Loading @@ -43,8 +43,8 @@ class RcsParticipantQueryHelper { RcsParticipant participant = null; try (Cursor cursor = mContentResolver.query( Uri.withAppendedPath(RCS_PARTICIPANT_URI, Integer.toString(participantId)), null, null, null)) { if (cursor == null && !cursor.moveToNext()) { new String[]{RCS_PARTICIPANT_ID_COLUMN}, null, null)) { if (cursor == null || !cursor.moveToNext()) { throw new RemoteException("Could not find participant with id: " + participantId); } Loading
src/java/com/android/internal/telephony/ims/RcsThreadQueryHelper.java +6 −5 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ import static android.provider.Telephony.RcsColumns.Rcs1To1ThreadColumns.RCS_1_T import static android.provider.Telephony.RcsColumns.RcsGroupThreadColumns.GROUP_ICON_COLUMN; import static android.provider.Telephony.RcsColumns.RcsGroupThreadColumns.GROUP_NAME_COLUMN; import static android.provider.Telephony.RcsColumns.RcsGroupThreadColumns.RCS_GROUP_THREAD_URI; import static android.provider.Telephony.RcsColumns.RcsParticipantColumns.RCS_PARTICIPANT_ID_COLUMN; import static android.provider.Telephony.RcsColumns.RcsParticipantColumns.RCS_PARTICIPANT_URI_PART; import static android.provider.Telephony.RcsColumns.RcsThreadColumns.RCS_THREAD_ID_COLUMN; import static android.provider.Telephony.RcsColumns.RcsThreadColumns.RCS_THREAD_URI; Loading Loading @@ -89,16 +90,16 @@ class RcsThreadQueryHelper { return new RcsThreadQueryResult(continuationToken, rcsThreadIdList); } int create1To1Thread() throws RemoteException { ContentValues contentValues = new ContentValues(0); Uri insertionUri = mContentResolver.insert(RCS_THREAD_URI, contentValues); int create1To1Thread(int participantId) throws RemoteException { ContentValues contentValues = new ContentValues(1); contentValues.put(RCS_PARTICIPANT_ID_COLUMN, participantId); Uri insertionUri = mContentResolver.insert(RCS_1_TO_1_THREAD_URI, contentValues); if (insertionUri == null) { throw new RemoteException("Rcs1To1Thread creation failed"); } String threadIdAsString = insertionUri.getPathSegments().get( THREAD_ID_INDEX_IN_INSERTION_URI); String threadIdAsString = insertionUri.getLastPathSegment(); int threadId = Integer.parseInt(threadIdAsString); if (threadId <= 0) { Loading