Merge "Add Satellite Availability config check in SatelliteController" into main
diff --git a/src/java/com/android/internal/telephony/satellite/SatelliteController.java b/src/java/com/android/internal/telephony/satellite/SatelliteController.java
index e536989..936975a 100644
--- a/src/java/com/android/internal/telephony/satellite/SatelliteController.java
+++ b/src/java/com/android/internal/telephony/satellite/SatelliteController.java
@@ -193,6 +193,7 @@
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Consumer;
import java.util.stream.Collectors;
+import com.android.internal.R;
/**
* Satellite controller is the backend service of
@@ -6395,6 +6396,13 @@
*/
private void updateSatelliteSystemNotification(int subId,
@CARRIER_ROAMING_NTN_CONNECT_TYPE int carrierRoamingNtnConnectType, boolean visible) {
+ boolean notifySatelliteAvailabilityEnabled =
+ mContext.getResources().getBoolean(R.bool.config_satellite_should_notify_availability);
+ if (!mFeatureFlags.carrierRoamingNbIotNtn() || !notifySatelliteAvailabilityEnabled) {
+ plogd("updateSatelliteSystemNotification: satellite notifications are not enabled.");
+ return;
+ }
+
plogd("updateSatelliteSystemNotification subId=" + subId + ", carrierRoamingNtnConnectType="
+ SatelliteServiceUtils.carrierRoamingNtnConnectTypeToString(
carrierRoamingNtnConnectType) + ", visible=" + visible);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java
index c0c6f63..cf6f6a9 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java
@@ -1702,6 +1702,7 @@
@Test
public void testRegisterForSatelliteProvisionStateChanged() {
+ when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true);
Semaphore semaphore = new Semaphore(0);
ISatelliteProvisionStateCallback callback =
new ISatelliteProvisionStateCallback.Stub() {
@@ -1753,7 +1754,6 @@
processAllMessages();
assertTrue(waitForForEvents(
semaphore, 1, "testRegisterForSatelliteProvisionStateChanged"));
-
mSatelliteControllerUT.unregisterForSatelliteProvisionStateChanged(callback);
semaphore.drainPermits();
cancelRemote = mSatelliteControllerUT.provisionSatelliteService(
@@ -3650,7 +3650,10 @@
@Test
public void testHandleEventServiceStateChanged() {
+ mContextFixture.putBooleanResource(
+ R.bool.config_satellite_should_notify_availability, true);
when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true);
+ when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true);
mCarrierConfigBundle.putInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT,
CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC);
invokeCarrierConfigChanged();
@@ -4145,6 +4148,8 @@
@Test
public void testNotifyNtnEligibilityHysteresisTimedOut() {
+ mContextFixture.putBooleanResource(
+ R.bool.config_satellite_should_notify_availability, true);
when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true);
when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true);
when(mServiceState2.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE);