Skip to content

Commit 22f7c47

Browse files
jaewan-githubAndroid (Google) Code Review
authored andcommitted
Merge "Treat empty subrating as the same as null subratings." into lmp-dev
2 parents 8a22f01 + d22e37a commit 22f7c47

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

media/java/android/media/tv/TvContentRating.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,9 @@ public static TvContentRating createRating(String domain, String ratingSystem,
14251425
if (TextUtils.isEmpty(domain)) {
14261426
throw new IllegalArgumentException("domain cannot be empty");
14271427
}
1428+
if (TextUtils.isEmpty(ratingSystem)) {
1429+
throw new IllegalArgumentException("ratingSystem cannot be empty");
1430+
}
14281431
if (TextUtils.isEmpty(rating)) {
14291432
throw new IllegalArgumentException("rating cannot be empty");
14301433
}
@@ -1469,7 +1472,7 @@ private TvContentRating(
14691472
mDomain = domain;
14701473
mRatingSystem = ratingSystem;
14711474
mRating = rating;
1472-
mSubRatings = subRatings;
1475+
mSubRatings = (subRatings == null || subRatings.length == 0) ? null : subRatings;
14731476
}
14741477

14751478
/**
@@ -1548,6 +1551,11 @@ public final boolean contains(TvContentRating rating) {
15481551
if (!rating.getMainRating().equals(mRating)) {
15491552
return false;
15501553
}
1554+
if (!rating.getDomain().equals(mDomain) ||
1555+
!rating.getRatingSystem().equals(mRatingSystem) ||
1556+
!rating.getMainRating().equals(mRating)) {
1557+
return false;
1558+
}
15511559
List<String> subRatings = getSubRatings();
15521560
List<String> subRatingsOther = rating.getSubRatings();
15531561
if (subRatings == null && subRatingsOther == null) {

0 commit comments

Comments
 (0)