Ensure restricted number CDMA call waiting info is passed to Telecom.

The code which notifies Telecom of an incoming call-waiting call over CDMA
made the erroneous assumption that if the phone number provided was empty
that it was not possible to pass the call information to Telecom.

This change specifically checks for the case where the connection's
number presentation is not "allow" and then opts to do the match solely
on the number presentation.

Finally, some more logging is present in all scenarios.

Test: Manual
Bug: 65432905
Merged-In: I13bd319606da450b7bb478f9ce51cde80013b780
Change-Id: I13bd319606da450b7bb478f9ce51cde80013b780
diff --git a/src/com/android/services/telephony/PstnIncomingCallNotifier.java b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
index afb2cf6..c0ccc3a 100644
--- a/src/com/android/services/telephony/PstnIncomingCallNotifier.java
+++ b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
@@ -141,8 +141,24 @@
             Connection connection = call.getLatestConnection();
             if (connection != null) {
                 String number = connection.getAddress();
-                if (!TextUtils.isEmpty(number) && Objects.equals(number, ccwi.number)) {
+                int presentation = connection.getNumberPresentation();
+
+                if (presentation != PhoneConstants.PRESENTATION_ALLOWED
+                        && presentation == ccwi.numberPresentation) {
+                    // Presentation of number not allowed, but the presentation of the Connection
+                    // and the call waiting presentation match.
+                    Log.i(this, "handleCdmaCallWaiting: inform telecom of waiting call; "
+                                    + "presentation = %d", presentation);
                     sendIncomingCallIntent(connection);
+                } else if (!TextUtils.isEmpty(number) && Objects.equals(number, ccwi.number)) {
+                    // Presentation of the number is allowed, so we ensure the number matches the
+                    // one in the call waiting information.
+                    Log.i(this, "handleCdmaCallWaiting: inform telecom of waiting call; "
+                            + "number = %s", Log.pii(number));
+                    sendIncomingCallIntent(connection);
+                } else {
+                    Log.w(this, "handleCdmaCallWaiting: presentation or number do not match, not"
+                            + " informing telecom of call: %s", ccwi);
                 }
             }
         }