Connect Call Composer Extras for incoming call

Test: treehugger
Bug: 173437870
Change-Id: Ie4b42e164c6203a02657bcac136de1ad1ec0be55
Merged-In: Ie4b42e164c6203a02657bcac136de1ad1ec0be55
(cherry picked from commit 69c722f884af4e0eb28e3905831a5a855116c993)
diff --git a/src/com/android/services/telephony/PstnIncomingCallNotifier.java b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
index 377b471..e0609bd 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,
                         "Call Dropped by lower layers");
             }
+            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();