diff options
36 files changed, 253 insertions, 202 deletions
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java index c48c878fc366..d32b6b516a7d 100644 --- a/core/java/android/app/SystemServiceRegistry.java +++ b/core/java/android/app/SystemServiceRegistry.java @@ -618,7 +618,7 @@ final class SystemServiceRegistry { new CachedServiceFetcher<RcsManager>() { @Override public RcsManager createService(ContextImpl ctx) { - return new RcsManager(); + return new RcsManager(ctx.getOuterContext()); } }); diff --git a/telephony/java/android/telephony/ims/Rcs1To1Thread.java b/telephony/java/android/telephony/ims/Rcs1To1Thread.java index 0bb1b4379679..39e9789b16e7 100644 --- a/telephony/java/android/telephony/ims/Rcs1To1Thread.java +++ b/telephony/java/android/telephony/ims/Rcs1To1Thread.java @@ -33,8 +33,8 @@ public class Rcs1To1Thread extends RcsThread { * * @hide */ - public Rcs1To1Thread(int threadId) { - super(threadId); + public Rcs1To1Thread(RcsControllerCall rcsControllerCall, int threadId) { + super(rcsControllerCall, threadId); mThreadId = threadId; } @@ -56,7 +56,7 @@ public class Rcs1To1Thread extends RcsThread { */ @WorkerThread public long getFallbackThreadId() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.get1To1ThreadFallbackThreadId(mThreadId)); + return mRcsControllerCall.call(iRcs -> iRcs.get1To1ThreadFallbackThreadId(mThreadId)); } /** @@ -69,7 +69,7 @@ public class Rcs1To1Thread extends RcsThread { */ @WorkerThread public void setFallbackThreadId(long fallbackThreadId) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn( + mRcsControllerCall.callWithNoReturn( iRcs -> iRcs.set1To1ThreadFallbackThreadId(mThreadId, fallbackThreadId)); } @@ -81,6 +81,7 @@ public class Rcs1To1Thread extends RcsThread { @WorkerThread public RcsParticipant getRecipient() throws RcsMessageStoreException { return new RcsParticipant( - RcsControllerCall.call(iRcs -> iRcs.get1To1ThreadOtherParticipantId(mThreadId))); + mRcsControllerCall, + mRcsControllerCall.call(iRcs -> iRcs.get1To1ThreadOtherParticipantId(mThreadId))); } } diff --git a/telephony/java/android/telephony/ims/RcsControllerCall.java b/telephony/java/android/telephony/ims/RcsControllerCall.java index 5512c4c7b19d..3bd441e9421d 100644 --- a/telephony/java/android/telephony/ims/RcsControllerCall.java +++ b/telephony/java/android/telephony/ims/RcsControllerCall.java @@ -27,7 +27,13 @@ import android.telephony.ims.aidl.IRcs; * @hide - not meant for public use */ class RcsControllerCall { - static <R> R call(RcsServiceCall<R> serviceCall) throws RcsMessageStoreException { + private final Context mContext; + + RcsControllerCall(Context context) { + mContext = context; + } + + <R> R call(RcsServiceCall<R> serviceCall) throws RcsMessageStoreException { IRcs iRcs = IRcs.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_RCS_SERVICE)); if (iRcs == null) { throw new RcsMessageStoreException("Could not connect to RCS storage service"); @@ -40,18 +46,12 @@ class RcsControllerCall { } } - static void callWithNoReturn(RcsServiceCallWithNoReturn serviceCall) + void callWithNoReturn(RcsServiceCallWithNoReturn serviceCall) throws RcsMessageStoreException { - IRcs iRcs = IRcs.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_RCS_SERVICE)); - if (iRcs == null) { - throw new RcsMessageStoreException("Could not connect to RCS storage service"); - } - - try { + call(iRcs -> { serviceCall.methodOnIRcs(iRcs); - } catch (RemoteException exception) { - throw new RcsMessageStoreException(exception.getMessage()); - } + return null; + }); } interface RcsServiceCall<R> { diff --git a/telephony/java/android/telephony/ims/RcsEvent.java b/telephony/java/android/telephony/ims/RcsEvent.java index 994b27ab7405..9dd07209fcfd 100644 --- a/telephony/java/android/telephony/ims/RcsEvent.java +++ b/telephony/java/android/telephony/ims/RcsEvent.java @@ -40,5 +40,5 @@ public abstract class RcsEvent { * * @hide */ - abstract void persist() throws RcsMessageStoreException; + abstract void persist(RcsControllerCall rcsControllerCall) throws RcsMessageStoreException; } diff --git a/telephony/java/android/telephony/ims/RcsEventDescriptor.java b/telephony/java/android/telephony/ims/RcsEventDescriptor.java index 8e3f6cd4d889..b44adeaa62bb 100644 --- a/telephony/java/android/telephony/ims/RcsEventDescriptor.java +++ b/telephony/java/android/telephony/ims/RcsEventDescriptor.java @@ -38,7 +38,7 @@ public abstract class RcsEventDescriptor implements Parcelable { * descriptor. */ @VisibleForTesting(visibility = PROTECTED) - public abstract RcsEvent createRcsEvent(); + public abstract RcsEvent createRcsEvent(RcsControllerCall rcsControllerCall); RcsEventDescriptor(Parcel in) { mTimestamp = in.readLong(); diff --git a/telephony/java/android/telephony/ims/RcsEventQueryResultDescriptor.java b/telephony/java/android/telephony/ims/RcsEventQueryResultDescriptor.java index e30745b7e633..b972d557fae0 100644 --- a/telephony/java/android/telephony/ims/RcsEventQueryResultDescriptor.java +++ b/telephony/java/android/telephony/ims/RcsEventQueryResultDescriptor.java @@ -39,9 +39,9 @@ public class RcsEventQueryResultDescriptor implements Parcelable { mEvents = events; } - protected RcsEventQueryResult getRcsEventQueryResult() { + protected RcsEventQueryResult getRcsEventQueryResult(RcsControllerCall rcsControllerCall) { List<RcsEvent> rcsEvents = mEvents.stream() - .map(RcsEventDescriptor::createRcsEvent) + .map(rcsEvent -> rcsEvent.createRcsEvent(rcsControllerCall)) .collect(Collectors.toList()); return new RcsEventQueryResult(mContinuationToken, rcsEvents); diff --git a/telephony/java/android/telephony/ims/RcsFileTransferPart.java b/telephony/java/android/telephony/ims/RcsFileTransferPart.java index 3816cd413722..992665832ee4 100644 --- a/telephony/java/android/telephony/ims/RcsFileTransferPart.java +++ b/telephony/java/android/telephony/ims/RcsFileTransferPart.java @@ -103,12 +103,15 @@ public class RcsFileTransferPart { public @interface RcsFileTransferStatus { } + private final RcsControllerCall mRcsControllerCall; + private int mId; /** * @hide */ - RcsFileTransferPart(int id) { + RcsFileTransferPart(RcsControllerCall rcsControllerCall, int id) { + mRcsControllerCall = rcsControllerCall; mId = id; } @@ -134,7 +137,7 @@ public class RcsFileTransferPart { */ @WorkerThread public void setFileTransferSessionId(String sessionId) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn(iRcs -> iRcs.setFileTransferSessionId(mId, sessionId)); + mRcsControllerCall.callWithNoReturn(iRcs -> iRcs.setFileTransferSessionId(mId, sessionId)); } /** @@ -143,7 +146,7 @@ public class RcsFileTransferPart { */ @WorkerThread public String getFileTransferSessionId() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getFileTransferSessionId(mId)); + return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferSessionId(mId)); } /** @@ -155,7 +158,8 @@ public class RcsFileTransferPart { */ @WorkerThread public void setContentUri(Uri contentUri) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn(iRcs -> iRcs.setFileTransferContentUri(mId, contentUri)); + mRcsControllerCall.callWithNoReturn( + iRcs -> iRcs.setFileTransferContentUri(mId, contentUri)); } /** @@ -165,7 +169,7 @@ public class RcsFileTransferPart { @Nullable @WorkerThread public Uri getContentUri() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getFileTransferContentUri(mId)); + return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferContentUri(mId)); } /** @@ -177,7 +181,7 @@ public class RcsFileTransferPart { */ @WorkerThread public void setContentMimeType(String contentMimeType) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn( + mRcsControllerCall.callWithNoReturn( iRcs -> iRcs.setFileTransferContentType(mId, contentMimeType)); } @@ -188,7 +192,7 @@ public class RcsFileTransferPart { @WorkerThread @Nullable public String getContentMimeType() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getFileTransferContentType(mId)); + return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferContentType(mId)); } /** @@ -199,7 +203,7 @@ public class RcsFileTransferPart { */ @WorkerThread public void setFileSize(long contentLength) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn( + mRcsControllerCall.callWithNoReturn( iRcs -> iRcs.setFileTransferFileSize(mId, contentLength)); } @@ -209,7 +213,7 @@ public class RcsFileTransferPart { */ @WorkerThread public long getFileSize() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getFileTransferFileSize(mId)); + return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferFileSize(mId)); } /** @@ -222,7 +226,7 @@ public class RcsFileTransferPart { */ @WorkerThread public void setTransferOffset(long transferOffset) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn( + mRcsControllerCall.callWithNoReturn( iRcs -> iRcs.setFileTransferTransferOffset(mId, transferOffset)); } @@ -232,7 +236,7 @@ public class RcsFileTransferPart { */ @WorkerThread public long getTransferOffset() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getFileTransferTransferOffset(mId)); + return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferTransferOffset(mId)); } /** @@ -244,7 +248,7 @@ public class RcsFileTransferPart { @WorkerThread public void setFileTransferStatus(@RcsFileTransferStatus int status) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn(iRcs -> iRcs.setFileTransferStatus(mId, status)); + mRcsControllerCall.callWithNoReturn(iRcs -> iRcs.setFileTransferStatus(mId, status)); } /** @@ -253,7 +257,7 @@ public class RcsFileTransferPart { */ @WorkerThread public @RcsFileTransferStatus int getFileTransferStatus() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getFileTransferStatus(mId)); + return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferStatus(mId)); } /** @@ -262,7 +266,7 @@ public class RcsFileTransferPart { */ @WorkerThread public int getWidth() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getFileTransferWidth(mId)); + return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferWidth(mId)); } /** @@ -273,7 +277,7 @@ public class RcsFileTransferPart { */ @WorkerThread public void setWidth(int width) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn(iRcs -> iRcs.setFileTransferWidth(mId, width)); + mRcsControllerCall.callWithNoReturn(iRcs -> iRcs.setFileTransferWidth(mId, width)); } /** @@ -282,7 +286,7 @@ public class RcsFileTransferPart { */ @WorkerThread public int getHeight() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getFileTransferHeight(mId)); + return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferHeight(mId)); } /** @@ -293,7 +297,7 @@ public class RcsFileTransferPart { */ @WorkerThread public void setHeight(int height) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn(iRcs -> iRcs.setFileTransferHeight(mId, height)); + mRcsControllerCall.callWithNoReturn(iRcs -> iRcs.setFileTransferHeight(mId, height)); } /** @@ -302,7 +306,7 @@ public class RcsFileTransferPart { */ @WorkerThread public long getLength() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getFileTransferLength(mId)); + return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferLength(mId)); } /** @@ -313,7 +317,7 @@ public class RcsFileTransferPart { */ @WorkerThread public void setLength(long length) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn(iRcs -> iRcs.setFileTransferLength(mId, length)); + mRcsControllerCall.callWithNoReturn(iRcs -> iRcs.setFileTransferLength(mId, length)); } /** @@ -323,7 +327,7 @@ public class RcsFileTransferPart { */ @WorkerThread public Uri getPreviewUri() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getFileTransferPreviewUri(mId)); + return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferPreviewUri(mId)); } /** @@ -334,7 +338,8 @@ public class RcsFileTransferPart { */ @WorkerThread public void setPreviewUri(Uri previewUri) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn(iRcs -> iRcs.setFileTransferPreviewUri(mId, previewUri)); + mRcsControllerCall.callWithNoReturn( + iRcs -> iRcs.setFileTransferPreviewUri(mId, previewUri)); } /** @@ -343,7 +348,7 @@ public class RcsFileTransferPart { */ @WorkerThread public String getPreviewMimeType() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getFileTransferPreviewType(mId)); + return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferPreviewType(mId)); } /** @@ -354,7 +359,7 @@ public class RcsFileTransferPart { */ @WorkerThread public void setPreviewMimeType(String previewMimeType) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn( + mRcsControllerCall.callWithNoReturn( iRcs -> iRcs.setFileTransferPreviewType(mId, previewMimeType)); } } diff --git a/telephony/java/android/telephony/ims/RcsGroupThread.java b/telephony/java/android/telephony/ims/RcsGroupThread.java index baec19ac6669..0482f57007dd 100644 --- a/telephony/java/android/telephony/ims/RcsGroupThread.java +++ b/telephony/java/android/telephony/ims/RcsGroupThread.java @@ -38,8 +38,8 @@ public class RcsGroupThread extends RcsThread { * * @hide */ - public RcsGroupThread(int threadId) { - super(threadId); + public RcsGroupThread(RcsControllerCall rcsControllerCall, int threadId) { + super(rcsControllerCall, threadId); } /** @@ -58,7 +58,7 @@ public class RcsGroupThread extends RcsThread { @Nullable @WorkerThread public String getGroupName() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getGroupThreadName(mThreadId)); + return mRcsControllerCall.call(iRcs -> iRcs.getGroupThreadName(mThreadId)); } /** @@ -69,7 +69,7 @@ public class RcsGroupThread extends RcsThread { */ @WorkerThread public void setGroupName(String groupName) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn(iRcs -> iRcs.setGroupThreadName(mThreadId, groupName)); + mRcsControllerCall.callWithNoReturn(iRcs -> iRcs.setGroupThreadName(mThreadId, groupName)); } /** @@ -79,7 +79,7 @@ public class RcsGroupThread extends RcsThread { */ @Nullable public Uri getGroupIcon() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getGroupThreadIcon(mThreadId)); + return mRcsControllerCall.call(iRcs -> iRcs.getGroupThreadIcon(mThreadId)); } /** @@ -90,7 +90,7 @@ public class RcsGroupThread extends RcsThread { */ @WorkerThread public void setGroupIcon(@Nullable Uri groupIcon) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn(iRcs -> iRcs.setGroupThreadIcon(mThreadId, groupIcon)); + mRcsControllerCall.callWithNoReturn(iRcs -> iRcs.setGroupThreadIcon(mThreadId, groupIcon)); } /** @@ -100,8 +100,9 @@ public class RcsGroupThread extends RcsThread { @Nullable @WorkerThread public RcsParticipant getOwner() throws RcsMessageStoreException { - return new RcsParticipant(RcsControllerCall.call( - iRcs -> iRcs.getGroupThreadOwner(mThreadId))); + return new RcsParticipant( + mRcsControllerCall, + mRcsControllerCall.call(iRcs -> iRcs.getGroupThreadOwner(mThreadId))); } /** @@ -114,7 +115,7 @@ public class RcsGroupThread extends RcsThread { */ @WorkerThread public void setOwner(@Nullable RcsParticipant participant) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn( + mRcsControllerCall.callWithNoReturn( iRcs -> iRcs.setGroupThreadOwner(mThreadId, participant.getId())); } @@ -133,7 +134,7 @@ public class RcsGroupThread extends RcsThread { return; } - RcsControllerCall.callWithNoReturn( + mRcsControllerCall.callWithNoReturn( iRcs -> iRcs.addParticipantToGroupThread(mThreadId, participant.getId())); } @@ -150,7 +151,7 @@ public class RcsGroupThread extends RcsThread { return; } - RcsControllerCall.callWithNoReturn( + mRcsControllerCall.callWithNoReturn( iRcs -> iRcs.removeParticipantFromGroupThread(mThreadId, participant.getId())); } @@ -170,7 +171,8 @@ public class RcsGroupThread extends RcsThread { new RcsParticipantQueryParams.Builder().setThread(this).build(); RcsParticipantQueryResult queryResult = new RcsParticipantQueryResult( - RcsControllerCall.call( + mRcsControllerCall, + mRcsControllerCall.call( iRcs -> iRcs.getParticipants(queryParameters))); List<RcsParticipant> participantList = queryResult.getParticipants(); @@ -187,7 +189,7 @@ public class RcsGroupThread extends RcsThread { @Nullable @WorkerThread public Uri getConferenceUri() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getGroupThreadConferenceUri(mThreadId)); + return mRcsControllerCall.call(iRcs -> iRcs.getGroupThreadConferenceUri(mThreadId)); } /** @@ -200,7 +202,7 @@ public class RcsGroupThread extends RcsThread { @Nullable @WorkerThread public void setConferenceUri(Uri conferenceUri) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn( + mRcsControllerCall.callWithNoReturn( iRcs -> iRcs.setGroupThreadConferenceUri(mThreadId, conferenceUri)); } } diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadEvent.java b/telephony/java/android/telephony/ims/RcsGroupThreadEvent.java index 4a6b963a143a..f4beef7f9843 100644 --- a/telephony/java/android/telephony/ims/RcsGroupThreadEvent.java +++ b/telephony/java/android/telephony/ims/RcsGroupThreadEvent.java @@ -23,14 +23,14 @@ import android.annotation.NonNull; * @hide */ public abstract class RcsGroupThreadEvent extends RcsEvent { - private final int mRcsGroupThreadId; - private final int mOriginatingParticipantId; + private final RcsGroupThread mRcsGroupThread; + private final RcsParticipant mOriginatingParticipant; - RcsGroupThreadEvent(long timestamp, int rcsGroupThreadId, - int originatingParticipantId) { + RcsGroupThreadEvent(long timestamp, RcsGroupThread rcsGroupThread, + RcsParticipant originatingParticipant) { super(timestamp); - mRcsGroupThreadId = rcsGroupThreadId; - mOriginatingParticipantId = originatingParticipantId; + mRcsGroupThread = rcsGroupThread; + mOriginatingParticipant = originatingParticipant; } /** @@ -38,7 +38,7 @@ public abstract class RcsGroupThreadEvent extends RcsEvent { */ @NonNull public RcsGroupThread getRcsGroupThread() { - return new RcsGroupThread(mRcsGroupThreadId); + return mRcsGroupThread; } /** @@ -46,6 +46,6 @@ public abstract class RcsGroupThreadEvent extends RcsEvent { */ @NonNull public RcsParticipant getOriginatingParticipant() { - return new RcsParticipant(mOriginatingParticipantId); + return mOriginatingParticipant; } } diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEvent.java b/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEvent.java index 3c6c74fac8e2..d17401fd0910 100644 --- a/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEvent.java +++ b/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEvent.java @@ -40,9 +40,10 @@ public final class RcsGroupThreadIconChangedEvent extends RcsGroupThreadEvent { * @param newIcon {@link Uri} to the new icon of this {@link RcsGroupThread} * @see RcsMessageStore#persistRcsEvent(RcsEvent) */ - public RcsGroupThreadIconChangedEvent(long timestamp, @NonNull RcsGroupThread rcsGroupThread, - @NonNull RcsParticipant originatingParticipant, @Nullable Uri newIcon) { - super(timestamp, rcsGroupThread.getThreadId(), originatingParticipant.getId()); + public RcsGroupThreadIconChangedEvent(long timestamp, + @NonNull RcsGroupThread rcsGroupThread, @NonNull RcsParticipant originatingParticipant, + @Nullable Uri newIcon) { + super(timestamp, rcsGroupThread, originatingParticipant); mNewIcon = newIcon; } @@ -61,9 +62,9 @@ public final class RcsGroupThreadIconChangedEvent extends RcsGroupThreadEvent { * @hide - not meant for public use. */ @Override - public void persist() throws RcsMessageStoreException { + void persist(RcsControllerCall rcsControllerCall) throws RcsMessageStoreException { // TODO ensure failure throws - RcsControllerCall.call(iRcs -> iRcs.createGroupThreadIconChangedEvent( + rcsControllerCall.call(iRcs -> iRcs.createGroupThreadIconChangedEvent( getTimestamp(), getRcsGroupThread().getThreadId(), getOriginatingParticipant().getId(), mNewIcon)); } diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEventDescriptor.java b/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEventDescriptor.java index bcadc80bda54..9350e402c04e 100644 --- a/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEventDescriptor.java +++ b/telephony/java/android/telephony/ims/RcsGroupThreadIconChangedEventDescriptor.java @@ -38,9 +38,10 @@ public class RcsGroupThreadIconChangedEventDescriptor extends RcsGroupThreadEven @Override @VisibleForTesting(visibility = PROTECTED) - public RcsGroupThreadIconChangedEvent createRcsEvent() { - return new RcsGroupThreadIconChangedEvent(mTimestamp, new RcsGroupThread(mRcsGroupThreadId), - new RcsParticipant(mOriginatingParticipantId), mNewIcon); + public RcsGroupThreadIconChangedEvent createRcsEvent(RcsControllerCall rcsControllerCall) { + return new RcsGroupThreadIconChangedEvent(mTimestamp, + new RcsGroupThread(rcsControllerCall, mRcsGroupThreadId), + new RcsParticipant(rcsControllerCall, mOriginatingParticipantId), mNewIcon); } public static final @NonNull Creator<RcsGroupThreadIconChangedEventDescriptor> CREATOR = diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEvent.java b/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEvent.java index 54032536601e..8430dc44eac2 100644 --- a/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEvent.java +++ b/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEvent.java @@ -41,7 +41,7 @@ public final class RcsGroupThreadNameChangedEvent extends RcsGroupThreadEvent { */ public RcsGroupThreadNameChangedEvent(long timestamp, @NonNull RcsGroupThread rcsGroupThread, @NonNull RcsParticipant originatingParticipant, @Nullable String newName) { - super(timestamp, rcsGroupThread.getThreadId(), originatingParticipant.getId()); + super(timestamp, rcsGroupThread, originatingParticipant); mNewName = newName; } @@ -60,8 +60,8 @@ public final class RcsGroupThreadNameChangedEvent extends RcsGroupThreadEvent { * @hide - not meant for public use. */ @Override - public void persist() throws RcsMessageStoreException { - RcsControllerCall.call(iRcs -> iRcs.createGroupThreadNameChangedEvent( + void persist(RcsControllerCall rcsControllerCall) throws RcsMessageStoreException { + rcsControllerCall.call(iRcs -> iRcs.createGroupThreadNameChangedEvent( getTimestamp(), getRcsGroupThread().getThreadId(), getOriginatingParticipant().getId(), mNewName)); } diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEventDescriptor.java b/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEventDescriptor.java index 597fa0a3f9f8..f9ccdd53f0a2 100644 --- a/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEventDescriptor.java +++ b/telephony/java/android/telephony/ims/RcsGroupThreadNameChangedEventDescriptor.java @@ -37,11 +37,11 @@ public class RcsGroupThreadNameChangedEventDescriptor extends RcsGroupThreadEven @Override @VisibleForTesting(visibility = PROTECTED) - public RcsGroupThreadNameChangedEvent createRcsEvent() { + public RcsGroupThreadNameChangedEvent createRcsEvent(RcsControllerCall rcsControllerCall) { return new RcsGroupThreadNameChangedEvent( mTimestamp, - new RcsGroupThread(mRcsGroupThreadId), - new RcsParticipant(mOriginatingParticipantId), + new RcsGroupThread(rcsControllerCall, mRcsGroupThreadId), + new RcsParticipant(rcsControllerCall, mOriginatingParticipantId), mNewName); } diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEvent.java b/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEvent.java index 48be479a1ac6..2cdf960a4afe 100644 --- a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEvent.java +++ b/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEvent.java @@ -42,7 +42,7 @@ public final class RcsGroupThreadParticipantJoinedEvent extends RcsGroupThreadEv public RcsGroupThreadParticipantJoinedEvent(long timestamp, @NonNull RcsGroupThread rcsGroupThread, @NonNull RcsParticipant originatingParticipant, @NonNull RcsParticipant joinedParticipant) { - super(timestamp, rcsGroupThread.getThreadId(), originatingParticipant.getId()); + super(timestamp, rcsGroupThread, originatingParticipant); mJoinedParticipantId = joinedParticipant; } @@ -59,8 +59,8 @@ public final class RcsGroupThreadParticipantJoinedEvent extends RcsGroupThreadEv * @hide - not meant for public use. */ @Override - public void persist() throws RcsMessageStoreException { - RcsControllerCall.call( + void persist(RcsControllerCall rcsControllerCall) throws RcsMessageStoreException { + rcsControllerCall.call( iRcs -> iRcs.createGroupThreadParticipantJoinedEvent(getTimestamp(), getRcsGroupThread().getThreadId(), getOriginatingParticipant().getId(), getJoinedParticipant().getId())); diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEventDescriptor.java b/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEventDescriptor.java index abea10a641ac..4a6803ebc52c 100644 --- a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEventDescriptor.java +++ b/telephony/java/android/telephony/ims/RcsGroupThreadParticipantJoinedEventDescriptor.java @@ -36,12 +36,13 @@ public class RcsGroupThreadParticipantJoinedEventDescriptor extends RcsGroupThre @Override @VisibleForTesting(visibility = PROTECTED) - public RcsGroupThreadParticipantJoinedEvent createRcsEvent() { + public RcsGroupThreadParticipantJoinedEvent createRcsEvent( + RcsControllerCall rcsControllerCall) { return new RcsGroupThreadParticipantJoinedEvent( mTimestamp, - new RcsGroupThread(mRcsGroupThreadId), - new RcsParticipant(mOriginatingParticipantId), - new RcsParticipant(mJoinedParticipantId)); + new RcsGroupThread(rcsControllerCall, mRcsGroupThreadId), + new RcsParticipant(rcsControllerCall, mOriginatingParticipantId), + new RcsParticipant(rcsControllerCall, mJoinedParticipantId)); } public static final @NonNull Creator<RcsGroupThreadParticipantJoinedEventDescriptor> CREATOR = diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEvent.java b/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEvent.java index b724a3f2159f..22d48fcc04b3 100644 --- a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEvent.java +++ b/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEvent.java @@ -44,7 +44,7 @@ public final class RcsGroupThreadParticipantLeftEvent extends RcsGroupThreadEven public RcsGroupThreadParticipantLeftEvent(long timestamp, @NonNull RcsGroupThread rcsGroupThread, @NonNull RcsParticipant originatingParticipant, @NonNull RcsParticipant leavingParticipant) { - super(timestamp, rcsGroupThread.getThreadId(), originatingParticipant.getId()); + super(timestamp, rcsGroupThread, originatingParticipant); mLeavingParticipant = leavingParticipant; } @@ -58,8 +58,8 @@ public final class RcsGroupThreadParticipantLeftEvent extends RcsGroupThreadEven } @Override - public void persist() throws RcsMessageStoreException { - RcsControllerCall.call( + void persist(RcsControllerCall rcsControllerCall) throws RcsMessageStoreException { + rcsControllerCall.call( iRcs -> iRcs.createGroupThreadParticipantLeftEvent(getTimestamp(), getRcsGroupThread().getThreadId(), getOriginatingParticipant().getId(), getLeavingParticipant().getId())); diff --git a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEventDescriptor.java b/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEventDescriptor.java index f287db19da05..9b1085c3d178 100644 --- a/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEventDescriptor.java +++ b/telephony/java/android/telephony/ims/RcsGroupThreadParticipantLeftEventDescriptor.java @@ -37,12 +37,12 @@ public class RcsGroupThreadParticipantLeftEventDescriptor extends RcsGroupThread @Override @VisibleForTesting(visibility = PROTECTED) - public RcsGroupThreadParticipantLeftEvent createRcsEvent() { + public RcsGroupThreadParticipantLeftEvent createRcsEvent(RcsControllerCall rcsControllerCall) { return new RcsGroupThreadParticipantLeftEvent( mTimestamp, - new RcsGroupThread(mRcsGroupThreadId), - new RcsParticipant(mOriginatingParticipantId), - new RcsParticipant(mLeavingParticipantId)); + new RcsGroupThread(rcsControllerCall, mRcsGroupThreadId), + new RcsParticipant(rcsControllerCall, mOriginatingParticipantId), + new RcsParticipant(rcsControllerCall, mLeavingParticipantId)); } @NonNull diff --git a/telephony/java/android/telephony/ims/RcsIncomingMessage.java b/telephony/java/android/telephony/ims/RcsIncomingMessage.java index 06e2a41accee..87ddbbf9b30a 100644 --- a/telephony/java/android/telephony/ims/RcsIncomingMessage.java +++ b/telephony/java/android/telephony/ims/RcsIncomingMessage.java @@ -26,8 +26,8 @@ public class RcsIncomingMessage extends RcsMessage { /** * @hide */ - RcsIncomingMessage(int id) { - super(id); + RcsIncomingMessage(RcsControllerCall rcsControllerCall, int id) { + super(rcsControllerCall, id); } /** @@ -39,7 +39,7 @@ public class RcsIncomingMessage extends RcsMessage { */ @WorkerThread public void setArrivalTimestamp(long arrivalTimestamp) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn( + mRcsControllerCall.callWithNoReturn( iRcs -> iRcs.setMessageArrivalTimestamp(mId, true, arrivalTimestamp)); } @@ -50,7 +50,7 @@ public class RcsIncomingMessage extends RcsMessage { */ @WorkerThread public long getArrivalTimestamp() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getMessageArrivalTimestamp(mId, true)); + return mRcsControllerCall.call(iRcs -> iRcs.getMessageArrivalTimestamp(mId, true)); } /** @@ -62,7 +62,7 @@ public class RcsIncomingMessage extends RcsMessage { */ @WorkerThread public void setSeenTimestamp(long notifiedTimestamp) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn( + mRcsControllerCall.callWithNoReturn( iRcs -> iRcs.setMessageSeenTimestamp(mId, true, notifiedTimestamp)); } @@ -73,7 +73,7 @@ public class RcsIncomingMessage extends RcsMessage { */ @WorkerThread public long getSeenTimestamp() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getMessageSeenTimestamp(mId, true)); + return mRcsControllerCall.call(iRcs -> iRcs.getMessageSeenTimestamp(mId, true)); } /** @@ -83,7 +83,8 @@ public class RcsIncomingMessage extends RcsMessage { @WorkerThread public RcsParticipant getSenderParticipant() throws RcsMessageStoreException { return new RcsParticipant( - RcsControllerCall.call(iRcs -> iRcs.getSenderParticipant(mId))); + mRcsControllerCall, + mRcsControllerCall.call(iRcs -> iRcs.getSenderParticipant(mId))); } /** diff --git a/telephony/java/android/telephony/ims/RcsManager.java b/telephony/java/android/telephony/ims/RcsManager.java index 63dc1ac568bf..0d6ca3cc58e1 100644 --- a/telephony/java/android/telephony/ims/RcsManager.java +++ b/telephony/java/android/telephony/ims/RcsManager.java @@ -25,20 +25,19 @@ import android.content.Context; */ @SystemService(Context.TELEPHONY_RCS_SERVICE) public class RcsManager { + private final RcsMessageStore mRcsMessageStore; /** * @hide */ - public RcsManager() { - // empty constructor + public RcsManager(Context context) { + mRcsMessageStore = new RcsMessageStore(context); } - private static final RcsMessageStore sRcsMessageStoreInstance = new RcsMessageStore(); - /** * Returns an instance of {@link RcsMessageStore} */ public RcsMessageStore getRcsMessageStore() { - return sRcsMessageStoreInstance; + return mRcsMessageStore; } } diff --git a/telephony/java/android/telephony/ims/RcsMessage.java b/telephony/java/android/telephony/ims/RcsMessage.java index b0d0d5a6a9bb..1c466b99f43d 100644 --- a/telephony/java/android/telephony/ims/RcsMessage.java +++ b/telephony/java/android/telephony/ims/RcsMessage.java @@ -86,6 +86,11 @@ public abstract class RcsMessage { /** * @hide */ + protected final RcsControllerCall mRcsControllerCall; + + /** + * @hide + */ protected final int mId; @IntDef({ @@ -95,7 +100,8 @@ public abstract class RcsMessage { public @interface RcsMessageStatus { } - RcsMessage(int id) { + RcsMessage(RcsControllerCall rcsControllerCall, int id) { + mRcsControllerCall = rcsControllerCall; mId = id; } @@ -115,7 +121,7 @@ public abstract class RcsMessage { * @see android.telephony.SubscriptionInfo#getSubscriptionId */ public int getSubscriptionId() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getMessageSubId(mId, isIncoming())); + return mRcsControllerCall.call(iRcs -> iRcs.getMessageSubId(mId, isIncoming())); } /** @@ -128,7 +134,7 @@ public abstract class RcsMessage { */ @WorkerThread public void setSubscriptionId(int subId) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn(iRcs -> iRcs.setMessageSubId(mId, isIncoming(), subId)); + mRcsControllerCall.callWithNoReturn(iRcs -> iRcs.setMessageSubId(mId, isIncoming(), subId)); } /** @@ -139,7 +145,7 @@ public abstract class RcsMessage { */ @WorkerThread public void setStatus(@RcsMessageStatus int rcsMessageStatus) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn( + mRcsControllerCall.callWithNoReturn( iRcs -> iRcs.setMessageStatus(mId, isIncoming(), rcsMessageStatus)); } @@ -150,7 +156,7 @@ public abstract class RcsMessage { */ @WorkerThread public @RcsMessageStatus int getStatus() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getMessageStatus(mId, isIncoming())); + return mRcsControllerCall.call(iRcs -> iRcs.getMessageStatus(mId, isIncoming())); } /** @@ -163,7 +169,7 @@ public abstract class RcsMessage { */ @WorkerThread public void setOriginationTimestamp(long timestamp) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn( + mRcsControllerCall.callWithNoReturn( iRcs -> iRcs.setMessageOriginationTimestamp(mId, isIncoming(), timestamp)); } @@ -175,7 +181,7 @@ public abstract class RcsMessage { */ @WorkerThread public long getOriginationTimestamp() throws RcsMessageStoreException { - return RcsControllerCall.call( + return mRcsControllerCall.call( iRcs -> iRcs.getMessageOriginationTimestamp(mId, isIncoming())); } @@ -189,7 +195,7 @@ public abstract class RcsMessage { */ @WorkerThread public void setRcsMessageId(String rcsMessageGlobalId) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn( + mRcsControllerCall.callWithNoReturn( iRcs -> iRcs.setGlobalMessageIdForMessage(mId, isIncoming(), rcsMessageGlobalId)); } @@ -200,7 +206,8 @@ public abstract class RcsMessage { */ @WorkerThread public String getRcsMessageId() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getGlobalMessageIdForMessage(mId, isIncoming())); + return mRcsControllerCall.call( + iRcs -> iRcs.getGlobalMessageIdForMessage(mId, isIncoming())); } /** @@ -209,7 +216,7 @@ public abstract class RcsMessage { */ @WorkerThread public String getText() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getTextForMessage(mId, isIncoming())); + return mRcsControllerCall.call(iRcs -> iRcs.getTextForMessage(mId, isIncoming())); } /** @@ -220,7 +227,8 @@ public abstract class RcsMessage { */ @WorkerThread public void setText(String text) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn(iRcs -> iRcs.setTextForMessage(mId, isIncoming(), text)); + mRcsControllerCall.callWithNoReturn( + iRcs -> iRcs.setTextForMessage(mId, isIncoming(), text)); } /** @@ -231,7 +239,7 @@ public abstract class RcsMessage { */ @WorkerThread public double getLatitude() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getLatitudeForMessage(mId, isIncoming())); + return mRcsControllerCall.call(iRcs -> iRcs.getLatitudeForMessage(mId, isIncoming())); } /** @@ -242,7 +250,7 @@ public abstract class RcsMessage { */ @WorkerThread public void setLatitude(double latitude) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn( + mRcsControllerCall.callWithNoReturn( iRcs -> iRcs.setLatitudeForMessage(mId, isIncoming(), latitude)); } @@ -254,7 +262,7 @@ public abstract class RcsMessage { */ @WorkerThread public double getLongitude() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getLongitudeForMessage(mId, isIncoming())); + return mRcsControllerCall.call(iRcs -> iRcs.getLongitudeForMessage(mId, isIncoming())); } /** @@ -265,7 +273,7 @@ public abstract class RcsMessage { */ @WorkerThread public void setLongitude(double longitude) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn( + mRcsControllerCall.callWithNoReturn( iRcs -> iRcs.setLongitudeForMessage(mId, isIncoming(), longitude)); } @@ -282,7 +290,7 @@ public abstract class RcsMessage { public RcsFileTransferPart insertFileTransfer( RcsFileTransferCreationParams fileTransferCreationParameters) throws RcsMessageStoreException { - return new RcsFileTransferPart(RcsControllerCall.call( + return new RcsFileTransferPart(mRcsControllerCall, mRcsControllerCall.call( iRcs -> iRcs.storeFileTransfer(mId, isIncoming(), fileTransferCreationParameters))); } @@ -296,11 +304,11 @@ public abstract class RcsMessage { public Set<RcsFileTransferPart> getFileTransferParts() throws RcsMessageStoreException { Set<RcsFileTransferPart> fileTransferParts = new HashSet<>(); - int[] fileTransferIds = RcsControllerCall.call( + int[] fileTransferIds = mRcsControllerCall.call( iRcs -> iRcs.getFileTransfersAttachedToMessage(mId, isIncoming())); for (int fileTransfer : fileTransferIds) { - fileTransferParts.add(new RcsFileTransferPart(fileTransfer)); + fileTransferParts.add(new RcsFileTransferPart(mRcsControllerCall, fileTransfer)); } return Collections.unmodifiableSet(fileTransferParts); @@ -319,7 +327,7 @@ public abstract class RcsMessage { return; } - RcsControllerCall.callWithNoReturn( + mRcsControllerCall.callWithNoReturn( iRcs -> iRcs.deleteFileTransfer(fileTransferPart.getId())); } diff --git a/telephony/java/android/telephony/ims/RcsMessageQueryResult.java b/telephony/java/android/telephony/ims/RcsMessageQueryResult.java index aa551c11a9d2..36bb78a0594b 100644 --- a/telephony/java/android/telephony/ims/RcsMessageQueryResult.java +++ b/telephony/java/android/telephony/ims/RcsMessageQueryResult.java @@ -32,9 +32,12 @@ import java.util.stream.Collectors; * @hide */ public final class RcsMessageQueryResult { + private final RcsControllerCall mRcsControllerCall; private final RcsMessageQueryResultParcelable mRcsMessageQueryResultParcelable; - RcsMessageQueryResult(RcsMessageQueryResultParcelable rcsMessageQueryResultParcelable) { + RcsMessageQueryResult(RcsControllerCall rcsControllerCall, + RcsMessageQueryResultParcelable rcsMessageQueryResultParcelable) { + mRcsControllerCall = rcsControllerCall; mRcsMessageQueryResultParcelable = rcsMessageQueryResultParcelable; } @@ -57,8 +60,8 @@ public final class RcsMessageQueryResult { public List<RcsMessage> getMessages() { return mRcsMessageQueryResultParcelable.mMessageTypeIdPairs.stream() .map(typeIdPair -> typeIdPair.getType() == MESSAGE_TYPE_INCOMING - ? new RcsIncomingMessage(typeIdPair.getId()) - : new RcsOutgoingMessage(typeIdPair.getId())) + ? new RcsIncomingMessage(mRcsControllerCall, typeIdPair.getId()) + : new RcsOutgoingMessage(mRcsControllerCall, typeIdPair.getId())) .collect(Collectors.toList()); } } diff --git a/telephony/java/android/telephony/ims/RcsMessageStore.java b/telephony/java/android/telephony/ims/RcsMessageStore.java index 0aaec7f7eeb7..20b47c016c35 100644 --- a/telephony/java/android/telephony/ims/RcsMessageStore.java +++ b/telephony/java/android/telephony/ims/RcsMessageStore.java @@ -19,6 +19,7 @@ package android.telephony.ims; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.WorkerThread; +import android.content.Context; import android.net.Uri; import java.util.List; @@ -30,6 +31,12 @@ import java.util.List; * @hide */ public class RcsMessageStore { + RcsControllerCall mRcsControllerCall; + + RcsMessageStore(Context context) { + mRcsControllerCall = new RcsControllerCall(context); + } + /** * Returns the first chunk of existing {@link RcsThread}s in the common storage. * @@ -41,8 +48,8 @@ public class RcsMessageStore { @NonNull public RcsThreadQueryResult getRcsThreads(@Nullable RcsThreadQueryParams queryParameters) throws RcsMessageStoreException { - return new RcsThreadQueryResult( - RcsControllerCall.call(iRcs -> iRcs.getRcsThreads(queryParameters))); + return new RcsThreadQueryResult(mRcsControllerCall, + mRcsControllerCall.call(iRcs -> iRcs.getRcsThreads(queryParameters))); } /** @@ -56,8 +63,8 @@ public class RcsMessageStore { @NonNull public RcsThreadQueryResult getRcsThreads(@NonNull RcsQueryContinuationToken continuationToken) throws RcsMessageStoreException { - return new RcsThreadQueryResult( - RcsControllerCall.call(iRcs -> iRcs.getRcsThreadsWithToken(continuationToken))); + return new RcsThreadQueryResult(mRcsControllerCall, + mRcsControllerCall.call(iRcs -> iRcs.getRcsThreadsWithToken(continuationToken))); } /** @@ -72,8 +79,8 @@ public class RcsMessageStore { public RcsParticipantQueryResult getRcsParticipants( @Nullable RcsParticipantQueryParams queryParameters) throws RcsMessageStoreException { - return new RcsParticipantQueryResult( - RcsControllerCall.call(iRcs -> iRcs.getParticipants(queryParameters))); + return new RcsParticipantQueryResult(mRcsControllerCall, + mRcsControllerCall.call(iRcs -> iRcs.getParticipants(queryParameters))); } /** @@ -89,23 +96,23 @@ public class RcsMessageStore { public RcsParticipantQueryResult getRcsParticipants( @NonNull RcsQueryContinuationToken continuationToken) throws RcsMessageStoreException { - return new RcsParticipantQueryResult( - RcsControllerCall.call(iRcs -> iRcs.getParticipantsWithToken(continuationToken))); + return new RcsParticipantQueryResult(mRcsControllerCall, + mRcsControllerCall.call(iRcs -> iRcs.getParticipantsWithToken(continuationToken))); } /** * Returns the first chunk of existing {@link RcsMessage}s in the common storage. * - * @param queryParameters Parameters to specify to return a subset of all RcsMessages. - * Passing a value of null will return all messages. + * @param queryParams Parameters to specify to return a subset of all RcsMessages. + * Passing a value of null will return all messages. * @throws RcsMessageStoreException if the query could not be completed on the storage */ @WorkerThread @NonNull public RcsMessageQueryResult getRcsMessages( - @Nullable RcsMessageQueryParams queryParameters) throws RcsMessageStoreException { - return new RcsMessageQueryResult( - RcsControllerCall.call(iRcs -> iRcs.getMessages(queryParameters))); + @Nullable RcsMessageQueryParams queryParams) throws RcsMessageStoreException { + return new RcsMessageQueryResult(mRcsControllerCall, + mRcsControllerCall.call(iRcs -> iRcs.getMessages(queryParams))); } /** @@ -119,8 +126,8 @@ public class RcsMessageStore { @NonNull public RcsMessageQueryResult getRcsMessages( @NonNull RcsQueryContinuationToken continuationToken) throws RcsMessageStoreException { - return new RcsMessageQueryResult( - RcsControllerCall.call(iRcs -> iRcs.getMessagesWithToken(continuationToken))); + return new RcsMessageQueryResult(mRcsControllerCall, + mRcsControllerCall.call(iRcs -> iRcs.getMessagesWithToken(continuationToken))); } /** @@ -134,8 +141,8 @@ public class RcsMessageStore { @NonNull public RcsEventQueryResult getRcsEvents( @Nullable RcsEventQueryParams queryParams) throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getEvents(queryParams)) - .getRcsEventQueryResult(); + return mRcsControllerCall.call(iRcs -> iRcs.getEvents(queryParams)) + .getRcsEventQueryResult(mRcsControllerCall); } /** @@ -149,14 +156,14 @@ public class RcsMessageStore { @NonNull public RcsEventQueryResult getRcsEvents( @NonNull RcsQueryContinuationToken continuationToken) throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getEventsWithToken(continuationToken)) - .getRcsEventQueryResult(); + return mRcsControllerCall.call(iRcs -> iRcs.getEventsWithToken(continuationToken)) + .getRcsEventQueryResult(mRcsControllerCall); } /** * Persists an {@link RcsEvent} to common storage. * - * @param persistableEvent The {@link RcsEvent} to persist into storage. + * @param rcsEvent The {@link RcsEvent} to persist into storage. * @throws RcsMessageStoreException if the query could not be completed on the storage * @see RcsGroupThreadNameChangedEvent * @see RcsGroupThreadIconChangedEvent @@ -166,8 +173,8 @@ public class RcsMessageStore { */ @WorkerThread @NonNull - public void persistRcsEvent(RcsEvent persistableEvent) throws RcsMessageStoreException { - persistableEvent.persist(); + public void persistRcsEvent(RcsEvent rcsEvent) throws RcsMessageStoreException { + rcsEvent.persist(mRcsControllerCall); } /** @@ -182,7 +189,8 @@ public class RcsMessageStore { public Rcs1To1Thread createRcs1To1Thread(@NonNull RcsParticipant recipient) throws RcsMessageStoreException { return new Rcs1To1Thread( - RcsControllerCall.call(iRcs -> iRcs.createRcs1To1Thread(recipient.getId()))); + mRcsControllerCall, + mRcsControllerCall.call(iRcs -> iRcs.createRcs1To1Thread(recipient.getId()))); } /** @@ -204,8 +212,11 @@ public class RcsMessageStore { } int[] finalRecipientIds = recipientIds; - return new RcsGroupThread(RcsControllerCall.call( - iRcs -> iRcs.createGroupThread(finalRecipientIds, groupName, groupIcon))); + + int threadId = mRcsControllerCall.call( + iRcs -> iRcs.createGroupThread(finalRecipientIds, groupName, groupIcon)); + + return new RcsGroupThread(mRcsControllerCall, threadId); } /** @@ -220,7 +231,7 @@ public class RcsMessageStore { return; } - boolean isDeleteSucceeded = RcsControllerCall.call( + boolean isDeleteSucceeded = mRcsControllerCall.call( iRcs -> iRcs.deleteThread(thread.getThreadId(), thread.getThreadType())); if (!isDeleteSucceeded) { @@ -239,7 +250,7 @@ public class RcsMessageStore { @NonNull public RcsParticipant createRcsParticipant(String canonicalAddress, @Nullable String alias) throws RcsMessageStoreException { - return new RcsParticipant( - RcsControllerCall.call(iRcs -> iRcs.createRcsParticipant(canonicalAddress, alias))); + return new RcsParticipant(mRcsControllerCall, mRcsControllerCall.call( + iRcs -> iRcs.createRcsParticipant(canonicalAddress, alias))); } } diff --git a/telephony/java/android/telephony/ims/RcsOutgoingMessage.java b/telephony/java/android/telephony/ims/RcsOutgoingMessage.java index 1b4bfe576ac6..e81231bbb557 100644 --- a/telephony/java/android/telephony/ims/RcsOutgoingMessage.java +++ b/telephony/java/android/telephony/ims/RcsOutgoingMessage.java @@ -27,8 +27,8 @@ import java.util.List; * @hide */ public class RcsOutgoingMessage extends RcsMessage { - RcsOutgoingMessage(int id) { - super(id); + RcsOutgoingMessage(RcsControllerCall rcsControllerCall, int id) { + super(rcsControllerCall, id); } /** @@ -45,12 +45,13 @@ public class RcsOutgoingMessage extends RcsMessage { int[] deliveryParticipants; List<RcsOutgoingMessageDelivery> messageDeliveries = new ArrayList<>(); - deliveryParticipants = RcsControllerCall.call( + deliveryParticipants = mRcsControllerCall.call( iRcs -> iRcs.getMessageRecipients(mId)); if (deliveryParticipants != null) { for (Integer deliveryParticipant : deliveryParticipants) { - messageDeliveries.add(new RcsOutgoingMessageDelivery(deliveryParticipant, mId)); + messageDeliveries.add(new RcsOutgoingMessageDelivery( + mRcsControllerCall, deliveryParticipant, mId)); } } diff --git a/telephony/java/android/telephony/ims/RcsOutgoingMessageDelivery.java b/telephony/java/android/telephony/ims/RcsOutgoingMessageDelivery.java index 2db49c6d0dce..af9a84be3a79 100644 --- a/telephony/java/android/telephony/ims/RcsOutgoingMessageDelivery.java +++ b/telephony/java/android/telephony/ims/RcsOutgoingMessageDelivery.java @@ -25,6 +25,7 @@ import android.annotation.WorkerThread; * @hide */ public class RcsOutgoingMessageDelivery { + private final RcsControllerCall mRcsControllerCall; // The participant that this delivery is intended for private final int mRecipientId; // The message this delivery is associated with @@ -35,7 +36,9 @@ public class RcsOutgoingMessageDelivery { * * @hide */ - RcsOutgoingMessageDelivery(int recipientId, int messageId) { + RcsOutgoingMessageDelivery( + RcsControllerCall rcsControllerCall, int recipientId, int messageId) { + mRcsControllerCall = rcsControllerCall; mRecipientId = recipientId; mRcsOutgoingMessageId = messageId; } @@ -49,7 +52,7 @@ public class RcsOutgoingMessageDelivery { */ @WorkerThread public void setDeliveredTimestamp(long deliveredTimestamp) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn(iRcs -> iRcs.setOutgoingDeliveryDeliveredTimestamp( + mRcsControllerCall.callWithNoReturn(iRcs -> iRcs.setOutgoingDeliveryDeliveredTimestamp( mRcsOutgoingMessageId, mRecipientId, deliveredTimestamp)); } @@ -61,7 +64,7 @@ public class RcsOutgoingMessageDelivery { */ @WorkerThread public long getDeliveredTimestamp() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getOutgoingDeliveryDeliveredTimestamp( + return mRcsControllerCall.call(iRcs -> iRcs.getOutgoingDeliveryDeliveredTimestamp( mRcsOutgoingMessageId, mRecipientId)); } @@ -74,7 +77,7 @@ public class RcsOutgoingMessageDelivery { */ @WorkerThread public void setSeenTimestamp(long seenTimestamp) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn(iRcs -> iRcs.setOutgoingDeliverySeenTimestamp( + mRcsControllerCall.callWithNoReturn(iRcs -> iRcs.setOutgoingDeliverySeenTimestamp( mRcsOutgoingMessageId, mRecipientId, seenTimestamp)); } @@ -86,7 +89,7 @@ public class RcsOutgoingMessageDelivery { */ @WorkerThread public long getSeenTimestamp() throws RcsMessageStoreException { - return RcsControllerCall.call( + return mRcsControllerCall.call( iRcs -> iRcs.getOutgoingDeliverySeenTimestamp(mRcsOutgoingMessageId, mRecipientId)); } @@ -99,7 +102,7 @@ public class RcsOutgoingMessageDelivery { */ @WorkerThread public void setStatus(@RcsMessage.RcsMessageStatus int status) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn(iRcs -> iRcs.setOutgoingDeliveryStatus( + mRcsControllerCall.callWithNoReturn(iRcs -> iRcs.setOutgoingDeliveryStatus( mRcsOutgoingMessageId, mRecipientId, status)); } @@ -109,7 +112,7 @@ public class RcsOutgoingMessageDelivery { */ @WorkerThread public @RcsMessage.RcsMessageStatus int getStatus() throws RcsMessageStoreException { - return RcsControllerCall.call( + return mRcsControllerCall.call( iRcs -> iRcs.getOutgoingDeliveryStatus(mRcsOutgoingMessageId, mRecipientId)); } @@ -118,7 +121,7 @@ public class RcsOutgoingMessageDelivery { */ @NonNull public RcsParticipant getRecipient() { - return new RcsParticipant(mRecipientId); + return new RcsParticipant(mRcsControllerCall, mRecipientId); } /** @@ -126,6 +129,6 @@ public class RcsOutgoingMessageDelivery { */ @NonNull public RcsOutgoingMessage getMessage() { - return new RcsOutgoingMessage(mRcsOutgoingMessageId); + return new RcsOutgoingMessage(mRcsControllerCall, mRcsOutgoingMessageId); } } diff --git a/telephony/java/android/telephony/ims/RcsParticipant.java b/telephony/java/android/telephony/ims/RcsParticipant.java index bcf134a71ea3..9ea55bac7833 100644 --- a/telephony/java/android/telephony/ims/RcsParticipant.java +++ b/telephony/java/android/telephony/ims/RcsParticipant.java @@ -24,8 +24,9 @@ import android.annotation.WorkerThread; * @hide */ public class RcsParticipant { + private final RcsControllerCall mRcsControllerCall; // The row ID of this participant in the database - private int mId; + private final int mId; /** * Constructor for {@link com.android.internal.telephony.ims.RcsMessageStoreController} @@ -33,7 +34,8 @@ public class RcsParticipant { * * @hide */ - public RcsParticipant(int id) { + public RcsParticipant(RcsControllerCall rcsControllerCall, int id) { + mRcsControllerCall = rcsControllerCall; mId = id; } @@ -45,7 +47,7 @@ public class RcsParticipant { @Nullable @WorkerThread public String getCanonicalAddress() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getRcsParticipantCanonicalAddress(mId)); + return mRcsControllerCall.call(iRcs -> iRcs.getRcsParticipantCanonicalAddress(mId)); } /** @@ -57,7 +59,7 @@ public class RcsParticipant { @Nullable @WorkerThread public String getAlias() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getRcsParticipantAlias(mId)); + return mRcsControllerCall.call(iRcs -> iRcs.getRcsParticipantAlias(mId)); } /** @@ -70,7 +72,7 @@ public class RcsParticipant { */ @WorkerThread public void setAlias(String alias) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn(iRcs -> iRcs.setRcsParticipantAlias(mId, alias)); + mRcsControllerCall.callWithNoReturn(iRcs -> iRcs.setRcsParticipantAlias(mId, alias)); } /** @@ -82,7 +84,7 @@ public class RcsParticipant { @Nullable @WorkerThread public String getContactId() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getRcsParticipantContactId(mId)); + return mRcsControllerCall.call(iRcs -> iRcs.getRcsParticipantContactId(mId)); } /** @@ -95,7 +97,8 @@ public class RcsParticipant { */ @WorkerThread public void setContactId(String contactId) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn(iRcs -> iRcs.setRcsParticipantContactId(mId, contactId)); + mRcsControllerCall.callWithNoReturn( + iRcs -> iRcs.setRcsParticipantContactId(mId, contactId)); } @Override diff --git a/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEvent.java b/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEvent.java index 61801f3fbf2c..8d2e8f2b1312 100644 --- a/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEvent.java +++ b/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEvent.java @@ -69,8 +69,8 @@ public final class RcsParticipantAliasChangedEvent extends RcsEvent { * @hide - not meant for public use. */ @Override - public void persist() throws RcsMessageStoreException { - RcsControllerCall.call(iRcs -> iRcs.createParticipantAliasChangedEvent( + void persist(RcsControllerCall rcsControllerCall) throws RcsMessageStoreException { + rcsControllerCall.call(iRcs -> iRcs.createParticipantAliasChangedEvent( getTimestamp(), getParticipant().getId(), getNewAlias())); } } diff --git a/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEventDescriptor.java b/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEventDescriptor.java index b29896c12ab8..43b918c3e0f4 100644 --- a/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEventDescriptor.java +++ b/telephony/java/android/telephony/ims/RcsParticipantAliasChangedEventDescriptor.java @@ -41,9 +41,9 @@ public class RcsParticipantAliasChangedEventDescriptor extends RcsEventDescripto @Override @VisibleForTesting(visibility = PROTECTED) - public RcsParticipantAliasChangedEvent createRcsEvent() { + public RcsParticipantAliasChangedEvent createRcsEvent(RcsControllerCall rcsControllerCall) { return new RcsParticipantAliasChangedEvent( - mTimestamp, new RcsParticipant(mParticipantId), mNewAlias); + mTimestamp, new RcsParticipant(rcsControllerCall, mParticipantId), mNewAlias); } public static final @NonNull Creator<RcsParticipantAliasChangedEventDescriptor> CREATOR = diff --git a/telephony/java/android/telephony/ims/RcsParticipantQueryResult.java b/telephony/java/android/telephony/ims/RcsParticipantQueryResult.java index 731c94e22889..0721dfdf5803 100644 --- a/telephony/java/android/telephony/ims/RcsParticipantQueryResult.java +++ b/telephony/java/android/telephony/ims/RcsParticipantQueryResult.java @@ -30,10 +30,13 @@ import java.util.stream.Collectors; * @hide */ public final class RcsParticipantQueryResult { + private final RcsControllerCall mRcsControllerCall; private final RcsParticipantQueryResultParcelable mRcsParticipantQueryResultParcelable; RcsParticipantQueryResult( + RcsControllerCall rcsControllerCall, RcsParticipantQueryResultParcelable rcsParticipantQueryResultParcelable) { + mRcsControllerCall = rcsControllerCall; mRcsParticipantQueryResultParcelable = rcsParticipantQueryResultParcelable; } @@ -55,7 +58,7 @@ public final class RcsParticipantQueryResult { @NonNull public List<RcsParticipant> getParticipants() { return mRcsParticipantQueryResultParcelable.mParticipantIds.stream() - .map(RcsParticipant::new) + .map(participantId -> new RcsParticipant(mRcsControllerCall, participantId)) .collect(Collectors.toList()); } } diff --git a/telephony/java/android/telephony/ims/RcsThread.java b/telephony/java/android/telephony/ims/RcsThread.java index 2495f670d1b6..638b12a36fa7 100644 --- a/telephony/java/android/telephony/ims/RcsThread.java +++ b/telephony/java/android/telephony/ims/RcsThread.java @@ -41,8 +41,14 @@ public abstract class RcsThread { /** * @hide */ - protected RcsThread(int threadId) { + protected final RcsControllerCall mRcsControllerCall; + + /** + * @hide + */ + protected RcsThread(RcsControllerCall rcsControllerCall, int threadId) { mThreadId = threadId; + mRcsControllerCall = rcsControllerCall; } /** @@ -52,7 +58,7 @@ public abstract class RcsThread { @WorkerThread @NonNull public RcsMessageSnippet getSnippet() throws RcsMessageStoreException { - return RcsControllerCall.call(iRcs -> iRcs.getMessageSnippet(mThreadId)); + return mRcsControllerCall.call(iRcs -> iRcs.getMessageSnippet(mThreadId)); } /** @@ -65,8 +71,9 @@ public abstract class RcsThread { public RcsIncomingMessage addIncomingMessage( @NonNull RcsIncomingMessageCreationParams rcsIncomingMessageCreationParams) throws RcsMessageStoreException { - return new RcsIncomingMessage(RcsControllerCall.call(iRcs -> iRcs.addIncomingMessage( - mThreadId, rcsIncomingMessageCreationParams))); + int messageId = mRcsControllerCall.call( + iRcs -> iRcs.addIncomingMessage(mThreadId, rcsIncomingMessageCreationParams)); + return new RcsIncomingMessage(mRcsControllerCall, messageId); } /** @@ -79,10 +86,10 @@ public abstract class RcsThread { public RcsOutgoingMessage addOutgoingMessage( @NonNull RcsOutgoingMessageCreationParams rcsOutgoingMessageCreationParams) throws RcsMessageStoreException { - int messageId = RcsControllerCall.call(iRcs -> iRcs.addOutgoingMessage( + int messageId = mRcsControllerCall.call(iRcs -> iRcs.addOutgoingMessage( mThreadId, rcsOutgoingMessageCreationParams)); - return new RcsOutgoingMessage(messageId); + return new RcsOutgoingMessage(mRcsControllerCall, messageId); } /** @@ -93,7 +100,7 @@ public abstract class RcsThread { */ @WorkerThread public void deleteMessage(@NonNull RcsMessage rcsMessage) throws RcsMessageStoreException { - RcsControllerCall.callWithNoReturn( + mRcsControllerCall.callWithNoReturn( iRcs -> iRcs.deleteMessage(rcsMessage.getId(), rcsMessage.isIncoming(), mThreadId, isGroup())); } @@ -109,10 +116,10 @@ public abstract class RcsThread { @WorkerThread @NonNull public RcsMessageQueryResult getMessages() throws RcsMessageStoreException { - RcsMessageQueryParams queryParameters = + RcsMessageQueryParams queryParams = new RcsMessageQueryParams.Builder().setThread(this).build(); - return new RcsMessageQueryResult( - RcsControllerCall.call(iRcs -> iRcs.getMessages(queryParameters))); + return new RcsMessageQueryResult(mRcsControllerCall, + mRcsControllerCall.call(iRcs -> iRcs.getMessages(queryParams))); } /** diff --git a/telephony/java/android/telephony/ims/RcsThreadQueryResult.java b/telephony/java/android/telephony/ims/RcsThreadQueryResult.java index c77bdb32eb7d..3de25de19430 100644 --- a/telephony/java/android/telephony/ims/RcsThreadQueryResult.java +++ b/telephony/java/android/telephony/ims/RcsThreadQueryResult.java @@ -33,9 +33,12 @@ import java.util.stream.Collectors; * @hide */ public final class RcsThreadQueryResult { + private final RcsControllerCall mRcsControllerCall; private final RcsThreadQueryResultParcelable mRcsThreadQueryResultParcelable; - RcsThreadQueryResult(RcsThreadQueryResultParcelable rcsThreadQueryResultParcelable) { + RcsThreadQueryResult(RcsControllerCall rcsControllerCall, + RcsThreadQueryResultParcelable rcsThreadQueryResultParcelable) { + mRcsControllerCall = rcsControllerCall; mRcsThreadQueryResultParcelable = rcsThreadQueryResultParcelable; } @@ -58,8 +61,8 @@ public final class RcsThreadQueryResult { public List<RcsThread> getThreads() { return mRcsThreadQueryResultParcelable.mRcsThreadIds.stream() .map(typeIdPair -> typeIdPair.getType() == THREAD_TYPE_1_TO_1 - ? new Rcs1To1Thread(typeIdPair.getId()) - : new RcsGroupThread(typeIdPair.getId())) + ? new Rcs1To1Thread(mRcsControllerCall, typeIdPair.getId()) + : new RcsGroupThread(mRcsControllerCall, typeIdPair.getId())) .collect(Collectors.toList()); } } diff --git a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadIconChangedEventTest.java b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadIconChangedEventTest.java index e8989424de6d..6c311f99f695 100644 --- a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadIconChangedEventTest.java +++ b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadIconChangedEventTest.java @@ -50,9 +50,7 @@ public class RcsGroupThreadIconChangedEventTest { RcsGroupThreadIconChangedEventDescriptor.CREATOR.createFromParcel(parcel); RcsGroupThreadIconChangedEvent iconChangedEvent = - iconChangedEventDescriptor.createRcsEvent(); - - + iconChangedEventDescriptor.createRcsEvent(null); assertThat(iconChangedEvent.getNewIcon()).isEqualTo(newIconUri); assertThat(iconChangedEvent.getRcsGroupThread().getThreadId()).isEqualTo(1); diff --git a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadNameChangedEventTest.java b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadNameChangedEventTest.java index 356688d4db81..a60dabb023f8 100644 --- a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadNameChangedEventTest.java +++ b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadNameChangedEventTest.java @@ -49,7 +49,7 @@ public class RcsGroupThreadNameChangedEventTest { .createFromParcel(parcel); RcsGroupThreadNameChangedEvent nameChangedEvent = - nameChangedEventDescriptor.createRcsEvent(); + nameChangedEventDescriptor.createRcsEvent(null); assertThat(nameChangedEvent.getNewName()).isEqualTo(newName); assertThat(nameChangedEvent.getRcsGroupThread().getThreadId()).isEqualTo(1); diff --git a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantJoinedEventTest.java b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantJoinedEventTest.java index 572fcb8ffd5e..7b02cb1eaafa 100644 --- a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantJoinedEventTest.java +++ b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantJoinedEventTest.java @@ -48,7 +48,7 @@ public class RcsGroupThreadParticipantJoinedEventTest { .createFromParcel(parcel); RcsGroupThreadParticipantJoinedEvent participantJoinedEvent = - participantJoinedEventDescriptor.createRcsEvent(); + participantJoinedEventDescriptor.createRcsEvent(null); assertThat(participantJoinedEvent.getJoinedParticipant().getId()).isEqualTo(2); assertThat(participantJoinedEvent.getRcsGroupThread().getThreadId()).isEqualTo(1); diff --git a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantLeftEventTest.java b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantLeftEventTest.java index 038b2e8e60e3..51466bd98d60 100644 --- a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantLeftEventTest.java +++ b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantLeftEventTest.java @@ -49,7 +49,7 @@ public class RcsGroupThreadParticipantLeftEventTest { .createFromParcel(parcel); RcsGroupThreadParticipantLeftEvent participantLeftEvent = - participantLeftEventDescriptor.createRcsEvent(); + participantLeftEventDescriptor.createRcsEvent(null); assertThat(participantLeftEvent.getRcsGroupThread().getThreadId()).isEqualTo(1); assertThat(participantLeftEvent.getLeavingParticipant().getId()).isEqualTo(2); diff --git a/tests/RcsTests/src/com/android/tests/ims/RcsParticipantAliasChangedEventTest.java b/tests/RcsTests/src/com/android/tests/ims/RcsParticipantAliasChangedEventTest.java index 283c71b38eef..56830dff1ce5 100644 --- a/tests/RcsTests/src/com/android/tests/ims/RcsParticipantAliasChangedEventTest.java +++ b/tests/RcsTests/src/com/android/tests/ims/RcsParticipantAliasChangedEventTest.java @@ -48,7 +48,7 @@ public class RcsParticipantAliasChangedEventTest { .createFromParcel(parcel); RcsParticipantAliasChangedEvent aliasChangedEvent = - aliasChangedEventDescriptor.createRcsEvent(); + aliasChangedEventDescriptor.createRcsEvent(null); assertThat(aliasChangedEvent.getParticipant().getId()).isEqualTo(mParticipantId); assertThat(aliasChangedEvent.getNewAlias()).isEqualTo(NEW_ALIAS); diff --git a/tests/RcsTests/src/com/android/tests/ims/RcsThreadQueryParamsTest.java b/tests/RcsTests/src/com/android/tests/ims/RcsThreadQueryParamsTest.java index fb51bdaa88a5..7a3e384020a1 100644 --- a/tests/RcsTests/src/com/android/tests/ims/RcsThreadQueryParamsTest.java +++ b/tests/RcsTests/src/com/android/tests/ims/RcsThreadQueryParamsTest.java @@ -34,7 +34,7 @@ public class RcsThreadQueryParamsTest { @Test public void testCanUnparcel() { - RcsParticipant rcsParticipant = new RcsParticipant(1); + RcsParticipant rcsParticipant = new RcsParticipant(null, 1); RcsThreadQueryParams rcsThreadQueryParams = new RcsThreadQueryParams.Builder() .setThreadType(THREAD_TYPE_GROUP) .setParticipant(rcsParticipant) |