Avoid resetting InCallAdapter when set.

This causes issues, for instance, when we have a MO and MT call
ongoing. The associated users for both calls would be different
based on the logic that was added for work profiles (MT calls
associated with target phone account handle user while MO calls
are associated with the profile user). As a result, resetting
the adapter puts Telecom in a state where it is unable to update
the existing calls.

The framework changes ensure that the phone instance (which provides
the in-call information to the user) is not being reset when it's
already instantiated.

Bug: 308856446
Bug: 294699269
Test: Manual
Test: New unit test to verify that call updates are persevered when
MO/MT call are placed from the secondary/guest user.
Test: v2/android-platinum/telephony-platinum-tests-ATT

Change-Id: I4976c0ec67d515e96f6d4df53c79ac500eb6a06e
diff --git a/telecomm/java/android/telecom/InCallService.java b/telecomm/java/android/telecom/InCallService.java
index 13a0458..bbd01d6 100644
--- a/telecomm/java/android/telecom/InCallService.java
+++ b/telecomm/java/android/telecom/InCallService.java
@@ -289,6 +289,11 @@
 
             switch (msg.what) {
                 case MSG_SET_IN_CALL_ADAPTER:
+                    if (mPhone != null) {
+                        Log.i(this, "mPhone is already instantiated, ignoring "
+                                + "request to reset adapter.");
+                        break;
+                    }
                     String callingPackage = getApplicationContext().getOpPackageName();
                     mPhone = new Phone(new InCallAdapter((IInCallAdapter) msg.obj), callingPackage,
                             getApplicationContext().getApplicationInfo().targetSdkVersion);