Loading Android.bp +8 −8 Original line number Diff line number Diff line Loading @@ -82,14 +82,14 @@ java_library { "android.hardware.radio-V1.4-java", "android.hardware.radio-V1.5-java", "android.hardware.radio-V1.6-java", "android.hardware.radio.config-V3-java", "android.hardware.radio.data-V3-java", "android.hardware.radio.ims-V2-java", "android.hardware.radio.messaging-V3-java", "android.hardware.radio.modem-V3-java", "android.hardware.radio.network-V3-java", "android.hardware.radio.sim-V3-java", "android.hardware.radio.voice-V3-java", "android.hardware.radio.config-V4-java", "android.hardware.radio.data-V4-java", "android.hardware.radio.ims-V3-java", "android.hardware.radio.messaging-V4-java", "android.hardware.radio.modem-V4-java", "android.hardware.radio.network-V4-java", "android.hardware.radio.sim-V4-java", "android.hardware.radio.voice-V4-java", "voip-common", "ims-common", "unsupportedappusage", Loading src/java/com/android/internal/telephony/satellite/SatelliteController.java +131 −3 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import static android.telephony.CarrierConfigManager.KEY_CARRIER_SUPPORTED_SATEL import static android.telephony.CarrierConfigManager.KEY_CARRIER_SUPPORTED_SATELLITE_SERVICES_PER_PROVIDER_BUNDLE; import static android.telephony.CarrierConfigManager.KEY_EMERGENCY_CALL_TO_SATELLITE_T911_HANDOVER_TIMEOUT_MILLIS_INT; import static android.telephony.CarrierConfigManager.KEY_EMERGENCY_MESSAGING_SUPPORTED_BOOL; import static android.telephony.CarrierConfigManager.KEY_REGIONAL_SATELLITE_EARFCN_BUNDLE; import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL; import static android.telephony.CarrierConfigManager.KEY_SATELLITE_CONNECTION_HYSTERESIS_SEC_INT; import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL; Loading Loading @@ -141,6 +142,7 @@ import android.telephony.satellite.SatelliteModemEnableRequestAttributes; import android.telephony.satellite.SatelliteSubscriberInfo; import android.telephony.satellite.SatelliteSubscriberProvisionStatus; import android.telephony.satellite.SatelliteSubscriptionInfo; import android.telephony.satellite.SystemSelectionSpecifier; import android.text.TextUtils; import android.util.Log; import android.util.Pair; Loading Loading @@ -299,6 +301,8 @@ public class SatelliteController extends Handler { private static final int EVENT_TERRESTRIAL_NETWORK_AVAILABLE_CHANGED = 55; private static final int EVENT_SET_NETWORK_SELECTION_AUTO_DONE = 56; private static final int EVENT_SIGNAL_STRENGTH_CHANGED = 57; private static final int CMD_UPDATE_SYSTEM_SELECTION_CHANNELS = 58; private static final int EVENT_UPDATE_SYSTEM_SELECTION_CHANNELS_DONE = 59; @NonNull private static SatelliteController sInstance; @NonNull private final Context mContext; Loading Loading @@ -481,6 +485,13 @@ public class SatelliteController extends Handler { * {@code true} for enabled and {@code false} for disabled. */ @NonNull private final Map<Integer, Boolean> mIsSatelliteAttachEnabledForCarrierArrayPerSub = new HashMap<>(); /** Key: subId, value: (key: Regional satellite config Id string, value: Integer * arrays of earfcns in the corresponding regions.) */ @GuardedBy("mRegionalSatelliteEarfcnsLock") @NonNull private final Map<Integer, Map<String, Set<Integer>>> mRegionalSatelliteEarfcns = new HashMap<>(); @NonNull private final Object mRegionalSatelliteEarfcnsLock = new Object(); @NonNull private final FeatureFlags mFeatureFlags; @NonNull private final Object mSatelliteConnectedLock = new Object(); /** Key: Subscription ID; Value: Last satellite connected time */ Loading Loading @@ -1223,6 +1234,17 @@ public class SatelliteController extends Handler { } } private static final class UpdateSystemSelectionChannelsArgument { @NonNull SystemSelectionSpecifier mSelectionSpecifier; @NonNull ResultReceiver mResult; UpdateSystemSelectionChannelsArgument(@NonNull SystemSelectionSpecifier selectionSpecifier, @NonNull ResultReceiver result) { this.mSelectionSpecifier = selectionSpecifier; this.mResult = result; } } /** * Arguments to send to SatelliteTransmissionUpdate registrants */ Loading Loading @@ -2040,6 +2062,29 @@ public class SatelliteController extends Handler { int phoneId = (int) ar.userObj; updateLastNotifiedCarrierRoamingNtnSignalStrengthAndNotify( PhoneFactory.getPhone(phoneId)); break; } case CMD_UPDATE_SYSTEM_SELECTION_CHANNELS: { plogd("CMD_UPDATE_SYSTEM_SELECTION_CHANNELS"); request = (SatelliteControllerHandlerRequest) msg.obj; onCompleted = obtainMessage(EVENT_UPDATE_SYSTEM_SELECTION_CHANNELS_DONE, request); mSatelliteModemInterface.updateSystemSelectionChannels( ((UpdateSystemSelectionChannelsArgument) (request.argument)) .mSelectionSpecifier, onCompleted); break; } case EVENT_UPDATE_SYSTEM_SELECTION_CHANNELS_DONE: { ar = (AsyncResult) msg.obj; request = (SatelliteControllerHandlerRequest) ar.userObj; int error = SatelliteServiceUtils.getSatelliteError( ar, "updateSystemSelectionChannel"); plogd("EVENT_UPDATE_SYSTEM_SELECTION_CHANNELS_DONE = " + error); ((UpdateSystemSelectionChannelsArgument) (request.argument)).mResult.send(error, null); break; } default: Loading Loading @@ -4580,14 +4625,31 @@ public class SatelliteController extends Handler { boolean provisionChanged = false; synchronized (mSatelliteTokenProvisionedLock) { for (SatelliteSubscriberInfo subscriberInfo : newList) { int subId = subscriberInfo.getSubId(); Boolean currentProvisioned = mProvisionedSubscriberId.get(subscriberInfo.getSubscriberId()); if (currentProvisioned != null && currentProvisioned == provisioned) { if (currentProvisioned == null) { currentProvisioned = false; } Boolean isProvisionedInPersistentDb = false; try { isProvisionedInPersistentDb = mSubscriptionManagerService .isSatelliteProvisionedForNonIpDatagram(subId); if (isProvisionedInPersistentDb == null) { isProvisionedInPersistentDb = false; } } catch (IllegalArgumentException | SecurityException ex) { ploge("isSatelliteProvisionedForNonIpDatagram: subId=" + subId + ", ex=" + ex); } if (currentProvisioned == provisioned && isProvisionedInPersistentDb == provisioned) { continue; } provisionChanged = true; mProvisionedSubscriberId.put(subscriberInfo.getSubscriberId(), provisioned); int subId = subscriberInfo.getSubId(); try { mSubscriptionManagerService.setIsSatelliteProvisionedForNonIpDatagram(subId, provisioned); Loading Loading @@ -5183,6 +5245,13 @@ public class SatelliteController extends Handler { KEY_CARRIER_SUPPORTED_SATELLITE_SERVICES_PER_PROVIDER_BUNDLE)); } @NonNull private Map<String, Set<Integer>> readRegionalSatelliteEarfcnsFromCarrierConfig(int subId) { PersistableBundle config = getPersistableBundle(subId); return SatelliteServiceUtils.parseRegionalSatelliteEarfcns( config.getPersistableBundle(KEY_REGIONAL_SATELLITE_EARFCN_BUNDLE)); } @NonNull private PersistableBundle getConfigForSubId(int subId) { PersistableBundle config = null; if (mCarrierConfigManager != null) { Loading @@ -5206,7 +5275,8 @@ public class SatelliteController extends Handler { KEY_SATELLITE_ROAMING_P2P_SMS_INACTIVITY_TIMEOUT_SEC_INT, KEY_SATELLITE_ROAMING_ESOS_INACTIVITY_TIMEOUT_SEC_INT, KEY_SATELLITE_SOS_MAX_DATAGRAM_SIZE, KEY_SATELLITE_SUPPORTED_MSG_APPS_STRING_ARRAY KEY_SATELLITE_SUPPORTED_MSG_APPS_STRING_ARRAY, KEY_REGIONAL_SATELLITE_EARFCN_BUNDLE ); } catch (Exception e) { logw("getConfigForSubId: " + e); Loading Loading @@ -5237,6 +5307,7 @@ public class SatelliteController extends Handler { evaluateCarrierRoamingNtnEligibilityChange(); sendMessageDelayed(obtainMessage(CMD_EVALUATE_ESOS_PROFILES_PRIORITIZATION), mEvaluateEsosProfilesPrioritizationDurationMillis); updateRegionalSatelliteEarfcns(subId); } // imsi, msisdn, default sms subId change Loading Loading @@ -7174,6 +7245,63 @@ public class SatelliteController extends Handler { incrementResultReceiverCount("SC:provisionSatellite"); } /** * Request to update system selection channels. * * @param result The result receiver that returns if the request is successful or * an error code if the request failed. */ public void updateSystemSelectionChannels(@NonNull SystemSelectionSpecifier selectionSpecifier, @NonNull ResultReceiver result) { if (!mFeatureFlags.carrierRoamingNbIotNtn()) { plogd("updateSystemSelectionChannels: " + "carrierRoamingNbIotNtn flag is disabled"); result.send(SATELLITE_RESULT_REQUEST_NOT_SUPPORTED, null); return; } sendRequestAsync(CMD_UPDATE_SYSTEM_SELECTION_CHANNELS, new UpdateSystemSelectionChannelsArgument(selectionSpecifier, result), null); } /** * @param subId Subscription ID. * @return The The map of earfcns with key: regional satellite config Id, * value: set of earfcns in the corresponding regions associated with the {@code subId}. */ @NonNull public Map<String, Set<Integer>> getRegionalSatelliteEarfcns(int subId) { if (!mFeatureFlags.carrierRoamingNbIotNtn()) { logd("getRegionalSatelliteEarfcns: carrierRoamingNbIotNtnFlag is disabled"); return new HashMap<>(); } synchronized (mRegionalSatelliteEarfcnsLock) { if (mRegionalSatelliteEarfcns.containsKey(subId)) { return mRegionalSatelliteEarfcns.get(subId); } else { logd("getRegionalSatelliteEarfcns: Earfcns for subId: " + subId + " not found"); return new HashMap<>(); } } } /** * Update regional satellite earfcn information from carrier config. */ public void updateRegionalSatelliteEarfcns(int subId) { plogd("updateRegionalSatelliteEarfcns with subId " + subId); if (!mFeatureFlags.carrierRoamingNbIotNtn()) { plogd("updateRegionalSatelliteEarfcns: " + "carrierRoamingNbIotNtn flag is disabled"); return; } synchronized (mRegionalSatelliteEarfcnsLock) { mRegionalSatelliteEarfcns.put(subId, readRegionalSatelliteEarfcnsFromCarrierConfig(subId)); } } /** * Deliver the list of deprovisioned satellite subscriber ids. * Loading src/java/com/android/internal/telephony/satellite/SatelliteModemInterface.java +37 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import android.telephony.satellite.SatelliteDatagram; import android.telephony.satellite.SatelliteManager; import android.telephony.satellite.SatelliteManager.SatelliteException; import android.telephony.satellite.SatelliteModemEnableRequestAttributes; import android.telephony.satellite.SystemSelectionSpecifier; import android.telephony.satellite.stub.INtnSignalStrengthConsumer; import android.telephony.satellite.stub.ISatellite; import android.telephony.satellite.stub.ISatelliteCapabilitiesConsumer; Loading Loading @@ -1383,6 +1384,42 @@ public class SatelliteModemInterface { mExponentialBackoff.start(); } /** * Request to update system selection channels * * @param systemSelectionSpecifier system selection specifiers * @param message The Message to send to result of the operation to. */ public void updateSystemSelectionChannels( @NonNull SystemSelectionSpecifier systemSelectionSpecifier, @Nullable Message message) { plogd("updateSystemSelectionChannels: SystemSelectionSpecifier: " + systemSelectionSpecifier.toString()); if (mSatelliteService != null) { try { mSatelliteService.updateSystemSelectionChannels(SatelliteServiceUtils .toSystemSelectionSpecifier(systemSelectionSpecifier), new IIntegerConsumer.Stub() { @Override public void accept(int result) { int error = SatelliteServiceUtils.fromSatelliteError(result); plogd("updateSystemSelectionChannels: " + error); Binder.withCleanCallingIdentity(() -> sendMessageWithResult(message, null, error)); } }); } catch (RemoteException e) { ploge("updateSystemSelectionChannels: RemoteException " + e); sendMessageWithResult(message, null, SatelliteManager.SATELLITE_RESULT_SERVICE_ERROR); } } else { ploge("updateSystemSelectionChannels: Satellite service is unavailable."); sendMessageWithResult(message, null, SatelliteManager.SATELLITE_RESULT_RADIO_NOT_AVAILABLE); } } @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE) protected static void sendMessageWithResult(@NonNull Message message, @Nullable Object result, @SatelliteManager.SatelliteResult int error) { Loading src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java +52 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.telephony.satellite.SatelliteDatagram; import android.telephony.satellite.SatelliteManager; import android.telephony.satellite.SatelliteModemEnableRequestAttributes; import android.telephony.satellite.SatelliteSubscriptionInfo; import android.telephony.satellite.SystemSelectionSpecifier; import android.telephony.satellite.stub.NTRadioTechnology; import android.telephony.satellite.stub.SatelliteModemState; import android.telephony.satellite.stub.SatelliteResult; Loading @@ -53,6 +54,7 @@ import com.android.internal.telephony.PhoneFactory; import com.android.internal.telephony.subscription.SubscriptionManagerService; import com.android.internal.telephony.util.TelephonyUtils; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; Loading Loading @@ -542,6 +544,56 @@ public class SatelliteServiceUtils { return mcc + mnc; } /** * Convert SystemSelectionSpecifier from framework definition to service definition * @param systemSelectionSpecifier The SystemSelectionSpecifier from the framework. * @return The converted SystemSelectionSpecifier for the satellite service. */ @NonNull public static List<android.telephony.satellite.stub .SystemSelectionSpecifier> toSystemSelectionSpecifier( @NonNull SystemSelectionSpecifier systemSelectionSpecifier) { List<android.telephony.satellite.stub.SystemSelectionSpecifier> converted = new ArrayList<>(); android.telephony.satellite.stub.SystemSelectionSpecifier convertedSpecifier = new android.telephony.satellite.stub.SystemSelectionSpecifier(); convertedSpecifier.mMccMnc = systemSelectionSpecifier.getMccMnc(); convertedSpecifier.mBands = systemSelectionSpecifier.getBands().toArray(); convertedSpecifier.mEarfcs = systemSelectionSpecifier.getEarfcs().toArray(); converted.add(convertedSpecifier); return converted; } /** * Expected format of the input dictionary bundle is: * <ul> * <li>Key: Regional satellite config Id string.</li> * <li>Value: Integer arrays of earfcns in the corresponding regions."</li> * </ul> * @return The map of earfcns with key: regional satellite config Id, * value: set of earfcns in the corresponding regions. */ @NonNull public static Map<String, Set<Integer>> parseRegionalSatelliteEarfcns( @Nullable PersistableBundle earfcnsBundle) { Map<String, Set<Integer>> earfcnsMap = new HashMap<>(); if (earfcnsBundle == null || earfcnsBundle.isEmpty()) { logd("parseRegionalSatelliteEarfcns: earfcnsBundle is null or empty"); return earfcnsMap; } for (String configId : earfcnsBundle.keySet()) { Set<Integer> earfcnsSet = new HashSet<>(); for (int earfcn : earfcnsBundle.getIntArray(configId)) { earfcnsSet.add(earfcn); } logd("parseRegionalSatelliteEarfcns: configId = " + configId + ", earfcns =" + earfcnsSet.stream().map(String::valueOf).collect(joining(","))); earfcnsMap.put(configId, earfcnsSet); } return earfcnsMap; } private static void logd(@NonNull String log) { Rlog.d(TAG, log); } Loading tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java +29 −0 Original line number Diff line number Diff line Loading @@ -4569,6 +4569,18 @@ public class SatelliteControllerTest extends TelephonyTest { } } }; TestSubscriptionManager testSubscriptionManager = new TestSubscriptionManager(); doAnswer(invocation -> { testSubscriptionManager.setIsSatelliteProvisionedForNonIpDatagram( invocation.getArgument(0), invocation.getArgument(1)); return null; }).when(mMockSubscriptionManagerService).setIsSatelliteProvisionedForNonIpDatagram(anyInt(), anyBoolean()); doAnswer(invocation -> testSubscriptionManager.isSatelliteProvisionedForNonIpDatagram( invocation.getArgument(0))).when( mMockSubscriptionManagerService).isSatelliteProvisionedForNonIpDatagram(anyInt()); setUpResponseForRequestIsSatelliteSupported(true, SATELLITE_RESULT_SUCCESS); verifySatelliteSupported(true, SATELLITE_RESULT_SUCCESS); int errorCode = mSatelliteControllerUT.registerForSatelliteProvisionStateChanged(callback); Loading Loading @@ -6022,4 +6034,21 @@ public class SatelliteControllerTest extends TelephonyTest { assertTrue(mSharedPreferences.getBoolean( SatelliteController.NTN_SMS_SUPPORTED_BY_MESSAGES_APP_KEY, false)); } private static class TestSubscriptionManager { public Map<Integer, Boolean> mSatelliteProvisionedForNonIpDatagram = new HashMap<>(); public void resetProvisionMapForNonIpDatagram() { mSatelliteProvisionedForNonIpDatagram.clear(); } public void setIsSatelliteProvisionedForNonIpDatagram(int subId, boolean provisioned) { mSatelliteProvisionedForNonIpDatagram.put(subId, provisioned); } public boolean isSatelliteProvisionedForNonIpDatagram(int subId) { Boolean isProvisioned = mSatelliteProvisionedForNonIpDatagram.get(subId); return isProvisioned != null ? isProvisioned : false; } } } Loading
Android.bp +8 −8 Original line number Diff line number Diff line Loading @@ -82,14 +82,14 @@ java_library { "android.hardware.radio-V1.4-java", "android.hardware.radio-V1.5-java", "android.hardware.radio-V1.6-java", "android.hardware.radio.config-V3-java", "android.hardware.radio.data-V3-java", "android.hardware.radio.ims-V2-java", "android.hardware.radio.messaging-V3-java", "android.hardware.radio.modem-V3-java", "android.hardware.radio.network-V3-java", "android.hardware.radio.sim-V3-java", "android.hardware.radio.voice-V3-java", "android.hardware.radio.config-V4-java", "android.hardware.radio.data-V4-java", "android.hardware.radio.ims-V3-java", "android.hardware.radio.messaging-V4-java", "android.hardware.radio.modem-V4-java", "android.hardware.radio.network-V4-java", "android.hardware.radio.sim-V4-java", "android.hardware.radio.voice-V4-java", "voip-common", "ims-common", "unsupportedappusage", Loading
src/java/com/android/internal/telephony/satellite/SatelliteController.java +131 −3 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import static android.telephony.CarrierConfigManager.KEY_CARRIER_SUPPORTED_SATEL import static android.telephony.CarrierConfigManager.KEY_CARRIER_SUPPORTED_SATELLITE_SERVICES_PER_PROVIDER_BUNDLE; import static android.telephony.CarrierConfigManager.KEY_EMERGENCY_CALL_TO_SATELLITE_T911_HANDOVER_TIMEOUT_MILLIS_INT; import static android.telephony.CarrierConfigManager.KEY_EMERGENCY_MESSAGING_SUPPORTED_BOOL; import static android.telephony.CarrierConfigManager.KEY_REGIONAL_SATELLITE_EARFCN_BUNDLE; import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL; import static android.telephony.CarrierConfigManager.KEY_SATELLITE_CONNECTION_HYSTERESIS_SEC_INT; import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL; Loading Loading @@ -141,6 +142,7 @@ import android.telephony.satellite.SatelliteModemEnableRequestAttributes; import android.telephony.satellite.SatelliteSubscriberInfo; import android.telephony.satellite.SatelliteSubscriberProvisionStatus; import android.telephony.satellite.SatelliteSubscriptionInfo; import android.telephony.satellite.SystemSelectionSpecifier; import android.text.TextUtils; import android.util.Log; import android.util.Pair; Loading Loading @@ -299,6 +301,8 @@ public class SatelliteController extends Handler { private static final int EVENT_TERRESTRIAL_NETWORK_AVAILABLE_CHANGED = 55; private static final int EVENT_SET_NETWORK_SELECTION_AUTO_DONE = 56; private static final int EVENT_SIGNAL_STRENGTH_CHANGED = 57; private static final int CMD_UPDATE_SYSTEM_SELECTION_CHANNELS = 58; private static final int EVENT_UPDATE_SYSTEM_SELECTION_CHANNELS_DONE = 59; @NonNull private static SatelliteController sInstance; @NonNull private final Context mContext; Loading Loading @@ -481,6 +485,13 @@ public class SatelliteController extends Handler { * {@code true} for enabled and {@code false} for disabled. */ @NonNull private final Map<Integer, Boolean> mIsSatelliteAttachEnabledForCarrierArrayPerSub = new HashMap<>(); /** Key: subId, value: (key: Regional satellite config Id string, value: Integer * arrays of earfcns in the corresponding regions.) */ @GuardedBy("mRegionalSatelliteEarfcnsLock") @NonNull private final Map<Integer, Map<String, Set<Integer>>> mRegionalSatelliteEarfcns = new HashMap<>(); @NonNull private final Object mRegionalSatelliteEarfcnsLock = new Object(); @NonNull private final FeatureFlags mFeatureFlags; @NonNull private final Object mSatelliteConnectedLock = new Object(); /** Key: Subscription ID; Value: Last satellite connected time */ Loading Loading @@ -1223,6 +1234,17 @@ public class SatelliteController extends Handler { } } private static final class UpdateSystemSelectionChannelsArgument { @NonNull SystemSelectionSpecifier mSelectionSpecifier; @NonNull ResultReceiver mResult; UpdateSystemSelectionChannelsArgument(@NonNull SystemSelectionSpecifier selectionSpecifier, @NonNull ResultReceiver result) { this.mSelectionSpecifier = selectionSpecifier; this.mResult = result; } } /** * Arguments to send to SatelliteTransmissionUpdate registrants */ Loading Loading @@ -2040,6 +2062,29 @@ public class SatelliteController extends Handler { int phoneId = (int) ar.userObj; updateLastNotifiedCarrierRoamingNtnSignalStrengthAndNotify( PhoneFactory.getPhone(phoneId)); break; } case CMD_UPDATE_SYSTEM_SELECTION_CHANNELS: { plogd("CMD_UPDATE_SYSTEM_SELECTION_CHANNELS"); request = (SatelliteControllerHandlerRequest) msg.obj; onCompleted = obtainMessage(EVENT_UPDATE_SYSTEM_SELECTION_CHANNELS_DONE, request); mSatelliteModemInterface.updateSystemSelectionChannels( ((UpdateSystemSelectionChannelsArgument) (request.argument)) .mSelectionSpecifier, onCompleted); break; } case EVENT_UPDATE_SYSTEM_SELECTION_CHANNELS_DONE: { ar = (AsyncResult) msg.obj; request = (SatelliteControllerHandlerRequest) ar.userObj; int error = SatelliteServiceUtils.getSatelliteError( ar, "updateSystemSelectionChannel"); plogd("EVENT_UPDATE_SYSTEM_SELECTION_CHANNELS_DONE = " + error); ((UpdateSystemSelectionChannelsArgument) (request.argument)).mResult.send(error, null); break; } default: Loading Loading @@ -4580,14 +4625,31 @@ public class SatelliteController extends Handler { boolean provisionChanged = false; synchronized (mSatelliteTokenProvisionedLock) { for (SatelliteSubscriberInfo subscriberInfo : newList) { int subId = subscriberInfo.getSubId(); Boolean currentProvisioned = mProvisionedSubscriberId.get(subscriberInfo.getSubscriberId()); if (currentProvisioned != null && currentProvisioned == provisioned) { if (currentProvisioned == null) { currentProvisioned = false; } Boolean isProvisionedInPersistentDb = false; try { isProvisionedInPersistentDb = mSubscriptionManagerService .isSatelliteProvisionedForNonIpDatagram(subId); if (isProvisionedInPersistentDb == null) { isProvisionedInPersistentDb = false; } } catch (IllegalArgumentException | SecurityException ex) { ploge("isSatelliteProvisionedForNonIpDatagram: subId=" + subId + ", ex=" + ex); } if (currentProvisioned == provisioned && isProvisionedInPersistentDb == provisioned) { continue; } provisionChanged = true; mProvisionedSubscriberId.put(subscriberInfo.getSubscriberId(), provisioned); int subId = subscriberInfo.getSubId(); try { mSubscriptionManagerService.setIsSatelliteProvisionedForNonIpDatagram(subId, provisioned); Loading Loading @@ -5183,6 +5245,13 @@ public class SatelliteController extends Handler { KEY_CARRIER_SUPPORTED_SATELLITE_SERVICES_PER_PROVIDER_BUNDLE)); } @NonNull private Map<String, Set<Integer>> readRegionalSatelliteEarfcnsFromCarrierConfig(int subId) { PersistableBundle config = getPersistableBundle(subId); return SatelliteServiceUtils.parseRegionalSatelliteEarfcns( config.getPersistableBundle(KEY_REGIONAL_SATELLITE_EARFCN_BUNDLE)); } @NonNull private PersistableBundle getConfigForSubId(int subId) { PersistableBundle config = null; if (mCarrierConfigManager != null) { Loading @@ -5206,7 +5275,8 @@ public class SatelliteController extends Handler { KEY_SATELLITE_ROAMING_P2P_SMS_INACTIVITY_TIMEOUT_SEC_INT, KEY_SATELLITE_ROAMING_ESOS_INACTIVITY_TIMEOUT_SEC_INT, KEY_SATELLITE_SOS_MAX_DATAGRAM_SIZE, KEY_SATELLITE_SUPPORTED_MSG_APPS_STRING_ARRAY KEY_SATELLITE_SUPPORTED_MSG_APPS_STRING_ARRAY, KEY_REGIONAL_SATELLITE_EARFCN_BUNDLE ); } catch (Exception e) { logw("getConfigForSubId: " + e); Loading Loading @@ -5237,6 +5307,7 @@ public class SatelliteController extends Handler { evaluateCarrierRoamingNtnEligibilityChange(); sendMessageDelayed(obtainMessage(CMD_EVALUATE_ESOS_PROFILES_PRIORITIZATION), mEvaluateEsosProfilesPrioritizationDurationMillis); updateRegionalSatelliteEarfcns(subId); } // imsi, msisdn, default sms subId change Loading Loading @@ -7174,6 +7245,63 @@ public class SatelliteController extends Handler { incrementResultReceiverCount("SC:provisionSatellite"); } /** * Request to update system selection channels. * * @param result The result receiver that returns if the request is successful or * an error code if the request failed. */ public void updateSystemSelectionChannels(@NonNull SystemSelectionSpecifier selectionSpecifier, @NonNull ResultReceiver result) { if (!mFeatureFlags.carrierRoamingNbIotNtn()) { plogd("updateSystemSelectionChannels: " + "carrierRoamingNbIotNtn flag is disabled"); result.send(SATELLITE_RESULT_REQUEST_NOT_SUPPORTED, null); return; } sendRequestAsync(CMD_UPDATE_SYSTEM_SELECTION_CHANNELS, new UpdateSystemSelectionChannelsArgument(selectionSpecifier, result), null); } /** * @param subId Subscription ID. * @return The The map of earfcns with key: regional satellite config Id, * value: set of earfcns in the corresponding regions associated with the {@code subId}. */ @NonNull public Map<String, Set<Integer>> getRegionalSatelliteEarfcns(int subId) { if (!mFeatureFlags.carrierRoamingNbIotNtn()) { logd("getRegionalSatelliteEarfcns: carrierRoamingNbIotNtnFlag is disabled"); return new HashMap<>(); } synchronized (mRegionalSatelliteEarfcnsLock) { if (mRegionalSatelliteEarfcns.containsKey(subId)) { return mRegionalSatelliteEarfcns.get(subId); } else { logd("getRegionalSatelliteEarfcns: Earfcns for subId: " + subId + " not found"); return new HashMap<>(); } } } /** * Update regional satellite earfcn information from carrier config. */ public void updateRegionalSatelliteEarfcns(int subId) { plogd("updateRegionalSatelliteEarfcns with subId " + subId); if (!mFeatureFlags.carrierRoamingNbIotNtn()) { plogd("updateRegionalSatelliteEarfcns: " + "carrierRoamingNbIotNtn flag is disabled"); return; } synchronized (mRegionalSatelliteEarfcnsLock) { mRegionalSatelliteEarfcns.put(subId, readRegionalSatelliteEarfcnsFromCarrierConfig(subId)); } } /** * Deliver the list of deprovisioned satellite subscriber ids. * Loading
src/java/com/android/internal/telephony/satellite/SatelliteModemInterface.java +37 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import android.telephony.satellite.SatelliteDatagram; import android.telephony.satellite.SatelliteManager; import android.telephony.satellite.SatelliteManager.SatelliteException; import android.telephony.satellite.SatelliteModemEnableRequestAttributes; import android.telephony.satellite.SystemSelectionSpecifier; import android.telephony.satellite.stub.INtnSignalStrengthConsumer; import android.telephony.satellite.stub.ISatellite; import android.telephony.satellite.stub.ISatelliteCapabilitiesConsumer; Loading Loading @@ -1383,6 +1384,42 @@ public class SatelliteModemInterface { mExponentialBackoff.start(); } /** * Request to update system selection channels * * @param systemSelectionSpecifier system selection specifiers * @param message The Message to send to result of the operation to. */ public void updateSystemSelectionChannels( @NonNull SystemSelectionSpecifier systemSelectionSpecifier, @Nullable Message message) { plogd("updateSystemSelectionChannels: SystemSelectionSpecifier: " + systemSelectionSpecifier.toString()); if (mSatelliteService != null) { try { mSatelliteService.updateSystemSelectionChannels(SatelliteServiceUtils .toSystemSelectionSpecifier(systemSelectionSpecifier), new IIntegerConsumer.Stub() { @Override public void accept(int result) { int error = SatelliteServiceUtils.fromSatelliteError(result); plogd("updateSystemSelectionChannels: " + error); Binder.withCleanCallingIdentity(() -> sendMessageWithResult(message, null, error)); } }); } catch (RemoteException e) { ploge("updateSystemSelectionChannels: RemoteException " + e); sendMessageWithResult(message, null, SatelliteManager.SATELLITE_RESULT_SERVICE_ERROR); } } else { ploge("updateSystemSelectionChannels: Satellite service is unavailable."); sendMessageWithResult(message, null, SatelliteManager.SATELLITE_RESULT_RADIO_NOT_AVAILABLE); } } @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE) protected static void sendMessageWithResult(@NonNull Message message, @Nullable Object result, @SatelliteManager.SatelliteResult int error) { Loading
src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java +52 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.telephony.satellite.SatelliteDatagram; import android.telephony.satellite.SatelliteManager; import android.telephony.satellite.SatelliteModemEnableRequestAttributes; import android.telephony.satellite.SatelliteSubscriptionInfo; import android.telephony.satellite.SystemSelectionSpecifier; import android.telephony.satellite.stub.NTRadioTechnology; import android.telephony.satellite.stub.SatelliteModemState; import android.telephony.satellite.stub.SatelliteResult; Loading @@ -53,6 +54,7 @@ import com.android.internal.telephony.PhoneFactory; import com.android.internal.telephony.subscription.SubscriptionManagerService; import com.android.internal.telephony.util.TelephonyUtils; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; Loading Loading @@ -542,6 +544,56 @@ public class SatelliteServiceUtils { return mcc + mnc; } /** * Convert SystemSelectionSpecifier from framework definition to service definition * @param systemSelectionSpecifier The SystemSelectionSpecifier from the framework. * @return The converted SystemSelectionSpecifier for the satellite service. */ @NonNull public static List<android.telephony.satellite.stub .SystemSelectionSpecifier> toSystemSelectionSpecifier( @NonNull SystemSelectionSpecifier systemSelectionSpecifier) { List<android.telephony.satellite.stub.SystemSelectionSpecifier> converted = new ArrayList<>(); android.telephony.satellite.stub.SystemSelectionSpecifier convertedSpecifier = new android.telephony.satellite.stub.SystemSelectionSpecifier(); convertedSpecifier.mMccMnc = systemSelectionSpecifier.getMccMnc(); convertedSpecifier.mBands = systemSelectionSpecifier.getBands().toArray(); convertedSpecifier.mEarfcs = systemSelectionSpecifier.getEarfcs().toArray(); converted.add(convertedSpecifier); return converted; } /** * Expected format of the input dictionary bundle is: * <ul> * <li>Key: Regional satellite config Id string.</li> * <li>Value: Integer arrays of earfcns in the corresponding regions."</li> * </ul> * @return The map of earfcns with key: regional satellite config Id, * value: set of earfcns in the corresponding regions. */ @NonNull public static Map<String, Set<Integer>> parseRegionalSatelliteEarfcns( @Nullable PersistableBundle earfcnsBundle) { Map<String, Set<Integer>> earfcnsMap = new HashMap<>(); if (earfcnsBundle == null || earfcnsBundle.isEmpty()) { logd("parseRegionalSatelliteEarfcns: earfcnsBundle is null or empty"); return earfcnsMap; } for (String configId : earfcnsBundle.keySet()) { Set<Integer> earfcnsSet = new HashSet<>(); for (int earfcn : earfcnsBundle.getIntArray(configId)) { earfcnsSet.add(earfcn); } logd("parseRegionalSatelliteEarfcns: configId = " + configId + ", earfcns =" + earfcnsSet.stream().map(String::valueOf).collect(joining(","))); earfcnsMap.put(configId, earfcnsSet); } return earfcnsMap; } private static void logd(@NonNull String log) { Rlog.d(TAG, log); } Loading
tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java +29 −0 Original line number Diff line number Diff line Loading @@ -4569,6 +4569,18 @@ public class SatelliteControllerTest extends TelephonyTest { } } }; TestSubscriptionManager testSubscriptionManager = new TestSubscriptionManager(); doAnswer(invocation -> { testSubscriptionManager.setIsSatelliteProvisionedForNonIpDatagram( invocation.getArgument(0), invocation.getArgument(1)); return null; }).when(mMockSubscriptionManagerService).setIsSatelliteProvisionedForNonIpDatagram(anyInt(), anyBoolean()); doAnswer(invocation -> testSubscriptionManager.isSatelliteProvisionedForNonIpDatagram( invocation.getArgument(0))).when( mMockSubscriptionManagerService).isSatelliteProvisionedForNonIpDatagram(anyInt()); setUpResponseForRequestIsSatelliteSupported(true, SATELLITE_RESULT_SUCCESS); verifySatelliteSupported(true, SATELLITE_RESULT_SUCCESS); int errorCode = mSatelliteControllerUT.registerForSatelliteProvisionStateChanged(callback); Loading Loading @@ -6022,4 +6034,21 @@ public class SatelliteControllerTest extends TelephonyTest { assertTrue(mSharedPreferences.getBoolean( SatelliteController.NTN_SMS_SUPPORTED_BY_MESSAGES_APP_KEY, false)); } private static class TestSubscriptionManager { public Map<Integer, Boolean> mSatelliteProvisionedForNonIpDatagram = new HashMap<>(); public void resetProvisionMapForNonIpDatagram() { mSatelliteProvisionedForNonIpDatagram.clear(); } public void setIsSatelliteProvisionedForNonIpDatagram(int subId, boolean provisioned) { mSatelliteProvisionedForNonIpDatagram.put(subId, provisioned); } public boolean isSatelliteProvisionedForNonIpDatagram(int subId) { Boolean isProvisioned = mSatelliteProvisionedForNonIpDatagram.get(subId); return isProvisioned != null ? isProvisioned : false; } } }