AudioAttributes: IAE for illegal usage / content type values.

Throw an IllegalArgumentException when trying to configure an
AudioAttributes instance with invalid usage or content type values.

Test: atest AudioAttributesTest
Change-Id: If674ed2b4208fe0c5b7f69a03fcd19b61e7653bf
This commit is contained in:
Jean-Michel Trivi
2019-10-16 15:09:37 -07:00
parent 779c5cc014
commit d8aaf45d93

View File

@@ -670,7 +670,7 @@ public final class AudioAttributes implements Parcelable {
mUsage = usage;
break;
default:
mUsage = USAGE_UNKNOWN;
throw new IllegalArgumentException("Invalid usage " + usage);
}
return this;
}
@@ -696,7 +696,7 @@ public final class AudioAttributes implements Parcelable {
mContentType = contentType;
break;
default:
mContentType = CONTENT_TYPE_UNKNOWN;
throw new IllegalArgumentException("Invalid content type " + contentType);
}
return this;
}