From 39198faea1b3b6b73f1db767be756ea2d1e68767 Mon Sep 17 00:00:00 2001 From: Tony Mak Date: Fri, 15 Sep 2017 17:41:43 +0100 Subject: [PATCH] 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 --- telecomm/java/android/telecom/DefaultDialerManager.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/telecomm/java/android/telecom/DefaultDialerManager.java b/telecomm/java/android/telecom/DefaultDialerManager.java index 2a707c91ebe40..1806aee27e31f 100644 --- a/telecomm/java/android/telecom/DefaultDialerManager.java +++ b/telecomm/java/android/telecom/DefaultDialerManager.java @@ -22,6 +22,7 @@ import android.content.pm.PackageManager; 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 @@ public class DefaultDialerManager { 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); } }