diff options
| author | 2016-06-13 15:47:03 -0700 | |
|---|---|---|
| committer | 2016-06-13 15:47:03 -0700 | |
| commit | 4ac6f6010bf18f331d2081699a57ce6a787e4fdc (patch) | |
| tree | cd0578ecf9c5300dbde5275b48c5920462cbde31 | |
| parent | bbcb733d802e9fbddaff899e0def8d250e803ebc (diff) | |
Fixed a bug with a legacy notification API
When using setLatestEventInfo the icons would not be shown
at all anymore, leading to a crash if they were grouped.
This CL makes sure the smallIcon is always set even for those
legacy apps.
It also fixes the usage of setShow when, as legacy apps wouldn't
have the time anymore.
Change-Id: I2645175b2adabcedbbfec7a502b89d143d2b9bd3
Fixes: 29255365
Fixes: 27430676
| -rw-r--r-- | core/java/android/app/Notification.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 83a20668b3b4..5a448f03a118 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -1986,6 +1986,10 @@ public class Notification implements Parcelable new Throwable()); } + if (context.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.N) { + extras.putBoolean(EXTRA_SHOW_WHEN, true); + } + // ensure that any information already set directly is preserved final Notification.Builder builder = new Notification.Builder(context, this); @@ -2269,6 +2273,14 @@ public class Notification implements Parcelable Collections.addAll(mPersonList, mN.extras.getStringArray(EXTRA_PEOPLE)); } + if (mN.getSmallIcon() == null && mN.icon != 0) { + setSmallIcon(mN.icon); + } + + if (mN.getLargeIcon() == null && mN.largeIcon != null) { + setLargeIcon(mN.largeIcon); + } + String templateClass = mN.extras.getString(EXTRA_TEMPLATE); if (!TextUtils.isEmpty(templateClass)) { final Class<? extends Style> styleClass |