Merge "Connect Call Composer Extras for incoming call" am: ba1f6693dc am: febb2a2659

Original change: https://android-review.googlesource.com/c/platform/packages/services/Telephony/+/1542211

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4eaccaf1d52790dca2b2ec8d6bb46777105e46fa
diff --git a/src/com/android/services/telephony/PstnIncomingCallNotifier.java b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
index b6d5d3e..ee4baae 100644
--- a/src/com/android/services/telephony/PstnIncomingCallNotifier.java
+++ b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
@@ -25,8 +25,10 @@
 import android.telecom.PhoneAccount;
 import android.telecom.PhoneAccountHandle;
 import android.telecom.TelecomManager;
+import android.telephony.ims.ImsCallProfile;
 import android.text.TextUtils;
 
+import com.android.ims.ImsCall;
 import com.android.internal.telephony.Call;
 import com.android.internal.telephony.CallStateException;
 import com.android.internal.telephony.Connection;
@@ -291,6 +293,22 @@
                 extras.putString(TelecomManager.EXTRA_CALL_DISCONNECT_MESSAGE,
                         TelecomManager.CALL_AUTO_DISCONNECT_MESSAGE_STRING);
             }
+            ImsCall imsCall = ((ImsPhoneConnection) connection).getImsCall();
+            if (imsCall != null) {
+                ImsCallProfile imsCallProfile = imsCall.getCallProfile();
+                if (imsCallProfile != null) {
+                    extras.putInt(TelecomManager.EXTRA_PRIORITY,
+                            imsCallProfile.getCallExtraInt(ImsCallProfile.EXTRA_PRIORITY));
+                    extras.putString(TelecomManager.EXTRA_CALL_SUBJECT,
+                            imsCallProfile.getCallExtra(ImsCallProfile.EXTRA_CALL_SUBJECT));
+                    extras.putParcelable(TelecomManager.EXTRA_LOCATION,
+                            imsCallProfile.getCallExtraParcelable(ImsCallProfile.EXTRA_LOCATION));
+                    if (!TextUtils.isEmpty(
+                            imsCallProfile.getCallExtra(ImsCallProfile.EXTRA_PICTURE_URL))) {
+                        extras.putBoolean(TelecomManager.EXTRA_HAS_PICTURE, true);
+                    }
+                }
+            }
         }
 
         PhoneAccountHandle handle = findCorrectPhoneAccountHandle();