Handle device doesn't point to satellite in CONNECTED state
Changed stop timer position for P2P and ESOS inactivity timer continuty when transitioning between CONNECTED and NOTCONNECTED states
Bug: 390722283
Test: atest SatelliteSessionControllerTest
Flag: EXEMPT (bug fix)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:3294867e4a61054ab0be45378fa7584cdf1ada5c)
Merged-In: I87fc9cd186c0bad380ab7c29e4cc12d136355037
Change-Id: I87fc9cd186c0bad380ab7c29e4cc12d136355037
diff --git a/src/java/com/android/internal/telephony/satellite/SatelliteSessionController.java b/src/java/com/android/internal/telephony/satellite/SatelliteSessionController.java
index 2784f0d..b0c985a 100644
--- a/src/java/com/android/internal/telephony/satellite/SatelliteSessionController.java
+++ b/src/java/com/android/internal/telephony/satellite/SatelliteSessionController.java
@@ -35,6 +35,7 @@
import static android.telephony.satellite.SatelliteManager.SATELLITE_MODEM_STATE_CONNECTED;
import static android.telephony.satellite.SatelliteManager.SATELLITE_MODEM_STATE_DATAGRAM_TRANSFERRING;
import static android.telephony.satellite.SatelliteManager.SATELLITE_MODEM_STATE_ENABLING_SATELLITE;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_MODEM_STATE_IDLE;
import static android.telephony.satellite.SatelliteManager.SATELLITE_MODEM_STATE_LISTENING;
import static android.telephony.satellite.SatelliteManager.SATELLITE_MODEM_STATE_UNKNOWN;
import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_REQUEST_ABORTED;
@@ -571,13 +572,16 @@
}
mIsDeviceAlignedWithSatellite = isAligned;
+ plogd("setDeviceAlignedWithSatellite: isAligned " + isAligned);
if (mIsDeviceAlignedWithSatellite) {
stopEsosInactivityTimer();
stopP2pSmsInactivityTimer();
endUserInactivity();
} else {
- if (mCurrentState == SatelliteManager.SATELLITE_MODEM_STATE_NOT_CONNECTED) {
+ if (mCurrentState == SatelliteManager.SATELLITE_MODEM_STATE_NOT_CONNECTED
+ || mCurrentState == SATELLITE_MODEM_STATE_CONNECTED
+ || mCurrentState == SATELLITE_MODEM_STATE_IDLE) {
evaluateStartingEsosInactivityTimer();
evaluateStartingP2pSmsInactivityTimer();
}
@@ -705,6 +709,8 @@
mIsSendingTriggeredDuringTransferringState.set(false);
unbindService();
stopNbIotInactivityTimer();
+ stopEsosInactivityTimer();
+ stopNbIotInactivityTimer();
endUserInactivity();
DemoSimulator.getInstance().onSatelliteModeOff();
notifyStateChangedEvent(SatelliteManager.SATELLITE_MODEM_STATE_OFF);
@@ -1060,6 +1066,9 @@
public void enter() {
if (DBG) plogd("Entering TransferringState");
stopNbIotInactivityTimer();
+ stopEsosInactivityTimer();
+ stopNbIotInactivityTimer();
+
mPreviousState = mCurrentState;
mCurrentState = SATELLITE_MODEM_STATE_DATAGRAM_TRANSFERRING;
notifyStateChangedEvent(SATELLITE_MODEM_STATE_DATAGRAM_TRANSFERRING);
@@ -1219,9 +1228,6 @@
@Override
public void exit() {
if (DBG) plogd("Exiting NotConnectedState");
-
- stopEsosInactivityTimer();
- stopP2pSmsInactivityTimer();
}
@Override
@@ -1327,9 +1333,6 @@
@Override
public void exit() {
if (DBG) plogd("Exiting ConnectedState");
-
- stopEsosInactivityTimer();
- stopP2pSmsInactivityTimer();
}
@Override
diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSessionControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSessionControllerTest.java
index de47662..54cf227 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSessionControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSessionControllerTest.java
@@ -368,9 +368,11 @@
// Verify that the P2P SMS inactivity timer is stopped.
assertFalse(mTestSatelliteSessionController.isP2pSmsInActivityTimerStarted());
+ moveNotConnectedToConnectedState();
+
mTestSatelliteSessionController.setDeviceAlignedWithSatellite(false);
- // Verify that the P2P SMS inactivity timer is started.
+ // Verify that the P2P SMS inactivity timer is started in CONNECTED state.
assertTrue(mTestSatelliteSessionController.isP2pSmsInActivityTimerStarted());
// Time shift to cause timeout