summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mady Mellor <madym@google.com> 2020-01-30 18:57:48 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-01-30 18:57:48 +0000
commitdc7efcc2ce8a57ae0a5d57825e08e8d6ad23583f (patch)
tree21ab4054c51c29ce8003108a95a0179beb11d4d9
parentdafca1e0da8fb96064c06c983885374796f946f7 (diff)
parent726df929e15bfe51350c16a334ca5394458c876d (diff)
Merge "Make sure we visit the icon URIs of Person objects on Notifications"
-rw-r--r--core/java/android/app/Notification.java24
-rw-r--r--core/java/android/app/Person.java15
2 files changed, 39 insertions, 0 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 35d26aba9094..576b56fa33f6 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -2487,6 +2487,20 @@ public class Notification implements Parcelable
if (extras.containsKey(EXTRA_BACKGROUND_IMAGE_URI)) {
visitor.accept(Uri.parse(extras.getString(EXTRA_BACKGROUND_IMAGE_URI)));
}
+
+ ArrayList<Person> people = extras.getParcelableArrayList(EXTRA_PEOPLE_LIST);
+ if (people != null && !people.isEmpty()) {
+ for (Person p : people) {
+ if (p.getIconUri() != null) {
+ visitor.accept(p.getIconUri());
+ }
+ }
+ }
+
+ final Person person = extras.getParcelable(EXTRA_MESSAGING_PERSON);
+ if (person != null && person.getIconUri() != null) {
+ visitor.accept(person.getIconUri());
+ }
}
if (MessagingStyle.class.equals(getNotificationStyle()) && extras != null) {
@@ -2495,6 +2509,11 @@ public class Notification implements Parcelable
for (MessagingStyle.Message message : MessagingStyle.Message
.getMessagesFromBundleArray(messages)) {
visitor.accept(message.getDataUri());
+
+ Person senderPerson = message.getSenderPerson();
+ if (senderPerson != null && senderPerson.getIconUri() != null) {
+ visitor.accept(senderPerson.getIconUri());
+ }
}
}
@@ -2503,6 +2522,11 @@ public class Notification implements Parcelable
for (MessagingStyle.Message message : MessagingStyle.Message
.getMessagesFromBundleArray(historic)) {
visitor.accept(message.getDataUri());
+
+ Person senderPerson = message.getSenderPerson();
+ if (senderPerson != null && senderPerson.getIconUri() != null) {
+ visitor.accept(senderPerson.getIconUri());
+ }
}
}
}
diff --git a/core/java/android/app/Person.java b/core/java/android/app/Person.java
index 14a5589c04c2..63ef2484ca1d 100644
--- a/core/java/android/app/Person.java
+++ b/core/java/android/app/Person.java
@@ -19,6 +19,7 @@ package android.app;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.graphics.drawable.Icon;
+import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
@@ -122,6 +123,20 @@ public final class Person implements Parcelable {
return "";
}
+ /**
+ * @return the URI associated with the {@link #getIcon()} for this person, iff the icon exists
+ * and is URI based.
+ * @hide
+ */
+ @Nullable
+ public Uri getIconUri() {
+ if (mIcon != null && (mIcon.getType() == Icon.TYPE_URI
+ || mIcon.getType() == Icon.TYPE_URI_ADAPTIVE_BITMAP)) {
+ return mIcon.getUri();
+ }
+ return null;
+ }
+
@Override
public boolean equals(Object obj) {
if (obj instanceof Person) {