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

Commit 63a3c763 authored by Brad Ebinger's avatar Brad Ebinger Committed by Automerger Merge Worker
Browse files

Add the ability to return SipTransport implementation if capable am: 0eafb70e am: ac218451

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ims/+/1453735

Change-Id: I62a212331777bd7e92011c7a50a42d8ed034d6b5
parents 753f219a ac218451
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
import android.telephony.TelephonyManager;
import android.telephony.ims.ImsService;
import android.telephony.ims.aidl.IImsConfig;
import android.telephony.ims.aidl.IImsRegistration;
import android.telephony.ims.aidl.ISipTransport;
@@ -183,6 +184,14 @@ public abstract class FeatureConnection {
        }
    }

    public boolean isCapable(@ImsService.ImsServiceCapability long capabilities)
            throws RemoteException {
        if (!isBinderAlive()) {
            throw new RemoteException("isCapable: ImsService is not alive");
        }
        return (getFeatureCapabilties() & capabilities) > 0;
    }

    /**
     * @return an integer describing the current Feature Status, defined in
     * {@link ImsFeature.ImsState}.
+21 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyFrameworkInitializer;
import android.telephony.ims.ImsException;
import android.telephony.ims.ImsService;
import android.telephony.ims.RcsContactUceCapability;
import android.telephony.ims.RegistrationManager;
import android.telephony.ims.aidl.IImsCapabilityCallback;
@@ -34,6 +35,7 @@ import android.telephony.ims.aidl.IImsRcsController;
import android.telephony.ims.aidl.IImsRcsFeature;
import android.telephony.ims.aidl.IImsRegistrationCallback;
import android.telephony.ims.aidl.IRcsFeatureListener;
import android.telephony.ims.aidl.ISipTransport;
import android.telephony.ims.feature.CapabilityChangeRequest;
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.feature.RcsFeature;
@@ -342,6 +344,25 @@ public class RcsFeatureManager implements FeatureUpdates {
            mRcsFeatureConnection.removeCallbackForSubscription(subId, callback);
    }

    public boolean isImsServiceCapable(@ImsService.ImsServiceCapability long capabilities)
            throws ImsException {
        try {
            return mRcsFeatureConnection.isCapable(capabilities);
        } catch (RemoteException e) {
            throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
        }
    }

    /**
     * @return The SipTransport interface if it exists or {@code null} if it does not exist due to
     * the ImsService not supporting it.
     */
    public ISipTransport getSipTransport() throws ImsException {
        if (!isImsServiceCapable(ImsService.CAPABILITY_SIP_DELEGATE_CREATION)) {
            return null;
        }
        return mRcsFeatureConnection.getSipTransport();
    }
    /**
     * Query for the specific capability.
     */