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

Commit eb3cf182 authored by Evan Chen's avatar Evan Chen Committed by Android Build Coastguard Worker
Browse files

Limits the display name to 1024 characters

Bug: 418773283
Test: cts
Flag: EXEMPT bugfix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:4234c17b14d65c4cea54c9a4ff119029595e9867)
Merged-In: I29e050c498e813e291af213ce4ddc590559c8b7d
Change-Id: I29e050c498e813e291af213ce4ddc590559c8b7d
parent 3a760757
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -274,6 +274,8 @@ public final class AssociationRequest implements Parcelable {
     */
    private boolean mSkipPrompt;

    private static final int DISPLAY_NAME_LENGTH_LIMIT = 1024;

    /**
     * The device icon displayed in selfManaged association dialog.
     * @hide
@@ -501,6 +503,11 @@ public final class AssociationRequest implements Parcelable {
        public Builder setDisplayName(@NonNull CharSequence displayName) {
            checkNotUsed();
            mDisplayName = requireNonNull(displayName);
            if (displayName.length() > DISPLAY_NAME_LENGTH_LIMIT) {
                throw new IllegalArgumentException("Length of the display name must be at most "
                        + DISPLAY_NAME_LENGTH_LIMIT + " characters");
            }

            return this;
        }