Merge "Added missed reporting route for satellite outgoing datagram fail cases" into 24D1-dev am: 0672c17c7e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/27180203
Change-Id: I4cb3d7d45e6e4a9e8ce2dd0daeaf335b86470675
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/src/java/com/android/internal/telephony/satellite/DatagramDispatcher.java b/src/java/com/android/internal/telephony/satellite/DatagramDispatcher.java
index a5b3ca6..4fc8d55 100644
--- a/src/java/com/android/internal/telephony/satellite/DatagramDispatcher.java
+++ b/src/java/com/android/internal/telephony/satellite/DatagramDispatcher.java
@@ -277,9 +277,6 @@
mDatagramController.updateSendStatus(argument.subId, argument.datagramType,
SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_SEND_SUCCESS,
getPendingDatagramCount(), error);
- mControllerMetricsStats.reportOutgoingDatagramSuccessCount(
- argument.datagramType, mIsDemoMode);
- mSessionMetricsStats.addCountOfSuccessfulOutgoingDatagram();
startWaitForSimulatedPollDatagramsDelayTimer(request);
if (getPendingDatagramCount() > 0) {
// Send response for current datagram
@@ -306,9 +303,6 @@
// after updating datagram transfer state internally.
argument.callback.accept(error);
// Abort sending all the pending datagrams
- mControllerMetricsStats.reportOutgoingDatagramFailCount(
- argument.datagramType, mIsDemoMode);
- mSessionMetricsStats.addCountOfFailedOutgoingDatagram();
abortSendingPendingDatagrams(argument.subId,
SatelliteManager.SATELLITE_RESULT_REQUEST_ABORTED);
}
@@ -550,8 +544,6 @@
pendingDatagramsMap.entrySet()) {
SendSatelliteDatagramArgument argument = entry.getValue();
reportSendDatagramCompleted(argument, errorCode);
- mControllerMetricsStats.reportOutgoingDatagramFailCount(argument.datagramType,
- mIsDemoMode);
argument.callback.accept(errorCode);
}
@@ -610,6 +602,15 @@
? (System.currentTimeMillis() - argument.datagramStartTime) : 0)
.setIsDemoMode(mIsDemoMode)
.build());
+ if (resultCode == SatelliteManager.SATELLITE_RESULT_SUCCESS) {
+ mControllerMetricsStats.reportOutgoingDatagramSuccessCount(argument.datagramType,
+ mIsDemoMode);
+ mSessionMetricsStats.addCountOfSuccessfulOutgoingDatagram();
+ } else {
+ mControllerMetricsStats.reportOutgoingDatagramFailCount(argument.datagramType,
+ mIsDemoMode);
+ mSessionMetricsStats.addCountOfFailedOutgoingDatagram();
+ }
}
/**
@@ -733,9 +734,6 @@
0, SatelliteManager.SATELLITE_RESULT_SUCCESS);
abortSendingPendingDatagrams(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID,
SATELLITE_RESULT_NOT_REACHABLE);
- mControllerMetricsStats.reportOutgoingDatagramFailCount(argument.datagramType,
- mIsDemoMode);
- mSessionMetricsStats.addCountOfFailedOutgoingDatagram();
}
}
@@ -798,8 +796,6 @@
// Log metrics about the outgoing datagram
reportSendDatagramCompleted(argument, SATELLITE_RESULT_MODEM_TIMEOUT);
- mControllerMetricsStats.reportOutgoingDatagramFailCount(argument.datagramType,
- mIsDemoMode);
// Remove current datagram from pending map.
if (SatelliteServiceUtils.isSosMessage(argument.datagramType)) {
mPendingEmergencyDatagramsMap.remove(argument.datagramId);
diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramDispatcherTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramDispatcherTest.java
index 096c8dc..ecec4cd 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramDispatcherTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramDispatcherTest.java
@@ -237,10 +237,7 @@
clearInvocations(mMockSatelliteModemInterface);
clearInvocations(mMockDatagramController);
- mResultListener.clear();
-
- clearInvocations(mMockSatelliteModemInterface);
- clearInvocations(mMockDatagramController);
+ clearInvocations(mMockSessionMetricsStats);
mResultListener.clear();
doReturn(true).when(mMockDatagramController)
.needsWaitingForSatelliteConnected(eq(datagramType));
@@ -282,6 +279,7 @@
clearInvocations(mMockSatelliteModemInterface);
clearInvocations(mMockDatagramController);
+ clearInvocations(mMockSessionMetricsStats);
mResultListener.clear();
mDatagramDispatcherUT.sendSatelliteDatagram(SUB_ID, datagramType, mDatagram,
true, mResultListener::offer);
@@ -356,6 +354,7 @@
verify(mMockSessionMetricsStats, times(1)).addCountOfSuccessfulOutgoingDatagram();
clearInvocations(mMockSatelliteModemInterface);
clearInvocations(mMockDatagramController);
+ clearInvocations(mMockSessionMetricsStats);
mResultListener.clear();
// No response for the send request from modem
@@ -385,7 +384,7 @@
any(SatelliteDatagram.class), anyBoolean(), anyBoolean(), any(Message.class));
verify(mMockSatelliteModemInterface).abortSendingSatelliteDatagrams(any(Message.class));
assertThat(mResultListener.peek()).isEqualTo(SATELLITE_RESULT_MODEM_TIMEOUT);
- verify(mMockSessionMetricsStats, never()).addCountOfFailedOutgoingDatagram();
+ verify(mMockSessionMetricsStats, times(1)).addCountOfFailedOutgoingDatagram();
}
@Test