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

Commit 225bd680 authored by Jae Seo's avatar Jae Seo Committed by Android Git Automerger
Browse files

am 7a85f00c: Merge "Ensure that custom label isn\'t empty" into lmp-dev

* commit '7a85f00cfca8f9adcdc9a237d603ebab72245da4':
  Ensure that custom label isn't empty
parents b7f9b739 186b8690
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -624,7 +624,7 @@ public final class TvInputInfo implements Parcelable {
                return new ArrayList<String>();
            }
            String[] ids = hiddenIdsString.split(TV_INPUT_SEPARATOR);
            return Arrays.asList(ids);
            return new ArrayList(Arrays.asList(ids));
        }

        /**
@@ -665,7 +665,7 @@ public final class TvInputInfo implements Parcelable {
            StringBuilder builder = new StringBuilder();
            boolean firstItem = true;
            for (String inputId : hiddenInputIds) {
                ensureSeparatorIsNotIncluded(inputId);
                ensureValidField(inputId);
                if (firstItem) {
                    firstItem = false;
                } else {
@@ -692,8 +692,8 @@ public final class TvInputInfo implements Parcelable {
            StringBuilder builder = new StringBuilder();
            boolean firstItem = true;
            for (Pair<String, String> pair : customLabels) {
                ensureSeparatorIsNotIncluded(pair.first);
                ensureSeparatorIsNotIncluded(pair.second);
                ensureValidField(pair.first);
                ensureValidField(pair.second);
                if (firstItem) {
                    firstItem = false;
                } else {
@@ -707,7 +707,10 @@ public final class TvInputInfo implements Parcelable {
                    Settings.Secure.TV_INPUT_CUSTOM_LABELS, builder.toString(), userId);
        }

        private static void ensureSeparatorIsNotIncluded(String value) {
        private static void ensureValidField(String value) {
            if (TextUtils.isEmpty(value)) {
                throw new IllegalArgumentException(value + " should not empty ");
            }
            if (value.contains(TV_INPUT_SEPARATOR)) {
                throw new IllegalArgumentException(value + " should not include "
                        + TV_INPUT_SEPARATOR);