getInstalledDialerApplications should not count ForwardIntentToParent

Issues:
1. Work profile call is logged into work profile side even there
is no work profile dialer.
2. In Settings, "Android" is shown as the default work profile dialer.

Cause:
When are querying installed dialers in work profile,
getInstalledDialerApplications return android/ForwardIntentToParent
because we forward calls to personal side if work dialer
is absent. But apparently, ForwardIntentToParent is not an installed
dialer in work profile. So Settings shows "Android" as default work
dialer and Telecom wrongly think that we have work dialer and insert
calllog in to work profile side.

Solution:
Ignore cross profile resolver by checking targetUserId.


Test: Manual
1. Check Settings, no longer see "Android" is set as work dialer.
2. Make a phone call using work contacts, observed that the call
   is inserted into persoonal side.
3. Make a phone call using personal side, observed that the call
   is inserted into personal side.

BUG: 65672386

Change-Id: I13d4234ad1684f714e1b4d7704f2413d903a0179
diff --git a/telecomm/java/android/telecom/DefaultDialerManager.java b/telecomm/java/android/telecom/DefaultDialerManager.java
index 2a707c9..1806aee 100644
--- a/telecomm/java/android/telecom/DefaultDialerManager.java
+++ b/telecomm/java/android/telecom/DefaultDialerManager.java
@@ -22,6 +22,7 @@
 import android.content.pm.ResolveInfo;
 import android.net.Uri;
 import android.os.Process;
+import android.os.UserHandle;
 import android.provider.Settings;
 import android.text.TextUtils;
 
@@ -163,7 +164,10 @@
 
         for (ResolveInfo resolveInfo : resolveInfoList) {
             final ActivityInfo activityInfo = resolveInfo.activityInfo;
-            if (activityInfo != null && !packageNames.contains(activityInfo.packageName)) {
+            if (activityInfo != null
+                    && !packageNames.contains(activityInfo.packageName)
+                    // ignore cross profile intent handler
+                    && resolveInfo.targetUserId == UserHandle.USER_CURRENT) {
                 packageNames.add(activityInfo.packageName);
             }
         }