adb shell command to trigger phone.notifyCarrierRoamingNtnEligibleStateChanged API.
adb shell cmd phone set-satellite-access-restriction-checking-result true
Flag: EXEMPT bugfix
Bug: 370033218
Test: Manually verified.
Change-Id: Iaef003f5833752c288779eff934314d8e697d64e
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 559effa..251976b 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -14505,4 +14505,17 @@
enforceReadPrivilegedPermission("getTestEuiccUiComponent");
return mTestEuiccUiComponent;
}
+
+ /**
+ * This API can be used only for test purpose to override the carrier roaming Ntn eligibility
+ *
+ * @param state to update Ntn Eligibility.
+ * @param resetRequired to reset the overridden flag in satellite controller.
+ * @return {@code true} if the shell command is successful, {@code false} otherwise.
+ */
+ public boolean overrideCarrierRoamingNtnEligibilityChanged(boolean state,
+ boolean resetRequired) {
+ return mSatelliteAccessController.overrideCarrierRoamingNtnEligibilityChanged(state,
+ resetRequired);
+ }
}
diff --git a/src/com/android/phone/TelephonyShellCommand.java b/src/com/android/phone/TelephonyShellCommand.java
index b9b2f58..840f961 100644
--- a/src/com/android/phone/TelephonyShellCommand.java
+++ b/src/com/android/phone/TelephonyShellCommand.java
@@ -212,6 +212,9 @@
private static final String SET_SATELLITE_SUBSCRIBERID_LIST_CHANGED_INTENT_COMPONENT =
"set-satellite-subscriberid-list-changed-intent-component";
+ private static final String SET_SATELLITE_ACCESS_RESTRICTION_CHECKING_RESULT =
+ "set-satellite-access-restriction-checking-result";
+
private static final String DOMAIN_SELECTION_SUBCOMMAND = "domainselection";
private static final String DOMAIN_SELECTION_SET_SERVICE_OVERRIDE = "set-dss-override";
private static final String DOMAIN_SELECTION_CLEAR_SERVICE_OVERRIDE = "clear-dss-override";
@@ -426,6 +429,8 @@
return handleSetIsSatelliteCommunicationAllowedForCurrentLocationCache();
case SET_SATELLITE_SUBSCRIBERID_LIST_CHANGED_INTENT_COMPONENT:
return handleSetSatelliteSubscriberIdListChangedIntentComponent();
+ case SET_SATELLITE_ACCESS_RESTRICTION_CHECKING_RESULT:
+ return handleOverrideCarrierRoamingNtnEligibilityChanged();
default: {
return handleDefaultCommands(cmd);
}
@@ -3716,7 +3721,6 @@
PrintWriter errPw = getErrPrintWriter();
String opt;
String state;
-
if ((opt = getNextArg()) == null) {
errPw.println(
"adb shell cmd phone set-is-satellite-communication-allowed-for-current"
@@ -4071,4 +4075,48 @@
}
return jSonString;
}
+
+ /**
+ * This method override the check for carrier roaming Ntn eligibility.
+ * <ul>
+ * <li> `adb shell cmd phone set-satellite-access-restriction-checking-result true` will set
+ * override eligibility to true.</li>
+ * <li> `adb shell cmd phone set-satellite-access-restriction-checking-result false` will
+ * override eligibility to false.</li>
+ * <li> `adb shell cmd phone set-satellite-access-restriction-checking-result` will reset the
+ * override data set through adb command.</li>
+ * </ul>
+ *
+ * @return {@code true} is command executed successfully otherwise {@code false}.
+ */
+ private int handleOverrideCarrierRoamingNtnEligibilityChanged() {
+ PrintWriter errPw = getErrPrintWriter();
+ String opt;
+ boolean state = false;
+ boolean isRestRequired = false;
+ try {
+ if ((opt = getNextArg()) == null) {
+ isRestRequired = true;
+ } else {
+ if ("true".equalsIgnoreCase(opt)) {
+ state = true;
+ }
+ }
+ boolean result = mInterface.overrideCarrierRoamingNtnEligibilityChanged(state,
+ isRestRequired);
+ if (VDBG) {
+ Log.v(LOG_TAG, "handleSetSatelliteAccessRestrictionCheckingResult "
+ + "returns: "
+ + result);
+ }
+ getOutPrintWriter().println(result);
+ } catch (RemoteException e) {
+ Log.w(LOG_TAG, "handleSetSatelliteAccessRestrictionCheckingResult("
+ + state + "), error = " + e.getMessage());
+ errPw.println("Exception: " + e.getMessage());
+ return -1;
+ }
+ Log.d(LOG_TAG, "handleSetSatelliteAccessRestrictionCheckingResult(" + state + ")");
+ return 0;
+ }
}
diff --git a/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java b/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
index f9bf0e8..57c7ff0 100644
--- a/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
+++ b/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
@@ -2020,6 +2020,32 @@
}
}
+ /**
+ * This API can be used only for test purpose to override the carrier roaming Ntn eligibility
+ *
+ * @param state to update Ntn Eligibility.
+ * @param resetRequired to reset the overridden flag in satellite controller.
+ * @return {@code true} if the shell command is successful, {@code false} otherwise.
+ */
+ public boolean overrideCarrierRoamingNtnEligibilityChanged(boolean state,
+ boolean resetRequired) {
+ if (!mFeatureFlags.carrierRoamingNbIotNtn()) {
+ logd("overrideCarrierRoamingNtnEligibilityChanged: "
+ + "carrierRoamingNbIotNtn is disabled");
+ return false;
+ }
+
+ if (!isMockModemAllowed()) {
+ logd("overrideCarrierRoamingNtnEligibilityChanged: "
+ + "mock modem not allowed.");
+ return false;
+ }
+
+ logd("calling overrideCarrierRoamingNtnEligibilityChanged");
+ return mSatelliteController.overrideCarrierRoamingNtnEligibilityChanged(state,
+ resetRequired);
+ }
+
private void plogv(@NonNull String log) {
Rlog.v(TAG, log);
if (mPersistentLogger != null) {