Make getInstalledDialerApplications to query for specific user
BUG=26634502
Change-Id: I8fe5506589bae85e3babba1aaab3b737cd12543b
diff --git a/telecomm/java/android/telecom/DefaultDialerManager.java b/telecomm/java/android/telecom/DefaultDialerManager.java
index a915d37..a5e8fe1 100644
--- a/telecomm/java/android/telecom/DefaultDialerManager.java
+++ b/telecomm/java/android/telecom/DefaultDialerManager.java
@@ -21,6 +21,7 @@
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
+import android.os.Process;
import android.provider.Settings;
import android.text.TextUtils;
@@ -150,12 +151,13 @@
*
* @hide
**/
- public static List<String> getInstalledDialerApplications(Context context) {
+ public static List<String> getInstalledDialerApplications(Context context, int userId) {
PackageManager packageManager = context.getPackageManager();
// Get the list of apps registered for the DIAL intent with empty scheme
Intent intent = new Intent(Intent.ACTION_DIAL);
- List<ResolveInfo> resolveInfoList = packageManager.queryIntentActivities(intent, 0);
+ List<ResolveInfo> resolveInfoList =
+ packageManager.queryIntentActivitiesAsUser(intent, 0, userId);
List<String> packageNames = new ArrayList<>();
@@ -171,6 +173,10 @@
return filterByIntent(context, packageNames, dialIntentWithTelScheme);
}
+ public static List<String> getInstalledDialerApplications(Context context) {
+ return getInstalledDialerApplications(context, Process.myUserHandle().getIdentifier());
+ }
+
/**
* Determines if the package name belongs to the user-selected default dialer or the preloaded
* system dialer, and thus should be allowed to perform certain privileged operations.