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

Commit 48af6040 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6516174 from e3801157 to rvc-release

Change-Id: I8632fd3ad8fea418e2ddcd19585ad921b80a0dce
parents e834845b e3801157
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -767,6 +767,22 @@ public class ImsResolver implements ImsServiceController.ImsServiceControllerCal
        return null;
        return null;
    }
    }


    /**
     * Unregister a previously registered IImsServiceFeatureCallback through
     * {@link #getImsServiceControllerAndListen(int, int, IImsServiceFeatureCallback)} .
     * @param slotId The slot id associated with the ImsFeature.
     * @param feature The {@link ImsFeature.FeatureType}
     * @param callback The callback to be unregistered.
     */
    public void unregisterImsFeatureCallback(int slotId, int feature,
            IImsServiceFeatureCallback callback) {
        ImsServiceController controller = getImsServiceController(slotId, feature);

        if (controller != null) {
            controller.removeImsServiceFeatureCallback(callback);
        }
    }

    // Used for testing only.
    // Used for testing only.
    public boolean overrideImsServiceConfiguration(int slotId, boolean isCarrierService,
    public boolean overrideImsServiceConfiguration(int slotId, boolean isCarrierService,
            Map<Integer, String> featureConfig) {
            Map<Integer, String> featureConfig) {
+16 −7
Original line number Original line Diff line number Diff line
@@ -504,19 +504,28 @@ public class ImsServiceController {
     */
     */
    public void addImsServiceFeatureCallback(IImsServiceFeatureCallback callback) {
    public void addImsServiceFeatureCallback(IImsServiceFeatureCallback callback) {
        mImsStatusCallbacks.add(callback);
        mImsStatusCallbacks.add(callback);
        Set<ImsFeatureConfiguration.FeatureSlotPair> features;
        synchronized (mLock) {
        synchronized (mLock) {
            if (mImsFeatures == null || mImsFeatures.isEmpty()) {
            if (mImsFeatures == null || mImsFeatures.isEmpty()) {
                return;
                return;
            }
            }
            features = new HashSet<>(mImsFeatures);
        }
        // notify the new status callback of the features that are available.
        // notify the new status callback of the features that are available.
        try {
        try {
                for (ImsFeatureConfiguration.FeatureSlotPair i : mImsFeatures) {
            for (ImsFeatureConfiguration.FeatureSlotPair i : features) {
                callback.imsFeatureCreated(i.slotId, i.featureType);
                callback.imsFeatureCreated(i.slotId, i.featureType);
            }
            }
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Log.w(LOG_TAG, "addImsServiceFeatureCallback: exception notifying callback");
            Log.w(LOG_TAG, "addImsServiceFeatureCallback: exception notifying callback");
        }
        }
    }
    }

    /**
     * Removes a previously registered callback if it was associated with this feature.
     */
    public void removeImsServiceFeatureCallback(IImsServiceFeatureCallback callback) {
        mImsStatusCallbacks.remove(callback);
    }
    }


    public void enableIms(int slotId) {
    public void enableIms(int slotId) {
+5 −0
Original line number Original line Diff line number Diff line
@@ -1470,6 +1470,11 @@ public class ImsPhone extends ImsPhoneBase {
        return cfInfo;
        return cfInfo;
    }
    }


    @Override
    public String getLine1Number() {
        return mDefaultPhone.getLine1Number();
    }

    /**
    /**
     * Used to Convert ImsCallForwardInfo[] to CallForwardInfo[].
     * Used to Convert ImsCallForwardInfo[] to CallForwardInfo[].
     * Update received call forward status to default IccRecords.
     * Update received call forward status to default IccRecords.
+0 −5
Original line number Original line Diff line number Diff line
@@ -336,11 +336,6 @@ abstract class ImsPhoneBase extends Phone {
        return null;
        return null;
    }
    }


    @Override
    public String getLine1Number() {
        return null;
    }

    @Override
    @Override
    public String getLine1AlphaTag() {
    public String getLine1AlphaTag() {
        return null;
        return null;
+29 −4
Original line number Original line Diff line number Diff line
@@ -28,7 +28,9 @@ import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager;
import android.os.IBinder;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.RemoteException;
import android.telephony.ims.aidl.IImsRegistration;
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.test.suitebuilder.annotation.SmallTest;
import android.test.suitebuilder.annotation.SmallTest;


import com.android.ims.FeatureConnection;
import com.android.ims.FeatureConnection;
@@ -59,8 +61,8 @@ public class FeatureConnectionTest extends TelephonyTest {
        public boolean isFeatureRemovedCalled = false;
        public boolean isFeatureRemovedCalled = false;
        public int mNewStatus = ImsFeature.STATE_UNAVAILABLE;
        public int mNewStatus = ImsFeature.STATE_UNAVAILABLE;


        TestFeatureConnection(Context context, int slotId, int featureType) {
        TestFeatureConnection(Context context, int slotId) {
            super(context, slotId, featureType);
            super(context, slotId);
            if (!ImsManager.isImsSupportedOnDevice(context)) {
            if (!ImsManager.isImsSupportedOnDevice(context)) {
                sImsSupportedOnDevice = false;
                sImsSupportedOnDevice = false;
            }
            }
@@ -91,6 +93,11 @@ public class FeatureConnectionTest extends TelephonyTest {
            return mFeatureState;
            return mFeatureState;
        }
        }


        @Override
        protected IImsRegistration getRegistrationBinder() {
            return getTestRegistrationBinder();
        }

        public void setFeatureState(int state) {
        public void setFeatureState(int state) {
            mFeatureState = state;
            mFeatureState = state;
        }
        }
@@ -99,6 +106,7 @@ public class FeatureConnectionTest extends TelephonyTest {
    private int mPhoneId;
    private int mPhoneId;
    private TestFeatureConnection mTestFeatureConnection;
    private TestFeatureConnection mTestFeatureConnection;
    @Mock IBinder mBinder;
    @Mock IBinder mBinder;
    @Mock IImsRegistration mRegistrationBinder;


    @Before
    @Before
    public void setUp() throws Exception {
    public void setUp() throws Exception {
@@ -108,8 +116,7 @@ public class FeatureConnectionTest extends TelephonyTest {
        doReturn(null).when(mContext).getMainLooper();
        doReturn(null).when(mContext).getMainLooper();
        doReturn(true).when(mPackageManager).hasSystemFeature(PackageManager.FEATURE_TELEPHONY_IMS);
        doReturn(true).when(mPackageManager).hasSystemFeature(PackageManager.FEATURE_TELEPHONY_IMS);


        mTestFeatureConnection = new TestFeatureConnection(
        mTestFeatureConnection = new TestFeatureConnection(mContext, mPhoneId);
                mContext, mPhoneId, ImsFeature.FEATURE_RCS);
        mTestFeatureConnection.mExecutor = mSimpleExecutor;
        mTestFeatureConnection.mExecutor = mSimpleExecutor;
        mTestFeatureConnection.setBinder(mBinder);
        mTestFeatureConnection.setBinder(mBinder);
    }
    }
@@ -163,6 +170,20 @@ public class FeatureConnectionTest extends TelephonyTest {
        }
        }
    }
    }


    /**
     * Test registration tech callbacks.
     */
    @Test
    @SmallTest
    public void testRegistrationTech() throws Exception {
        when(mRegistrationBinder.getRegistrationTechnology()).thenReturn(
                ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN);

        assertEquals(ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN,
                mTestFeatureConnection.getRegistrationTech());

    }

    /**
    /**
     * Test callback is called when IMS feature created/removed/changed.
     * Test callback is called when IMS feature created/removed/changed.
     */
     */
@@ -192,4 +213,8 @@ public class FeatureConnectionTest extends TelephonyTest {
            throw new AssertionFailedError("testListenerCallback(Changed): " + e);
            throw new AssertionFailedError("testListenerCallback(Changed): " + e);
        }
        }
    }
    }

    private IImsRegistration getTestRegistrationBinder() {
        return mRegistrationBinder;
    }
}
}
Loading