am 297576a0: am 01298dc9: am ecbdead1: am 209cb1e4: Merge "Fix issue where host shows up as a conference participant." into mnc-dr-dev

* commit '297576a043ece99fa186386d5181e115252f4217':
  Fix issue where host shows up as a conference participant.
diff --git a/src/com/android/services/telephony/ImsConference.java b/src/com/android/services/telephony/ImsConference.java
index 4f26a68..c7c6e92 100644
--- a/src/com/android/services/telephony/ImsConference.java
+++ b/src/com/android/services/telephony/ImsConference.java
@@ -28,6 +28,7 @@
 import android.telecom.PhoneAccountHandle;
 import android.telecom.StatusHints;
 import android.telecom.VideoProfile;
+import android.telephony.PhoneNumberUtils;
 
 import com.android.internal.telephony.Call;
 import com.android.internal.telephony.CallStateException;
@@ -706,9 +707,16 @@
     private boolean isParticipantHost(Uri hostHandle, Uri handle) {
         // If host and participant handles are the same, bail early.
         if (Objects.equals(hostHandle, handle)) {
+            Log.v(this, "isParticipantHost(Y) : uris equal");
             return true;
         }
 
+        // If there is no host handle or not participant handle, bail early.
+        if (hostHandle == null || handle == null) {
+            Log.v(this, "isParticipantHost(N) : host or participant uri null");
+            return false;
+        }
+
         // Conference event package participants are identified using SIP URIs (see RFC3261).
         // A valid SIP uri has the format: sip:user:password@host:port;uri-parameters?headers
         // Per RFC3261, the "user" can be a telephone number.
@@ -726,6 +734,7 @@
         String numberParts[] = number.split("[@;:]");
 
         if (numberParts.length == 0) {
+            Log.v(this, "isParticipantHost(N) : no number in participant handle");
             return false;
         }
         number = numberParts[0];
@@ -734,7 +743,14 @@
         // number.
         String hostNumber = hostHandle.getSchemeSpecificPart();
 
-        return Objects.equals(hostNumber, number);
+        // Use a loose comparison of the phone numbers.  This ensures that numbers that differ by
+        // special characters are counted as equal.
+        // E.g. +16505551212 would be the same as 16505551212
+        boolean isHost = PhoneNumberUtils.compare(hostNumber, number);
+
+        Log.v(this, "isParticipantHost(%s) : host: %s, participant %s", (isHost ? "Y" : "N"),
+                Log.pii(hostNumber), Log.pii(number));
+        return isHost;
     }
 
     /**