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

Commit 8b784bfe authored by Aishwarya Mallampati's avatar Aishwarya Mallampati
Browse files

Call starlink HAL APIs added in RIL.java

Bug: 383620752
Test: atest SatelliteControllerTest, atest
SatelliteManagerTestOnMockService
FLAG: EXEMPT bugfix

Change-Id: I386323afe4a9f2570c988dcd924d900e3da04af1
parent 64d40c50
Loading
Loading
Loading
Loading
+41 −0
Original line number Original line Diff line number Diff line
@@ -5432,6 +5432,47 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        mNotifier.notifyCarrierRoamingNtnSignalStrengthChanged(this, ntnSignalStrength);
        mNotifier.notifyCarrierRoamingNtnSignalStrengthChanged(this, ntnSignalStrength);
    }
    }


    /**
     * Set the non-terrestrial PLMN with lower priority than terrestrial networks.
     *
     * @param simSlot Indicates the SIM slot to which this API will be applied. The modem will use
     *                this information to determine the relevant carrier.
     * @param carrierPlmnList The list of roaming PLMN used for connecting to satellite networks
     *                        supported by user subscription.
     * @param allSatellitePlmnList Modem should use the allSatellitePlmnList to identify satellite
     *                             PLMNs that are not supported by the carrier and make sure not to
     *                             attach to them.
     * @param result Callback message to receive the result.
     */
    public void setSatellitePlmn(int simSlot,
            @NonNull List<String> carrierPlmnList, @NonNull List<String> allSatellitePlmnList,
            Message result) {
        mCi.setSatellitePlmn(simSlot, carrierPlmnList, allSatellitePlmnList, result);
    }

    /**
     * Enable or disable satellite in the cellular modem associated with a carrier.
     *
     * @param simSlot Indicates the SIM slot to which this API will be applied. The modem will use
     *                this information to determine the relevant carrier.
     * @param satelliteEnabled {@code true} to enable satellite, {@code false} to disable satellite.
     * @param result Callback message to receive the result.
     */
    public void setSatelliteEnabledForCarrier(int simSlot, boolean satelliteEnabled,
            Message result) {
        mCi.setSatelliteEnabledForCarrier(simSlot, satelliteEnabled, result);
    }

    /**
     * Check whether satellite is enabled in the cellular modem associated with a carrier.
     *
     * @param simSlot Indicates the SIM slot to which this API will be applied.
     * @param result Callback message to receive the result.
     */
    public void isSatelliteEnabledForCarrier(int simSlot, Message result) {
        mCi.isSatelliteEnabledForCarrier(simSlot, result);
    }

    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.println("Phone: subId=" + getSubId());
        pw.println("Phone: subId=" + getSubId());
        pw.println(" mPhoneId=" + mPhoneId);
        pw.println(" mPhoneId=" + mPhoneId);
+13 −15
Original line number Original line Diff line number Diff line
@@ -94,6 +94,7 @@ import com.android.internal.telephony.imsphone.ImsCallInfo;
import com.android.internal.telephony.metrics.ModemRestartStats;
import com.android.internal.telephony.metrics.ModemRestartStats;
import com.android.internal.telephony.metrics.TelephonyMetrics;
import com.android.internal.telephony.metrics.TelephonyMetrics;
import com.android.internal.telephony.nano.TelephonyProto.SmsSession;
import com.android.internal.telephony.nano.TelephonyProto.SmsSession;
import com.android.internal.telephony.satellite.SatelliteModemInterface;
import com.android.internal.telephony.uicc.IccCardApplicationStatus.PersoSubState;
import com.android.internal.telephony.uicc.IccCardApplicationStatus.PersoSubState;
import com.android.internal.telephony.uicc.IccUtils;
import com.android.internal.telephony.uicc.IccUtils;
import com.android.internal.telephony.uicc.SimPhonebookRecord;
import com.android.internal.telephony.uicc.SimPhonebookRecord;
@@ -5400,11 +5401,10 @@ public class RIL extends BaseCommands implements CommandsInterface {
    public void setSatellitePlmn(int simSlot, @NonNull List<String> carrierPlmnList,
    public void setSatellitePlmn(int simSlot, @NonNull List<String> carrierPlmnList,
            @NonNull List<String> allSatellitePlmnList, Message result) {
            @NonNull List<String> allSatellitePlmnList, Message result) {
        RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
        RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
        if (!canMakeRequest(
        if (getHalVersion(HAL_SERVICE_NETWORK).less(RADIO_HAL_VERSION_2_4)) {
                "setSatellitePlmn",
            riljLog("setSatellitePlmn: SatelliteModemInterface is used.");
                networkProxy,
            SatelliteModemInterface.getInstance().setSatellitePlmn(
                result,
                    simSlot, carrierPlmnList, allSatellitePlmnList, result);
                RADIO_HAL_VERSION_2_4)) {
            return;
            return;
        }
        }


@@ -5434,11 +5434,10 @@ public class RIL extends BaseCommands implements CommandsInterface {
    public void setSatelliteEnabledForCarrier(int simSlot, boolean satelliteEnabled,
    public void setSatelliteEnabledForCarrier(int simSlot, boolean satelliteEnabled,
            Message result) {
            Message result) {
        RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
        RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
        if (!canMakeRequest(
        if (getHalVersion(HAL_SERVICE_NETWORK).less(RADIO_HAL_VERSION_2_4)) {
                "setSatelliteEnabledForCarrier",
            riljLog("setSatelliteEnabledForCarrier: SatelliteModemInterface is used.");
                networkProxy,
            SatelliteModemInterface.getInstance().requestSetSatelliteEnabledForCarrier(
                result,
                    simSlot, satelliteEnabled, result);
                RADIO_HAL_VERSION_2_4)) {
            return;
            return;
        }
        }


@@ -5466,11 +5465,10 @@ public class RIL extends BaseCommands implements CommandsInterface {
    @Override
    @Override
    public void isSatelliteEnabledForCarrier(int simSlot, Message result) {
    public void isSatelliteEnabledForCarrier(int simSlot, Message result) {
        RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
        RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
        if (!canMakeRequest(
        if (getHalVersion(HAL_SERVICE_NETWORK).less(RADIO_HAL_VERSION_2_4)) {
                "isSatelliteEnabledForCarrier",
            riljLog("isSatelliteEnabledForCarrier: SatelliteModemInterface is used.");
                networkProxy,
            SatelliteModemInterface.getInstance().requestIsSatelliteEnabledForCarrier(
                result,
                    simSlot, result);
                RADIO_HAL_VERSION_2_4)) {
            return;
            return;
        }
        }


+18 −4
Original line number Original line Diff line number Diff line
@@ -56,6 +56,7 @@ import static android.telephony.satellite.SatelliteManager.KEY_NTN_SIGNAL_STRENG
import static android.telephony.satellite.SatelliteManager.SATELLITE_COMMUNICATION_RESTRICTION_REASON_ENTITLEMENT;
import static android.telephony.satellite.SatelliteManager.SATELLITE_COMMUNICATION_RESTRICTION_REASON_ENTITLEMENT;
import static android.telephony.satellite.SatelliteManager.SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER;
import static android.telephony.satellite.SatelliteManager.SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER;
import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_INVALID_ARGUMENTS;
import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_INVALID_ARGUMENTS;
import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE;
import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_MODEM_ERROR;
import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_MODEM_ERROR;
import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_MODEM_TIMEOUT;
import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_MODEM_TIMEOUT;
import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_NO_VALID_SATELLITE_SUBSCRIPTION;
import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_NO_VALID_SATELLITE_SUBSCRIPTION;
@@ -5296,14 +5297,20 @@ public class SatelliteController extends Handler {
            logd("configureSatellitePlmnForCarrier: carrierEnabledSatelliteFlag is disabled");
            logd("configureSatellitePlmnForCarrier: carrierEnabledSatelliteFlag is disabled");
            return;
            return;
        }
        }

        Phone phone = SatelliteServiceUtils.getPhone(subId);
        if (phone == null) {
            ploge("configureSatellitePlmnForCarrier: phone is null for subId=" + subId);
            return;
        }

        synchronized (mSupportedSatelliteServicesLock) {
        synchronized (mSupportedSatelliteServicesLock) {
            List<String> carrierPlmnList = mMergedPlmnListPerCarrier.get(subId,
            List<String> carrierPlmnList = mMergedPlmnListPerCarrier.get(subId,
                    new ArrayList<>()).stream().toList();
                    new ArrayList<>()).stream().toList();
            List<String> barredPlmnList = mEntitlementBarredPlmnListPerCarrier.get(subId,
            List<String> barredPlmnList = mEntitlementBarredPlmnListPerCarrier.get(subId,
                    new ArrayList<>()).stream().toList();
                    new ArrayList<>()).stream().toList();
            int slotId = SubscriptionManager.getSlotIndex(subId);
            int slotId = SubscriptionManager.getSlotIndex(subId);
            mSatelliteModemInterface.setSatellitePlmn(slotId, carrierPlmnList,
            phone.setSatellitePlmn(slotId, carrierPlmnList, SatelliteServiceUtils.mergeStrLists(
                    SatelliteServiceUtils.mergeStrLists(
                    carrierPlmnList, mSatellitePlmnListFromOverlayConfig, barredPlmnList),
                    carrierPlmnList, mSatellitePlmnListFromOverlayConfig, barredPlmnList),
                    obtainMessage(EVENT_SET_SATELLITE_PLMN_INFO_DONE));
                    obtainMessage(EVENT_SET_SATELLITE_PLMN_INFO_DONE));
        }
        }
@@ -5892,6 +5899,13 @@ public class SatelliteController extends Handler {
            return;
            return;
        }
        }


        Phone phone = SatelliteServiceUtils.getPhone(subId);
        if (phone == null) {
            ploge("evaluateEnablingSatelliteForCarrier: phone is null for subId=" + subId);
            callback.accept(SATELLITE_RESULT_INVALID_TELEPHONY_STATE);
            return;
        }

        /* Request to enable or disable the satellite in the cellular modem only when the desired
        /* Request to enable or disable the satellite in the cellular modem only when the desired
        state and the current state are different. */
        state and the current state are different. */
        boolean isSatelliteExpectedToBeEnabled = !isSatelliteRestrictedForCarrier(subId);
        boolean isSatelliteExpectedToBeEnabled = !isSatelliteRestrictedForCarrier(subId);
@@ -5906,7 +5920,7 @@ public class SatelliteController extends Handler {
                                SatelliteServiceUtils.getPhone(subId));
                                SatelliteServiceUtils.getPhone(subId));
                Message onCompleted = obtainMessage(
                Message onCompleted = obtainMessage(
                        EVENT_EVALUATE_SATELLITE_ATTACH_RESTRICTION_CHANGE_DONE, request);
                        EVENT_EVALUATE_SATELLITE_ATTACH_RESTRICTION_CHANGE_DONE, request);
                mSatelliteModemInterface.requestSetSatelliteEnabledForCarrier(simSlot,
                phone.setSatelliteEnabledForCarrier(simSlot,
                        isSatelliteExpectedToBeEnabled, onCompleted);
                        isSatelliteExpectedToBeEnabled, onCompleted);
            } else {
            } else {
                callback.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE);
                callback.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE);
+37 −25
Original line number Original line Diff line number Diff line
@@ -2273,7 +2273,7 @@ public class SatelliteControllerTest extends TelephonyTest {
        processAllMessages();
        processAllMessages();
        List<String> carrierPlmnList = testSatelliteController.getSatellitePlmnsForCarrier(
        List<String> carrierPlmnList = testSatelliteController.getSatellitePlmnsForCarrier(
                SUB_ID);
                SUB_ID);
        verify(mMockSatelliteModemInterface, never()).setSatellitePlmn(
        verify(mPhone, never()).setSatellitePlmn(
                anyInt(), anyList(), anyList(), any(Message.class));
                anyInt(), anyList(), anyList(), any(Message.class));
        assertTrue(carrierPlmnList.isEmpty());
        assertTrue(carrierPlmnList.isEmpty());
        reset(mMockSatelliteModemInterface);
        reset(mMockSatelliteModemInterface);
@@ -2300,15 +2300,18 @@ public class SatelliteControllerTest extends TelephonyTest {
        }
        }
        processAllMessages();
        processAllMessages();
        carrierPlmnList = testSatelliteController.getSatellitePlmnsForCarrier(SUB_ID);
        carrierPlmnList = testSatelliteController.getSatellitePlmnsForCarrier(SUB_ID);
        verify(mMockSatelliteModemInterface, never()).setSatellitePlmn(
        verify(mPhone, never()).setSatellitePlmn(
                anyInt(), anyList(), anyList(), any(Message.class));
                anyInt(), anyList(), anyList(), any(Message.class));
        assertTrue(carrierPlmnList.isEmpty());
        assertTrue(carrierPlmnList.isEmpty());
        reset(mMockSatelliteModemInterface);
        reset(mMockSatelliteModemInterface);
        reset(mPhone);


        // Reset TestSatelliteController so that device satellite PLMNs is loaded when
        // Reset TestSatelliteController so that device satellite PLMNs is loaded when
        // carrierEnabledSatelliteFlag is enabled.
        // carrierEnabledSatelliteFlag is enabled.
        when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true);
        when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true);
        mCarrierConfigChangedListenerList.clear();
        mCarrierConfigChangedListenerList.clear();
        when(mPhone.getSignalStrengthController()).thenReturn(mSignalStrengthController);
        when(mPhone.getDeviceStateMonitor()).thenReturn(mDeviceStateMonitor);
        testSatelliteController =
        testSatelliteController =
                new TestSatelliteController(mContext, Looper.myLooper(), mFeatureFlags);
                new TestSatelliteController(mContext, Looper.myLooper(), mFeatureFlags);


@@ -2329,9 +2332,10 @@ public class SatelliteControllerTest extends TelephonyTest {
        assertTrue(carrierPlmnList.isEmpty());
        assertTrue(carrierPlmnList.isEmpty());
        List<String> allSatellitePlmnList = SatelliteServiceUtils.mergeStrLists(
        List<String> allSatellitePlmnList = SatelliteServiceUtils.mergeStrLists(
                carrierPlmnList, satellitePlmnListFromOverlayConfig);
                carrierPlmnList, satellitePlmnListFromOverlayConfig);
        verify(mMockSatelliteModemInterface, times(1)).setSatellitePlmn(anyInt(),
        verify(mPhone, times(1)).setSatellitePlmn(anyInt(),
                eq(EMPTY_STRING_LIST), eq(allSatellitePlmnList), any(Message.class));
                eq(EMPTY_STRING_LIST), eq(allSatellitePlmnList), any(Message.class));
        reset(mMockSatelliteModemInterface);
        reset(mMockSatelliteModemInterface);
        reset(mPhone);


        // Trigger carrier config changed with carrierEnabledSatelliteFlag enabled and non-empty
        // Trigger carrier config changed with carrierEnabledSatelliteFlag enabled and non-empty
        // carrier supported satellite services.
        // carrier supported satellite services.
@@ -2349,9 +2353,10 @@ public class SatelliteControllerTest extends TelephonyTest {
        allSatellitePlmnList = SatelliteServiceUtils.mergeStrLists(
        allSatellitePlmnList = SatelliteServiceUtils.mergeStrLists(
                carrierPlmnList, satellitePlmnListFromOverlayConfig);
                carrierPlmnList, satellitePlmnListFromOverlayConfig);
        assertEquals(expectedCarrierPlmnList, carrierPlmnList);
        assertEquals(expectedCarrierPlmnList, carrierPlmnList);
        verify(mMockSatelliteModemInterface, times(1)).setSatellitePlmn(anyInt(),
        verify(mPhone, times(1)).setSatellitePlmn(anyInt(),
                eq(carrierPlmnList), eq(allSatellitePlmnList), any(Message.class));
                eq(carrierPlmnList), eq(allSatellitePlmnList), any(Message.class));
        reset(mMockSatelliteModemInterface);
        reset(mMockSatelliteModemInterface);
        reset(mPhone);


        /* setSatellitePlmn() is called regardless whether satellite attach for carrier is
        /* setSatellitePlmn() is called regardless whether satellite attach for carrier is
           supported. */
           supported. */
@@ -2364,14 +2369,17 @@ public class SatelliteControllerTest extends TelephonyTest {
            );
            );
        }
        }
        processAllMessages();
        processAllMessages();
        verify(mMockSatelliteModemInterface, times(1)).setSatellitePlmn(anyInt(),
        verify(mPhone, times(1)).setSatellitePlmn(anyInt(),
                eq(carrierPlmnList), eq(allSatellitePlmnList), any(Message.class));
                eq(carrierPlmnList), eq(allSatellitePlmnList), any(Message.class));
        reset(mMockSatelliteModemInterface);
        reset(mMockSatelliteModemInterface);
        reset(mPhone);


        // Test empty config_satellite_providers and empty carrier PLMN list
        // Test empty config_satellite_providers and empty carrier PLMN list
        mCarrierConfigChangedListenerList.clear();
        mCarrierConfigChangedListenerList.clear();
        mContextFixture.putStringArrayResource(
        mContextFixture.putStringArrayResource(
                R.array.config_satellite_providers, EMPTY_STRING_ARRAY);
                R.array.config_satellite_providers, EMPTY_STRING_ARRAY);
        when(mPhone.getSignalStrengthController()).thenReturn(mSignalStrengthController);
        when(mPhone.getDeviceStateMonitor()).thenReturn(mDeviceStateMonitor);
        testSatelliteController =
        testSatelliteController =
                new TestSatelliteController(mContext, Looper.myLooper(), mFeatureFlags);
                new TestSatelliteController(mContext, Looper.myLooper(), mFeatureFlags);
        mCarrierConfigBundle.putPersistableBundle(CarrierConfigManager
        mCarrierConfigBundle.putPersistableBundle(CarrierConfigManager
@@ -2386,9 +2394,10 @@ public class SatelliteControllerTest extends TelephonyTest {
        processAllMessages();
        processAllMessages();
        carrierPlmnList = testSatelliteController.getSatellitePlmnsForCarrier(SUB_ID);
        carrierPlmnList = testSatelliteController.getSatellitePlmnsForCarrier(SUB_ID);
        assertTrue(carrierPlmnList.isEmpty());
        assertTrue(carrierPlmnList.isEmpty());
        verify(mMockSatelliteModemInterface, times(1)).setSatellitePlmn(anyInt(),
        verify(mPhone, times(1)).setSatellitePlmn(anyInt(),
                eq(EMPTY_STRING_LIST), eq(EMPTY_STRING_LIST), any(Message.class));
                eq(EMPTY_STRING_LIST), eq(EMPTY_STRING_LIST), any(Message.class));
        reset(mMockSatelliteModemInterface);
        reset(mMockSatelliteModemInterface);
        reset(mPhone);
    }
    }


    @Test
    @Test
@@ -2435,8 +2444,8 @@ public class SatelliteControllerTest extends TelephonyTest {
                SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER, mIIntegerConsumer);
                SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER, mIIntegerConsumer);
        processAllMessages();
        processAllMessages();
        assertEquals(SATELLITE_RESULT_SUCCESS, (long) mIIntegerConsumerResults.get(0));
        assertEquals(SATELLITE_RESULT_SUCCESS, (long) mIIntegerConsumerResults.get(0));
        verify(mMockSatelliteModemInterface, never())
        verify(mPhone, never())
                .requestSetSatelliteEnabledForCarrier(anyInt(), anyBoolean(), any(Message.class));
                .setSatelliteEnabledForCarrier(anyInt(), anyBoolean(), any(Message.class));
        assertTrue(waitForIIntegerConsumerResult(1));
        assertTrue(waitForIIntegerConsumerResult(1));
        restrictionSet =
        restrictionSet =
                mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID);
                mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID);
@@ -2455,8 +2464,8 @@ public class SatelliteControllerTest extends TelephonyTest {
        restrictionSet =
        restrictionSet =
                mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID);
                mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID);
        assertTrue(!restrictionSet.contains(SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER));
        assertTrue(!restrictionSet.contains(SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER));
        verify(mMockSatelliteModemInterface, times(1))
        verify(mPhone, times(1))
                .requestSetSatelliteEnabledForCarrier(anyInt(), anyBoolean(), any(Message.class));
                .setSatelliteEnabledForCarrier(anyInt(), anyBoolean(), any(Message.class));


        // Add satellite attach restriction reason by user
        // Add satellite attach restriction reason by user
        mIIntegerConsumerResults.clear();
        mIIntegerConsumerResults.clear();
@@ -2471,12 +2480,13 @@ public class SatelliteControllerTest extends TelephonyTest {
        restrictionSet =
        restrictionSet =
                mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID);
                mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID);
        assertTrue(restrictionSet.contains(SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER));
        assertTrue(restrictionSet.contains(SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER));
        verify(mMockSatelliteModemInterface, times(1))
        verify(mPhone, times(1))
                .requestSetSatelliteEnabledForCarrier(anyInt(), eq(false), any(Message.class));
                .setSatelliteEnabledForCarrier(anyInt(), eq(false), any(Message.class));


        // add satellite attach restriction reason by geolocation
        // add satellite attach restriction reason by geolocation
        mIIntegerConsumerResults.clear();
        mIIntegerConsumerResults.clear();
        reset(mMockSatelliteModemInterface);
        reset(mMockSatelliteModemInterface);
        reset(mPhone);
        setUpResponseForRequestSetSatelliteEnabledForCarrier(false, SATELLITE_RESULT_SUCCESS);
        setUpResponseForRequestSetSatelliteEnabledForCarrier(false, SATELLITE_RESULT_SUCCESS);
        mSatelliteControllerUT.addAttachRestrictionForCarrier(SUB_ID,
        mSatelliteControllerUT.addAttachRestrictionForCarrier(SUB_ID,
                SATELLITE_COMMUNICATION_RESTRICTION_REASON_GEOLOCATION, mIIntegerConsumer);
                SATELLITE_COMMUNICATION_RESTRICTION_REASON_GEOLOCATION, mIIntegerConsumer);
@@ -2487,8 +2497,8 @@ public class SatelliteControllerTest extends TelephonyTest {
        restrictionSet =
        restrictionSet =
                mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID);
                mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID);
        assertTrue(restrictionSet.contains(SATELLITE_COMMUNICATION_RESTRICTION_REASON_GEOLOCATION));
        assertTrue(restrictionSet.contains(SATELLITE_COMMUNICATION_RESTRICTION_REASON_GEOLOCATION));
        verify(mMockSatelliteModemInterface, never())
        verify(mPhone, never())
                .requestSetSatelliteEnabledForCarrier(anyInt(), anyBoolean(), any(Message.class));
                .setSatelliteEnabledForCarrier(anyInt(), anyBoolean(), any(Message.class));


        // remove satellite attach restriction reason by geolocation
        // remove satellite attach restriction reason by geolocation
        mIIntegerConsumerResults.clear();
        mIIntegerConsumerResults.clear();
@@ -2504,8 +2514,8 @@ public class SatelliteControllerTest extends TelephonyTest {
                mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID);
                mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID);
        assertTrue(!restrictionSet.contains(
        assertTrue(!restrictionSet.contains(
                SATELLITE_COMMUNICATION_RESTRICTION_REASON_GEOLOCATION));
                SATELLITE_COMMUNICATION_RESTRICTION_REASON_GEOLOCATION));
        verify(mMockSatelliteModemInterface, never())
        verify(mPhone, never())
                .requestSetSatelliteEnabledForCarrier(anyInt(), anyBoolean(), any(Message.class));
                .setSatelliteEnabledForCarrier(anyInt(), anyBoolean(), any(Message.class));


        // remove satellite restriction reason by user
        // remove satellite restriction reason by user
        mIIntegerConsumerResults.clear();
        mIIntegerConsumerResults.clear();
@@ -2520,8 +2530,8 @@ public class SatelliteControllerTest extends TelephonyTest {
        restrictionSet =
        restrictionSet =
                mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID);
                mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID);
        assertTrue(!restrictionSet.contains(SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER));
        assertTrue(!restrictionSet.contains(SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER));
        verify(mMockSatelliteModemInterface, times(1))
        verify(mPhone, times(1))
                .requestSetSatelliteEnabledForCarrier(anyInt(), eq(true), any(Message.class));
                .setSatelliteEnabledForCarrier(anyInt(), eq(true), any(Message.class));
        reset(mMockSatelliteModemInterface);
        reset(mMockSatelliteModemInterface);


        when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(false);
        when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(false);
@@ -3191,8 +3201,8 @@ public class SatelliteControllerTest extends TelephonyTest {


        assertTrue(waitForIIntegerConsumerResult(1));
        assertTrue(waitForIIntegerConsumerResult(1));
        assertEquals(SATELLITE_RESULT_SUCCESS, (long) mIIntegerConsumerResults.get(0));
        assertEquals(SATELLITE_RESULT_SUCCESS, (long) mIIntegerConsumerResults.get(0));
        verify(mMockSatelliteModemInterface, times(1))
        verify(mPhone, times(1))
                .requestSetSatelliteEnabledForCarrier(anyInt(), eq(true), any(Message.class));
                .setSatelliteEnabledForCarrier(anyInt(), eq(true), any(Message.class));


        // Verify call the requestSetSatelliteEnabledForCarrier to disable the satellite when
        // Verify call the requestSetSatelliteEnabledForCarrier to disable the satellite when
        // satellite service is disabled by entitlement server.
        // satellite service is disabled by entitlement server.
@@ -3212,8 +3222,8 @@ public class SatelliteControllerTest extends TelephonyTest {


        assertTrue(waitForIIntegerConsumerResult(1));
        assertTrue(waitForIIntegerConsumerResult(1));
        assertEquals(SATELLITE_RESULT_SUCCESS, (long) mIIntegerConsumerResults.get(0));
        assertEquals(SATELLITE_RESULT_SUCCESS, (long) mIIntegerConsumerResults.get(0));
        verify(mMockSatelliteModemInterface, times(1))
        verify(mPhone, times(1))
                .requestSetSatelliteEnabledForCarrier(anyInt(), eq(false), any(Message.class));
                .setSatelliteEnabledForCarrier(anyInt(), eq(false), any(Message.class));
    }
    }


    @Test
    @Test
@@ -3258,6 +3268,7 @@ public class SatelliteControllerTest extends TelephonyTest {
        // If the entitlement plmn list, the overlay config plmn list and the carrier plmn list
        // If the entitlement plmn list, the overlay config plmn list and the carrier plmn list
        // are available and the barred plmn list is empty, verify passing to the modem.
        // are available and the barred plmn list is empty, verify passing to the modem.
        reset(mMockSatelliteModemInterface);
        reset(mMockSatelliteModemInterface);
        reset(mPhone);
        Map<Integer, Map<String, Set<Integer>>>
        Map<Integer, Map<String, Set<Integer>>>
                satelliteServicesSupportedByCarriers = new HashMap<>();
                satelliteServicesSupportedByCarriers = new HashMap<>();
        List<String> carrierConfigPlmnList = Arrays.stream(new String[]{"00105", "00106"}).toList();
        List<String> carrierConfigPlmnList = Arrays.stream(new String[]{"00105", "00106"}).toList();
@@ -3288,6 +3299,7 @@ public class SatelliteControllerTest extends TelephonyTest {
        // If the entitlement plmn list is null and the overlay config plmn list and the carrier
        // If the entitlement plmn list is null and the overlay config plmn list and the carrier
        // plmn list are available, verify passing to the modem.
        // plmn list are available, verify passing to the modem.
        reset(mMockSatelliteModemInterface);
        reset(mMockSatelliteModemInterface);
        reset(mPhone);
        entitlementPlmnList = null;
        entitlementPlmnList = null;
        mergedPlmnList = carrierConfigPlmnList;
        mergedPlmnList = carrierConfigPlmnList;
        verifyPassingToModemAfterQueryCompleted(entitlementPlmnList, mergedPlmnList,
        verifyPassingToModemAfterQueryCompleted(entitlementPlmnList, mergedPlmnList,
@@ -3346,7 +3358,7 @@ public class SatelliteControllerTest extends TelephonyTest {
        if (overlayConfigPlmnList.isEmpty()) {
        if (overlayConfigPlmnList.isEmpty()) {
            assertEquals(plmnListPerCarrier, allSatellitePlmnList);
            assertEquals(plmnListPerCarrier, allSatellitePlmnList);
        }
        }
        verify(mMockSatelliteModemInterface, times(1)).setSatellitePlmn(anyInt(),
        verify(mPhone, times(1)).setSatellitePlmn(anyInt(),
                eq(plmnListPerCarrier), eq(allSatellitePlmnList), any(Message.class));
                eq(plmnListPerCarrier), eq(allSatellitePlmnList), any(Message.class));
    }
    }


@@ -5553,8 +5565,8 @@ public class SatelliteControllerTest extends TelephonyTest {
            AsyncResult.forMessage(message, null, exception);
            AsyncResult.forMessage(message, null, exception);
            message.sendToTarget();
            message.sendToTarget();
            return null;
            return null;
        }).when(mMockSatelliteModemInterface)
        }).when(mPhone)
                .requestSetSatelliteEnabledForCarrier(anyInt(), eq(enabled), any(Message.class));
                .setSatelliteEnabledForCarrier(anyInt(), eq(enabled), any(Message.class));
    }
    }


    private void setUpNoResponseForRequestSatelliteEnabled(boolean enabled, boolean demoMode,
    private void setUpNoResponseForRequestSatelliteEnabled(boolean enabled, boolean demoMode,