CTS to ensure telecom can bind to NonUiInCallService wo export prop.

This CL is a postmortem action which is detailed in the linked bug.
In short, an OEM had the telecom stack outside of the system process
and had a non-ui InCallService it wanted to bind.  However, the
InCallService set the Exported property to false.  This combo caused
a calling outage that prevented users from making/receiving calls.

To prevent the above scenaro from occuring again, this new CTS test
was created. It tests the Telecom stack of the OEM against a
non-ui InCallService that has it's exported property set to false.

Bug: 198715680

Test: 1 new CTS test,
      NonUiInCallServiceWoExportTest
      #testTelecomCanBindToNonUiInCallServiceThatIsNotExported

Change-Id: I5b99aa9c7e989a1c20a7b086f65782286a8be575
diff --git a/cmds/telecom/src/com/android/commands/telecom/Telecom.java b/cmds/telecom/src/com/android/commands/telecom/Telecom.java
index 13c7946..1488e14cf 100644
--- a/cmds/telecom/src/com/android/commands/telecom/Telecom.java
+++ b/cmds/telecom/src/com/android/commands/telecom/Telecom.java
@@ -76,6 +76,8 @@
     private static final String COMMAND_CLEANUP_ORPHAN_PHONE_ACCOUNTS =
             "cleanup-orphan-phone-accounts";
     private static final String COMMAND_RESET_CAR_MODE = "reset-car-mode";
+    private static final String COMMAND_IS_NON_IN_CALL_SERVICE_BOUND =
+            "is-non-ui-in-call-service-bound";
 
     /**
      * Change the system dialer package name if a package name was specified,
@@ -169,6 +171,8 @@
                         + " over Telephony.\n"
                 + "telecom log-mark <MESSAGE>: emits a message into the telecom logs.  Useful for "
                         + "testers to indicate where in the logs various test steps take place.\n"
+                + "telecom is-non-ui-in-call-service-bound <PACKAGE>: queries a particular "
+                + "non-ui-InCallService in InCallController to determine if it is bound \n"
         );
     }
 
@@ -270,6 +274,9 @@
             case COMMAND_GET_MAX_PHONES:
                 runGetMaxPhones();
                 break;
+            case COMMAND_IS_NON_IN_CALL_SERVICE_BOUND:
+                runIsNonUiInCallServiceBound();
+                break;
             case COMMAND_SET_TEST_EMERGENCY_PHONE_ACCOUNT_PACKAGE_FILTER:
                 runSetEmergencyPhoneAccountPackageFilter();
                 break;
@@ -428,6 +435,18 @@
     }
 
     /**
+     * prints out whether a particular non-ui InCallServices is bound in a call
+     */
+    public void runIsNonUiInCallServiceBound() throws RemoteException {
+        if (TextUtils.isEmpty(mArgs.peekNextArg())) {
+            System.out.println("No Argument passed. Please pass a <PACKAGE_NAME> to lookup.");
+        } else {
+            System.out.println(
+                    String.valueOf(mTelecomService.isNonUiInCallServiceBound(nextArg())));
+        }
+    }
+
+    /**
      * Prints the mSIM config to the console.
      * "DSDS" for a phone in DSDS mode
      * "" (empty string) for a phone in SS mode
diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
index fdcb974..53154e6 100644
--- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
+++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
@@ -358,6 +358,8 @@
 
     int cleanupOrphanPhoneAccounts();
 
+    boolean isNonUiInCallServiceBound(in String packageName);
+
     void resetCarMode();
 
     void setTestDefaultCallRedirectionApp(String packageName);