Loading core/java/android/app/Notification.java +5 −2 Original line number Diff line number Diff line Loading @@ -3885,9 +3885,12 @@ public class Notification implements Parcelable } if (mN.extras.containsKey(EXTRA_PEOPLE_LIST)) { ArrayList<Person> people = mN.extras.getParcelableArrayList(EXTRA_PEOPLE_LIST, android.app.Person.class); ArrayList<Person> people = mN.extras.getParcelableArrayList(EXTRA_PEOPLE_LIST, android.app.Person.class); if (people != null && !people.isEmpty()) { mPersonList.addAll(people); } } if (mN.getSmallIcon() == null && mN.icon != 0) { setSmallIcon(mN.icon); Loading core/tests/coretests/src/android/app/NotificationTest.java +18 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import static android.app.Notification.EXTRA_LARGE_ICON_BIG; import static android.app.Notification.EXTRA_MEDIA_REMOTE_INTENT; import static android.app.Notification.EXTRA_MEDIA_SESSION; import static android.app.Notification.EXTRA_MESSAGING_PERSON; import static android.app.Notification.EXTRA_PEOPLE_LIST; import static android.app.Notification.EXTRA_PICTURE; import static android.app.Notification.EXTRA_PICTURE_ICON; import static android.app.Notification.MessagingStyle.Message.KEY_DATA_URI; Loading Loading @@ -816,6 +817,23 @@ public class NotificationTest { } } @Test public void testRecoverBuilder_nullExtraPeopleList_noCrash() { Bundle extras = new Bundle(); extras.putParcelable(EXTRA_PEOPLE_LIST, null); Notification n = new Notification.Builder(mContext, "test") .setSmallIcon(0) .addExtras(extras) .build(); Bundle fakeTypes = new Bundle(); fakeTypes.putParcelable(EXTRA_BUILDER_APPLICATION_INFO, new Bundle()); Notification.Builder.recoverBuilder(mContext, n); // no crash, good } @Test public void testVisitUris_invalidExtra_noCrash() { Notification n = new Notification.Builder(mContext, "test") Loading Loading
core/java/android/app/Notification.java +5 −2 Original line number Diff line number Diff line Loading @@ -3885,9 +3885,12 @@ public class Notification implements Parcelable } if (mN.extras.containsKey(EXTRA_PEOPLE_LIST)) { ArrayList<Person> people = mN.extras.getParcelableArrayList(EXTRA_PEOPLE_LIST, android.app.Person.class); ArrayList<Person> people = mN.extras.getParcelableArrayList(EXTRA_PEOPLE_LIST, android.app.Person.class); if (people != null && !people.isEmpty()) { mPersonList.addAll(people); } } if (mN.getSmallIcon() == null && mN.icon != 0) { setSmallIcon(mN.icon); Loading
core/tests/coretests/src/android/app/NotificationTest.java +18 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import static android.app.Notification.EXTRA_LARGE_ICON_BIG; import static android.app.Notification.EXTRA_MEDIA_REMOTE_INTENT; import static android.app.Notification.EXTRA_MEDIA_SESSION; import static android.app.Notification.EXTRA_MESSAGING_PERSON; import static android.app.Notification.EXTRA_PEOPLE_LIST; import static android.app.Notification.EXTRA_PICTURE; import static android.app.Notification.EXTRA_PICTURE_ICON; import static android.app.Notification.MessagingStyle.Message.KEY_DATA_URI; Loading Loading @@ -816,6 +817,23 @@ public class NotificationTest { } } @Test public void testRecoverBuilder_nullExtraPeopleList_noCrash() { Bundle extras = new Bundle(); extras.putParcelable(EXTRA_PEOPLE_LIST, null); Notification n = new Notification.Builder(mContext, "test") .setSmallIcon(0) .addExtras(extras) .build(); Bundle fakeTypes = new Bundle(); fakeTypes.putParcelable(EXTRA_BUILDER_APPLICATION_INFO, new Bundle()); Notification.Builder.recoverBuilder(mContext, n); // no crash, good } @Test public void testVisitUris_invalidExtra_noCrash() { Notification n = new Notification.Builder(mContext, "test") Loading