AudioProductStrategy: fix attributesMatches()

Use AudioAttributes.getSystemUsage() instead of getUsage()
when comparing attributes as getUsage() defaults to UNKNOWN for
system usages and causes a false match.

Bug: 136121584
Test: build & run cts-dev -m CtsMediaTestCase --test android.media.cts.AudioProductStrategyTest
Change-Id: I377e840b18443c33fb0b562b27fbc706aaeb8055
This commit is contained in:
Eric Laurent
2020-03-25 09:24:05 -07:00
parent 051829b895
commit e9e26309fd

View File

@@ -374,8 +374,8 @@ public final class AudioProductStrategy implements Parcelable {
if (refAttr.equals(sDefaultAttributes)) {
return false;
}
return ((refAttr.getUsage() == AudioAttributes.USAGE_UNKNOWN)
|| (attr.getUsage() == refAttr.getUsage()))
return ((refAttr.getSystemUsage() == AudioAttributes.USAGE_UNKNOWN)
|| (attr.getSystemUsage() == refAttr.getSystemUsage()))
&& ((refAttr.getContentType() == AudioAttributes.CONTENT_TYPE_UNKNOWN)
|| (attr.getContentType() == refAttr.getContentType()))
&& ((refAttr.getAllFlags() == 0)