Update APIs for domain selection service plug-in
1. resetScan is added to onRequestEmergencyNetworkScan().
2. isTestEmergencyNumber() is added to SelectionAttributes.
3. getSubId(), getSlotId(), and getIso() are renamed.
4. cancelSelection() is removed from DomainSelector.
5. Add shell commands for CTS tests
Bug: 258112541
Test: atest DomainSelectionServiceTestOnMockModem
Change-Id: Id15403d87fb38961c40260542c740aea62e4863a
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 43011e8..2d149d5 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -13787,6 +13787,62 @@
}
/**
+ * Sets the service defined in ComponentName to be bound.
+ *
+ * This should only be used for testing.
+ * @return {@code true} if the DomainSelectionService to bind to was set,
+ * {@code false} otherwise.
+ */
+ @Override
+ public boolean setDomainSelectionServiceOverride(ComponentName componentName) {
+ Log.i(LOG_TAG, "setDomainSelectionServiceOverride component=" + componentName);
+
+ TelephonyPermissions.enforceShellOnly(Binder.getCallingUid(),
+ "setDomainSelectionServiceOverride");
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(mApp,
+ getDefaultSubscription(), "setDomainSelectionServiceOverride");
+
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ if (DomainSelectionResolver.getInstance().isDomainSelectionSupported()) {
+ return DomainSelectionResolver.getInstance()
+ .setDomainSelectionServiceOverride(componentName);
+ }
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ return false;
+ }
+
+ /**
+ * Clears the DomainSelectionService override.
+ *
+ * This should only be used for testing.
+ * @return {@code true} if the DomainSelectionService override was cleared,
+ * {@code false} otherwise.
+ */
+ @Override
+ public boolean clearDomainSelectionServiceOverride() {
+ Log.i(LOG_TAG, "clearDomainSelectionServiceOverride");
+
+ TelephonyPermissions.enforceShellOnly(Binder.getCallingUid(),
+ "clearDomainSelectionServiceOverride");
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(mApp,
+ getDefaultSubscription(), "clearDomainSelectionServiceOverride");
+
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ if (DomainSelectionResolver.getInstance().isDomainSelectionSupported()) {
+ return DomainSelectionResolver.getInstance()
+ .clearDomainSelectionServiceOverride();
+ }
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ return false;
+ }
+
+ /**
* Enable or disable notifications sent for cellular identifier disclosure events.
*
* Disclosure events are defined as instances where a device has sent a cellular identifier