Loading src/java/com/android/internal/telephony/satellite/SatelliteController.java +14 −18 Original line number Original line Diff line number Diff line Loading @@ -6167,17 +6167,16 @@ public class SatelliteController extends Handler { return; 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. */ state and the current state are different. */ boolean isSatelliteExpectedToBeEnabled = !isSatelliteRestrictedForCarrier(subId) boolean isSatelliteExpectedToBeEnabled = !isSatelliteRestrictedForCarrier(subId) && isSatelliteSupportedViaCarrier(subId); && isSatelliteSupportedViaCarrier(subId) && getCarrierRoamingNtnConnectType(subId) == CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC; boolean isSatelliteEnabledForCarrierAtModem = isSatelliteEnabledForCarrierAtModem( boolean isSatelliteEnabledForCarrierAtModem = isSatelliteEnabledForCarrierAtModem( phone.getSubId()); phone.getSubId()); plogd("evaluateEnablingSatelliteForCarrier: subId=" + subId + " reason=" + reason plogd("evaluateEnablingSatelliteForCarrier: subId=" + subId + " reason=" + reason + " isSatelliteExpectedToBeEnabled=" + isSatelliteExpectedToBeEnabled + " isSatelliteExpectedToBeEnabled=" + isSatelliteExpectedToBeEnabled + " isSatelliteEnabledForCarrierAtModem=" + isSatelliteEnabledForCarrierAtModem); + " isSatelliteEnabledForCarrierAtModem=" + isSatelliteEnabledForCarrierAtModem); if (isSatelliteExpectedToBeEnabled != isSatelliteEnabledForCarrierAtModem) { int simSlot = SubscriptionManager.getSlotIndex(subId); int simSlot = SubscriptionManager.getSlotIndex(subId); RequestHandleSatelliteAttachRestrictionForCarrierArgument argument = RequestHandleSatelliteAttachRestrictionForCarrierArgument argument = new RequestHandleSatelliteAttachRestrictionForCarrierArgument(subId, new RequestHandleSatelliteAttachRestrictionForCarrierArgument(subId, Loading @@ -6189,9 +6188,6 @@ public class SatelliteController extends Handler { EVENT_EVALUATE_SATELLITE_ATTACH_RESTRICTION_CHANGE_DONE, request); EVENT_EVALUATE_SATELLITE_ATTACH_RESTRICTION_CHANGE_DONE, request); phone.setSatelliteEnabledForCarrier(simSlot, phone.setSatelliteEnabledForCarrier(simSlot, isSatelliteExpectedToBeEnabled, onCompleted); isSatelliteExpectedToBeEnabled, onCompleted); } else { callback.accept(SATELLITE_RESULT_SUCCESS); } } } @SatelliteManager.SatelliteResult private int evaluateOemSatelliteRequestAllowed( @SatelliteManager.SatelliteResult private int evaluateOemSatelliteRequestAllowed( Loading tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java +9 −6 Original line number Original line Diff line number Diff line Loading @@ -2369,14 +2369,15 @@ public class SatelliteControllerTest extends TelephonyTest { // Add satellite attach restriction reason by user // Add satellite attach restriction reason by user mIIntegerConsumerResults.clear(); mIIntegerConsumerResults.clear(); reset(mMockSatelliteModemInterface); reset(mMockSatelliteModemInterface); reset(mPhone); setUpResponseForRequestSetSatelliteEnabledForCarrier(false, SATELLITE_RESULT_SUCCESS); setUpResponseForRequestSetSatelliteEnabledForCarrier(false, SATELLITE_RESULT_SUCCESS); doReturn(true).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); doReturn(true).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); mSatelliteControllerUT.addAttachRestrictionForCarrier(SUB_ID, mSatelliteControllerUT.addAttachRestrictionForCarrier(SUB_ID, 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(mPhone, never()) verify(mPhone, times(1)) .setSatelliteEnabledForCarrier(anyInt(), anyBoolean(), any(Message.class)); .setSatelliteEnabledForCarrier(anyInt(), eq(false), any(Message.class)); assertTrue(waitForIIntegerConsumerResult(1)); assertTrue(waitForIIntegerConsumerResult(1)); restrictionSet = restrictionSet = mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID); mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID); Loading @@ -2385,6 +2386,7 @@ public class SatelliteControllerTest extends TelephonyTest { // remove satellite restriction reason by user // remove satellite restriction reason by user mIIntegerConsumerResults.clear(); mIIntegerConsumerResults.clear(); reset(mMockSatelliteModemInterface); reset(mMockSatelliteModemInterface); reset(mPhone); setUpResponseForRequestSetSatelliteEnabledForCarrier(true, SATELLITE_RESULT_SUCCESS); setUpResponseForRequestSetSatelliteEnabledForCarrier(true, SATELLITE_RESULT_SUCCESS); doReturn(true).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); doReturn(true).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); mSatelliteControllerUT.removeAttachRestrictionForCarrier(SUB_ID, mSatelliteControllerUT.removeAttachRestrictionForCarrier(SUB_ID, Loading Loading @@ -2428,8 +2430,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(mPhone, never()) verify(mPhone, times(1)) .setSatelliteEnabledForCarrier(anyInt(), anyBoolean(), any(Message.class)); .setSatelliteEnabledForCarrier(anyInt(), eq(false), any(Message.class)); // remove satellite attach restriction reason by geolocation // remove satellite attach restriction reason by geolocation mIIntegerConsumerResults.clear(); mIIntegerConsumerResults.clear(); Loading @@ -2445,8 +2447,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(mPhone, never()) verify(mPhone, times(2)) .setSatelliteEnabledForCarrier(anyInt(), anyBoolean(), any(Message.class)); .setSatelliteEnabledForCarrier(anyInt(), eq(false), any(Message.class)); // remove satellite restriction reason by user // remove satellite restriction reason by user mIIntegerConsumerResults.clear(); mIIntegerConsumerResults.clear(); Loading Loading @@ -2941,6 +2943,7 @@ public class SatelliteControllerTest extends TelephonyTest { // satellite service is disabled by entitlement server. // satellite service is disabled by entitlement server. mIIntegerConsumerResults.clear(); mIIntegerConsumerResults.clear(); reset(mMockSatelliteModemInterface); reset(mMockSatelliteModemInterface); reset(mPhone); Map<Integer, Boolean> enabledForCarrierArrayPerSub = new HashMap<>(); Map<Integer, Boolean> enabledForCarrierArrayPerSub = new HashMap<>(); enabledForCarrierArrayPerSub.put(SUB_ID, true); enabledForCarrierArrayPerSub.put(SUB_ID, true); replaceInstance(SatelliteController.class, "mIsSatelliteAttachEnabledForCarrierArrayPerSub", replaceInstance(SatelliteController.class, "mIsSatelliteAttachEnabledForCarrierArrayPerSub", Loading Loading
src/java/com/android/internal/telephony/satellite/SatelliteController.java +14 −18 Original line number Original line Diff line number Diff line Loading @@ -6167,17 +6167,16 @@ public class SatelliteController extends Handler { return; 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. */ state and the current state are different. */ boolean isSatelliteExpectedToBeEnabled = !isSatelliteRestrictedForCarrier(subId) boolean isSatelliteExpectedToBeEnabled = !isSatelliteRestrictedForCarrier(subId) && isSatelliteSupportedViaCarrier(subId); && isSatelliteSupportedViaCarrier(subId) && getCarrierRoamingNtnConnectType(subId) == CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC; boolean isSatelliteEnabledForCarrierAtModem = isSatelliteEnabledForCarrierAtModem( boolean isSatelliteEnabledForCarrierAtModem = isSatelliteEnabledForCarrierAtModem( phone.getSubId()); phone.getSubId()); plogd("evaluateEnablingSatelliteForCarrier: subId=" + subId + " reason=" + reason plogd("evaluateEnablingSatelliteForCarrier: subId=" + subId + " reason=" + reason + " isSatelliteExpectedToBeEnabled=" + isSatelliteExpectedToBeEnabled + " isSatelliteExpectedToBeEnabled=" + isSatelliteExpectedToBeEnabled + " isSatelliteEnabledForCarrierAtModem=" + isSatelliteEnabledForCarrierAtModem); + " isSatelliteEnabledForCarrierAtModem=" + isSatelliteEnabledForCarrierAtModem); if (isSatelliteExpectedToBeEnabled != isSatelliteEnabledForCarrierAtModem) { int simSlot = SubscriptionManager.getSlotIndex(subId); int simSlot = SubscriptionManager.getSlotIndex(subId); RequestHandleSatelliteAttachRestrictionForCarrierArgument argument = RequestHandleSatelliteAttachRestrictionForCarrierArgument argument = new RequestHandleSatelliteAttachRestrictionForCarrierArgument(subId, new RequestHandleSatelliteAttachRestrictionForCarrierArgument(subId, Loading @@ -6189,9 +6188,6 @@ public class SatelliteController extends Handler { EVENT_EVALUATE_SATELLITE_ATTACH_RESTRICTION_CHANGE_DONE, request); EVENT_EVALUATE_SATELLITE_ATTACH_RESTRICTION_CHANGE_DONE, request); phone.setSatelliteEnabledForCarrier(simSlot, phone.setSatelliteEnabledForCarrier(simSlot, isSatelliteExpectedToBeEnabled, onCompleted); isSatelliteExpectedToBeEnabled, onCompleted); } else { callback.accept(SATELLITE_RESULT_SUCCESS); } } } @SatelliteManager.SatelliteResult private int evaluateOemSatelliteRequestAllowed( @SatelliteManager.SatelliteResult private int evaluateOemSatelliteRequestAllowed( Loading
tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java +9 −6 Original line number Original line Diff line number Diff line Loading @@ -2369,14 +2369,15 @@ public class SatelliteControllerTest extends TelephonyTest { // Add satellite attach restriction reason by user // Add satellite attach restriction reason by user mIIntegerConsumerResults.clear(); mIIntegerConsumerResults.clear(); reset(mMockSatelliteModemInterface); reset(mMockSatelliteModemInterface); reset(mPhone); setUpResponseForRequestSetSatelliteEnabledForCarrier(false, SATELLITE_RESULT_SUCCESS); setUpResponseForRequestSetSatelliteEnabledForCarrier(false, SATELLITE_RESULT_SUCCESS); doReturn(true).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); doReturn(true).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); mSatelliteControllerUT.addAttachRestrictionForCarrier(SUB_ID, mSatelliteControllerUT.addAttachRestrictionForCarrier(SUB_ID, 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(mPhone, never()) verify(mPhone, times(1)) .setSatelliteEnabledForCarrier(anyInt(), anyBoolean(), any(Message.class)); .setSatelliteEnabledForCarrier(anyInt(), eq(false), any(Message.class)); assertTrue(waitForIIntegerConsumerResult(1)); assertTrue(waitForIIntegerConsumerResult(1)); restrictionSet = restrictionSet = mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID); mSatelliteControllerUT.getAttachRestrictionReasonsForCarrier(SUB_ID); Loading @@ -2385,6 +2386,7 @@ public class SatelliteControllerTest extends TelephonyTest { // remove satellite restriction reason by user // remove satellite restriction reason by user mIIntegerConsumerResults.clear(); mIIntegerConsumerResults.clear(); reset(mMockSatelliteModemInterface); reset(mMockSatelliteModemInterface); reset(mPhone); setUpResponseForRequestSetSatelliteEnabledForCarrier(true, SATELLITE_RESULT_SUCCESS); setUpResponseForRequestSetSatelliteEnabledForCarrier(true, SATELLITE_RESULT_SUCCESS); doReturn(true).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); doReturn(true).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); mSatelliteControllerUT.removeAttachRestrictionForCarrier(SUB_ID, mSatelliteControllerUT.removeAttachRestrictionForCarrier(SUB_ID, Loading Loading @@ -2428,8 +2430,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(mPhone, never()) verify(mPhone, times(1)) .setSatelliteEnabledForCarrier(anyInt(), anyBoolean(), any(Message.class)); .setSatelliteEnabledForCarrier(anyInt(), eq(false), any(Message.class)); // remove satellite attach restriction reason by geolocation // remove satellite attach restriction reason by geolocation mIIntegerConsumerResults.clear(); mIIntegerConsumerResults.clear(); Loading @@ -2445,8 +2447,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(mPhone, never()) verify(mPhone, times(2)) .setSatelliteEnabledForCarrier(anyInt(), anyBoolean(), any(Message.class)); .setSatelliteEnabledForCarrier(anyInt(), eq(false), any(Message.class)); // remove satellite restriction reason by user // remove satellite restriction reason by user mIIntegerConsumerResults.clear(); mIIntegerConsumerResults.clear(); Loading Loading @@ -2941,6 +2943,7 @@ public class SatelliteControllerTest extends TelephonyTest { // satellite service is disabled by entitlement server. // satellite service is disabled by entitlement server. mIIntegerConsumerResults.clear(); mIIntegerConsumerResults.clear(); reset(mMockSatelliteModemInterface); reset(mMockSatelliteModemInterface); reset(mPhone); Map<Integer, Boolean> enabledForCarrierArrayPerSub = new HashMap<>(); Map<Integer, Boolean> enabledForCarrierArrayPerSub = new HashMap<>(); enabledForCarrierArrayPerSub.put(SUB_ID, true); enabledForCarrierArrayPerSub.put(SUB_ID, true); replaceInstance(SatelliteController.class, "mIsSatelliteAttachEnabledForCarrierArrayPerSub", replaceInstance(SatelliteController.class, "mIsSatelliteAttachEnabledForCarrierArrayPerSub", Loading