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

Commit d1cb346d authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Make RcsMessageStore a top level API

RcsManager was handling both DB APIs and RcsFeature logic, which
made it confusing. Instead, make RcsMessageStore->RcsMessageManager,
which is a top level API.

Test: Manual
Change-Id: I9b9f96154d0705797cedade3d6cee27719897164
parent 360b2c44
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -507,7 +507,7 @@ java_defaults {
        "telephony/java/android/telephony/ims/aidl/IImsServiceController.aidl",
        "telephony/java/android/telephony/ims/aidl/IImsServiceControllerListener.aidl",
        "telephony/java/android/telephony/ims/aidl/IImsSmsListener.aidl",
        "telephony/java/android/telephony/ims/aidl/IRcs.aidl",
        "telephony/java/android/telephony/ims/aidl/IRcsMessage.aidl",
        "telephony/java/android/telephony/mbms/IMbmsDownloadSessionCallback.aidl",
        "telephony/java/android/telephony/mbms/IMbmsStreamingSessionCallback.aidl",
        "telephony/java/android/telephony/mbms/IMbmsGroupCallSessionCallback.aidl",
+5 −5
Original line number Diff line number Diff line
@@ -149,7 +149,7 @@ import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.euicc.EuiccCardManager;
import android.telephony.euicc.EuiccManager;
import android.telephony.ims.RcsManager;
import android.telephony.ims.RcsMessageManager;
import android.util.ArrayMap;
import android.util.Log;
import android.view.ContextThemeWrapper;
@@ -552,11 +552,11 @@ final class SystemServiceRegistry {
                return new SubscriptionManager(ctx.getOuterContext());
            }});

        registerService(Context.TELEPHONY_RCS_SERVICE, RcsManager.class,
                new CachedServiceFetcher<RcsManager>() {
        registerService(Context.TELEPHONY_RCS_MESSAGE_SERVICE, RcsMessageManager.class,
                new CachedServiceFetcher<RcsMessageManager>() {
                    @Override
                    public RcsManager createService(ContextImpl ctx) {
                        return new RcsManager(ctx.getOuterContext());
                    public RcsMessageManager createService(ContextImpl ctx) {
                        return new RcsMessageManager(ctx.getOuterContext());
                    }
                });

+2 −2
Original line number Diff line number Diff line
@@ -4290,10 +4290,10 @@ public abstract class Context {

    /**
     * Use with {@link #getSystemService(String)} to retrieve an
     * {@link android.telephony.ims.RcsManager}.
     * {@link android.telephony.ims.RcsMessageManager}.
     * @hide
     */
    public static final String TELEPHONY_RCS_SERVICE = "ircs";
    public static final String TELEPHONY_RCS_MESSAGE_SERVICE = "ircsmessage";

     /**
     * Use with {@link #getSystemService(String)} to retrieve an
+11 −9
Original line number Diff line number Diff line
@@ -19,10 +19,11 @@ package android.telephony.ims;
import android.content.Context;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.telephony.ims.aidl.IRcs;
import android.telephony.ims.aidl.IRcsMessage;

/**
 * A wrapper class around RPC calls that {@link RcsMessageStore} APIs to minimize boilerplate code.
 * A wrapper class around RPC calls that {@link RcsMessageManager} APIs to minimize boilerplate
 * code.
 *
 * @hide - not meant for public use
 */
@@ -34,13 +35,14 @@ class RcsControllerCall {
    }

    <R> R call(RcsServiceCall<R> serviceCall) throws RcsMessageStoreException {
        IRcs iRcs = IRcs.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_RCS_SERVICE));
        if (iRcs == null) {
        IRcsMessage iRcsMessage = IRcsMessage.Stub.asInterface(ServiceManager.getService(
                Context.TELEPHONY_RCS_MESSAGE_SERVICE));
        if (iRcsMessage == null) {
            throw new RcsMessageStoreException("Could not connect to RCS storage service");
        }

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

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

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

    interface RcsServiceCallWithNoReturn {
        void methodOnIRcs(IRcs iRcs, String callingPackage) throws RemoteException;
        void methodOnIRcs(IRcsMessage iRcs, String callingPackage) throws RemoteException;
    }
}
+0 −43
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package android.telephony.ims;

import android.annotation.SystemService;
import android.content.Context;

/**
 * The manager class for RCS related utilities.
 *
 * @hide
 */
@SystemService(Context.TELEPHONY_RCS_SERVICE)
public class RcsManager {
    private final RcsMessageStore mRcsMessageStore;

    /**
     * @hide
     */
    public RcsManager(Context context) {
        mRcsMessageStore = new RcsMessageStore(context);
    }

    /**
     * Returns an instance of {@link RcsMessageStore}
     */
    public RcsMessageStore getRcsMessageStore() {
        return mRcsMessageStore;
    }
}
Loading