summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nick Chalko <nchalko@google.com> 2020-01-07 16:04:28 -0800
committer Nick Chalko <nchalko@google.com> 2020-01-12 05:53:07 +0000
commit63cdbb59f104cd984ca5e80cee8bb8b00f8fa1a1 (patch)
tree246034e26a43622d9c0f79e377e7d86708aca116
parentf800e435de041d5e60ed712a541ddd87513295bf (diff)
Mark @NonNull where possible in TvTrackInfo
Test: m framework-minus-apex Change-Id: I4acdb1c9871ee71294e2ebfec2c7444de95861b7 Bug: 112835103
-rw-r--r--api/current.txt24
-rw-r--r--media/java/android/media/tv/TvTrackInfo.java39
2 files changed, 40 insertions, 23 deletions
diff --git a/api/current.txt b/api/current.txt
index 5ce5d6107982..df55d329486d 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -28701,7 +28701,7 @@ package android.media.tv {
method public boolean isEncrypted();
method public boolean isHardOfHearing();
method public boolean isSpokenSubtitle();
- method public void writeToParcel(android.os.Parcel, int);
+ method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.media.tv.TvTrackInfo> CREATOR;
field public static final int TYPE_AUDIO = 0; // 0x0
field public static final int TYPE_SUBTITLE = 2; // 0x2
@@ -28710,21 +28710,21 @@ package android.media.tv {
public static final class TvTrackInfo.Builder {
ctor public TvTrackInfo.Builder(int, @NonNull String);
- method public android.media.tv.TvTrackInfo build();
- method public android.media.tv.TvTrackInfo.Builder setAudioChannelCount(int);
+ method @NonNull public android.media.tv.TvTrackInfo build();
+ method @NonNull public android.media.tv.TvTrackInfo.Builder setAudioChannelCount(int);
method @NonNull public android.media.tv.TvTrackInfo.Builder setAudioDescription(boolean);
- method public android.media.tv.TvTrackInfo.Builder setAudioSampleRate(int);
- method public android.media.tv.TvTrackInfo.Builder setDescription(CharSequence);
+ method @NonNull public android.media.tv.TvTrackInfo.Builder setAudioSampleRate(int);
+ method @NonNull public android.media.tv.TvTrackInfo.Builder setDescription(@NonNull CharSequence);
method @NonNull public android.media.tv.TvTrackInfo.Builder setEncrypted(boolean);
- method public android.media.tv.TvTrackInfo.Builder setExtra(android.os.Bundle);
+ method @NonNull public android.media.tv.TvTrackInfo.Builder setExtra(@NonNull android.os.Bundle);
method @NonNull public android.media.tv.TvTrackInfo.Builder setHardOfHearing(boolean);
- method public android.media.tv.TvTrackInfo.Builder setLanguage(String);
+ method @NonNull public android.media.tv.TvTrackInfo.Builder setLanguage(@NonNull String);
method @NonNull public android.media.tv.TvTrackInfo.Builder setSpokenSubtitle(boolean);
- method public android.media.tv.TvTrackInfo.Builder setVideoActiveFormatDescription(byte);
- method public android.media.tv.TvTrackInfo.Builder setVideoFrameRate(float);
- method public android.media.tv.TvTrackInfo.Builder setVideoHeight(int);
- method public android.media.tv.TvTrackInfo.Builder setVideoPixelAspectRatio(float);
- method public android.media.tv.TvTrackInfo.Builder setVideoWidth(int);
+ method @NonNull public android.media.tv.TvTrackInfo.Builder setVideoActiveFormatDescription(byte);
+ method @NonNull public android.media.tv.TvTrackInfo.Builder setVideoFrameRate(float);
+ method @NonNull public android.media.tv.TvTrackInfo.Builder setVideoHeight(int);
+ method @NonNull public android.media.tv.TvTrackInfo.Builder setVideoPixelAspectRatio(float);
+ method @NonNull public android.media.tv.TvTrackInfo.Builder setVideoWidth(int);
}
public class TvView extends android.view.ViewGroup {
diff --git a/media/java/android/media/tv/TvTrackInfo.java b/media/java/android/media/tv/TvTrackInfo.java
index 4318a0ae7d06..5e0b1eab4393 100644
--- a/media/java/android/media/tv/TvTrackInfo.java
+++ b/media/java/android/media/tv/TvTrackInfo.java
@@ -318,7 +318,8 @@ public final class TvTrackInfo implements Parcelable {
* @param flags The flags used for parceling.
*/
@Override
- public void writeToParcel(Parcel dest, int flags) {
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ Preconditions.checkNotNull(dest);
dest.writeInt(mType);
dest.writeString(mId);
dest.writeString(mLanguage);
@@ -387,11 +388,13 @@ public final class TvTrackInfo implements Parcelable {
public static final @android.annotation.NonNull Parcelable.Creator<TvTrackInfo> CREATOR =
new Parcelable.Creator<TvTrackInfo>() {
@Override
+ @NonNull
public TvTrackInfo createFromParcel(Parcel in) {
return new TvTrackInfo(in);
}
@Override
+ @NonNull
public TvTrackInfo[] newArray(int size) {
return new TvTrackInfo[size];
}
@@ -444,7 +447,9 @@ public final class TvTrackInfo implements Parcelable {
*
* @param language The language string encoded by either ISO 639-1 or ISO 639-2/T.
*/
- public final Builder setLanguage(String language) {
+ @NonNull
+ public Builder setLanguage(@NonNull String language) {
+ Preconditions.checkNotNull(language);
mLanguage = language;
return this;
}
@@ -454,7 +459,9 @@ public final class TvTrackInfo implements Parcelable {
*
* @param description The user readable description.
*/
- public final Builder setDescription(CharSequence description) {
+ @NonNull
+ public Builder setDescription(@NonNull CharSequence description) {
+ Preconditions.checkNotNull(description);
mDescription = description;
return this;
}
@@ -479,7 +486,8 @@ public final class TvTrackInfo implements Parcelable {
* @param audioChannelCount The audio channel count.
* @throws IllegalStateException if not called on an audio track
*/
- public final Builder setAudioChannelCount(int audioChannelCount) {
+ @NonNull
+ public Builder setAudioChannelCount(int audioChannelCount) {
if (mType != TYPE_AUDIO) {
throw new IllegalStateException("Not an audio track");
}
@@ -494,7 +502,8 @@ public final class TvTrackInfo implements Parcelable {
* @param audioSampleRate The audio sample rate.
* @throws IllegalStateException if not called on an audio track
*/
- public final Builder setAudioSampleRate(int audioSampleRate) {
+ @NonNull
+ public Builder setAudioSampleRate(int audioSampleRate) {
if (mType != TYPE_AUDIO) {
throw new IllegalStateException("Not an audio track");
}
@@ -570,7 +579,8 @@ public final class TvTrackInfo implements Parcelable {
* @param videoWidth The width of the video.
* @throws IllegalStateException if not called on a video track
*/
- public final Builder setVideoWidth(int videoWidth) {
+ @NonNull
+ public Builder setVideoWidth(int videoWidth) {
if (mType != TYPE_VIDEO) {
throw new IllegalStateException("Not a video track");
}
@@ -585,7 +595,8 @@ public final class TvTrackInfo implements Parcelable {
* @param videoHeight The height of the video.
* @throws IllegalStateException if not called on a video track
*/
- public final Builder setVideoHeight(int videoHeight) {
+ @NonNull
+ public Builder setVideoHeight(int videoHeight) {
if (mType != TYPE_VIDEO) {
throw new IllegalStateException("Not a video track");
}
@@ -600,7 +611,8 @@ public final class TvTrackInfo implements Parcelable {
* @param videoFrameRate The frame rate of the video.
* @throws IllegalStateException if not called on a video track
*/
- public final Builder setVideoFrameRate(float videoFrameRate) {
+ @NonNull
+ public Builder setVideoFrameRate(float videoFrameRate) {
if (mType != TYPE_VIDEO) {
throw new IllegalStateException("Not a video track");
}
@@ -620,7 +632,8 @@ public final class TvTrackInfo implements Parcelable {
* @param videoPixelAspectRatio The pixel aspect ratio of the video.
* @throws IllegalStateException if not called on a video track
*/
- public final Builder setVideoPixelAspectRatio(float videoPixelAspectRatio) {
+ @NonNull
+ public Builder setVideoPixelAspectRatio(float videoPixelAspectRatio) {
if (mType != TYPE_VIDEO) {
throw new IllegalStateException("Not a video track");
}
@@ -640,7 +653,8 @@ public final class TvTrackInfo implements Parcelable {
* @param videoActiveFormatDescription The AFD code of the video.
* @throws IllegalStateException if not called on a video track
*/
- public final Builder setVideoActiveFormatDescription(byte videoActiveFormatDescription) {
+ @NonNull
+ public Builder setVideoActiveFormatDescription(byte videoActiveFormatDescription) {
if (mType != TYPE_VIDEO) {
throw new IllegalStateException("Not a video track");
}
@@ -653,7 +667,9 @@ public final class TvTrackInfo implements Parcelable {
*
* @param extra The extra information.
*/
- public final Builder setExtra(Bundle extra) {
+ @NonNull
+ public Builder setExtra(@NonNull Bundle extra) {
+ Preconditions.checkNotNull(extra);
mExtra = new Bundle(extra);
return this;
}
@@ -663,6 +679,7 @@ public final class TvTrackInfo implements Parcelable {
*
* @return The new {@link TvTrackInfo} instance
*/
+ @NonNull
public TvTrackInfo build() {
return new TvTrackInfo(mType, mId, mLanguage, mDescription, mEncrypted,
mAudioChannelCount, mAudioSampleRate, mAudioDescription, mHardOfHearing,