Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a344be93 authored by Tony Mak's avatar Tony Mak Committed by Android (Google) Code Review
Browse files

Merge "Make getInstalledDialerApplications to query for specific user"

parents 0102a8a8 b401a94d
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.pm.ActivityInfo;
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 @@ public class DefaultDialerManager {
     *
     * @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 @@ public class DefaultDialerManager {
        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.