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

Commit 3c69ca62 authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Pipe through SipTransport IBinder interface

Add SipTransport IBinder interface to the ImsFeatureContainer
and expose it to the relevant FeatureConnections.

Test: atest ImsCommonTests
Merged-In: Id2380928382627ae55d3bdb7a40dcdf2852505fd
Change-Id: Id2380928382627ae55d3bdb7a40dcdf2852505fd
parent e482d456
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.os.RemoteException;
import android.telephony.TelephonyManager;
import android.telephony.ims.aidl.IImsConfig;
import android.telephony.ims.aidl.IImsRegistration;
import android.telephony.ims.aidl.ISipTransport;
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.util.Log;
@@ -49,13 +50,16 @@ public abstract class FeatureConnection {
    protected long mFeatureCapabilities;
    private final IImsRegistration mRegistrationBinder;
    private final IImsConfig mConfigBinder;
    private final ISipTransport mSipTransportBinder;
    protected final Object mLock = new Object();

    public FeatureConnection(Context context, int slotId, IImsConfig c, IImsRegistration r) {
    public FeatureConnection(Context context, int slotId, IImsConfig c, IImsRegistration r,
            ISipTransport s) {
        mSlotId = slotId;
        mContext = context;
        mRegistrationBinder = r;
        mConfigBinder = c;
        mSipTransportBinder = s;
    }

    protected TelephonyManager getTelephonyManager() {
@@ -124,6 +128,10 @@ public abstract class FeatureConnection {
        return mConfigBinder;
    }

    public @Nullable ISipTransport getSipTransport() {
        return mSipTransportBinder;
    }

    @VisibleForTesting
    public void checkServiceIsReady() throws RemoteException {
        if (!sImsSupportedOnDevice) {
+1 −1
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ public class FeatureConnector<U extends FeatureUpdates> {
        public void imsFeatureCreated(ImsFeatureContainer c) {
            log("imsFeatureCreated: " + c);
            synchronized (mLock) {
                mManager.associate(c.imsFeature, c.imsConfig, c.imsRegistration);
                mManager.associate(c);
                mManager.updateFeatureCapabilities(c.getCapabilities());
                mDisconnectedReason = null;
            }
+2 −4
Original line number Diff line number Diff line
@@ -16,10 +16,7 @@

package com.android.ims;

import android.os.IBinder;
import android.telephony.ims.ImsService;
import android.telephony.ims.aidl.IImsConfig;
import android.telephony.ims.aidl.IImsRegistration;
import android.telephony.ims.feature.ImsFeature;

import com.android.ims.internal.IImsServiceFeatureCallback;
@@ -50,8 +47,9 @@ public interface FeatureUpdates {
    /**
     * Associate this Manager instance with the IMS Binder interfaces specified. This is usually
     * done by creating a FeatureConnection instance with these interfaces.
     * @param container Contains all of the related interfaces attached to a specific ImsFeature.
     */
    void associate(IBinder feature, IImsConfig c, IImsRegistration r);
    void associate(ImsFeatureContainer container);

    /**
     * Invalidate the previously associated Binder interfaces set in {@link #associate}.
+13 −7
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.app.PendingIntent;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.IBinder;
import android.os.Message;
import android.os.PersistableBundle;
import android.os.RemoteException;
@@ -48,6 +47,7 @@ import android.telephony.ims.aidl.IImsMmTelFeature;
import android.telephony.ims.aidl.IImsRegistration;
import android.telephony.ims.aidl.IImsRegistrationCallback;
import android.telephony.ims.aidl.IImsSmsListener;
import android.telephony.ims.aidl.ISipTransport;
import android.telephony.ims.feature.CapabilityChangeRequest;
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.feature.MmTelFeature;
@@ -225,7 +225,7 @@ public class ImsManager implements FeatureUpdates {
    @VisibleForTesting
    public interface MmTelFeatureConnectionFactory {
        MmTelFeatureConnection create(Context context, int phoneId, IImsMmTelFeature feature,
                IImsConfig c, IImsRegistration r);
                IImsConfig c, IImsRegistration r, ISipTransport s);
    }

    @VisibleForTesting
@@ -1650,7 +1650,7 @@ public class ImsManager implements FeatureUpdates {
        mBinderCache = new BinderCacheManager<>(ImsManager::getITelephonyInterface);
        // Start off with an empty MmTelFeatureConnection, which will be replaced one an
        // ImsService is available (ImsManager expects a non-null FeatureConnection)
        associate(null, null, null);
        associate(null /*container*/);
    }

    /**
@@ -1669,7 +1669,7 @@ public class ImsManager implements FeatureUpdates {
        mExecutor = Runnable::run;
        mBinderCache = new BinderCacheManager<>(ImsManager::getITelephonyInterface);
        // MmTelFeatureConnection should be replaced for tests with mMmTelFeatureConnectionFactory.
        associate(null, null, null);
        associate(null /*container*/);
    }

    /*
@@ -2438,9 +2438,15 @@ public class ImsManager implements FeatureUpdates {
    }

    @Override
    public void associate(IBinder binder, IImsConfig c, IImsRegistration r) {
    public void associate(ImsFeatureContainer c) {
        if (c == null) {
            mMmTelConnectionRef.set(mMmTelFeatureConnectionFactory.create(
                mContext, mPhoneId, IImsMmTelFeature.Stub.asInterface(binder), c, r));
                    mContext, mPhoneId, null, null, null, null));
        } else {
            mMmTelConnectionRef.set(mMmTelFeatureConnectionFactory.create(
                    mContext, mPhoneId, IImsMmTelFeature.Stub.asInterface(c.imsFeature),
                    c.imsConfig, c.imsRegistration, c.sipTransport));
        }
    }

    @Override
+3 −2
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.telephony.ims.aidl.IImsMmTelFeature;
import android.telephony.ims.aidl.IImsRegistration;
import android.telephony.ims.aidl.IImsRegistrationCallback;
import android.telephony.ims.aidl.IImsSmsListener;
import android.telephony.ims.aidl.ISipTransport;
import android.telephony.ims.feature.CapabilityChangeRequest;
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.feature.MmTelFeature;
@@ -204,8 +205,8 @@ public class MmTelFeatureConnection extends FeatureConnection {
    private final ProvisioningCallbackManager mProvisioningCallbackManager;

    public MmTelFeatureConnection(Context context, int slotId, IImsMmTelFeature f,
            IImsConfig c, IImsRegistration r) {
        super(context, slotId, c, r);
            IImsConfig c, IImsRegistration r, ISipTransport s) {
        super(context, slotId, c, r, s);

        setBinder((f != null) ? f.asBinder() : null);
        mRegistrationCallbackManager = new ImsRegistrationCallbackAdapter(context, mLock);
Loading