Create handle with correct scheme in MissedCallNotifier

Bug: 18074511
Change-Id: If724708d3ac16ca524f03257e66b0e650a6030dd
diff --git a/src/com/android/server/telecom/MissedCallNotifier.java b/src/com/android/server/telecom/MissedCallNotifier.java
index 76d0ae8..2c1ffb8 100644
--- a/src/com/android/server/telecom/MissedCallNotifier.java
+++ b/src/com/android/server/telecom/MissedCallNotifier.java
@@ -34,6 +34,8 @@
 import android.provider.CallLog.Calls;
 import android.telecom.CallState;
 import android.telecom.DisconnectCause;
+import android.telecom.PhoneAccount;
+import android.telephony.PhoneNumberUtils;
 import android.text.BidiFormatter;
 import android.text.TextDirectionHeuristics;
 import android.text.TextUtils;
@@ -278,13 +280,19 @@
                     try {
                         while (cursor.moveToNext()) {
                             // Get data about the missed call from the cursor
-                            Uri handle = Uri.parse(cursor.getString(
-                                    cursor.getColumnIndexOrThrow(Calls.NUMBER)));
-                            int presentation = cursor.getInt(cursor.getColumnIndexOrThrow(
+                            final String handleString = cursor.getString(
+                                    cursor.getColumnIndexOrThrow(Calls.NUMBER));
+                            final int presentation = cursor.getInt(cursor.getColumnIndexOrThrow(
                                     Calls.NUMBER_PRESENTATION));
 
-                            if (presentation != Calls.PRESENTATION_ALLOWED) {
+                            final Uri handle;
+                            if (presentation != Calls.PRESENTATION_ALLOWED
+                                    || TextUtils.isEmpty(handleString)) {
                                 handle = null;
+                            } else {
+                                handle = Uri.fromParts(PhoneNumberUtils.isUriNumber(handleString) ?
+                                        PhoneAccount.SCHEME_SIP : PhoneAccount.SCHEME_TEL,
+                                                handleString, null);
                             }
 
                             // Convert the data to a call object