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

Commit 32a2c37c authored by Brad Ebinger's avatar Brad Ebinger Committed by Android (Google) Code Review
Browse files

Merge changes from topic "presubmit-am-978f4d87dcd74b94998b115677f1bbc2"

* changes:
  [automerge] Partial Revert of subId changes in ImsManager 2p: 10fa560e
  Partial Revert of subId changes in ImsManager
parents 65bd11e8 0dabb66f
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -255,6 +255,7 @@ public class ImsManager implements FeatureUpdates {
    @VisibleForTesting
    public interface SubscriptionManagerProxy {
        boolean isValidSubscriptionId(int subId);
        int[] getSubscriptionIds(int slotIndex);
        int getDefaultVoicePhoneId();
        int getIntegerSubscriptionProperty(int subId, String propKey, int defValue);
        void setSubscriptionProperty(int subId, String propKey, String propValue);
@@ -288,6 +289,11 @@ public class ImsManager implements FeatureUpdates {
            return SubscriptionManager.isValidSubscriptionId(subId);
        }

        @Override
        public int[] getSubscriptionIds(int slotIndex) {
            return getSubscriptionManager().getSubscriptionIds(slotIndex);
        }

        @Override
        public int getDefaultVoicePhoneId() {
            return SubscriptionManager.getDefaultVoicePhoneId();
@@ -1406,7 +1412,12 @@ public class ImsManager implements FeatureUpdates {
    }

    private int getSubId() {
        return mMmTelConnectionRef.get().getSubId();
        int[] subIds = mSubscriptionManagerProxy.getSubscriptionIds(mPhoneId);
        int subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
        if (subIds != null && subIds.length >= 1) {
            subId = subIds[0];
        }
        return subId;
    }

    private void setWfcModeInternal(int wfcMode) {
@@ -2774,6 +2785,12 @@ public class ImsManager implements FeatureUpdates {
            throw new ImsException("Service is unavailable",
                    ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
        }
        if (getSubId() != c.getSubId()) {
            logi("Trying to get MmTelFeature when it is still setting up, curr subId=" + getSubId()
                    + ", target subId=" + c.getSubId());
            throw new ImsException("Service is still initializing",
                    ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
        }
        return c;
    }

+1 −0
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ public class ImsManagerTest extends ImsTestBase {

        doReturn(true).when(mSubscriptionManagerProxy).isValidSubscriptionId(anyInt());
        doReturn(mSubId).when(mSubscriptionManagerProxy).getActiveSubscriptionIdList();
        doReturn(mSubId).when(mSubscriptionManagerProxy).getSubscriptionIds(anyInt());
        doReturn(mPhoneId).when(mSubscriptionManagerProxy).getDefaultVoicePhoneId();
        doReturn(-1).when(mSubscriptionManagerProxy).getIntegerSubscriptionProperty(anyInt(),
                anyString(), anyInt());