Loading src/java/com/android/internal/telephony/satellite/SatelliteController.java +1 −1 Original line number Diff line number Diff line Loading @@ -5488,7 +5488,7 @@ public class SatelliteController extends Handler { /** If the provision state per subscriberId for the cached is not exist, check the database for * the corresponding value and use it. */ private void updateSatelliteProvisionedStatePerSubscriberId() { protected void updateSatelliteProvisionedStatePerSubscriberId() { if (!mFeatureFlags.carrierRoamingNbIotNtn()) { return; } Loading src/java/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommender.java +39 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,9 @@ import static android.telephony.TelephonyManager.EXTRA_EMERGENCY_CALL_TO_SATELLI import static android.telephony.TelephonyManager.EXTRA_EMERGENCY_CALL_TO_SATELLITE_LAUNCH_INTENT; import static android.telephony.satellite.SatelliteManager.EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_SOS; import static android.telephony.satellite.SatelliteManager.EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_T911; import static android.telephony.satellite.SatelliteManager.SATELLITE_DISALLOWED_REASON_NOT_PROVISIONED; import static android.telephony.satellite.SatelliteManager.SATELLITE_DISALLOWED_REASON_NOT_SUPPORTED; import static android.telephony.satellite.SatelliteManager.SATELLITE_DISALLOWED_REASON_UNSUPPORTED_DEFAULT_MSG_APP; import static com.android.internal.telephony.flags.Flags.satellitePersistentLogging; import static com.android.internal.telephony.satellite.SatelliteController.INVALID_EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE; Loading Loading @@ -262,8 +265,32 @@ public class SatelliteSOSMessageRecommender extends Handler { return SmsApplication.getDefaultSendToApplication(mContext, false); } @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE) protected boolean updateAndGetProvisionState() { mSatelliteController.updateSatelliteProvisionedStatePerSubscriberId(); return isDeviceProvisioned(); } @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE) protected boolean isSatelliteAllowedByReasons() { SatelliteManager satelliteManager = mContext.getSystemService(SatelliteManager.class); List<Integer> disallowedReasons = satelliteManager.getSatelliteDisallowedReasons(); if (disallowedReasons.stream().anyMatch(r -> (r == SATELLITE_DISALLOWED_REASON_UNSUPPORTED_DEFAULT_MSG_APP || r == SATELLITE_DISALLOWED_REASON_NOT_PROVISIONED || r == SATELLITE_DISALLOWED_REASON_NOT_SUPPORTED))) { plogd("isAllowedForDefaultMessageApp:false, disallowedReasons=" + disallowedReasons); return false; } return true; } private void handleEmergencyCallStartedEvent(@NonNull Connection connection) { plogd("handleEmergencyCallStartedEvent: connection=" + connection); if (!updateAndGetProvisionState() || !isSatelliteAllowedByReasons()) { plogd("handleEmergencyCallStartedEvent: not ready to handle emergency call start"); return; } mSatelliteController.setLastEmergencyCallTime(); if (sendEventDisplayEmergencyMessageForcefully(connection)) { Loading Loading @@ -310,6 +337,12 @@ public class SatelliteSOSMessageRecommender extends Handler { return; } if (!updateAndGetProvisionState() || !isSatelliteAllowedByReasons()) { plogd("evaluateSendingConnectionEventDisplayEmergencyMessage: " + "not ready to use satellite."); return; } /* * The device might be connected to satellite after the emergency call started. Thus, we * need to do this check again so that we will have higher chance of sending the event Loading Loading @@ -376,6 +409,12 @@ public class SatelliteSOSMessageRecommender extends Handler { return; } if (!updateAndGetProvisionState() || !isSatelliteAllowedByReasons()) { plogd("handleEmergencyCallConnectionStateChangedEvent: not ready to use satellite."); cleanUpResources(false); return; } String callId = arg.first; int state = arg.second; if (!mEmergencyConnection.getTelecomCallId().equals(callId)) { Loading tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommenderTest.java +12 −0 Original line number Diff line number Diff line Loading @@ -983,6 +983,8 @@ public class SatelliteSOSMessageRecommenderTest extends TelephonyTest { private ComponentName mSmsAppComponent = new ComponentName( DEFAULT_SATELLITE_MESSAGING_PACKAGE, DEFAULT_SATELLITE_MESSAGING_CLASS); private boolean mIsDialerNotified; private boolean mProvisionState = true; private boolean mSatelliteAllowedByReasons = true; /** * Create an instance of SatelliteSOSMessageRecommender. Loading Loading @@ -1017,6 +1019,16 @@ public class SatelliteSOSMessageRecommenderTest extends TelephonyTest { mIsDialerNotified = isDialerNotified; } @Override protected boolean updateAndGetProvisionState() { return mProvisionState; } @Override protected boolean isSatelliteAllowedByReasons() { return mSatelliteAllowedByReasons; } public boolean isTimerStarted() { return hasMessages(EVENT_TIME_OUT); } Loading Loading
src/java/com/android/internal/telephony/satellite/SatelliteController.java +1 −1 Original line number Diff line number Diff line Loading @@ -5488,7 +5488,7 @@ public class SatelliteController extends Handler { /** If the provision state per subscriberId for the cached is not exist, check the database for * the corresponding value and use it. */ private void updateSatelliteProvisionedStatePerSubscriberId() { protected void updateSatelliteProvisionedStatePerSubscriberId() { if (!mFeatureFlags.carrierRoamingNbIotNtn()) { return; } Loading
src/java/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommender.java +39 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,9 @@ import static android.telephony.TelephonyManager.EXTRA_EMERGENCY_CALL_TO_SATELLI import static android.telephony.TelephonyManager.EXTRA_EMERGENCY_CALL_TO_SATELLITE_LAUNCH_INTENT; import static android.telephony.satellite.SatelliteManager.EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_SOS; import static android.telephony.satellite.SatelliteManager.EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_T911; import static android.telephony.satellite.SatelliteManager.SATELLITE_DISALLOWED_REASON_NOT_PROVISIONED; import static android.telephony.satellite.SatelliteManager.SATELLITE_DISALLOWED_REASON_NOT_SUPPORTED; import static android.telephony.satellite.SatelliteManager.SATELLITE_DISALLOWED_REASON_UNSUPPORTED_DEFAULT_MSG_APP; import static com.android.internal.telephony.flags.Flags.satellitePersistentLogging; import static com.android.internal.telephony.satellite.SatelliteController.INVALID_EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE; Loading Loading @@ -262,8 +265,32 @@ public class SatelliteSOSMessageRecommender extends Handler { return SmsApplication.getDefaultSendToApplication(mContext, false); } @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE) protected boolean updateAndGetProvisionState() { mSatelliteController.updateSatelliteProvisionedStatePerSubscriberId(); return isDeviceProvisioned(); } @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE) protected boolean isSatelliteAllowedByReasons() { SatelliteManager satelliteManager = mContext.getSystemService(SatelliteManager.class); List<Integer> disallowedReasons = satelliteManager.getSatelliteDisallowedReasons(); if (disallowedReasons.stream().anyMatch(r -> (r == SATELLITE_DISALLOWED_REASON_UNSUPPORTED_DEFAULT_MSG_APP || r == SATELLITE_DISALLOWED_REASON_NOT_PROVISIONED || r == SATELLITE_DISALLOWED_REASON_NOT_SUPPORTED))) { plogd("isAllowedForDefaultMessageApp:false, disallowedReasons=" + disallowedReasons); return false; } return true; } private void handleEmergencyCallStartedEvent(@NonNull Connection connection) { plogd("handleEmergencyCallStartedEvent: connection=" + connection); if (!updateAndGetProvisionState() || !isSatelliteAllowedByReasons()) { plogd("handleEmergencyCallStartedEvent: not ready to handle emergency call start"); return; } mSatelliteController.setLastEmergencyCallTime(); if (sendEventDisplayEmergencyMessageForcefully(connection)) { Loading Loading @@ -310,6 +337,12 @@ public class SatelliteSOSMessageRecommender extends Handler { return; } if (!updateAndGetProvisionState() || !isSatelliteAllowedByReasons()) { plogd("evaluateSendingConnectionEventDisplayEmergencyMessage: " + "not ready to use satellite."); return; } /* * The device might be connected to satellite after the emergency call started. Thus, we * need to do this check again so that we will have higher chance of sending the event Loading Loading @@ -376,6 +409,12 @@ public class SatelliteSOSMessageRecommender extends Handler { return; } if (!updateAndGetProvisionState() || !isSatelliteAllowedByReasons()) { plogd("handleEmergencyCallConnectionStateChangedEvent: not ready to use satellite."); cleanUpResources(false); return; } String callId = arg.first; int state = arg.second; if (!mEmergencyConnection.getTelecomCallId().equals(callId)) { Loading
tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommenderTest.java +12 −0 Original line number Diff line number Diff line Loading @@ -983,6 +983,8 @@ public class SatelliteSOSMessageRecommenderTest extends TelephonyTest { private ComponentName mSmsAppComponent = new ComponentName( DEFAULT_SATELLITE_MESSAGING_PACKAGE, DEFAULT_SATELLITE_MESSAGING_CLASS); private boolean mIsDialerNotified; private boolean mProvisionState = true; private boolean mSatelliteAllowedByReasons = true; /** * Create an instance of SatelliteSOSMessageRecommender. Loading Loading @@ -1017,6 +1019,16 @@ public class SatelliteSOSMessageRecommenderTest extends TelephonyTest { mIsDialerNotified = isDialerNotified; } @Override protected boolean updateAndGetProvisionState() { return mProvisionState; } @Override protected boolean isSatelliteAllowedByReasons() { return mSatelliteAllowedByReasons; } public boolean isTimerStarted() { return hasMessages(EVENT_TIME_OUT); } Loading