Loading src/java/com/android/internal/telephony/satellite/SatelliteController.java +98 −10 Original line number Diff line number Diff line Loading @@ -547,6 +547,11 @@ public class SatelliteController extends Handler { @GuardedBy("mIsWifiConnectedLock") private boolean mIsWifiConnected = false; private boolean mHasSentBroadcast = false; // For satellite CTS test which to configure intent component with the necessary values. private boolean mChangeIntentComponent = false; private String mConfigSatelliteGatewayServicePackage = ""; private String mConfigSatelliteCarrierRoamingEsosProvisionedClass = ""; private BroadcastReceiver mDefaultSmsSubscriptionChangedBroadcastReceiver = new BroadcastReceiver() { @Override Loading Loading @@ -1227,28 +1232,39 @@ public class SatelliteController extends Handler { break; } case EVENT_WAIT_FOR_SATELLITE_ENABLING_RESPONSE_TIMED_OUT: case EVENT_WAIT_FOR_SATELLITE_ENABLING_RESPONSE_TIMED_OUT: { handleEventWaitForSatelliteEnablingResponseTimedOut( (RequestSatelliteEnabledArgument) msg.obj); break; } case CMD_UPDATE_SATELLITE_ENABLE_ATTRIBUTES: { request = (SatelliteControllerHandlerRequest) msg.obj; RequestSatelliteEnabledArgument argument = (RequestSatelliteEnabledArgument) request.argument; if (!mFeatureFlags.carrierRoamingNbIotNtn()) { plogd("UpdateEnableAttributes: carrierRoamingNbIotNtn flag is disabled"); sendErrorAndReportSessionMetrics( SatelliteManager.SATELLITE_RESULT_INVALID_ARGUMENTS, argument.callback); synchronized (mSatelliteEnabledRequestLock) { mSatelliteEnableAttributesUpdateRequest = null; } break; } synchronized (mSatelliteEnabledRequestLock) { if (mSatelliteEnabledRequest != null) { plogd("UpdateEnableAttributes: Satellite is being enabled. Need to " + "wait until enable complete before updating attributes"); return; break; } if (isSatelliteBeingDisabled()) { plogd("UpdateEnableAttributes: Satellite is being disabled. Aborting the " + "enable attributes update request"); mSatelliteEnableAttributesUpdateRequest = null; argument.callback.accept(SATELLITE_RESULT_REQUEST_ABORTED); return; break; } } onCompleted = obtainMessage(EVENT_UPDATE_SATELLITE_ENABLE_ATTRIBUTES_DONE, request); Loading Loading @@ -1918,6 +1934,12 @@ public class SatelliteController extends Handler { * carriers want to disable satellite for prioritizing emergency calls. Thus, * we need to push the disable request to modem while enable is in progress. */ if (!mFeatureFlags.carrierRoamingNbIotNtn()) { plogd("requestSatelliteEnabled: carrierRoamingNbIotNtn flag is disabled"); sendErrorAndReportSessionMetrics( SatelliteManager.SATELLITE_RESULT_ENABLE_IN_PROGRESS, result); return; } mSatelliteDisabledRequest = request; } } Loading Loading @@ -6043,7 +6065,7 @@ public class SatelliteController extends Handler { for (Map.Entry<Integer, List<SubscriptionInfo>> entry : currentMap.entrySet()) { List<SubscriptionInfo> currentList = entry.getValue(); List<SubscriptionInfo> newList = newMap.get(entry.getKey()); if (currentList == null || currentList.size() != newList.size()) { if (newList == null || currentList == null || currentList.size() != newList.size()) { return true; } for (int i = 0; i < currentList.size(); i++) { Loading @@ -6058,13 +6080,11 @@ public class SatelliteController extends Handler { } private void sendBroadCastForProvisionedESOSSubs() { String packageName = getStringFromOverlayConfig( R.string.config_satellite_gateway_service_package); String className = getStringFromOverlayConfig( R.string.config_satellite_carrier_roaming_esos_provisioned_class); String packageName = getConfigSatelliteGatewayServicePackage(); String className = getConfigSatelliteCarrierRoamingEsosProvisionedClass(); if (packageName == null || className == null || packageName.isEmpty() || className.isEmpty()) { logd("sendBroadCaseToProvisionedESOSSubs: packageName or className is null or empty."); logd("sendBroadCastForProvisionedESOSSubs: packageName or className is null or empty."); return; } String action = SatelliteManager.ACTION_SATELLITE_SUBSCRIBER_ID_LIST_CHANGED; Loading @@ -6072,7 +6092,7 @@ public class SatelliteController extends Handler { Intent intent = new Intent(action); intent.setComponent(new ComponentName(packageName, className)); mContext.sendBroadcast(intent); logd("sendBroadCaseToProvisionedESOSSubs" + intent); logd("sendBroadCastForProvisionedESOSSubs" + intent); } @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) Loading Loading @@ -6394,6 +6414,74 @@ public class SatelliteController extends Handler { } } /** * This API can be used by only CTS to override the cached value for the device overlay config * value : * config_satellite_gateway_service_package and * config_satellite_carrier_roaming_esos_provisioned_class. * These values are set before sending an intent to broadcast there are any change to list of * subscriber informations. * * @param name the name is one of the following that constitute an intent. * component package name, or component class name. * @return {@code true} if the setting is successful, {@code false} otherwise. */ public boolean setSatelliteSubscriberIdListChangedIntentComponent(String name) { if (!mFeatureFlags.carrierRoamingNbIotNtn()) { logd("setSatelliteSubscriberIdListChangedIntentComponent: carrierRoamingNbIotNtn is " + "disabled"); return false; } if (!isMockModemAllowed()) { logd("setSatelliteSubscriberIdListChangedIntentComponent: mock modem is not allowed"); return false; } logd("setSatelliteSubscriberIdListChangedIntentComponent:" + name); if (name.contains("/")) { mChangeIntentComponent = true; } else { mChangeIntentComponent = false; return true; } boolean result = true; String[] cmdPart = name.split("/"); switch (cmdPart[0]) { case "-p": { mConfigSatelliteGatewayServicePackage = cmdPart[1]; break; } case "-c": { mConfigSatelliteCarrierRoamingEsosProvisionedClass = cmdPart[1]; break; } default: logd("setSatelliteSubscriberIdListChangedIntentComponent: invalid name " + name); result = false; break; } return result; } private String getConfigSatelliteGatewayServicePackage() { if (!mChangeIntentComponent) { return getStringFromOverlayConfig( R.string.config_satellite_gateway_service_package); } logd("getConfigSatelliteGatewayServicePackage: " + mConfigSatelliteGatewayServicePackage); return mConfigSatelliteGatewayServicePackage; } private String getConfigSatelliteCarrierRoamingEsosProvisionedClass() { if (!mChangeIntentComponent) { return getStringFromOverlayConfig( R.string.config_satellite_carrier_roaming_esos_provisioned_class); } logd("getConfigSatelliteCarrierRoamingEsosProvisionedClass: " + mConfigSatelliteCarrierRoamingEsosProvisionedClass); return mConfigSatelliteCarrierRoamingEsosProvisionedClass; } private void registerDefaultSmsSubscriptionChangedBroadcastReceiver() { if (!mFeatureFlags.carrierRoamingNbIotNtn()) { plogd("registerDefaultSmsSubscriptionChangedBroadcastReceiver: Flag " Loading tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -921,6 +921,7 @@ public class SatelliteControllerTest extends TelephonyTest { @Test public void testRequestSatelliteEnabled() { when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true); mIsSatelliteEnabledSemaphore.drainPermits(); // Fail to enable satellite when SatelliteController is not fully loaded yet. Loading Loading
src/java/com/android/internal/telephony/satellite/SatelliteController.java +98 −10 Original line number Diff line number Diff line Loading @@ -547,6 +547,11 @@ public class SatelliteController extends Handler { @GuardedBy("mIsWifiConnectedLock") private boolean mIsWifiConnected = false; private boolean mHasSentBroadcast = false; // For satellite CTS test which to configure intent component with the necessary values. private boolean mChangeIntentComponent = false; private String mConfigSatelliteGatewayServicePackage = ""; private String mConfigSatelliteCarrierRoamingEsosProvisionedClass = ""; private BroadcastReceiver mDefaultSmsSubscriptionChangedBroadcastReceiver = new BroadcastReceiver() { @Override Loading Loading @@ -1227,28 +1232,39 @@ public class SatelliteController extends Handler { break; } case EVENT_WAIT_FOR_SATELLITE_ENABLING_RESPONSE_TIMED_OUT: case EVENT_WAIT_FOR_SATELLITE_ENABLING_RESPONSE_TIMED_OUT: { handleEventWaitForSatelliteEnablingResponseTimedOut( (RequestSatelliteEnabledArgument) msg.obj); break; } case CMD_UPDATE_SATELLITE_ENABLE_ATTRIBUTES: { request = (SatelliteControllerHandlerRequest) msg.obj; RequestSatelliteEnabledArgument argument = (RequestSatelliteEnabledArgument) request.argument; if (!mFeatureFlags.carrierRoamingNbIotNtn()) { plogd("UpdateEnableAttributes: carrierRoamingNbIotNtn flag is disabled"); sendErrorAndReportSessionMetrics( SatelliteManager.SATELLITE_RESULT_INVALID_ARGUMENTS, argument.callback); synchronized (mSatelliteEnabledRequestLock) { mSatelliteEnableAttributesUpdateRequest = null; } break; } synchronized (mSatelliteEnabledRequestLock) { if (mSatelliteEnabledRequest != null) { plogd("UpdateEnableAttributes: Satellite is being enabled. Need to " + "wait until enable complete before updating attributes"); return; break; } if (isSatelliteBeingDisabled()) { plogd("UpdateEnableAttributes: Satellite is being disabled. Aborting the " + "enable attributes update request"); mSatelliteEnableAttributesUpdateRequest = null; argument.callback.accept(SATELLITE_RESULT_REQUEST_ABORTED); return; break; } } onCompleted = obtainMessage(EVENT_UPDATE_SATELLITE_ENABLE_ATTRIBUTES_DONE, request); Loading Loading @@ -1918,6 +1934,12 @@ public class SatelliteController extends Handler { * carriers want to disable satellite for prioritizing emergency calls. Thus, * we need to push the disable request to modem while enable is in progress. */ if (!mFeatureFlags.carrierRoamingNbIotNtn()) { plogd("requestSatelliteEnabled: carrierRoamingNbIotNtn flag is disabled"); sendErrorAndReportSessionMetrics( SatelliteManager.SATELLITE_RESULT_ENABLE_IN_PROGRESS, result); return; } mSatelliteDisabledRequest = request; } } Loading Loading @@ -6043,7 +6065,7 @@ public class SatelliteController extends Handler { for (Map.Entry<Integer, List<SubscriptionInfo>> entry : currentMap.entrySet()) { List<SubscriptionInfo> currentList = entry.getValue(); List<SubscriptionInfo> newList = newMap.get(entry.getKey()); if (currentList == null || currentList.size() != newList.size()) { if (newList == null || currentList == null || currentList.size() != newList.size()) { return true; } for (int i = 0; i < currentList.size(); i++) { Loading @@ -6058,13 +6080,11 @@ public class SatelliteController extends Handler { } private void sendBroadCastForProvisionedESOSSubs() { String packageName = getStringFromOverlayConfig( R.string.config_satellite_gateway_service_package); String className = getStringFromOverlayConfig( R.string.config_satellite_carrier_roaming_esos_provisioned_class); String packageName = getConfigSatelliteGatewayServicePackage(); String className = getConfigSatelliteCarrierRoamingEsosProvisionedClass(); if (packageName == null || className == null || packageName.isEmpty() || className.isEmpty()) { logd("sendBroadCaseToProvisionedESOSSubs: packageName or className is null or empty."); logd("sendBroadCastForProvisionedESOSSubs: packageName or className is null or empty."); return; } String action = SatelliteManager.ACTION_SATELLITE_SUBSCRIBER_ID_LIST_CHANGED; Loading @@ -6072,7 +6092,7 @@ public class SatelliteController extends Handler { Intent intent = new Intent(action); intent.setComponent(new ComponentName(packageName, className)); mContext.sendBroadcast(intent); logd("sendBroadCaseToProvisionedESOSSubs" + intent); logd("sendBroadCastForProvisionedESOSSubs" + intent); } @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) Loading Loading @@ -6394,6 +6414,74 @@ public class SatelliteController extends Handler { } } /** * This API can be used by only CTS to override the cached value for the device overlay config * value : * config_satellite_gateway_service_package and * config_satellite_carrier_roaming_esos_provisioned_class. * These values are set before sending an intent to broadcast there are any change to list of * subscriber informations. * * @param name the name is one of the following that constitute an intent. * component package name, or component class name. * @return {@code true} if the setting is successful, {@code false} otherwise. */ public boolean setSatelliteSubscriberIdListChangedIntentComponent(String name) { if (!mFeatureFlags.carrierRoamingNbIotNtn()) { logd("setSatelliteSubscriberIdListChangedIntentComponent: carrierRoamingNbIotNtn is " + "disabled"); return false; } if (!isMockModemAllowed()) { logd("setSatelliteSubscriberIdListChangedIntentComponent: mock modem is not allowed"); return false; } logd("setSatelliteSubscriberIdListChangedIntentComponent:" + name); if (name.contains("/")) { mChangeIntentComponent = true; } else { mChangeIntentComponent = false; return true; } boolean result = true; String[] cmdPart = name.split("/"); switch (cmdPart[0]) { case "-p": { mConfigSatelliteGatewayServicePackage = cmdPart[1]; break; } case "-c": { mConfigSatelliteCarrierRoamingEsosProvisionedClass = cmdPart[1]; break; } default: logd("setSatelliteSubscriberIdListChangedIntentComponent: invalid name " + name); result = false; break; } return result; } private String getConfigSatelliteGatewayServicePackage() { if (!mChangeIntentComponent) { return getStringFromOverlayConfig( R.string.config_satellite_gateway_service_package); } logd("getConfigSatelliteGatewayServicePackage: " + mConfigSatelliteGatewayServicePackage); return mConfigSatelliteGatewayServicePackage; } private String getConfigSatelliteCarrierRoamingEsosProvisionedClass() { if (!mChangeIntentComponent) { return getStringFromOverlayConfig( R.string.config_satellite_carrier_roaming_esos_provisioned_class); } logd("getConfigSatelliteCarrierRoamingEsosProvisionedClass: " + mConfigSatelliteCarrierRoamingEsosProvisionedClass); return mConfigSatelliteCarrierRoamingEsosProvisionedClass; } private void registerDefaultSmsSubscriptionChangedBroadcastReceiver() { if (!mFeatureFlags.carrierRoamingNbIotNtn()) { plogd("registerDefaultSmsSubscriptionChangedBroadcastReceiver: Flag " Loading
tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -921,6 +921,7 @@ public class SatelliteControllerTest extends TelephonyTest { @Test public void testRequestSatelliteEnabled() { when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true); mIsSatelliteEnabledSemaphore.drainPermits(); // Fail to enable satellite when SatelliteController is not fully loaded yet. Loading