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

Commit edaece1f authored by Jaewan Kim's avatar Jaewan Kim Committed by Android (Google) Code Review
Browse files

Merge "TIF: Accept any character for custom label." into lmp-dev

parents a945c352 f0e530e4
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -4740,17 +4740,16 @@ public final class Settings {

        /**
         * List of TV inputs that are currently hidden. This is a string
         * containing the IDs of all hidden TV inputs. Each ID is separated by ':'.
         *
         * containing the IDs of all hidden TV inputs. Each ID is encoded by
         * {@link android.net.Uri#encode(String)} and separated by ':'.
         * @hide
         */
        public static final String TV_INPUT_HIDDEN_INPUTS = "tv_input_hidden_inputs";

        /**
         * List of custom TV input labels. This is a string containing <TV input id, custom name>
         * pairs. Each pair is separated by ':' and TV input id and custom name are separated by
         * ','.
         *
         * pairs. TV input id and custom name are encoded by {@link android.net.Uri#encode(String)}
         * and separated by ','. Each pair is separated by ':'.
         * @hide
         */
        public static final String TV_INPUT_CUSTOM_LABELS = "tv_input_custom_labels";
+10 −15
Original line number Diff line number Diff line
@@ -46,7 +46,6 @@ import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -616,11 +615,15 @@ public final class TvInputInfo implements Parcelable {
        public static Set<String> getHiddenTvInputIds(Context context, int userId) {
            String hiddenIdsString = Settings.Secure.getStringForUser(
                    context.getContentResolver(), Settings.Secure.TV_INPUT_HIDDEN_INPUTS, userId);
            Set<String> set = new HashSet<String>();
            if (TextUtils.isEmpty(hiddenIdsString)) {
                return new HashSet<String>();
                return set;
            }
            String[] ids = hiddenIdsString.split(TV_INPUT_SEPARATOR);
            return new HashSet<>(Arrays.asList(ids));
            for (String id : ids) {
                set.add(Uri.decode(id));
            }
            return set;
        }

        /**
@@ -641,7 +644,7 @@ public final class TvInputInfo implements Parcelable {
            String[] pairs = labelsString.split(TV_INPUT_SEPARATOR);
            for (String pairString : pairs) {
                String[] pair = pairString.split(CUSTOM_NAME_SEPARATOR);
                map.put(pair[0], pair[1]);
                map.put(Uri.decode(pair[0]), Uri.decode(pair[1]));
            }
            return map;
        }
@@ -667,7 +670,7 @@ public final class TvInputInfo implements Parcelable {
                } else {
                    builder.append(TV_INPUT_SEPARATOR);
                }
                builder.append(inputId);
                builder.append(Uri.encode(inputId));
            }
            Settings.Secure.putStringForUser(context.getContentResolver(),
                    Settings.Secure.TV_INPUT_HIDDEN_INPUTS, builder.toString(), userId);
@@ -695,9 +698,9 @@ public final class TvInputInfo implements Parcelable {
                } else {
                    builder.append(TV_INPUT_SEPARATOR);
                }
                builder.append(entry.getKey());
                builder.append(Uri.encode(entry.getKey()));
                builder.append(CUSTOM_NAME_SEPARATOR);
                builder.append(entry.getValue());
                builder.append(Uri.encode(entry.getValue()));
            }
            Settings.Secure.putStringForUser(context.getContentResolver(),
                    Settings.Secure.TV_INPUT_CUSTOM_LABELS, builder.toString(), userId);
@@ -707,14 +710,6 @@ public final class TvInputInfo implements Parcelable {
            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);
            }
            if (value.contains(CUSTOM_NAME_SEPARATOR)) {
                throw new IllegalArgumentException(value + " should not include "
                        + CUSTOM_NAME_SEPARATOR);
            }
        }
    }
}