Loading src/java/com/android/internal/telephony/PhoneConfigurationManager.java +44 −22 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import com.android.telephony.Rlog; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; import java.util.Optional; Loading Loading @@ -97,7 +98,9 @@ public class PhoneConfigurationManager { private static PhoneConfigurationManager sInstance = null; private final Context mContext; private PhoneCapability mStaticCapability; // Static capability retrieved from the modem - may be null in the case where no info has been // retrieved yet. private PhoneCapability mStaticCapability = null; private final Set<Integer> mSlotsSupportingSimultaneousCellularCalls = new HashSet<>(3); private final Set<Integer> mSubIdsSupportingSimultaneousCellularCalls = new HashSet<>(3); private final HashSet<Consumer<Set<Integer>>> mSimultaneousCellularCallingListeners = Loading Loading @@ -151,8 +154,6 @@ public class PhoneConfigurationManager { mFeatureFlags = featureFlags; // TODO: send commands to modem once interface is ready. mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); //initialize with default, it'll get updated when RADIO is ON/AVAILABLE mStaticCapability = getDefaultCapability(); mRadioConfig = RadioConfig.getInstance(); mHandler = new ConfigManagerHandler(); mPhoneStatusMap = new HashMap<>(); Loading Loading @@ -256,7 +257,8 @@ public class PhoneConfigurationManager { boolean halSupportSimulCalling = mRadioConfig != null && mRadioConfig.getRadioConfigProxy(null).getVersion().greaterOrEqual( RIL.RADIO_HAL_VERSION_2_2) && getPhoneCount() > 1 && mStaticCapability.getMaxActiveVoiceSubscriptions() > 1; && getPhoneCount() > 1 && getCellularStaticPhoneCapability().getMaxActiveVoiceSubscriptions() > 1; // Register for simultaneous calling support changes in the modem if the HAL supports it if (halSupportSimulCalling) { updateSimultaneousCallingSupport(); Loading Loading @@ -318,7 +320,7 @@ public class PhoneConfigurationManager { log("Unable to add phoneStatus to cache. " + "No phone object provided for event " + msg.what); } getStaticPhoneCapability(); updateRadioCapability(); break; case EVENT_SWITCH_DSDS_CONFIG_DONE: ar = (AsyncResult) msg.obj; Loading @@ -343,7 +345,7 @@ public class PhoneConfigurationManager { case EVENT_GET_PHONE_CAPABILITY_DONE: ar = (AsyncResult) msg.obj; if (ar != null && ar.exception == null) { mStaticCapability = (PhoneCapability) ar.result; setStaticPhoneCapability((PhoneCapability) ar.result); notifyCapabilityChanged(); for (Listener l : mListeners) { l.onPhoneCapabilityChanged(); Loading Loading @@ -376,12 +378,12 @@ public class PhoneConfigurationManager { } ar = (AsyncResult) msg.obj; if (ar != null && ar.exception == null) { int[] returnedIntArray = (int[]) ar.result; List<Integer> returnedArrayList = (List<Integer>) ar.result; if (!mSlotsSupportingSimultaneousCellularCalls.isEmpty()) { mSlotsSupportingSimultaneousCellularCalls.clear(); } int maxValidPhoneSlot = getPhoneCount() - 1; for (int i : returnedIntArray) { for (int i : returnedArrayList) { if (i < 0 || i > maxValidPhoneSlot) { loge("Invalid slot supporting DSDA =" + i + ". Disabling DSDA."); mSlotsSupportingSimultaneousCellularCalls.clear(); Loading Loading @@ -534,20 +536,42 @@ public class PhoneConfigurationManager { } /** * get static overall phone capabilities for all phones. * @return static overall phone capabilities for all phones, including voice overrides. */ public synchronized PhoneCapability getStaticPhoneCapability() { if (getDefaultCapability().equals(mStaticCapability)) { log("getStaticPhoneCapability: sending the request for getting PhoneCapability"); Message callback = Message.obtain( mHandler, EVENT_GET_PHONE_CAPABILITY_DONE); mRadioConfig.getPhoneCapability(callback); boolean isDefault = mStaticCapability == null; PhoneCapability caps = isDefault ? getDefaultCapability() : mStaticCapability; caps = maybeOverrideMaxActiveVoiceSubscriptions(caps); log("getStaticPhoneCapability: isDefault=" + isDefault + ", caps=" + caps); return caps; } mStaticCapability = maybeOverrideMaxActiveVoiceSubscriptions(mStaticCapability); log("getStaticPhoneCapability: mStaticCapability " + mStaticCapability); /** * @return untouched capabilities returned from the modem */ private synchronized PhoneCapability getCellularStaticPhoneCapability() { log("getCellularStaticPhoneCapability: mStaticCapability " + mStaticCapability); return mStaticCapability; } /** * Caches the static PhoneCapability returned by the modem */ public synchronized void setStaticPhoneCapability(PhoneCapability capability) { log("setStaticPhoneCapability: mStaticCapability " + capability); mStaticCapability = capability; } /** * Query the modem to return its static PhoneCapability and cache it */ @VisibleForTesting public void updateRadioCapability() { log("updateRadioCapability: sending the request for getting PhoneCapability"); Message callback = Message.obtain(mHandler, EVENT_GET_PHONE_CAPABILITY_DONE); mRadioConfig.getPhoneCapability(callback); } /** * get configuration related status of each phone. */ Loading @@ -556,12 +580,11 @@ public class PhoneConfigurationManager { } public int getNumberOfModemsWithSimultaneousDataConnections() { return mStaticCapability.getMaxActiveDataSubscriptions(); return getStaticPhoneCapability().getMaxActiveDataSubscriptions(); } public int getNumberOfModemsWithSimultaneousVoiceConnections() { return maybeOverrideMaxActiveVoiceSubscriptions(mStaticCapability) .getMaxActiveVoiceSubscriptions(); return getStaticPhoneCapability().getMaxActiveVoiceSubscriptions(); } public boolean isVirtualDsdaEnabled() { Loading Loading @@ -591,8 +614,7 @@ public class PhoneConfigurationManager { } private void notifyCapabilityChanged() { mNotifier.notifyPhoneCapabilityChanged(maybeOverrideMaxActiveVoiceSubscriptions( mStaticCapability)); mNotifier.notifyPhoneCapabilityChanged(getStaticPhoneCapability()); } /** Loading src/java/com/android/internal/telephony/RadioConfigIndicationAidl.java +5 −3 Original line number Diff line number Diff line Loading @@ -17,14 +17,14 @@ package com.android.internal.telephony; import android.os.AsyncResult; import android.os.RemoteException; import android.os.Trace; import com.android.internal.telephony.uicc.IccSlotStatus; import com.android.telephony.Rlog; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; /** * This class is the AIDL implementation of IRadioConfigIndication interface. Loading Loading @@ -58,9 +58,11 @@ public class RadioConfigIndicationAidl extends */ @Override public void onSimultaneousCallingSupportChanged(int[] enabledLogicalSlots) { ArrayList<Integer> ret = RILUtils.primitiveArrayToArrayList(enabledLogicalSlots); List<Integer> ret = (enabledLogicalSlots == null) ? Collections.emptyList() : RILUtils.primitiveArrayToArrayList(enabledLogicalSlots); logd("onSimultaneousCallingSupportChanged: enabledLogicalSlots = " + ret); if (mRadioConfig.mSimultaneousCallingSupportStatusRegistrant != null) { logd("onSimultaneousCallingSupportChanged: notifying registrant"); mRadioConfig.mSimultaneousCallingSupportStatusRegistrant.notifyRegistrant( new AsyncResult(null, ret, null)); } Loading tests/telephonytests/src/com/android/internal/telephony/PhoneConfigurationManagerTest.java +11 −8 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ import org.mockito.ArgumentCaptor; import org.mockito.Mockito; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; Loading Loading @@ -157,6 +158,7 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { init(1); assertEquals(PhoneCapability.DEFAULT_SSSS_CAPABILITY, mPcm.getStaticPhoneCapability()); mPcm.updateRadioCapability(); setAndVerifyStaticCapability(PhoneCapability.DEFAULT_DSDS_CAPABILITY); } Loading @@ -171,6 +173,7 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { .setMaxActiveVoiceSubscriptions(2) .build(); mPcm.updateRadioCapability(); ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class); verify(mMockRadioConfig).getPhoneCapability(captor.capture()); Message msg = captor.getValue(); Loading @@ -188,7 +191,7 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { init(2); mPcm.updateSimultaneousCallingSupport(); int[] enabledLogicalSlots = {0, 1}; List<Integer> enabledLogicalSlots = Arrays.asList(0, 1); ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class); verify(mMockRadioConfig).updateSimultaneousCallingSupport(captor.capture()); Message msg = captor.getValue(); Loading @@ -209,7 +212,7 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { mPcm.updateSimultaneousCallingSupport(); // Have the modem send invalid phone slots -1 and 5: int[] invalidEnabledLogicalSlots = {-1, 5}; List<Integer> invalidEnabledLogicalSlots = Arrays.asList(-1, 5); ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class); verify(mMockRadioConfig).updateSimultaneousCallingSupport(captor.capture()); Message msg = captor.getValue(); Loading Loading @@ -245,14 +248,14 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { mPcm.registerForSimultaneousCellularCallingSlotsChanged(newSlots -> cachedSimultaneousCallingSlots[0] = newSlots); mPcm.getStaticPhoneCapability(); mPcm.updateRadioCapability(); setAndVerifyStaticCapability(STATIC_DSDA_CAPABILITY); ArgumentCaptor<SubscriptionManager.OnSubscriptionsChangedListener> cBCaptor = ArgumentCaptor.forClass(SubscriptionManager.OnSubscriptionsChangedListener.class); verify(mMockRegistryManager).addOnSubscriptionsChangedListener(cBCaptor.capture(), any()); processAllMessages(); int[] enabledLogicalSlots = {0, 1}; List<Integer> enabledLogicalSlots = Arrays.asList(0, 1); HashSet<Integer> expectedSlots = new HashSet<>(2); for (int i : enabledLogicalSlots) { expectedSlots.add(i); Loading Loading @@ -296,7 +299,7 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { // Simultaneous calling enabled mPcm.updateSimultaneousCallingSupport(); int[] enabledLogicalSlots = {0, 1}; List<Integer> enabledLogicalSlots = Arrays.asList(0, 1); ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class); verify(mMockRadioConfig).updateSimultaneousCallingSupport(captor.capture()); Message msg = captor.getValue(); Loading @@ -318,7 +321,7 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { // Simultaneous Calling Disabled mPcm.updateSimultaneousCallingSupport(); int[] disabled = {}; List<Integer> disabled = List.of(); captor = ArgumentCaptor.forClass(Message.class); verify(mMockRadioConfig, times(2)).updateSimultaneousCallingSupport(captor.capture()); msg = captor.getAllValues().get(1); Loading Loading @@ -346,13 +349,13 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { // Set the capability to DSDA mode to register listener, which will also trigger // simultaneous calling evaluation mPcm.getCurrentPhoneCapability(); mPcm.updateRadioCapability(); setAndVerifyStaticCapability(STATIC_DSDA_CAPABILITY); ArgumentCaptor<SubscriptionManager.OnSubscriptionsChangedListener> cBCaptor = ArgumentCaptor.forClass(SubscriptionManager.OnSubscriptionsChangedListener.class); verify(mMockRegistryManager).addOnSubscriptionsChangedListener(cBCaptor.capture(), any()); int[] enabledLogicalSlots = {0, 1}; List<Integer> enabledLogicalSlots = Arrays.asList(0, 1); ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class); verify(mMockRadioConfig).updateSimultaneousCallingSupport(captor.capture()); Message msg = captor.getValue(); Loading tests/telephonytests/src/com/android/internal/telephony/SimultaneousCallingTrackerTest.java +11 −10 Original line number Diff line number Diff line Loading @@ -172,7 +172,7 @@ public class SimultaneousCallingTrackerTest extends TelephonyTest { } private void setAndVerifyStaticCapability(PhoneCapability capability) { mPcm.getCurrentPhoneCapability(); mPcm.updateRadioCapability(); ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class); verify(mMockRadioConfig).getPhoneCapability(captor.capture()); Message msg = captor.getValue(); Loading @@ -185,7 +185,8 @@ public class SimultaneousCallingTrackerTest extends TelephonyTest { } private void setAndVerifySlotsSupportingSimultaneousCellularCalling(int[] enabledLogicalSlots) { private void setAndVerifySlotsSupportingSimultaneousCellularCalling( List<Integer> enabledLogicalSlots) { ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class); verify(mMockRadioConfig).updateSimultaneousCallingSupport(captor.capture()); Message msg = captor.getValue(); Loading Loading @@ -241,7 +242,7 @@ public class SimultaneousCallingTrackerTest extends TelephonyTest { init(2); setAndVerifyStaticCapability(STATIC_DSDA_CAPABILITY); int[] enabledLogicalSlots = {0, 1}; List<Integer> enabledLogicalSlots = Arrays.asList(0, 1); setAndVerifySlotsSupportingSimultaneousCellularCalling(enabledLogicalSlots); // Trigger onSubscriptionsChanged by updating the subscription ID of a phone slot: Loading @@ -264,7 +265,7 @@ public class SimultaneousCallingTrackerTest extends TelephonyTest { setAndVerifyStaticCapability(STATIC_DSDA_CAPABILITY); // Have the modem inform telephony that only phone slot 0 supports DSDA: int[] enabledLogicalSlots = {0}; List<Integer> enabledLogicalSlots = List.of(0); setAndVerifySlotsSupportingSimultaneousCellularCalling(enabledLogicalSlots); // Trigger onSubscriptionsChanged by updating the subscription ID of a phone slot: Loading @@ -286,7 +287,7 @@ public class SimultaneousCallingTrackerTest extends TelephonyTest { init(2); setAndVerifyStaticCapability(STATIC_DSDA_CAPABILITY); int[] enabledLogicalSlots = {0, 1}; List<Integer> enabledLogicalSlots = Arrays.asList(0, 1); setAndVerifySlotsSupportingSimultaneousCellularCalling(enabledLogicalSlots); // Trigger onSubscriptionsChanged by updating the subscription ID of a phone slot: Loading @@ -309,7 +310,7 @@ public class SimultaneousCallingTrackerTest extends TelephonyTest { init(2); setAndVerifyStaticCapability(STATIC_DSDA_CAPABILITY); int[] enabledLogicalSlots = {0, 1}; List<Integer> enabledLogicalSlots = Arrays.asList(0, 1); setAndVerifySlotsSupportingSimultaneousCellularCalling(enabledLogicalSlots); // Trigger onSubscriptionsChanged by updating the subscription ID of a phone slot: Loading Loading @@ -356,7 +357,7 @@ public class SimultaneousCallingTrackerTest extends TelephonyTest { init(2); setAndVerifyStaticCapability(STATIC_DSDA_CAPABILITY); int[] enabledLogicalSlots = {0, 1}; List<Integer> enabledLogicalSlots = Arrays.asList(0, 1); setAndVerifySlotsSupportingSimultaneousCellularCalling(enabledLogicalSlots); // Trigger onSubscriptionsChanged by updating the subscription ID of a phone slot: Loading Loading @@ -384,7 +385,7 @@ public class SimultaneousCallingTrackerTest extends TelephonyTest { init(2); setAndVerifyStaticCapability(STATIC_DSDA_CAPABILITY); int[] enabledLogicalSlots = {0}; List<Integer> enabledLogicalSlots = List.of(0); setAndVerifySlotsSupportingSimultaneousCellularCalling(enabledLogicalSlots); // Trigger onSubscriptionsChanged by updating the subscription ID of a phone slot: Loading Loading @@ -416,7 +417,7 @@ public class SimultaneousCallingTrackerTest extends TelephonyTest { init(2); setAndVerifyStaticCapability(STATIC_DSDA_CAPABILITY); int[] enabledLogicalSlots = {0, 1}; List<Integer> enabledLogicalSlots = Arrays.asList(0, 1); setAndVerifySlotsSupportingSimultaneousCellularCalling(enabledLogicalSlots); // Trigger onSubscriptionsChanged by updating the subscription ID of a phone slot: Loading Loading @@ -449,7 +450,7 @@ public class SimultaneousCallingTrackerTest extends TelephonyTest { init(3); setAndVerifyStaticCapability(STATIC_DSDA_CAPABILITY); int[] enabledLogicalSlots = {0, 1}; List<Integer> enabledLogicalSlots = Arrays.asList(0, 1); setAndVerifySlotsSupportingSimultaneousCellularCalling(enabledLogicalSlots); // Trigger onSubscriptionsChanged by updating the subscription ID of a phone slot: Loading Loading
src/java/com/android/internal/telephony/PhoneConfigurationManager.java +44 −22 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import com.android.telephony.Rlog; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.NoSuchElementException; import java.util.Optional; Loading Loading @@ -97,7 +98,9 @@ public class PhoneConfigurationManager { private static PhoneConfigurationManager sInstance = null; private final Context mContext; private PhoneCapability mStaticCapability; // Static capability retrieved from the modem - may be null in the case where no info has been // retrieved yet. private PhoneCapability mStaticCapability = null; private final Set<Integer> mSlotsSupportingSimultaneousCellularCalls = new HashSet<>(3); private final Set<Integer> mSubIdsSupportingSimultaneousCellularCalls = new HashSet<>(3); private final HashSet<Consumer<Set<Integer>>> mSimultaneousCellularCallingListeners = Loading Loading @@ -151,8 +154,6 @@ public class PhoneConfigurationManager { mFeatureFlags = featureFlags; // TODO: send commands to modem once interface is ready. mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); //initialize with default, it'll get updated when RADIO is ON/AVAILABLE mStaticCapability = getDefaultCapability(); mRadioConfig = RadioConfig.getInstance(); mHandler = new ConfigManagerHandler(); mPhoneStatusMap = new HashMap<>(); Loading Loading @@ -256,7 +257,8 @@ public class PhoneConfigurationManager { boolean halSupportSimulCalling = mRadioConfig != null && mRadioConfig.getRadioConfigProxy(null).getVersion().greaterOrEqual( RIL.RADIO_HAL_VERSION_2_2) && getPhoneCount() > 1 && mStaticCapability.getMaxActiveVoiceSubscriptions() > 1; && getPhoneCount() > 1 && getCellularStaticPhoneCapability().getMaxActiveVoiceSubscriptions() > 1; // Register for simultaneous calling support changes in the modem if the HAL supports it if (halSupportSimulCalling) { updateSimultaneousCallingSupport(); Loading Loading @@ -318,7 +320,7 @@ public class PhoneConfigurationManager { log("Unable to add phoneStatus to cache. " + "No phone object provided for event " + msg.what); } getStaticPhoneCapability(); updateRadioCapability(); break; case EVENT_SWITCH_DSDS_CONFIG_DONE: ar = (AsyncResult) msg.obj; Loading @@ -343,7 +345,7 @@ public class PhoneConfigurationManager { case EVENT_GET_PHONE_CAPABILITY_DONE: ar = (AsyncResult) msg.obj; if (ar != null && ar.exception == null) { mStaticCapability = (PhoneCapability) ar.result; setStaticPhoneCapability((PhoneCapability) ar.result); notifyCapabilityChanged(); for (Listener l : mListeners) { l.onPhoneCapabilityChanged(); Loading Loading @@ -376,12 +378,12 @@ public class PhoneConfigurationManager { } ar = (AsyncResult) msg.obj; if (ar != null && ar.exception == null) { int[] returnedIntArray = (int[]) ar.result; List<Integer> returnedArrayList = (List<Integer>) ar.result; if (!mSlotsSupportingSimultaneousCellularCalls.isEmpty()) { mSlotsSupportingSimultaneousCellularCalls.clear(); } int maxValidPhoneSlot = getPhoneCount() - 1; for (int i : returnedIntArray) { for (int i : returnedArrayList) { if (i < 0 || i > maxValidPhoneSlot) { loge("Invalid slot supporting DSDA =" + i + ". Disabling DSDA."); mSlotsSupportingSimultaneousCellularCalls.clear(); Loading Loading @@ -534,20 +536,42 @@ public class PhoneConfigurationManager { } /** * get static overall phone capabilities for all phones. * @return static overall phone capabilities for all phones, including voice overrides. */ public synchronized PhoneCapability getStaticPhoneCapability() { if (getDefaultCapability().equals(mStaticCapability)) { log("getStaticPhoneCapability: sending the request for getting PhoneCapability"); Message callback = Message.obtain( mHandler, EVENT_GET_PHONE_CAPABILITY_DONE); mRadioConfig.getPhoneCapability(callback); boolean isDefault = mStaticCapability == null; PhoneCapability caps = isDefault ? getDefaultCapability() : mStaticCapability; caps = maybeOverrideMaxActiveVoiceSubscriptions(caps); log("getStaticPhoneCapability: isDefault=" + isDefault + ", caps=" + caps); return caps; } mStaticCapability = maybeOverrideMaxActiveVoiceSubscriptions(mStaticCapability); log("getStaticPhoneCapability: mStaticCapability " + mStaticCapability); /** * @return untouched capabilities returned from the modem */ private synchronized PhoneCapability getCellularStaticPhoneCapability() { log("getCellularStaticPhoneCapability: mStaticCapability " + mStaticCapability); return mStaticCapability; } /** * Caches the static PhoneCapability returned by the modem */ public synchronized void setStaticPhoneCapability(PhoneCapability capability) { log("setStaticPhoneCapability: mStaticCapability " + capability); mStaticCapability = capability; } /** * Query the modem to return its static PhoneCapability and cache it */ @VisibleForTesting public void updateRadioCapability() { log("updateRadioCapability: sending the request for getting PhoneCapability"); Message callback = Message.obtain(mHandler, EVENT_GET_PHONE_CAPABILITY_DONE); mRadioConfig.getPhoneCapability(callback); } /** * get configuration related status of each phone. */ Loading @@ -556,12 +580,11 @@ public class PhoneConfigurationManager { } public int getNumberOfModemsWithSimultaneousDataConnections() { return mStaticCapability.getMaxActiveDataSubscriptions(); return getStaticPhoneCapability().getMaxActiveDataSubscriptions(); } public int getNumberOfModemsWithSimultaneousVoiceConnections() { return maybeOverrideMaxActiveVoiceSubscriptions(mStaticCapability) .getMaxActiveVoiceSubscriptions(); return getStaticPhoneCapability().getMaxActiveVoiceSubscriptions(); } public boolean isVirtualDsdaEnabled() { Loading Loading @@ -591,8 +614,7 @@ public class PhoneConfigurationManager { } private void notifyCapabilityChanged() { mNotifier.notifyPhoneCapabilityChanged(maybeOverrideMaxActiveVoiceSubscriptions( mStaticCapability)); mNotifier.notifyPhoneCapabilityChanged(getStaticPhoneCapability()); } /** Loading
src/java/com/android/internal/telephony/RadioConfigIndicationAidl.java +5 −3 Original line number Diff line number Diff line Loading @@ -17,14 +17,14 @@ package com.android.internal.telephony; import android.os.AsyncResult; import android.os.RemoteException; import android.os.Trace; import com.android.internal.telephony.uicc.IccSlotStatus; import com.android.telephony.Rlog; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; /** * This class is the AIDL implementation of IRadioConfigIndication interface. Loading Loading @@ -58,9 +58,11 @@ public class RadioConfigIndicationAidl extends */ @Override public void onSimultaneousCallingSupportChanged(int[] enabledLogicalSlots) { ArrayList<Integer> ret = RILUtils.primitiveArrayToArrayList(enabledLogicalSlots); List<Integer> ret = (enabledLogicalSlots == null) ? Collections.emptyList() : RILUtils.primitiveArrayToArrayList(enabledLogicalSlots); logd("onSimultaneousCallingSupportChanged: enabledLogicalSlots = " + ret); if (mRadioConfig.mSimultaneousCallingSupportStatusRegistrant != null) { logd("onSimultaneousCallingSupportChanged: notifying registrant"); mRadioConfig.mSimultaneousCallingSupportStatusRegistrant.notifyRegistrant( new AsyncResult(null, ret, null)); } Loading
tests/telephonytests/src/com/android/internal/telephony/PhoneConfigurationManagerTest.java +11 −8 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ import org.mockito.ArgumentCaptor; import org.mockito.Mockito; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; Loading Loading @@ -157,6 +158,7 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { init(1); assertEquals(PhoneCapability.DEFAULT_SSSS_CAPABILITY, mPcm.getStaticPhoneCapability()); mPcm.updateRadioCapability(); setAndVerifyStaticCapability(PhoneCapability.DEFAULT_DSDS_CAPABILITY); } Loading @@ -171,6 +173,7 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { .setMaxActiveVoiceSubscriptions(2) .build(); mPcm.updateRadioCapability(); ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class); verify(mMockRadioConfig).getPhoneCapability(captor.capture()); Message msg = captor.getValue(); Loading @@ -188,7 +191,7 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { init(2); mPcm.updateSimultaneousCallingSupport(); int[] enabledLogicalSlots = {0, 1}; List<Integer> enabledLogicalSlots = Arrays.asList(0, 1); ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class); verify(mMockRadioConfig).updateSimultaneousCallingSupport(captor.capture()); Message msg = captor.getValue(); Loading @@ -209,7 +212,7 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { mPcm.updateSimultaneousCallingSupport(); // Have the modem send invalid phone slots -1 and 5: int[] invalidEnabledLogicalSlots = {-1, 5}; List<Integer> invalidEnabledLogicalSlots = Arrays.asList(-1, 5); ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class); verify(mMockRadioConfig).updateSimultaneousCallingSupport(captor.capture()); Message msg = captor.getValue(); Loading Loading @@ -245,14 +248,14 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { mPcm.registerForSimultaneousCellularCallingSlotsChanged(newSlots -> cachedSimultaneousCallingSlots[0] = newSlots); mPcm.getStaticPhoneCapability(); mPcm.updateRadioCapability(); setAndVerifyStaticCapability(STATIC_DSDA_CAPABILITY); ArgumentCaptor<SubscriptionManager.OnSubscriptionsChangedListener> cBCaptor = ArgumentCaptor.forClass(SubscriptionManager.OnSubscriptionsChangedListener.class); verify(mMockRegistryManager).addOnSubscriptionsChangedListener(cBCaptor.capture(), any()); processAllMessages(); int[] enabledLogicalSlots = {0, 1}; List<Integer> enabledLogicalSlots = Arrays.asList(0, 1); HashSet<Integer> expectedSlots = new HashSet<>(2); for (int i : enabledLogicalSlots) { expectedSlots.add(i); Loading Loading @@ -296,7 +299,7 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { // Simultaneous calling enabled mPcm.updateSimultaneousCallingSupport(); int[] enabledLogicalSlots = {0, 1}; List<Integer> enabledLogicalSlots = Arrays.asList(0, 1); ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class); verify(mMockRadioConfig).updateSimultaneousCallingSupport(captor.capture()); Message msg = captor.getValue(); Loading @@ -318,7 +321,7 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { // Simultaneous Calling Disabled mPcm.updateSimultaneousCallingSupport(); int[] disabled = {}; List<Integer> disabled = List.of(); captor = ArgumentCaptor.forClass(Message.class); verify(mMockRadioConfig, times(2)).updateSimultaneousCallingSupport(captor.capture()); msg = captor.getAllValues().get(1); Loading Loading @@ -346,13 +349,13 @@ public class PhoneConfigurationManagerTest extends TelephonyTest { // Set the capability to DSDA mode to register listener, which will also trigger // simultaneous calling evaluation mPcm.getCurrentPhoneCapability(); mPcm.updateRadioCapability(); setAndVerifyStaticCapability(STATIC_DSDA_CAPABILITY); ArgumentCaptor<SubscriptionManager.OnSubscriptionsChangedListener> cBCaptor = ArgumentCaptor.forClass(SubscriptionManager.OnSubscriptionsChangedListener.class); verify(mMockRegistryManager).addOnSubscriptionsChangedListener(cBCaptor.capture(), any()); int[] enabledLogicalSlots = {0, 1}; List<Integer> enabledLogicalSlots = Arrays.asList(0, 1); ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class); verify(mMockRadioConfig).updateSimultaneousCallingSupport(captor.capture()); Message msg = captor.getValue(); Loading
tests/telephonytests/src/com/android/internal/telephony/SimultaneousCallingTrackerTest.java +11 −10 Original line number Diff line number Diff line Loading @@ -172,7 +172,7 @@ public class SimultaneousCallingTrackerTest extends TelephonyTest { } private void setAndVerifyStaticCapability(PhoneCapability capability) { mPcm.getCurrentPhoneCapability(); mPcm.updateRadioCapability(); ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class); verify(mMockRadioConfig).getPhoneCapability(captor.capture()); Message msg = captor.getValue(); Loading @@ -185,7 +185,8 @@ public class SimultaneousCallingTrackerTest extends TelephonyTest { } private void setAndVerifySlotsSupportingSimultaneousCellularCalling(int[] enabledLogicalSlots) { private void setAndVerifySlotsSupportingSimultaneousCellularCalling( List<Integer> enabledLogicalSlots) { ArgumentCaptor<Message> captor = ArgumentCaptor.forClass(Message.class); verify(mMockRadioConfig).updateSimultaneousCallingSupport(captor.capture()); Message msg = captor.getValue(); Loading Loading @@ -241,7 +242,7 @@ public class SimultaneousCallingTrackerTest extends TelephonyTest { init(2); setAndVerifyStaticCapability(STATIC_DSDA_CAPABILITY); int[] enabledLogicalSlots = {0, 1}; List<Integer> enabledLogicalSlots = Arrays.asList(0, 1); setAndVerifySlotsSupportingSimultaneousCellularCalling(enabledLogicalSlots); // Trigger onSubscriptionsChanged by updating the subscription ID of a phone slot: Loading @@ -264,7 +265,7 @@ public class SimultaneousCallingTrackerTest extends TelephonyTest { setAndVerifyStaticCapability(STATIC_DSDA_CAPABILITY); // Have the modem inform telephony that only phone slot 0 supports DSDA: int[] enabledLogicalSlots = {0}; List<Integer> enabledLogicalSlots = List.of(0); setAndVerifySlotsSupportingSimultaneousCellularCalling(enabledLogicalSlots); // Trigger onSubscriptionsChanged by updating the subscription ID of a phone slot: Loading @@ -286,7 +287,7 @@ public class SimultaneousCallingTrackerTest extends TelephonyTest { init(2); setAndVerifyStaticCapability(STATIC_DSDA_CAPABILITY); int[] enabledLogicalSlots = {0, 1}; List<Integer> enabledLogicalSlots = Arrays.asList(0, 1); setAndVerifySlotsSupportingSimultaneousCellularCalling(enabledLogicalSlots); // Trigger onSubscriptionsChanged by updating the subscription ID of a phone slot: Loading @@ -309,7 +310,7 @@ public class SimultaneousCallingTrackerTest extends TelephonyTest { init(2); setAndVerifyStaticCapability(STATIC_DSDA_CAPABILITY); int[] enabledLogicalSlots = {0, 1}; List<Integer> enabledLogicalSlots = Arrays.asList(0, 1); setAndVerifySlotsSupportingSimultaneousCellularCalling(enabledLogicalSlots); // Trigger onSubscriptionsChanged by updating the subscription ID of a phone slot: Loading Loading @@ -356,7 +357,7 @@ public class SimultaneousCallingTrackerTest extends TelephonyTest { init(2); setAndVerifyStaticCapability(STATIC_DSDA_CAPABILITY); int[] enabledLogicalSlots = {0, 1}; List<Integer> enabledLogicalSlots = Arrays.asList(0, 1); setAndVerifySlotsSupportingSimultaneousCellularCalling(enabledLogicalSlots); // Trigger onSubscriptionsChanged by updating the subscription ID of a phone slot: Loading Loading @@ -384,7 +385,7 @@ public class SimultaneousCallingTrackerTest extends TelephonyTest { init(2); setAndVerifyStaticCapability(STATIC_DSDA_CAPABILITY); int[] enabledLogicalSlots = {0}; List<Integer> enabledLogicalSlots = List.of(0); setAndVerifySlotsSupportingSimultaneousCellularCalling(enabledLogicalSlots); // Trigger onSubscriptionsChanged by updating the subscription ID of a phone slot: Loading Loading @@ -416,7 +417,7 @@ public class SimultaneousCallingTrackerTest extends TelephonyTest { init(2); setAndVerifyStaticCapability(STATIC_DSDA_CAPABILITY); int[] enabledLogicalSlots = {0, 1}; List<Integer> enabledLogicalSlots = Arrays.asList(0, 1); setAndVerifySlotsSupportingSimultaneousCellularCalling(enabledLogicalSlots); // Trigger onSubscriptionsChanged by updating the subscription ID of a phone slot: Loading Loading @@ -449,7 +450,7 @@ public class SimultaneousCallingTrackerTest extends TelephonyTest { init(3); setAndVerifyStaticCapability(STATIC_DSDA_CAPABILITY); int[] enabledLogicalSlots = {0, 1}; List<Integer> enabledLogicalSlots = Arrays.asList(0, 1); setAndVerifySlotsSupportingSimultaneousCellularCalling(enabledLogicalSlots); // Trigger onSubscriptionsChanged by updating the subscription ID of a phone slot: Loading