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

Commit d27e4435 authored by Daniel Bright's avatar Daniel Bright
Browse files

Create method to query capability status directly on ImsServices

There was a race case that occurs when an ImsService changes its capability status
and with a call against IsAvailable(capability) within the telephony component which
checks a cache.  This change moves the call in ImsPhoneCallTracker from its internal
cache to instead check the capability status directly within the ImsService.

Bug: 149780842
Test: android.telephony.ims.cts.ImsServiceTest
Change-Id: Ia5329bdb0c2338c9d9b215d74ad1a027fb7f5ba6
parent 01a5ac22
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -2128,6 +2128,26 @@ public class ImsManager implements IFeatureConnector {
        return false;
    }

    public boolean queryMmTelCapabilityStatus(
            @MmTelFeature.MmTelCapabilities.MmTelCapability int capability,
            @ImsRegistrationImplBase.ImsRegistrationTech int radioTech) throws ImsException {
        checkAndThrowExceptionIfServiceUnavailable();

        if (getRegistrationTech() != radioTech)
            return false;

        try {

            MmTelFeature.MmTelCapabilities capabilities =
                    mMmTelFeatureConnection.queryCapabilityStatus();

            return capabilities.isCapable(capability);
        } catch (RemoteException e) {
            throw new ImsException("queryMmTelCapabilityStatus()", e,
                    ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
        }
    }

    public void setRttEnabled(boolean enabled) {
        try {
            if (enabled) {