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

Commit 4871f3e0 authored by Jeff DeCew's avatar Jeff DeCew Committed by Android (Google) Code Review
Browse files

Merge "Limit the length of the ShortCriticalText" into main

parents b845b602 a3bf7c40
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -3322,6 +3322,18 @@ public class Notification implements Parcelable
        }
    }
    /**
     * Make sure this String is safe to put into a bundle.
     * @hide
     */
    public static String safeString(String str) {
        if (str == null) return str;
        if (str.length() > MAX_CHARSEQUENCE_LENGTH) {
            str = str.substring(0, MAX_CHARSEQUENCE_LENGTH);
        }
        return str;
    }
    /**
     * Make sure this CharSequence is safe to put into a bundle, which basically
     * means it had better not be some custom Parcelable implementation.
@@ -5051,7 +5063,7 @@ public class Notification implements Parcelable
        @FlaggedApi(Flags.FLAG_API_RICH_ONGOING)
        @NonNull
        public Builder setShortCriticalText(@Nullable String shortCriticalText) {
            mN.extras.putString(EXTRA_SHORT_CRITICAL_TEXT, shortCriticalText);
            mN.extras.putString(EXTRA_SHORT_CRITICAL_TEXT, safeString(shortCriticalText));
            return this;
        }