Add new datagrm controller API for CTS
Bug: 339040483
Test: atest SatelliteManagerTestOnMockService, atest DemoSimulatorTest
Change-Id: Ifbc578a006e4102bae99440e9395d70f26886a08
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index d7eb4b8..6c9cc92 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -13758,6 +13758,26 @@
}
/**
+ * This API can be used by only CTS to override the boolean configs used by the
+ * DatagramController module.
+ *
+ * @param enable Whether to enable or disable boolean config.
+ * @return {@code true} if the boolean config is set successfully, {@code false} otherwise.
+ */
+ public boolean setDatagramControllerBooleanConfig(
+ boolean reset, int booleanType, boolean enable) {
+ Log.d(LOG_TAG, "setDatagramControllerBooleanConfig: booleanType=" + booleanType
+ + ", reset=" + reset + ", enable=" + enable);
+ TelephonyPermissions.enforceShellOnly(
+ Binder.getCallingUid(), "setDatagramControllerBooleanConfig");
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(mApp,
+ SubscriptionManager.INVALID_SUBSCRIPTION_ID,
+ "ssetDatagramControllerBooleanConfig");
+ return mSatelliteController.setDatagramControllerBooleanConfig(reset, booleanType, enable);
+ }
+
+
+ /**
* This API can be used by only CTS to override the timeout durations used by the
* SatelliteController module.
*
diff --git a/src/com/android/phone/TelephonyShellCommand.java b/src/com/android/phone/TelephonyShellCommand.java
index 80304b2..9f67c75 100644
--- a/src/com/android/phone/TelephonyShellCommand.java
+++ b/src/com/android/phone/TelephonyShellCommand.java
@@ -193,6 +193,8 @@
"set-satellite-pointing-ui-class-name";
private static final String SET_DATAGRAM_CONTROLLER_TIMEOUT_DURATION =
"set-datagram-controller-timeout-duration";
+ private static final String SET_DATAGRAM_CONTROLLER_BOOLEAN_CONFIG =
+ "set-datagram-controller-boolean-config";
private static final String SET_SATELLITE_CONTROLLER_TIMEOUT_DURATION =
"set-satellite-controller-timeout-duration";
@@ -402,6 +404,8 @@
return handleSetSatellitePointingUiClassNameCommand();
case SET_DATAGRAM_CONTROLLER_TIMEOUT_DURATION:
return handleSetDatagramControllerTimeoutDuration();
+ case SET_DATAGRAM_CONTROLLER_BOOLEAN_CONFIG:
+ return handleSetDatagramControllerBooleanConfig();
case SET_SATELLITE_CONTROLLER_TIMEOUT_DURATION:
return handleSetSatelliteControllerTimeoutDuration();
case SET_EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE:
@@ -3416,6 +3420,47 @@
return 0;
}
+ private int handleSetDatagramControllerBooleanConfig() {
+ PrintWriter errPw = getErrPrintWriter();
+ boolean reset = false;
+ int booleanType = 0;
+ boolean enable = false;
+
+ String opt;
+ while ((opt = getNextOption()) != null) {
+ switch (opt) {
+ case "-d": {
+ enable = Boolean.parseBoolean(getNextArgRequired());
+ break;
+ }
+ case "-r": {
+ reset = true;
+ break;
+ }
+ case "-t": {
+ booleanType = Integer.parseInt(getNextArgRequired());
+ break;
+ }
+ }
+ }
+ Log.d(LOG_TAG, "setDatagramControllerBooleanConfig: enable="
+ + enable + ", reset=" + reset + ", booleanType=" + booleanType);
+
+ try {
+ boolean result = mInterface.setDatagramControllerBooleanConfig(
+ reset, booleanType, enable);
+ if (VDBG) {
+ Log.v(LOG_TAG, "setDatagramControllerBooleanConfig result = " + result);
+ }
+ getOutPrintWriter().println(result);
+ } catch (RemoteException e) {
+ Log.w(LOG_TAG, "setDatagramControllerBooleanConfig: error = " + e.getMessage());
+ errPw.println("Exception: " + e.getMessage());
+ return -1;
+ }
+ return 0;
+ }
+
private int handleSetSatelliteControllerTimeoutDuration() {
PrintWriter errPw = getErrPrintWriter();
boolean reset = false;