URI parsing permission for SystemUI
Fixes: 151021631 Test: manual -> promote people bubble from overflow, chathead icon shows Change-Id: Ib3a3f944f16908a01a24ed765f78ccbc270ea288
This commit is contained in:
@@ -17,6 +17,7 @@ package com.android.systemui.bubbles;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.content.pm.ShortcutInfo;
|
||||
import android.graphics.Bitmap;
|
||||
@@ -59,6 +60,12 @@ public class BubbleIconFactory extends BaseIconFactory {
|
||||
} else {
|
||||
Icon ic = metadata.getBubbleIcon();
|
||||
if (ic != null) {
|
||||
if (ic.getType() == Icon.TYPE_URI
|
||||
|| ic.getType() == Icon.TYPE_URI_ADAPTIVE_BITMAP) {
|
||||
context.grantUriPermission(context.getPackageName(),
|
||||
ic.getUri(),
|
||||
Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
}
|
||||
return ic.loadDrawable(context);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.annotation.NonNull;
|
||||
import android.app.Notification;
|
||||
import android.app.Person;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ShortcutInfo;
|
||||
@@ -33,6 +34,7 @@ import android.graphics.Color;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.Icon;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Parcelable;
|
||||
import android.service.notification.StatusBarNotification;
|
||||
@@ -246,9 +248,17 @@ public class BubbleViewInfoTask extends AsyncTask<Void, Void, BubbleViewInfoTask
|
||||
bubbleMessage.senderName = sender != null
|
||||
? sender.getName()
|
||||
: null;
|
||||
bubbleMessage.senderAvatar = sender != null && sender.getIcon() != null
|
||||
? sender.getIcon().loadDrawable(context)
|
||||
: null;
|
||||
|
||||
bubbleMessage.senderAvatar = null;
|
||||
if (sender != null && sender.getIcon() != null) {
|
||||
if (sender.getIcon().getType() == Icon.TYPE_URI
|
||||
|| sender.getIcon().getType() == Icon.TYPE_URI_ADAPTIVE_BITMAP) {
|
||||
context.grantUriPermission(context.getPackageName(),
|
||||
sender.getIcon().getUri(),
|
||||
Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
}
|
||||
bubbleMessage.senderAvatar = sender.getIcon().loadDrawable(context);
|
||||
}
|
||||
return bubbleMessage;
|
||||
}
|
||||
} else if (Notification.InboxStyle.class.equals(style)) {
|
||||
|
||||
Reference in New Issue
Block a user