diff options
| author | 2024-05-21 19:24:07 +0000 | |
|---|---|---|
| committer | 2024-05-21 19:24:07 +0000 | |
| commit | 3df6df00b841cfd70417d438fe096489c6b9d4f7 (patch) | |
| tree | 8ec17c8a39959d7b595871d03f2d692de92e18bb | |
| parent | 5dd378548ef5141b58d19a27c5f083bac4d4c9e5 (diff) | |
Make the fallback nature of message text clear from the docs.
Notification.MessagingStyle.Message.text has always been used on handheld as the non-displayed alt-text of images, and should be explicitly represented that way in the API.
Change-Id: Ib122657d3ceeeb3f7a3238ba65feddf6463f5163
Fixes: 341964094
Flag: DOCS_ONLY
Test: n/a
| -rw-r--r-- | core/java/android/app/Notification.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index d8f03b165a00..dfae48b82909 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -8725,6 +8725,12 @@ public class Notification implements Parcelable * <p>The messages should be added in chronologic order, i.e. the oldest first, * the newest last. * + * <p>Multiple Messages in a row with the same timestamp and sender may be grouped as a + * single message. This means an app should represent a message that has both an image and + * text as two Message objects, one with the image (and fallback text), and the other with + * the message text. For consistency, a text message (if any) should be provided after Uri + * content. + * * @param message The {@link Message} to be displayed * @return this object for method chaining */ @@ -9359,6 +9365,15 @@ public class Notification implements Parcelable } } + /* + * An object representing a simple message or piece of media within a mixed-media message. + * + * This object can only represent text or a single binary piece of media. For apps which + * support mixed-media messages (e.g. text + image), multiple Messages should be used, one + * to represent each piece of the message, and they should all be given the same timestamp. + * For consistency, a text message should be added last of all Messages with the same + * timestamp. + */ public static final class Message { /** @hide */ public static final String KEY_TEXT = "text"; @@ -9447,8 +9462,9 @@ public class Notification implements Parcelable /** * Sets a binary blob of data and an associated MIME type for a message. In the case - * where the platform doesn't support the MIME type, the original text provided in the - * constructor will be used. + * where the platform or the UI state doesn't support the MIME type, the original text + * provided in the constructor will be used. When this data can be presented to the + * user, the original text will only be used as accessibility text. * @param dataMimeType The MIME type of the content. See * {@link android.graphics.ImageDecoder#isMimeTypeSupported(String)} for a list of * supported image MIME types. |