am 4755a930: Merge "TIF: Remove countryCode in TvContentRating" into lmp-dev
* commit '4755a930104e28bfc5078b16a101e26e21be04ae': TIF: Remove countryCode in TvContentRating
This commit is contained in:
@@ -16869,9 +16869,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();
|
||||
|
||||
@@ -755,7 +755,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;
|
||||
@@ -764,21 +763,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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -786,7 +784,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
|
||||
*/
|
||||
@@ -795,27 +793,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;
|
||||
@@ -828,13 +827,6 @@ public final class TvContentRating {
|
||||
return mDomain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the country code in ISO 3166-2 format or {@code null}.
|
||||
*/
|
||||
public String getCountry() {
|
||||
return mCountryCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the rating system id.
|
||||
*/
|
||||
@@ -872,8 +864,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);
|
||||
|
||||
Reference in New Issue
Block a user