Update datagram controller APIs used for CTS
Bug: 323571903
Test: atest SatelliteManagerTestOnMockService SatelliteControllerTest DatagramDispatcherTest
Manual test with SatelliteTestApp. SMS, MMS, call with live network.
Change-Id: I991645be8741831eeb4f240e9534b6f1e29db510
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 60d93b6..eacdf78 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -13670,20 +13670,43 @@
}
/**
- * This API can be used by only CTS to update the timeout duration in milliseconds whether
- * the device is aligned with the satellite for demo mode
+ * This API can be used by only CTS to override the timeout durations used by the
+ * DatagramController module.
*
* @param timeoutMillis The timeout duration in millisecond.
* @return {@code true} if the timeout duration is set successfully, {@code false} otherwise.
*/
- public boolean setSatelliteDeviceAlignedTimeoutDuration(long timeoutMillis) {
- Log.d(LOG_TAG, "setDeviceAlignedTimeoutDuration - " + timeoutMillis);
+ public boolean setDatagramControllerTimeoutDuration(
+ boolean reset, int timeoutType, long timeoutMillis) {
+ Log.d(LOG_TAG, "setDatagramControllerTimeoutDuration - " + timeoutMillis + ", reset="
+ + reset + ", timeoutMillis=" + timeoutMillis);
TelephonyPermissions.enforceShellOnly(
- Binder.getCallingUid(), "setDeviceAlignedTimeoutDuration");
+ Binder.getCallingUid(), "setDatagramControllerTimeoutDuration");
TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(mApp,
SubscriptionManager.INVALID_SUBSCRIPTION_ID,
- "setDeviceAlignedTimeoutDuration");
- return mSatelliteController.setSatelliteDeviceAlignedTimeoutDuration(timeoutMillis);
+ "setDatagramControllerTimeoutDuration");
+ return mSatelliteController.setDatagramControllerTimeoutDuration(
+ reset, timeoutType, timeoutMillis);
+ }
+
+ /**
+ * This API can be used by only CTS to override the timeout durations used by the
+ * SatelliteController module.
+ *
+ * @param timeoutMillis The timeout duration in millisecond.
+ * @return {@code true} if the timeout duration is set successfully, {@code false} otherwise.
+ */
+ public boolean setSatelliteControllerTimeoutDuration(
+ boolean reset, int timeoutType, long timeoutMillis) {
+ Log.d(LOG_TAG, "setSatelliteControllerTimeoutDuration - " + timeoutMillis + ", reset="
+ + reset + ", timeoutMillis=" + timeoutMillis);
+ TelephonyPermissions.enforceShellOnly(
+ Binder.getCallingUid(), "setSatelliteControllerTimeoutDuration");
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(mApp,
+ SubscriptionManager.INVALID_SUBSCRIPTION_ID,
+ "setSatelliteControllerTimeoutDuration");
+ return mSatelliteController.setSatelliteControllerTimeoutDuration(
+ reset, timeoutType, timeoutMillis);
}
/**
diff --git a/src/com/android/phone/TelephonyShellCommand.java b/src/com/android/phone/TelephonyShellCommand.java
index 3e3d31d..c55cc6c 100644
--- a/src/com/android/phone/TelephonyShellCommand.java
+++ b/src/com/android/phone/TelephonyShellCommand.java
@@ -191,8 +191,11 @@
"set-satellite-listening-timeout-duration";
private static final String SET_SATELLITE_POINTING_UI_CLASS_NAME =
"set-satellite-pointing-ui-class-name";
- private static final String SET_SATELLITE_DEVICE_ALIGNED_TIMEOUT_DURATION =
- "set-satellite-device-aligned-timeout-duration";
+ private static final String SET_DATAGRAM_CONTROLLER_TIMEOUT_DURATION =
+ "set-datagram-controller-timeout-duration";
+
+ private static final String SET_SATELLITE_CONTROLLER_TIMEOUT_DURATION =
+ "set-satellite-controller-timeout-duration";
private static final String SET_EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE =
"set-emergency-call-to-satellite-handover-type";
private static final String SET_COUNTRY_CODES = "set-country-codes";
@@ -397,8 +400,10 @@
return handleSetSatelliteListeningTimeoutDuration();
case SET_SATELLITE_POINTING_UI_CLASS_NAME:
return handleSetSatellitePointingUiClassNameCommand();
- case SET_SATELLITE_DEVICE_ALIGNED_TIMEOUT_DURATION:
- return handleSettSatelliteDeviceAlignedTimeoutDuration();
+ case SET_DATAGRAM_CONTROLLER_TIMEOUT_DURATION:
+ return handleSetDatagramControllerTimeoutDuration();
+ case SET_SATELLITE_CONTROLLER_TIMEOUT_DURATION:
+ return handleSetSatelliteControllerTimeoutDuration();
case SET_EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE:
return handleSetEmergencyCallToSatelliteHandoverType();
case SET_SHOULD_SEND_DATAGRAM_TO_MODEM_IN_DEMO_MODE:
@@ -3368,31 +3373,85 @@
return 0;
}
- private int handleSettSatelliteDeviceAlignedTimeoutDuration() {
+ private int handleSetDatagramControllerTimeoutDuration() {
PrintWriter errPw = getErrPrintWriter();
+ boolean reset = false;
+ int timeoutType = 0;
long timeoutMillis = 0;
String opt;
while ((opt = getNextOption()) != null) {
switch (opt) {
- case "-t": {
+ case "-d": {
timeoutMillis = Long.parseLong(getNextArgRequired());
break;
}
+ case "-r": {
+ reset = true;
+ break;
+ }
+ case "-t": {
+ timeoutType = Integer.parseInt(getNextArgRequired());
+ break;
+ }
}
}
- Log.d(LOG_TAG, "handleSettSatelliteDeviceAlignedTimeoutDuration: timeoutMillis="
- + timeoutMillis);
+ Log.d(LOG_TAG, "setDatagramControllerTimeoutDuration: timeoutMillis="
+ + timeoutMillis + ", reset=" + reset + ", timeoutType=" + timeoutType);
try {
- boolean result = mInterface.setSatelliteDeviceAlignedTimeoutDuration(timeoutMillis);
+ boolean result = mInterface.setDatagramControllerTimeoutDuration(
+ reset, timeoutType, timeoutMillis);
if (VDBG) {
- Log.v(LOG_TAG, "setSatelliteDeviceAlignedTimeoutDuration " + timeoutMillis
+ Log.v(LOG_TAG, "setDatagramControllerTimeoutDuration " + timeoutMillis
+ ", result = " + result);
}
getOutPrintWriter().println(result);
} catch (RemoteException e) {
- Log.w(LOG_TAG, "setSatelliteDeviceAlignedTimeoutDuration: " + timeoutMillis
+ Log.w(LOG_TAG, "setDatagramControllerTimeoutDuration: " + timeoutMillis
+ + ", error = " + e.getMessage());
+ errPw.println("Exception: " + e.getMessage());
+ return -1;
+ }
+ return 0;
+ }
+
+ private int handleSetSatelliteControllerTimeoutDuration() {
+ PrintWriter errPw = getErrPrintWriter();
+ boolean reset = false;
+ int timeoutType = 0;
+ long timeoutMillis = 0;
+
+ String opt;
+ while ((opt = getNextOption()) != null) {
+ switch (opt) {
+ case "-d": {
+ timeoutMillis = Long.parseLong(getNextArgRequired());
+ break;
+ }
+ case "-r": {
+ reset = true;
+ break;
+ }
+ case "-t": {
+ timeoutType = Integer.parseInt(getNextArgRequired());
+ break;
+ }
+ }
+ }
+ Log.d(LOG_TAG, "setSatelliteControllerTimeoutDuration: timeoutMillis="
+ + timeoutMillis + ", reset=" + reset + ", timeoutType=" + timeoutType);
+
+ try {
+ boolean result = mInterface.setSatelliteControllerTimeoutDuration(
+ reset, timeoutType, timeoutMillis);
+ if (VDBG) {
+ Log.v(LOG_TAG, "setSatelliteControllerTimeoutDuration " + timeoutMillis
+ + ", result = " + result);
+ }
+ getOutPrintWriter().println(result);
+ } catch (RemoteException e) {
+ Log.w(LOG_TAG, "setSatelliteControllerTimeoutDuration: " + timeoutMillis
+ ", error = " + e.getMessage());
errPw.println("Exception: " + e.getMessage());
return -1;