Loading core/java/android/app/Notification.java +5 −1 Original line number Diff line number Diff line Loading @@ -11296,7 +11296,11 @@ public class Notification implements Parcelable * @see Segment */ public @NonNull ProgressStyle setProgressSegments(@NonNull List<Segment> progressSegments) { mProgressSegments = new ArrayList<>(progressSegments.size()); if (mProgressSegments == null) { mProgressSegments = new ArrayList<>(); } mProgressSegments.clear(); mProgressSegments.addAll(progressSegments); return this; } Loading core/tests/coretests/src/android/app/NotificationTest.java +16 −1 Original line number Diff line number Diff line Loading @@ -2397,10 +2397,25 @@ public class NotificationTest { public void progressStyle_getProgressMax_returnsSumOfSegmentLength() { final Notification.ProgressStyle progressStyle = new Notification.ProgressStyle(); progressStyle .setProgressSegments(List.of(new Notification.ProgressStyle.Segment(15), new Notification.ProgressStyle.Segment(25))) .addProgressSegment(new Notification.ProgressStyle.Segment(10)) .addProgressSegment(new Notification.ProgressStyle.Segment(20)); assertThat(progressStyle.getProgressMax()).isEqualTo(30); assertThat(progressStyle.getProgressMax()).isEqualTo(70); } @Test @EnableFlags(Flags.FLAG_API_RICH_ONGOING) public void progressStyle_getProgressMax_onSetProgressSegments_resets() { final Notification.ProgressStyle progressStyle = new Notification.ProgressStyle(); progressStyle .addProgressSegment(new Notification.ProgressStyle.Segment(10)) .addProgressSegment(new Notification.ProgressStyle.Segment(20)) .setProgressSegments(List.of(new Notification.ProgressStyle.Segment(15), new Notification.ProgressStyle.Segment(25))); assertThat(progressStyle.getProgressMax()).isEqualTo(40); } @Test Loading Loading
core/java/android/app/Notification.java +5 −1 Original line number Diff line number Diff line Loading @@ -11296,7 +11296,11 @@ public class Notification implements Parcelable * @see Segment */ public @NonNull ProgressStyle setProgressSegments(@NonNull List<Segment> progressSegments) { mProgressSegments = new ArrayList<>(progressSegments.size()); if (mProgressSegments == null) { mProgressSegments = new ArrayList<>(); } mProgressSegments.clear(); mProgressSegments.addAll(progressSegments); return this; } Loading
core/tests/coretests/src/android/app/NotificationTest.java +16 −1 Original line number Diff line number Diff line Loading @@ -2397,10 +2397,25 @@ public class NotificationTest { public void progressStyle_getProgressMax_returnsSumOfSegmentLength() { final Notification.ProgressStyle progressStyle = new Notification.ProgressStyle(); progressStyle .setProgressSegments(List.of(new Notification.ProgressStyle.Segment(15), new Notification.ProgressStyle.Segment(25))) .addProgressSegment(new Notification.ProgressStyle.Segment(10)) .addProgressSegment(new Notification.ProgressStyle.Segment(20)); assertThat(progressStyle.getProgressMax()).isEqualTo(30); assertThat(progressStyle.getProgressMax()).isEqualTo(70); } @Test @EnableFlags(Flags.FLAG_API_RICH_ONGOING) public void progressStyle_getProgressMax_onSetProgressSegments_resets() { final Notification.ProgressStyle progressStyle = new Notification.ProgressStyle(); progressStyle .addProgressSegment(new Notification.ProgressStyle.Segment(10)) .addProgressSegment(new Notification.ProgressStyle.Segment(20)) .setProgressSegments(List.of(new Notification.ProgressStyle.Segment(15), new Notification.ProgressStyle.Segment(25))); assertThat(progressStyle.getProgressMax()).isEqualTo(40); } @Test Loading