From 732be11cefc439ea47a6c9cced6ab240aa5f1ea9 Mon Sep 17 00:00:00 2001 From: Sungsoo Lim Date: Mon, 4 Aug 2014 11:30:54 +0900 Subject: [PATCH] TIF: Remove countryCode in TvContentRating In the standard TV content rating systems, there are no cases that a TV content rating system is used for multiple countries. Moreover, since we allow the case that the country code is null for a custom rating system (e.g. YT), the country code should be removed. Change-Id: I79472dbd491aa7efb40f3e081f90b45e13a91505 --- api/current.txt | 3 +- media/java/android/media/tv/TvContentRating.java | 41 +++++++++--------------- 2 files changed, 16 insertions(+), 28 deletions(-) diff --git a/api/current.txt b/api/current.txt index 851d20f4d32e..0700c603d1dd 100644 --- a/api/current.txt +++ b/api/current.txt @@ -16847,9 +16847,8 @@ package android.media.session { package android.media.tv { public final class TvContentRating { - method public static android.media.tv.TvContentRating createRating(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String...); + method public static android.media.tv.TvContentRating createRating(java.lang.String, java.lang.String, java.lang.String, java.lang.String...); method public java.lang.String flattenToString(); - method public java.lang.String getCountry(); method public java.lang.String getDomain(); method public java.lang.String getMainRating(); method public java.lang.String getRatingSystem(); diff --git a/media/java/android/media/tv/TvContentRating.java b/media/java/android/media/tv/TvContentRating.java index 1ace7752b036..e0a6d427419c 100644 --- a/media/java/android/media/tv/TvContentRating.java +++ b/media/java/android/media/tv/TvContentRating.java @@ -237,7 +237,6 @@ public final class TvContentRating { private static final String DELIMITER = "/"; private final String mDomain; - private final String mCountryCode; private final String mRatingSystem; private final String mRating; private final String[] mSubRatings; @@ -246,21 +245,20 @@ public final class TvContentRating { * Creates a TvContentRating object. * * @param domain The domain name. - * @param countryCode The country code in ISO 3166-2 format or {@code null}. * @param ratingSystem The rating system id. * @param rating The content rating string. * @param subRatings The string array of sub-ratings. * @return A TvContentRating object, or null if creation failed. */ - public static TvContentRating createRating(String domain, String countryCode, - String ratingSystem, String rating, String... subRatings) { + public static TvContentRating createRating(String domain, String ratingSystem, + String rating, String... subRatings) { if (TextUtils.isEmpty(domain)) { throw new IllegalArgumentException("domain cannot be empty"); } if (TextUtils.isEmpty(rating)) { throw new IllegalArgumentException("rating cannot be empty"); } - return new TvContentRating(domain, countryCode, ratingSystem, rating, subRatings); + return new TvContentRating(domain, ratingSystem, rating, subRatings); } /** @@ -268,7 +266,7 @@ public final class TvContentRating { * {@link #flattenToString}. * * @param ratingString The String that was returned by flattenToString(). - * @return a new TvContentRating containing the domain, countryCode, rating system, rating and + * @return a new TvContentRating containing the domain, rating system, rating and * sub-ratings information was encoded in {@code ratingString}. * @see #flattenToString */ @@ -277,27 +275,28 @@ public final class TvContentRating { throw new IllegalArgumentException("ratingString cannot be empty"); } String[] strs = ratingString.split(DELIMITER); - if (strs.length < 4) { + if (strs.length < 3) { throw new IllegalArgumentException("Invalid rating string: " + ratingString); } - if (strs.length > 4) { - String[] subRatings = new String[strs.length - 4]; - System.arraycopy(strs, 4, subRatings, 0, subRatings.length); - return new TvContentRating(strs[0], strs[1], strs[2], strs[3], subRatings); + if (strs.length > 3) { + String[] subRatings = new String[strs.length - 3]; + System.arraycopy(strs, 3, subRatings, 0, subRatings.length); + return new TvContentRating(strs[0], strs[1], strs[2], subRatings); } - return new TvContentRating(strs[0], strs[1], strs[2], strs[3], null); + return new TvContentRating(strs[0], strs[1], strs[2], null); } /** * Constructs a TvContentRating object from a given rating and sub-rating constants. * - * @param rating The rating constant defined in this class. + * @param domain The domain name. + * @param ratingSystem The rating system id. + * @param rating The content rating string. * @param subRatings The String array of sub-rating constants defined in this class. */ - private TvContentRating(String domain, String countryCode, - String ratingSystem, String rating, String[] subRatings) { + private TvContentRating( + String domain, String ratingSystem, String rating, String[] subRatings) { mDomain = domain; - mCountryCode = countryCode; mRatingSystem = ratingSystem; mRating = rating; mSubRatings = subRatings; @@ -311,13 +310,6 @@ public final class TvContentRating { } /** - * Returns the country code in ISO 3166-2 format or {@code null}. - */ - public String getCountry() { - return mCountryCode; - } - - /** * Returns the rating system id. */ public String getRatingSystem() { @@ -341,7 +333,6 @@ public final class TvContentRating { return Collections.unmodifiableList(Arrays.asList(mSubRatings)); } - /** * Returns a String that unambiguously describes both the rating and sub-rating information * contained in the TvContentRating. You can later recover the TvContentRating from this string @@ -355,8 +346,6 @@ public final class TvContentRating { StringBuilder builder = new StringBuilder(); builder.append(mDomain); builder.append(DELIMITER); - builder.append(mCountryCode); - builder.append(DELIMITER); builder.append(mRatingSystem); builder.append(DELIMITER); builder.append(mRating); -- 2.11.0