Implement isAospDomainSelectionService of ITelephony

EmergencyCallDomainSelectionTestOnMockModem is a test
for AOSP domain selection service.

It determines whether the AOSP domain selection
service is running or not with this API.

Bug: 333893700
Test: atest EmergencyCallDomainSelectionTestOnMockModem
Change-Id: I540e0bc0ae279b378dc7782f77db522c97b564aa
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 2779bdb..2efb48e 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -261,6 +261,7 @@
 import com.android.server.feature.flags.Flags;
 import com.android.services.telephony.TelecomAccountRegistry;
 import com.android.services.telephony.TelephonyConnectionService;
+import com.android.services.telephony.domainselection.TelephonyDomainSelectionService;
 import com.android.telephony.Rlog;
 
 import java.io.ByteArrayOutputStream;
@@ -12994,6 +12995,34 @@
     }
 
     /**
+     * Returns whether the AOSP domain selection service is supported.
+     *
+     * @return {@code true} if the AOSP domain selection service is supported,
+     *         {@code false} otherwise.
+     */
+    @Override
+    public boolean isAospDomainSelectionService() {
+        mApp.enforceCallingOrSelfPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE,
+                "isAospDomainSelectionService");
+
+        final long identity = Binder.clearCallingIdentity();
+        try {
+            if (DomainSelectionResolver.getInstance().isDomainSelectionSupported()) {
+                String dssComponentName = mApp.getResources().getString(
+                        R.string.config_domain_selection_service_component_name);
+                ComponentName componentName = ComponentName.createRelative(mApp.getPackageName(),
+                        TelephonyDomainSelectionService.class.getName());
+                Log.i(LOG_TAG, "isAospDomainSelectionService dss=" + dssComponentName
+                        + ", aosp=" + componentName.flattenToString());
+                return TextUtils.equals(componentName.flattenToString(), dssComponentName);
+            }
+        } finally {
+            Binder.restoreCallingIdentity(identity);
+        }
+        return false;
+    }
+
+    /**
      * Request to enable or disable the satellite modem and demo mode. If the satellite modem is
      * enabled, this may also disable the cellular modem, and if the satellite modem is disabled,
      * this may also re-enable the cellular modem.