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

Commit d5261e1d authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Use userid of sender, not notification target.

When trying to find a package.

Bug: 33178040
Test: manual, ./vendor/google/tools/fake-ota on
Change-Id: I0b69c37f16e7e1763bff4df1650911fe3435bc77
parent 76ab11d4
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -246,7 +246,7 @@ public class StatusBarNotification implements Parcelable {
    }
    }


    /**
    /**
     * Returns a userHandle for the instance of the app that posted this notification.
     * Returns a userid for whom this notification is intended.
     *
     *
     * @deprecated Use {@link #getUser()} instead.
     * @deprecated Use {@link #getUser()} instead.
     */
     */
+3 −8
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@ import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationChannel;
import android.content.Context;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Bitmap;
@@ -136,15 +137,9 @@ public final class NotificationRecord {
    private boolean isPreChannelsNotification() {
    private boolean isPreChannelsNotification() {
        try {
        try {
            if (NotificationChannel.DEFAULT_CHANNEL_ID.equals(getChannel().getId())) {
            if (NotificationChannel.DEFAULT_CHANNEL_ID.equals(getChannel().getId())) {
                final boolean isSystemNotification =
                        NotificationManagerService.isUidSystem(sbn.getUid())
                                || ("android".equals(sbn.getPackageName()));
                if (isSystemNotification) {
                    return false;
                }
                  final ApplicationInfo applicationInfo =
                  final ApplicationInfo applicationInfo =
                        mContext.getPackageManager().getApplicationInfoAsUser(sbn.getPackageName(),
                        mContext.getPackageManager().getApplicationInfoAsUser(sbn.getPackageName(),
                                0, sbn.getUserId());
                                0, UserHandle.getUserId(sbn.getUid()));
                if (applicationInfo.targetSdkVersion <= Build.VERSION_CODES.N_MR1) {
                if (applicationInfo.targetSdkVersion <= Build.VERSION_CODES.N_MR1) {
                    return true;
                    return true;
                }
                }
+0 −5
Original line number Original line Diff line number Diff line
@@ -784,11 +784,6 @@ public class RankingHelper implements RankingConfig {
        }
        }
    }
    }


    private static boolean isUidSystem(int uid) {
        final int appid = UserHandle.getAppId(uid);
        return (appid == Process.SYSTEM_UID || appid == Process.PHONE_UID || uid == 0);
    }

    private static class Record {
    private static class Record {
        static int UNKNOWN_UID = UserHandle.USER_NULL;
        static int UNKNOWN_UID = UserHandle.USER_NULL;