Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 71cd8f7d authored by David Krska's avatar David Krska
Browse files

Remove @VisibleForTesting from Message#toBundle to make it public.

This changes the method from private to public to allow other platform
components to depend on it.

Test: atest FrameworksCoreTests:NotificationTest
Bug: 275303162
Change-Id: I8fb45b5ab1a42921ae19b904f83013e2f0ca4449
parent 00558ac5
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -8723,9 +8723,11 @@ public class Notification implements Parcelable
            }
            /**
             * Converts the message into a {@link Bundle}. To extract the message back,
             * check {@link #getMessageFromBundle()}
             * @hide
             */
            @VisibleForTesting
            @NonNull
            public Bundle toBundle() {
                Bundle bundle = new Bundle();
                if (mText != null) {
+21 −0
Original line number Diff line number Diff line
@@ -931,6 +931,27 @@ public class NotificationTest {
        // no crash, good
    }

    @Test
    public void testToBundle_getMessageFromBundle_returnsSameData() {
        Notification.MessagingStyle.Message message =
                new Notification.MessagingStyle.Message(
                        "a", 100, new Person.Builder().setName("hi").build());
        message.setData("text", Uri.parse("http://test/uri"));

        Notification.MessagingStyle.Message convertedMessage =
                Notification.MessagingStyle.Message.getMessageFromBundle(message.toBundle());

        assertThat(convertedMessage).isNotNull();
        assertThat(message.getText()).isEqualTo(convertedMessage.getText());
        assertThat(message.getTimestamp()).isEqualTo(convertedMessage.getTimestamp());
        assertThat(message.getExtras().size()).isEqualTo(convertedMessage.getExtras().size());
        assertThat(message.getSender()).isEqualTo(convertedMessage.getSender());
        assertThat(message.getSenderPerson()).isEqualTo(convertedMessage.getSenderPerson());
        assertThat(message.getDataMimeType()).isEqualTo(convertedMessage.getDataMimeType());
        assertThat(message.getDataUri()).isEqualTo(convertedMessage.getDataUri());
        assertThat(message.isRemoteInputHistory())
                .isEqualTo(convertedMessage.isRemoteInputHistory());
    }

    @Test
    public void testDoesNotStripsExtenders() {