Merge "Use userid of sender, not notification target."
This commit is contained in:
committed by
Android (Google) Code Review
commit
86cdcd33df
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
@@ -136,15 +137,9 @@ public final class NotificationRecord {
|
||||
private boolean isPreChannelsNotification() {
|
||||
try {
|
||||
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(),
|
||||
0, sbn.getUserId());
|
||||
0, UserHandle.getUserId(sbn.getUid()));
|
||||
if (applicationInfo.targetSdkVersion <= Build.VERSION_CODES.N_MR1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
static int UNKNOWN_UID = UserHandle.USER_NULL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user