Skip to content

Commit d22e37a

Browse files
committed
Treat empty subrating as the same as null subratings.
Change-Id: Ic288c680c639ccba6cf593d1286776a6c891b726
1 parent 328e679 commit d22e37a

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
@@ -1427,6 +1427,9 @@ public static TvContentRating createRating(String domain, String ratingSystem,
14271427
if (TextUtils.isEmpty(domain)) {
14281428
throw new IllegalArgumentException("domain cannot be empty");
14291429
}
1430+
if (TextUtils.isEmpty(ratingSystem)) {
1431+
throw new IllegalArgumentException("ratingSystem cannot be empty");
1432+
}
14301433
if (TextUtils.isEmpty(rating)) {
14311434
throw new IllegalArgumentException("rating cannot be empty");
14321435
}
@@ -1471,7 +1474,7 @@ private TvContentRating(
14711474
mDomain = domain;
14721475
mRatingSystem = ratingSystem;
14731476
mRating = rating;
1474-
mSubRatings = subRatings;
1477+
mSubRatings = (subRatings == null || subRatings.length == 0) ? null : subRatings;
14751478
}
14761479

14771480
/**
@@ -1550,6 +1553,11 @@ public final boolean contains(TvContentRating rating) {
15501553
if (!rating.getMainRating().equals(mRating)) {
15511554
return false;
15521555
}
1556+
if (!rating.getDomain().equals(mDomain) ||
1557+
!rating.getRatingSystem().equals(mRatingSystem) ||
1558+
!rating.getMainRating().equals(mRating)) {
1559+
return false;
1560+
}
15531561
List<String> subRatings = getSubRatings();
15541562
List<String> subRatingsOther = rating.getSubRatings();
15551563
if (subRatings == null && subRatingsOther == null) {

0 commit comments

Comments
 (0)