Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 511db40d authored by Hidayat Khan's avatar Hidayat Khan
Browse files

Add Satellite Availability config check in SatelliteController

Bug: 378782898
Test: atest SatelliteManagerTest
FLAG: com.android.internal.telephony.flags.carrier_roaming_nb_iot_ntn
Change-Id: I3b54480dbd6272bd9b0c79999f9d0d48cdf468ec
parent 9ffde753
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -190,6 +190,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
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
@@ -6323,6 +6324,13 @@ public class SatelliteController extends Handler {
     */
    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);
+6 −1
Original line number Diff line number Diff line
@@ -1702,6 +1702,7 @@ public class SatelliteControllerTest extends TelephonyTest {

    @Test
    public void testRegisterForSatelliteProvisionStateChanged() {
        when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true);
        Semaphore semaphore = new Semaphore(0);
        ISatelliteProvisionStateCallback callback =
                new ISatelliteProvisionStateCallback.Stub() {
@@ -1753,7 +1754,6 @@ public class SatelliteControllerTest extends TelephonyTest {
        processAllMessages();
        assertTrue(waitForForEvents(
                semaphore, 1, "testRegisterForSatelliteProvisionStateChanged"));

        mSatelliteControllerUT.unregisterForSatelliteProvisionStateChanged(callback);
        semaphore.drainPermits();
        cancelRemote = mSatelliteControllerUT.provisionSatelliteService(
@@ -3650,7 +3650,10 @@ public class SatelliteControllerTest extends TelephonyTest {

    @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 @@ public class SatelliteControllerTest extends TelephonyTest {

    @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);