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

Commit 3e2e2d66 authored by Leland Miller's avatar Leland Miller Committed by android-build-merger
Browse files

Merge "Use injected instance of RcsControllerCall"

am: f545515e

Change-Id: Id364fe89943027eb1ec9f60b7457126ff8945b16
parents 15df31ba f545515e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -555,7 +555,7 @@ final class SystemServiceRegistry {
                new CachedServiceFetcher<RcsManager>() {
                    @Override
                    public RcsManager createService(ContextImpl ctx) {
                        return new RcsManager();
                        return new RcsManager(ctx.getOuterContext());
                    }
                });

+6 −5
Original line number Diff line number Diff line
@@ -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)));
    }
}
+11 −11
Original line number Diff line number Diff line
@@ -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> {
+1 −1
Original line number Diff line number Diff line
@@ -40,5 +40,5 @@ public abstract class RcsEvent {
     *
     * @hide
     */
    abstract void persist() throws RcsMessageStoreException;
    abstract void persist(RcsControllerCall rcsControllerCall) throws RcsMessageStoreException;
}
+1 −1
Original line number Diff line number Diff line
@@ -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();
Loading