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

Commit 82e0040a authored by Brad Ebinger's avatar Brad Ebinger
Browse files

MMTEL Compat: Remove VT flag when VT+VoLTE are enabled

Older modems would not batch feature flags together, so they
would be sent down one at a time. If multiple features are
enabled at one time (VT+VoLTE, for example), it would cause
two registrations on the network. This has been fixed with the
ImsService APIs, but we still need to keep this behavior in
the compat layer for older devices.

Bug: 110130897
Test: Manual, check logs during registration for VT+VoLTE
Change-Id: Ibe17ed4277d8d73f1e5feddb5f12947e134c4677
parent 869bf5b0
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import com.android.ims.internal.IImsRegistrationListener;
import com.android.ims.internal.IImsUt;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -80,6 +81,15 @@ public class MmTelFeatureCompatAdapter extends MmTelFeature {
    public static final int FEATURE_DISABLED = 0;
    public static final int FEATURE_ENABLED = 1;

    private static final CapabilityChangeRequest.CapabilityPair VOLTE_CAPABILITY_PAIR =
            new CapabilityChangeRequest.CapabilityPair(
                    MmTelCapabilities.CAPABILITY_TYPE_VOICE,
                    ImsRegistrationImplBase.REGISTRATION_TECH_LTE);
    private static final CapabilityChangeRequest.CapabilityPair VT_CAPABILITY_PAIR =
            new CapabilityChangeRequest.CapabilityPair(
                    MmTelCapabilities.CAPABILITY_TYPE_VIDEO,
                    ImsRegistrationImplBase.REGISTRATION_TECH_LTE);

    private static class ConfigListener extends ImsConfigListener.Stub {

        private final int mCapability;
@@ -348,6 +358,20 @@ public class MmTelFeatureCompatAdapter extends MmTelFeature {
                        });
                latch.await(WAIT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
            }
            // Hack For compatibility purposes: older implementations would ignore the VT feature
            // enabled flag when VoLTE was also enabled on the first time after sub loaded. If we
            // did not ignore the VT feature, it would send multiple registrations to the network
            // (first voice, then voice+video). So, we should only send voice if voice+vt is enabled
            // because they will check to see if VT is enabled separately.
            List<CapabilityChangeRequest.CapabilityPair> enableRequest =
                    request.getCapabilitiesToEnable();
            if (enableRequest.contains(VT_CAPABILITY_PAIR)
                    && enableRequest.contains(VOLTE_CAPABILITY_PAIR)) {
                Log.i(TAG, "changeEnabledCapabilities: VT + VoLTE enable requested - removing VT "
                        + "request");
                enableRequest.remove(VT_CAPABILITY_PAIR);
            }

            // Enable Capabilities
            for (CapabilityChangeRequest.CapabilityPair cap : request.getCapabilitiesToEnable()) {
                CountDownLatch latch = new CountDownLatch(1);