Add a new internal api for receiving the new intent in satellite CTS test which to configure intent component with the necessary values.
Bug: 362405259
Test: atest SatelliteManagerTest, SatelliteManagerTestOnMockService
Flag: com.android.internal.telephony.flags.carrier_roaming_nb_iot_ntn
Change-Id: Icebd22f0389d9154bca8711a4ce97b790f9688ad
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 2cd0336..5dc64ab 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -14410,4 +14410,37 @@
Binder.restoreCallingIdentity(identity);
}
}
+
+ /**
+ * This API can be used by only CTS to override the cached value for the device overlay config
+ * value :
+ * config_satellite_gateway_service_package and
+ * config_satellite_carrier_roaming_esos_provisioned_class.
+ * These values are set before sending an intent to broadcast there are any change to list of
+ * subscriber informations.
+ *
+ * @param name the name is one of the following that constitute an intent.
+ * Component package name, or component class name.
+ * @return {@code true} if the setting is successful, {@code false} otherwise.
+ */
+ @Override
+ public boolean setSatelliteSubscriberIdListChangedIntentComponent(String name) {
+ if (!mFeatureFlags.carrierRoamingNbIotNtn()) {
+ Log.d(LOG_TAG, "setSatelliteSubscriberIdListChangedIntentComponent:"
+ + " carrierRoamingNbIotNtn is disabled");
+ return false;
+ }
+ Log.d(LOG_TAG, "setSatelliteSubscriberIdListChangedIntentComponent");
+ TelephonyPermissions.enforceShellOnly(
+ Binder.getCallingUid(), "setSatelliteSubscriberIdListChangedIntentComponent");
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(mApp,
+ SubscriptionManager.INVALID_SUBSCRIPTION_ID,
+ "setSatelliteSubscriberIdListChangedIntentComponent");
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ return mSatelliteController.setSatelliteSubscriberIdListChangedIntentComponent(name);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
}
diff --git a/src/com/android/phone/TelephonyShellCommand.java b/src/com/android/phone/TelephonyShellCommand.java
index 7a424cb..08b041b 100644
--- a/src/com/android/phone/TelephonyShellCommand.java
+++ b/src/com/android/phone/TelephonyShellCommand.java
@@ -209,6 +209,8 @@
"set-should-send-datagram-to-modem-in-demo-mode";
private static final String SET_IS_SATELLITE_COMMUNICATION_ALLOWED_FOR_CURRENT_LOCATION_CACHE =
"set-is-satellite-communication-allowed-for-current-location-cache";
+ private static final String SET_SATELLITE_SUBSCRIBERID_LIST_CHANGED_INTENT_COMPONENT =
+ "set-satellite-subscriberid-list-changed-intent-component";
private static final String DOMAIN_SELECTION_SUBCOMMAND = "domainselection";
private static final String DOMAIN_SELECTION_SET_SERVICE_OVERRIDE = "set-dss-override";
@@ -422,6 +424,8 @@
return handleSetOemEnabledSatelliteProvisionStatus();
case SET_IS_SATELLITE_COMMUNICATION_ALLOWED_FOR_CURRENT_LOCATION_CACHE:
return handleSetIsSatelliteCommunicationAllowedForCurrentLocationCache();
+ case SET_SATELLITE_SUBSCRIBERID_LIST_CHANGED_INTENT_COMPONENT:
+ return handleSetSatelliteSubscriberIdListChangedIntentComponent();
default: {
return handleDefaultCommands(cmd);
}
@@ -3766,6 +3770,54 @@
return 0;
}
+ private int handleSetSatelliteSubscriberIdListChangedIntentComponent() {
+ final String cmd = SET_SATELLITE_SUBSCRIBERID_LIST_CHANGED_INTENT_COMPONENT;
+ PrintWriter errPw = getErrPrintWriter();
+ String opt;
+ String name;
+
+ if ((opt = getNextArg()) == null) {
+ errPw.println("adb shell cmd phone " + cmd + ": Invalid Argument");
+ return -1;
+ } else {
+ switch (opt) {
+ case "-p": {
+ name = opt + "/" + "android.telephony.cts";
+ break;
+ }
+ case "-c": {
+ name = opt + "/" + "android.telephony.cts.SatelliteReceiver";
+ break;
+ }
+ case "-r": {
+ name = "reset";
+ break;
+ }
+ default:
+ errPw.println("adb shell cmd phone " + cmd + ": Invalid Argument");
+ return -1;
+ }
+ }
+
+ Log.d(LOG_TAG, "handleSetSatelliteSubscriberIdListChangedIntentComponent("
+ + name + ")");
+
+ try {
+ boolean result = mInterface.setSatelliteSubscriberIdListChangedIntentComponent(name);
+ if (VDBG) {
+ Log.v(LOG_TAG, "handleSetSatelliteSubscriberIdListChangedIntentComponent "
+ + "returns: " + result);
+ }
+ getOutPrintWriter().println(result);
+ } catch (RemoteException e) {
+ Log.w(LOG_TAG, "handleSetSatelliteSubscriberIdListChangedIntentComponent("
+ + name + "), error = " + e.getMessage());
+ errPw.println("Exception: " + e.getMessage());
+ return -1;
+ }
+ return 0;
+ }
+
/**
* Sample inputStr = "US,UK,CA;2,1,3"
* Sample output: {[US,2], [UK,1], [CA,3]}