Loading core/java/android/app/Notification.java +14 −4 Original line number Original line Diff line number Diff line Loading @@ -3510,8 +3510,16 @@ public class Notification implements Parcelable return cs.toString(); return cs.toString(); } } @Nullable private static CharSequence stripNonStyleSpans(@Nullable CharSequence text) { private static CharSequence stripNonStyleSpans(@Nullable CharSequence text) { // Keep Strikethrough spans for MessagingStyle notifications. // Strikethrough can be an important part of the meaning of the message // e.g.the corrections, cancelations etc. return stripNonStyleSpans(text, /* keepStrikethrough= */ true); } @Nullable private static CharSequence stripNonStyleSpans(@Nullable CharSequence text, boolean keepStrikethrough) { if (text == null) return null; if (text == null) return null; if (text instanceof Spanned) { if (text instanceof Spanned) { Loading @@ -3521,7 +3529,7 @@ public class Notification implements Parcelable for (Object span : spans) { for (Object span : spans) { final Object resultSpan; final Object resultSpan; if (span instanceof StyleSpan if (span instanceof StyleSpan || span instanceof StrikethroughSpan || (keepStrikethrough && (span instanceof StrikethroughSpan)) || span instanceof UnderlineSpan) { || span instanceof UnderlineSpan) { resultSpan = span; resultSpan = span; } else if (span instanceof TextAppearanceSpan) { } else if (span instanceof TextAppearanceSpan) { Loading Loading @@ -7514,8 +7522,10 @@ public class Notification implements Parcelable public CharSequence ensureColorSpanContrastOrStripStyling(CharSequence cs, public CharSequence ensureColorSpanContrastOrStripStyling(CharSequence cs, int buttonFillColor) { int buttonFillColor) { if ( mN.isPromotedOngoing()) { if ( mN.isPromotedOngoing()) { // RON keeps non style spans just like MessagingStyle // RON keeps non style spans just like MessagingStyle but disallow strikethrough return stripNonStyleSpans(cs); // as that could change the text's meaning between promoted (which allows spans) // and demoted (which removes spans). return stripNonStyleSpans(cs, /* keepStrikethrough= */ false); } else if (Flags.cleanUpSpansAndNewLines()) { } else if (Flags.cleanUpSpansAndNewLines()) { return stripStyling(cs); return stripStyling(cs); } } Loading Loading
core/java/android/app/Notification.java +14 −4 Original line number Original line Diff line number Diff line Loading @@ -3510,8 +3510,16 @@ public class Notification implements Parcelable return cs.toString(); return cs.toString(); } } @Nullable private static CharSequence stripNonStyleSpans(@Nullable CharSequence text) { private static CharSequence stripNonStyleSpans(@Nullable CharSequence text) { // Keep Strikethrough spans for MessagingStyle notifications. // Strikethrough can be an important part of the meaning of the message // e.g.the corrections, cancelations etc. return stripNonStyleSpans(text, /* keepStrikethrough= */ true); } @Nullable private static CharSequence stripNonStyleSpans(@Nullable CharSequence text, boolean keepStrikethrough) { if (text == null) return null; if (text == null) return null; if (text instanceof Spanned) { if (text instanceof Spanned) { Loading @@ -3521,7 +3529,7 @@ public class Notification implements Parcelable for (Object span : spans) { for (Object span : spans) { final Object resultSpan; final Object resultSpan; if (span instanceof StyleSpan if (span instanceof StyleSpan || span instanceof StrikethroughSpan || (keepStrikethrough && (span instanceof StrikethroughSpan)) || span instanceof UnderlineSpan) { || span instanceof UnderlineSpan) { resultSpan = span; resultSpan = span; } else if (span instanceof TextAppearanceSpan) { } else if (span instanceof TextAppearanceSpan) { Loading Loading @@ -7514,8 +7522,10 @@ public class Notification implements Parcelable public CharSequence ensureColorSpanContrastOrStripStyling(CharSequence cs, public CharSequence ensureColorSpanContrastOrStripStyling(CharSequence cs, int buttonFillColor) { int buttonFillColor) { if ( mN.isPromotedOngoing()) { if ( mN.isPromotedOngoing()) { // RON keeps non style spans just like MessagingStyle // RON keeps non style spans just like MessagingStyle but disallow strikethrough return stripNonStyleSpans(cs); // as that could change the text's meaning between promoted (which allows spans) // and demoted (which removes spans). return stripNonStyleSpans(cs, /* keepStrikethrough= */ false); } else if (Flags.cleanUpSpansAndNewLines()) { } else if (Flags.cleanUpSpansAndNewLines()) { return stripStyling(cs); return stripStyling(cs); } } Loading