Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f0ffaf9 authored by Leland Miller's avatar Leland Miller Committed by android-build-merger
Browse files

Merge "Add calling package parameter to IRcs methods"

am: 017d7b58

Change-Id: I8ad891352f0003ea8524780080d0fd53222219e1
parents a489dfde 017d7b58
Loading
Loading
Loading
Loading
+8 −3
Original line number Original line Diff line number Diff line
@@ -56,7 +56,9 @@ public class Rcs1To1Thread extends RcsThread {
     */
     */
    @WorkerThread
    @WorkerThread
    public long getFallbackThreadId() throws RcsMessageStoreException {
    public long getFallbackThreadId() throws RcsMessageStoreException {
        return mRcsControllerCall.call(iRcs -> iRcs.get1To1ThreadFallbackThreadId(mThreadId));
        return mRcsControllerCall.call(
                (iRcs, callingPackage) -> iRcs.get1To1ThreadFallbackThreadId(mThreadId,
                        callingPackage));
    }
    }


    /**
    /**
@@ -70,7 +72,8 @@ public class Rcs1To1Thread extends RcsThread {
    @WorkerThread
    @WorkerThread
    public void setFallbackThreadId(long fallbackThreadId) throws RcsMessageStoreException {
    public void setFallbackThreadId(long fallbackThreadId) throws RcsMessageStoreException {
        mRcsControllerCall.callWithNoReturn(
        mRcsControllerCall.callWithNoReturn(
                iRcs -> iRcs.set1To1ThreadFallbackThreadId(mThreadId, fallbackThreadId));
                (iRcs, callingPackage) -> iRcs.set1To1ThreadFallbackThreadId(mThreadId,
                        fallbackThreadId, callingPackage));
    }
    }


    /**
    /**
@@ -82,6 +85,8 @@ public class Rcs1To1Thread extends RcsThread {
    public RcsParticipant getRecipient() throws RcsMessageStoreException {
    public RcsParticipant getRecipient() throws RcsMessageStoreException {
        return new RcsParticipant(
        return new RcsParticipant(
                mRcsControllerCall,
                mRcsControllerCall,
                mRcsControllerCall.call(iRcs -> iRcs.get1To1ThreadOtherParticipantId(mThreadId)));
                mRcsControllerCall.call(
                        (iRcs, callingPackage) -> iRcs.get1To1ThreadOtherParticipantId(mThreadId,
                                callingPackage)));
    }
    }
}
}
+5 −5
Original line number Original line Diff line number Diff line
@@ -40,7 +40,7 @@ class RcsControllerCall {
        }
        }


        try {
        try {
            return serviceCall.methodOnIRcs(iRcs);
            return serviceCall.methodOnIRcs(iRcs, mContext.getOpPackageName());
        } catch (RemoteException exception) {
        } catch (RemoteException exception) {
            throw new RcsMessageStoreException(exception.getMessage());
            throw new RcsMessageStoreException(exception.getMessage());
        }
        }
@@ -48,17 +48,17 @@ class RcsControllerCall {


    void callWithNoReturn(RcsServiceCallWithNoReturn serviceCall)
    void callWithNoReturn(RcsServiceCallWithNoReturn serviceCall)
            throws RcsMessageStoreException {
            throws RcsMessageStoreException {
        call(iRcs -> {
        call((iRcs, callingPackage) -> {
            serviceCall.methodOnIRcs(iRcs);
            serviceCall.methodOnIRcs(iRcs, callingPackage);
            return null;
            return null;
        });
        });
    }
    }


    interface RcsServiceCall<R> {
    interface RcsServiceCall<R> {
        R methodOnIRcs(IRcs iRcs) throws RemoteException;
        R methodOnIRcs(IRcs iRcs, String callingPackage) throws RemoteException;
    }
    }


    interface RcsServiceCallWithNoReturn {
    interface RcsServiceCallWithNoReturn {
        void methodOnIRcs(IRcs iRcs) throws RemoteException;
        void methodOnIRcs(IRcs iRcs, String callingPackage) throws RemoteException;
    }
    }
}
}
+45 −22
Original line number Original line Diff line number Diff line
@@ -137,7 +137,9 @@ public class RcsFileTransferPart {
     */
     */
    @WorkerThread
    @WorkerThread
    public void setFileTransferSessionId(String sessionId) throws RcsMessageStoreException {
    public void setFileTransferSessionId(String sessionId) throws RcsMessageStoreException {
        mRcsControllerCall.callWithNoReturn(iRcs -> iRcs.setFileTransferSessionId(mId, sessionId));
        mRcsControllerCall.callWithNoReturn(
                (iRcs, callingPackage) -> iRcs.setFileTransferSessionId(mId, sessionId,
                        callingPackage));
    }
    }


    /**
    /**
@@ -146,7 +148,8 @@ public class RcsFileTransferPart {
     */
     */
    @WorkerThread
    @WorkerThread
    public String getFileTransferSessionId() throws RcsMessageStoreException {
    public String getFileTransferSessionId() throws RcsMessageStoreException {
        return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferSessionId(mId));
        return mRcsControllerCall.call(
                (iRcs, callingPackage) -> iRcs.getFileTransferSessionId(mId, callingPackage));
    }
    }


    /**
    /**
@@ -159,7 +162,8 @@ public class RcsFileTransferPart {
    @WorkerThread
    @WorkerThread
    public void setContentUri(Uri contentUri) throws RcsMessageStoreException {
    public void setContentUri(Uri contentUri) throws RcsMessageStoreException {
        mRcsControllerCall.callWithNoReturn(
        mRcsControllerCall.callWithNoReturn(
                iRcs -> iRcs.setFileTransferContentUri(mId, contentUri));
                (iRcs, callingPackage) -> iRcs.setFileTransferContentUri(mId, contentUri,
                        callingPackage));
    }
    }


    /**
    /**
@@ -169,7 +173,8 @@ public class RcsFileTransferPart {
    @Nullable
    @Nullable
    @WorkerThread
    @WorkerThread
    public Uri getContentUri() throws RcsMessageStoreException {
    public Uri getContentUri() throws RcsMessageStoreException {
        return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferContentUri(mId));
        return mRcsControllerCall.call(
                (iRcs, callingPackage) -> iRcs.getFileTransferContentUri(mId, callingPackage));
    }
    }


    /**
    /**
@@ -182,7 +187,8 @@ public class RcsFileTransferPart {
    @WorkerThread
    @WorkerThread
    public void setContentMimeType(String contentMimeType) throws RcsMessageStoreException {
    public void setContentMimeType(String contentMimeType) throws RcsMessageStoreException {
        mRcsControllerCall.callWithNoReturn(
        mRcsControllerCall.callWithNoReturn(
                iRcs -> iRcs.setFileTransferContentType(mId, contentMimeType));
                (iRcs, callingPackage) -> iRcs.setFileTransferContentType(mId, contentMimeType,
                        callingPackage));
    }
    }


    /**
    /**
@@ -192,7 +198,8 @@ public class RcsFileTransferPart {
    @WorkerThread
    @WorkerThread
    @Nullable
    @Nullable
    public String getContentMimeType() throws RcsMessageStoreException {
    public String getContentMimeType() throws RcsMessageStoreException {
        return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferContentType(mId));
        return mRcsControllerCall.call(
                (iRcs, callingPackage) -> iRcs.getFileTransferContentType(mId, callingPackage));
    }
    }


    /**
    /**
@@ -204,7 +211,8 @@ public class RcsFileTransferPart {
    @WorkerThread
    @WorkerThread
    public void setFileSize(long contentLength) throws RcsMessageStoreException {
    public void setFileSize(long contentLength) throws RcsMessageStoreException {
        mRcsControllerCall.callWithNoReturn(
        mRcsControllerCall.callWithNoReturn(
                iRcs -> iRcs.setFileTransferFileSize(mId, contentLength));
                (iRcs, callingPackage) -> iRcs.setFileTransferFileSize(mId, contentLength,
                        callingPackage));
    }
    }


    /**
    /**
@@ -213,7 +221,8 @@ public class RcsFileTransferPart {
     */
     */
    @WorkerThread
    @WorkerThread
    public long getFileSize() throws RcsMessageStoreException {
    public long getFileSize() throws RcsMessageStoreException {
        return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferFileSize(mId));
        return mRcsControllerCall.call(
                (iRcs, callingPackage) -> iRcs.getFileTransferFileSize(mId, callingPackage));
    }
    }


    /**
    /**
@@ -227,7 +236,8 @@ public class RcsFileTransferPart {
    @WorkerThread
    @WorkerThread
    public void setTransferOffset(long transferOffset) throws RcsMessageStoreException {
    public void setTransferOffset(long transferOffset) throws RcsMessageStoreException {
        mRcsControllerCall.callWithNoReturn(
        mRcsControllerCall.callWithNoReturn(
                iRcs -> iRcs.setFileTransferTransferOffset(mId, transferOffset));
                (iRcs, callingPackage) -> iRcs.setFileTransferTransferOffset(mId, transferOffset,
                        callingPackage));
    }
    }


    /**
    /**
@@ -236,7 +246,8 @@ public class RcsFileTransferPart {
     */
     */
    @WorkerThread
    @WorkerThread
    public long getTransferOffset() throws RcsMessageStoreException {
    public long getTransferOffset() throws RcsMessageStoreException {
        return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferTransferOffset(mId));
        return mRcsControllerCall.call(
                (iRcs, callingPackage) -> iRcs.getFileTransferTransferOffset(mId, callingPackage));
    }
    }


    /**
    /**
@@ -248,7 +259,8 @@ public class RcsFileTransferPart {
    @WorkerThread
    @WorkerThread
    public void setFileTransferStatus(@RcsFileTransferStatus int status)
    public void setFileTransferStatus(@RcsFileTransferStatus int status)
            throws RcsMessageStoreException {
            throws RcsMessageStoreException {
        mRcsControllerCall.callWithNoReturn(iRcs -> iRcs.setFileTransferStatus(mId, status));
        mRcsControllerCall.callWithNoReturn(
                (iRcs, callingPackage) -> iRcs.setFileTransferStatus(mId, status, callingPackage));
    }
    }


    /**
    /**
@@ -257,7 +269,8 @@ public class RcsFileTransferPart {
     */
     */
    @WorkerThread
    @WorkerThread
    public @RcsFileTransferStatus int getFileTransferStatus() throws RcsMessageStoreException {
    public @RcsFileTransferStatus int getFileTransferStatus() throws RcsMessageStoreException {
        return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferStatus(mId));
        return mRcsControllerCall.call(
                (iRcs, callingPackage) -> iRcs.getFileTransferStatus(mId, callingPackage));
    }
    }


    /**
    /**
@@ -266,7 +279,8 @@ public class RcsFileTransferPart {
     */
     */
    @WorkerThread
    @WorkerThread
    public int getWidth() throws RcsMessageStoreException {
    public int getWidth() throws RcsMessageStoreException {
        return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferWidth(mId));
        return mRcsControllerCall.call(
                (iRcs, callingPackage) -> iRcs.getFileTransferWidth(mId, callingPackage));
    }
    }


    /**
    /**
@@ -277,7 +291,8 @@ public class RcsFileTransferPart {
     */
     */
    @WorkerThread
    @WorkerThread
    public void setWidth(int width) throws RcsMessageStoreException {
    public void setWidth(int width) throws RcsMessageStoreException {
        mRcsControllerCall.callWithNoReturn(iRcs -> iRcs.setFileTransferWidth(mId, width));
        mRcsControllerCall.callWithNoReturn(
                (iRcs, callingPackage) -> iRcs.setFileTransferWidth(mId, width, callingPackage));
    }
    }


    /**
    /**
@@ -286,7 +301,8 @@ public class RcsFileTransferPart {
     */
     */
    @WorkerThread
    @WorkerThread
    public int getHeight() throws RcsMessageStoreException {
    public int getHeight() throws RcsMessageStoreException {
        return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferHeight(mId));
        return mRcsControllerCall.call(
                (iRcs, callingPackage) -> iRcs.getFileTransferHeight(mId, callingPackage));
    }
    }


    /**
    /**
@@ -297,7 +313,8 @@ public class RcsFileTransferPart {
     */
     */
    @WorkerThread
    @WorkerThread
    public void setHeight(int height) throws RcsMessageStoreException {
    public void setHeight(int height) throws RcsMessageStoreException {
        mRcsControllerCall.callWithNoReturn(iRcs -> iRcs.setFileTransferHeight(mId, height));
        mRcsControllerCall.callWithNoReturn(
                (iRcs, callingPackage) -> iRcs.setFileTransferHeight(mId, height, callingPackage));
    }
    }


    /**
    /**
@@ -306,7 +323,8 @@ public class RcsFileTransferPart {
     */
     */
    @WorkerThread
    @WorkerThread
    public long getLength() throws RcsMessageStoreException {
    public long getLength() throws RcsMessageStoreException {
        return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferLength(mId));
        return mRcsControllerCall.call(
                (iRcs, callingPackage) -> iRcs.getFileTransferLength(mId, callingPackage));
    }
    }


    /**
    /**
@@ -317,7 +335,8 @@ public class RcsFileTransferPart {
     */
     */
    @WorkerThread
    @WorkerThread
    public void setLength(long length) throws RcsMessageStoreException {
    public void setLength(long length) throws RcsMessageStoreException {
        mRcsControllerCall.callWithNoReturn(iRcs -> iRcs.setFileTransferLength(mId, length));
        mRcsControllerCall.callWithNoReturn(
                (iRcs, callingPackage) -> iRcs.setFileTransferLength(mId, length, callingPackage));
    }
    }


    /**
    /**
@@ -327,7 +346,8 @@ public class RcsFileTransferPart {
     */
     */
    @WorkerThread
    @WorkerThread
    public Uri getPreviewUri() throws RcsMessageStoreException {
    public Uri getPreviewUri() throws RcsMessageStoreException {
        return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferPreviewUri(mId));
        return mRcsControllerCall.call(
                (iRcs, callingPackage) -> iRcs.getFileTransferPreviewUri(mId, callingPackage));
    }
    }


    /**
    /**
@@ -339,7 +359,8 @@ public class RcsFileTransferPart {
    @WorkerThread
    @WorkerThread
    public void setPreviewUri(Uri previewUri) throws RcsMessageStoreException {
    public void setPreviewUri(Uri previewUri) throws RcsMessageStoreException {
        mRcsControllerCall.callWithNoReturn(
        mRcsControllerCall.callWithNoReturn(
                iRcs -> iRcs.setFileTransferPreviewUri(mId, previewUri));
                (iRcs, callingPackage) -> iRcs.setFileTransferPreviewUri(mId, previewUri,
                        callingPackage));
    }
    }


    /**
    /**
@@ -348,7 +369,8 @@ public class RcsFileTransferPart {
     */
     */
    @WorkerThread
    @WorkerThread
    public String getPreviewMimeType() throws RcsMessageStoreException {
    public String getPreviewMimeType() throws RcsMessageStoreException {
        return mRcsControllerCall.call(iRcs -> iRcs.getFileTransferPreviewType(mId));
        return mRcsControllerCall.call(
                (iRcs, callingPackage) -> iRcs.getFileTransferPreviewType(mId, callingPackage));
    }
    }


    /**
    /**
@@ -360,6 +382,7 @@ public class RcsFileTransferPart {
    @WorkerThread
    @WorkerThread
    public void setPreviewMimeType(String previewMimeType) throws RcsMessageStoreException {
    public void setPreviewMimeType(String previewMimeType) throws RcsMessageStoreException {
        mRcsControllerCall.callWithNoReturn(
        mRcsControllerCall.callWithNoReturn(
                iRcs -> iRcs.setFileTransferPreviewType(mId, previewMimeType));
                (iRcs, callingPackage) -> iRcs.setFileTransferPreviewType(mId, previewMimeType,
                        callingPackage));
    }
    }
}
}
+26 −11
Original line number Original line Diff line number Diff line
@@ -58,7 +58,8 @@ public class RcsGroupThread extends RcsThread {
    @Nullable
    @Nullable
    @WorkerThread
    @WorkerThread
    public String getGroupName() throws RcsMessageStoreException {
    public String getGroupName() throws RcsMessageStoreException {
        return mRcsControllerCall.call(iRcs -> iRcs.getGroupThreadName(mThreadId));
        return mRcsControllerCall.call(
                (iRcs, callingPackage) -> iRcs.getGroupThreadName(mThreadId, callingPackage));
    }
    }


    /**
    /**
@@ -69,7 +70,9 @@ public class RcsGroupThread extends RcsThread {
     */
     */
    @WorkerThread
    @WorkerThread
    public void setGroupName(String groupName) throws RcsMessageStoreException {
    public void setGroupName(String groupName) throws RcsMessageStoreException {
        mRcsControllerCall.callWithNoReturn(iRcs -> iRcs.setGroupThreadName(mThreadId, groupName));
        mRcsControllerCall.callWithNoReturn(
                (iRcs, callingPackage) -> iRcs.setGroupThreadName(mThreadId, groupName,
                        callingPackage));
    }
    }


    /**
    /**
@@ -79,7 +82,8 @@ public class RcsGroupThread extends RcsThread {
     */
     */
    @Nullable
    @Nullable
    public Uri getGroupIcon() throws RcsMessageStoreException {
    public Uri getGroupIcon() throws RcsMessageStoreException {
        return mRcsControllerCall.call(iRcs -> iRcs.getGroupThreadIcon(mThreadId));
        return mRcsControllerCall.call(
                (iRcs, callingPackage) -> iRcs.getGroupThreadIcon(mThreadId, callingPackage));
    }
    }


    /**
    /**
@@ -90,7 +94,9 @@ public class RcsGroupThread extends RcsThread {
     */
     */
    @WorkerThread
    @WorkerThread
    public void setGroupIcon(@Nullable Uri groupIcon) throws RcsMessageStoreException {
    public void setGroupIcon(@Nullable Uri groupIcon) throws RcsMessageStoreException {
        mRcsControllerCall.callWithNoReturn(iRcs -> iRcs.setGroupThreadIcon(mThreadId, groupIcon));
        mRcsControllerCall.callWithNoReturn(
                (iRcs, callingPackage) -> iRcs.setGroupThreadIcon(mThreadId, groupIcon,
                        callingPackage));
    }
    }


    /**
    /**
@@ -102,7 +108,9 @@ public class RcsGroupThread extends RcsThread {
    public RcsParticipant getOwner() throws RcsMessageStoreException {
    public RcsParticipant getOwner() throws RcsMessageStoreException {
        return new RcsParticipant(
        return new RcsParticipant(
                mRcsControllerCall,
                mRcsControllerCall,
                mRcsControllerCall.call(iRcs -> iRcs.getGroupThreadOwner(mThreadId)));
                mRcsControllerCall.call(
                        (iRcs, callingPackage) -> iRcs.getGroupThreadOwner(mThreadId,
                                callingPackage)));
    }
    }


    /**
    /**
@@ -116,7 +124,8 @@ public class RcsGroupThread extends RcsThread {
    @WorkerThread
    @WorkerThread
    public void setOwner(@Nullable RcsParticipant participant) throws RcsMessageStoreException {
    public void setOwner(@Nullable RcsParticipant participant) throws RcsMessageStoreException {
        mRcsControllerCall.callWithNoReturn(
        mRcsControllerCall.callWithNoReturn(
                iRcs -> iRcs.setGroupThreadOwner(mThreadId, participant.getId()));
                (iRcs, callingPackage) -> iRcs.setGroupThreadOwner(mThreadId, participant.getId(),
                        callingPackage));
    }
    }


    /**
    /**
@@ -135,7 +144,8 @@ public class RcsGroupThread extends RcsThread {
        }
        }


        mRcsControllerCall.callWithNoReturn(
        mRcsControllerCall.callWithNoReturn(
                iRcs -> iRcs.addParticipantToGroupThread(mThreadId, participant.getId()));
                (iRcs, callingPackage) -> iRcs.addParticipantToGroupThread(mThreadId,
                        participant.getId(), callingPackage));
    }
    }


    /**
    /**
@@ -152,7 +162,8 @@ public class RcsGroupThread extends RcsThread {
        }
        }


        mRcsControllerCall.callWithNoReturn(
        mRcsControllerCall.callWithNoReturn(
                iRcs -> iRcs.removeParticipantFromGroupThread(mThreadId, participant.getId()));
                (iRcs, callingPackage) -> iRcs.removeParticipantFromGroupThread(mThreadId,
                        participant.getId(), callingPackage));
    }
    }


    /**
    /**
@@ -173,7 +184,8 @@ public class RcsGroupThread extends RcsThread {
        RcsParticipantQueryResult queryResult = new RcsParticipantQueryResult(
        RcsParticipantQueryResult queryResult = new RcsParticipantQueryResult(
                mRcsControllerCall,
                mRcsControllerCall,
                mRcsControllerCall.call(
                mRcsControllerCall.call(
                        iRcs -> iRcs.getParticipants(queryParameters)));
                        (iRcs, callingPackage) -> iRcs.getParticipants(queryParameters,
                                callingPackage)));


        List<RcsParticipant> participantList = queryResult.getParticipants();
        List<RcsParticipant> participantList = queryResult.getParticipants();
        Set<RcsParticipant> participantSet = new LinkedHashSet<>(participantList);
        Set<RcsParticipant> participantSet = new LinkedHashSet<>(participantList);
@@ -189,7 +201,9 @@ public class RcsGroupThread extends RcsThread {
    @Nullable
    @Nullable
    @WorkerThread
    @WorkerThread
    public Uri getConferenceUri() throws RcsMessageStoreException {
    public Uri getConferenceUri() throws RcsMessageStoreException {
        return mRcsControllerCall.call(iRcs -> iRcs.getGroupThreadConferenceUri(mThreadId));
        return mRcsControllerCall.call(
                (iRcs, callingPackage) -> iRcs.getGroupThreadConferenceUri(mThreadId,
                        callingPackage));
    }
    }


    /**
    /**
@@ -203,6 +217,7 @@ public class RcsGroupThread extends RcsThread {
    @WorkerThread
    @WorkerThread
    public void setConferenceUri(Uri conferenceUri) throws RcsMessageStoreException {
    public void setConferenceUri(Uri conferenceUri) throws RcsMessageStoreException {
        mRcsControllerCall.callWithNoReturn(
        mRcsControllerCall.callWithNoReturn(
                iRcs -> iRcs.setGroupThreadConferenceUri(mThreadId, conferenceUri));
                (iRcs, callingPackage) -> iRcs.setGroupThreadConferenceUri(mThreadId, conferenceUri,
                        callingPackage));
    }
    }
}
}
+2 −2
Original line number Original line Diff line number Diff line
@@ -64,8 +64,8 @@ public final class RcsGroupThreadIconChangedEvent extends RcsGroupThreadEvent {
    @Override
    @Override
    void persist(RcsControllerCall rcsControllerCall) throws RcsMessageStoreException {
    void persist(RcsControllerCall rcsControllerCall) throws RcsMessageStoreException {
        // TODO ensure failure throws
        // TODO ensure failure throws
        rcsControllerCall.call(iRcs -> iRcs.createGroupThreadIconChangedEvent(
        rcsControllerCall.call((iRcs, callingPackage) -> iRcs.createGroupThreadIconChangedEvent(
                getTimestamp(), getRcsGroupThread().getThreadId(),
                getTimestamp(), getRcsGroupThread().getThreadId(),
                getOriginatingParticipant().getId(), mNewIcon));
                getOriginatingParticipant().getId(), mNewIcon, callingPackage));
    }
    }
}
}
Loading