Loading src/java/com/android/internal/telephony/satellite/NtnCapabilityResolver.java +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ public class NtnCapabilityResolver { public static void resolveNtnCapability( @NonNull NetworkRegistrationInfo networkRegistrationInfo, int subId) { SatelliteController satelliteController = SatelliteController.getInstance(); List<String> satellitePlmnList = satelliteController.getSatellitePlmnList(); List<String> satellitePlmnList = satelliteController.getSatellitePlmnList(subId); String registeredPlmn = networkRegistrationInfo.getRegisteredPlmn(); for (String satellitePlmn : satellitePlmnList) { if (TextUtils.equals(satellitePlmn, registeredPlmn)) { Loading src/java/com/android/internal/telephony/satellite/SatelliteController.java +19 −20 Original line number Diff line number Diff line Loading @@ -227,7 +227,6 @@ public class SatelliteController extends Handler { @NonNull private final Object mCarrierConfigArrayLock = new Object(); @GuardedBy("mCarrierConfigArrayLock") @NonNull private final SparseArray<PersistableBundle> mCarrierConfigArray = new SparseArray<>(); @NonNull private final List<String> mSatellitePlmnList; /** * @return The singleton instance of SatelliteController. Loading Loading @@ -319,8 +318,6 @@ public class SatelliteController extends Handler { } mSatelliteServicesSupportedByProviders = readSupportedSatelliteServicesFromOverlayConfig(); mSatellitePlmnList = mSatelliteServicesSupportedByProviders.keySet().stream().toList(); updateSupportedSatelliteServicesForActiveSubscriptions(); mCarrierConfigChangeListener = (slotIndex, subId, carrierId, specificCarrierId) -> Loading Loading @@ -1947,11 +1944,18 @@ public class SatelliteController extends Handler { } /** * @param subId Subscription ID. * @return The list of satellite PLMNs used for connecting to satellite networks. */ @NonNull public List<String> getSatellitePlmnList() { return new ArrayList<>(mSatellitePlmnList); public List<String> getSatellitePlmnList(int subId) { synchronized (mSupportedSatelliteServicesLock) { if (mSupportedSatelliteServices.containsKey(subId)) { return new ArrayList<>(mSupportedSatelliteServices.get(subId).keySet()); } else { return new ArrayList<>(); } } } /** Loading Loading @@ -2393,23 +2397,17 @@ public class SatelliteController extends Handler { private void configureSatellitePlmn() { logd("configureSatellitePlmn()"); if (mSatellitePlmnList != null && !mSatellitePlmnList.isEmpty()) { Message onCompleted = obtainMessage( EVENT_SET_ROAMING_PLMN_INFO_DONE, mSatellitePlmnList); Phone[] phones = PhoneFactory.getPhones(); for (Phone phone : phones) { if (phone != null) { // TODO : This command should be sent to only phone/modem whose carrier // supports satellite - next task phone.setSatellitePlmn(onCompleted, mSatellitePlmnList); List<String> satellitePlmns = getSatellitePlmnList(phone.getSubId()); phone.setSatellitePlmn( obtainMessage(EVENT_SET_ROAMING_PLMN_INFO_DONE), satellitePlmns); logd("phone[" + phone.getPhoneId() + "].setSatellitePlmn()"); } else { loge("configureSatellitePlmn: No phone object"); } } } else { logd("mSatellitePlmnList is empty"); } } private void handleSetRoamingPlmnInfoDoneEvent(Message msg) { Loading Loading @@ -2486,6 +2484,7 @@ public class SatelliteController extends Handler { updateCarrierConfig(subId); updateSupportedSatelliteServicesForActiveSubscriptions(); configureSatellitePlmn(); } private void updateCarrierConfig(int subId) { Loading src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java +19 −10 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package com.android.internal.telephony.satellite; import static android.telephony.NetworkRegistrationInfo.FIRST_SERVICE_TYPE; import static android.telephony.NetworkRegistrationInfo.LAST_SERVICE_TYPE; import static java.util.stream.Collectors.joining; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; Loading Loading @@ -316,6 +318,9 @@ public class SatelliteServiceUtils { } } } logd("parseSupportedSatelliteServices: plmn=" + plmn + ", supportedServicesSet=" + supportedServicesSet.stream().map(String::valueOf).collect( joining(","))); supportedServicesMap.put(plmn, supportedServicesSet); } else { loge("parseSupportedSatelliteServices: invalid format input, " Loading Loading @@ -353,17 +358,18 @@ public class SatelliteServiceUtils { + " for plmn=" + plmn); } } logd("parseSupportedSatelliteServices: plmn=" + plmn + ", supportedServicesSet=" + supportedServicesSet.stream().map(String::valueOf).collect( joining(","))); supportedServicesMap.put(plmn, supportedServicesSet); } return supportedServicesMap; } /** * For the PLMN that exists in both {@code providerSupportedServices} and * {@code carrierSupportedServices}, the supported services will be the intersection of the two * sets. For the PLMN that is present in {@code providerSupportedServices} but not in * {@code carrierSupportedServices}, the provider supported services will be used. The rest * will not be used. * For the PLMN that exists in {@code carrierSupportedServices}, the carrier supported services * will be used. For the PLMN that is present in {@code providerSupportedServices} but not in * {@code carrierSupportedServices}, the provider supported services will be used. * * @param providerSupportedServices Satellite provider supported satellite services. * @param carrierSupportedServices Carrier supported satellite services. Loading @@ -379,12 +385,15 @@ public class SatelliteServiceUtils { carrierSupportedServices) { Map<String, Set<Integer>> supportedServicesMap = new HashMap<>(); for (Map.Entry<String, Set<Integer>> entry : providerSupportedServices.entrySet()) { Set<Integer> supportedServices = new HashSet<>(entry.getValue()); if (carrierSupportedServices.containsKey(entry.getKey())) { supportedServices.retainAll(carrierSupportedServices.get(entry.getKey())); if (!entry.getValue().isEmpty()) { supportedServicesMap.put(entry.getKey(), entry.getValue()); } } if (!supportedServices.isEmpty()) { supportedServicesMap.put(entry.getKey(), supportedServices); for (Map.Entry<String, Set<Integer>> entry : carrierSupportedServices.entrySet()) { if (entry.getValue().isEmpty()) { supportedServicesMap.remove(entry.getKey()); } else { supportedServicesMap.put(entry.getKey(), entry.getValue()); } } return supportedServicesMap; Loading tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -258,7 +258,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { mSatelliteController = Mockito.mock(SatelliteController.class); replaceInstance(SatelliteController.class, "sInstance", null, mSatelliteController); doReturn(new ArrayList<>()).when(mSatelliteController).getSatellitePlmnList(); doReturn(new ArrayList<>()).when(mSatelliteController).getSatellitePlmnList(anyInt()); mContextFixture.putResource(R.string.kg_text_message_separator, " \u2014 "); Loading Loading @@ -3261,7 +3261,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { CellIdentityGsm cellIdentity = new CellIdentityGsm(0, 1, 900, 5, "101", "23", "test", "tst", Collections.emptyList()); doReturn(Arrays.asList("10123")).when(mSatelliteController).getSatellitePlmnList(); doReturn(Arrays.asList("10123")).when(mSatelliteController).getSatellitePlmnList(anyInt()); doReturn(satelliteSupportedServiceList).when(mSatelliteController) .getSupportedSatelliteServices(sst.mSubId, "10123"); Loading tests/telephonytests/src/com/android/internal/telephony/satellite/NtnCapabilityResolverTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.doReturn; import android.annotation.NonNull; Loading Loading @@ -75,7 +76,7 @@ public class NtnCapabilityResolverTest extends TelephonyTest { replaceInstance(SatelliteController.class, "sInstance", null, mMockSatelliteController); doReturn(Arrays.asList(SATELLITE_PLMN_ARRAY)) .when(mMockSatelliteController).getSatellitePlmnList(); .when(mMockSatelliteController).getSatellitePlmnList(anyInt()); doReturn(mSatelliteSupportedServiceList).when(mMockSatelliteController) .getSupportedSatelliteServices(SUB_ID, SATELLITE_PLMN); } Loading Loading
src/java/com/android/internal/telephony/satellite/NtnCapabilityResolver.java +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ public class NtnCapabilityResolver { public static void resolveNtnCapability( @NonNull NetworkRegistrationInfo networkRegistrationInfo, int subId) { SatelliteController satelliteController = SatelliteController.getInstance(); List<String> satellitePlmnList = satelliteController.getSatellitePlmnList(); List<String> satellitePlmnList = satelliteController.getSatellitePlmnList(subId); String registeredPlmn = networkRegistrationInfo.getRegisteredPlmn(); for (String satellitePlmn : satellitePlmnList) { if (TextUtils.equals(satellitePlmn, registeredPlmn)) { Loading
src/java/com/android/internal/telephony/satellite/SatelliteController.java +19 −20 Original line number Diff line number Diff line Loading @@ -227,7 +227,6 @@ public class SatelliteController extends Handler { @NonNull private final Object mCarrierConfigArrayLock = new Object(); @GuardedBy("mCarrierConfigArrayLock") @NonNull private final SparseArray<PersistableBundle> mCarrierConfigArray = new SparseArray<>(); @NonNull private final List<String> mSatellitePlmnList; /** * @return The singleton instance of SatelliteController. Loading Loading @@ -319,8 +318,6 @@ public class SatelliteController extends Handler { } mSatelliteServicesSupportedByProviders = readSupportedSatelliteServicesFromOverlayConfig(); mSatellitePlmnList = mSatelliteServicesSupportedByProviders.keySet().stream().toList(); updateSupportedSatelliteServicesForActiveSubscriptions(); mCarrierConfigChangeListener = (slotIndex, subId, carrierId, specificCarrierId) -> Loading Loading @@ -1947,11 +1944,18 @@ public class SatelliteController extends Handler { } /** * @param subId Subscription ID. * @return The list of satellite PLMNs used for connecting to satellite networks. */ @NonNull public List<String> getSatellitePlmnList() { return new ArrayList<>(mSatellitePlmnList); public List<String> getSatellitePlmnList(int subId) { synchronized (mSupportedSatelliteServicesLock) { if (mSupportedSatelliteServices.containsKey(subId)) { return new ArrayList<>(mSupportedSatelliteServices.get(subId).keySet()); } else { return new ArrayList<>(); } } } /** Loading Loading @@ -2393,23 +2397,17 @@ public class SatelliteController extends Handler { private void configureSatellitePlmn() { logd("configureSatellitePlmn()"); if (mSatellitePlmnList != null && !mSatellitePlmnList.isEmpty()) { Message onCompleted = obtainMessage( EVENT_SET_ROAMING_PLMN_INFO_DONE, mSatellitePlmnList); Phone[] phones = PhoneFactory.getPhones(); for (Phone phone : phones) { if (phone != null) { // TODO : This command should be sent to only phone/modem whose carrier // supports satellite - next task phone.setSatellitePlmn(onCompleted, mSatellitePlmnList); List<String> satellitePlmns = getSatellitePlmnList(phone.getSubId()); phone.setSatellitePlmn( obtainMessage(EVENT_SET_ROAMING_PLMN_INFO_DONE), satellitePlmns); logd("phone[" + phone.getPhoneId() + "].setSatellitePlmn()"); } else { loge("configureSatellitePlmn: No phone object"); } } } else { logd("mSatellitePlmnList is empty"); } } private void handleSetRoamingPlmnInfoDoneEvent(Message msg) { Loading Loading @@ -2486,6 +2484,7 @@ public class SatelliteController extends Handler { updateCarrierConfig(subId); updateSupportedSatelliteServicesForActiveSubscriptions(); configureSatellitePlmn(); } private void updateCarrierConfig(int subId) { Loading
src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java +19 −10 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package com.android.internal.telephony.satellite; import static android.telephony.NetworkRegistrationInfo.FIRST_SERVICE_TYPE; import static android.telephony.NetworkRegistrationInfo.LAST_SERVICE_TYPE; import static java.util.stream.Collectors.joining; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; Loading Loading @@ -316,6 +318,9 @@ public class SatelliteServiceUtils { } } } logd("parseSupportedSatelliteServices: plmn=" + plmn + ", supportedServicesSet=" + supportedServicesSet.stream().map(String::valueOf).collect( joining(","))); supportedServicesMap.put(plmn, supportedServicesSet); } else { loge("parseSupportedSatelliteServices: invalid format input, " Loading Loading @@ -353,17 +358,18 @@ public class SatelliteServiceUtils { + " for plmn=" + plmn); } } logd("parseSupportedSatelliteServices: plmn=" + plmn + ", supportedServicesSet=" + supportedServicesSet.stream().map(String::valueOf).collect( joining(","))); supportedServicesMap.put(plmn, supportedServicesSet); } return supportedServicesMap; } /** * For the PLMN that exists in both {@code providerSupportedServices} and * {@code carrierSupportedServices}, the supported services will be the intersection of the two * sets. For the PLMN that is present in {@code providerSupportedServices} but not in * {@code carrierSupportedServices}, the provider supported services will be used. The rest * will not be used. * For the PLMN that exists in {@code carrierSupportedServices}, the carrier supported services * will be used. For the PLMN that is present in {@code providerSupportedServices} but not in * {@code carrierSupportedServices}, the provider supported services will be used. * * @param providerSupportedServices Satellite provider supported satellite services. * @param carrierSupportedServices Carrier supported satellite services. Loading @@ -379,12 +385,15 @@ public class SatelliteServiceUtils { carrierSupportedServices) { Map<String, Set<Integer>> supportedServicesMap = new HashMap<>(); for (Map.Entry<String, Set<Integer>> entry : providerSupportedServices.entrySet()) { Set<Integer> supportedServices = new HashSet<>(entry.getValue()); if (carrierSupportedServices.containsKey(entry.getKey())) { supportedServices.retainAll(carrierSupportedServices.get(entry.getKey())); if (!entry.getValue().isEmpty()) { supportedServicesMap.put(entry.getKey(), entry.getValue()); } } if (!supportedServices.isEmpty()) { supportedServicesMap.put(entry.getKey(), supportedServices); for (Map.Entry<String, Set<Integer>> entry : carrierSupportedServices.entrySet()) { if (entry.getValue().isEmpty()) { supportedServicesMap.remove(entry.getKey()); } else { supportedServicesMap.put(entry.getKey(), entry.getValue()); } } return supportedServicesMap; Loading
tests/telephonytests/src/com/android/internal/telephony/ServiceStateTrackerTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -258,7 +258,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { mSatelliteController = Mockito.mock(SatelliteController.class); replaceInstance(SatelliteController.class, "sInstance", null, mSatelliteController); doReturn(new ArrayList<>()).when(mSatelliteController).getSatellitePlmnList(); doReturn(new ArrayList<>()).when(mSatelliteController).getSatellitePlmnList(anyInt()); mContextFixture.putResource(R.string.kg_text_message_separator, " \u2014 "); Loading Loading @@ -3261,7 +3261,7 @@ public class ServiceStateTrackerTest extends TelephonyTest { CellIdentityGsm cellIdentity = new CellIdentityGsm(0, 1, 900, 5, "101", "23", "test", "tst", Collections.emptyList()); doReturn(Arrays.asList("10123")).when(mSatelliteController).getSatellitePlmnList(); doReturn(Arrays.asList("10123")).when(mSatelliteController).getSatellitePlmnList(anyInt()); doReturn(satelliteSupportedServiceList).when(mSatelliteController) .getSupportedSatelliteServices(sst.mSubId, "10123"); Loading
tests/telephonytests/src/com/android/internal/telephony/satellite/NtnCapabilityResolverTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.doReturn; import android.annotation.NonNull; Loading Loading @@ -75,7 +76,7 @@ public class NtnCapabilityResolverTest extends TelephonyTest { replaceInstance(SatelliteController.class, "sInstance", null, mMockSatelliteController); doReturn(Arrays.asList(SATELLITE_PLMN_ARRAY)) .when(mMockSatelliteController).getSatellitePlmnList(); .when(mMockSatelliteController).getSatellitePlmnList(anyInt()); doReturn(mSatelliteSupportedServiceList).when(mMockSatelliteController) .getSupportedSatelliteServices(SUB_ID, SATELLITE_PLMN); } Loading