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

Commit 908ae991 authored by Koushik Dutta's avatar Koushik Dutta Committed by Gerrit Code Review
Browse files

Merge "SMSDispatcher: Fix determining the defaultSmsApp for proxied messages" into cm-11.0

parents 9b4b0df3 56c3c130
Loading
Loading
Loading
Loading
+22 −2
Original line number Diff line number Diff line
@@ -716,7 +716,17 @@ public abstract class SMSDispatcher extends Handler {

        // Get calling app package name via UID from Binder call
        PackageManager pm = mContext.getPackageManager();
        String[] packageNames = pm.getPackagesForUid(Binder.getCallingUid());
        int callingUid = Binder.getCallingUid();
        // Special case: We're being proxied by the telephony stack itself,
        // so use the intent generator's UID if one exists
        String[] packageNames;

        if (callingUid == android.os.Process.PHONE_UID && sentIntent != null &&
                sentIntent.getCreatorPackage() != null) {
            packageNames = new String[] { sentIntent.getCreatorPackage() };
        } else {
            packageNames = pm.getPackagesForUid(callingUid);
        }

        if (packageNames == null || packageNames.length == 0) {
            // Refuse to send SMS if we can't get the calling package name.
@@ -1121,7 +1131,17 @@ public abstract class SMSDispatcher extends Handler {
            PendingIntent deliveryIntent, String format) {
        // Get calling app package name via UID from Binder call
        PackageManager pm = mContext.getPackageManager();
        String[] packageNames = pm.getPackagesForUid(Binder.getCallingUid());
        int callingUid = Binder.getCallingUid();
        // Special case: We're being proxied by the telephony stack itself,
        // so use the intent generator's UID if one exists
        String[] packageNames;

        if (callingUid == android.os.Process.PHONE_UID && sentIntent != null &&
                sentIntent.getCreatorPackage() != null) {
            packageNames = new String[] { sentIntent.getCreatorPackage() };
        } else {
            packageNames = pm.getPackagesForUid(callingUid);
        }

        // Get package info via packagemanager
        PackageInfo appInfo = null;