diff options
| -rw-r--r-- | media/java/android/media/tv/TvInputInfo.java | 7 | ||||
| -rw-r--r-- | media/java/android/media/tv/TvInputManager.java | 11 | ||||
| -rw-r--r-- | media/java/android/media/tv/TvInputService.java | 10 | ||||
| -rw-r--r-- | media/java/android/media/tv/TvView.java | 5 |
4 files changed, 20 insertions, 13 deletions
diff --git a/media/java/android/media/tv/TvInputInfo.java b/media/java/android/media/tv/TvInputInfo.java index f0e2f5c5e0cf..46d33b468982 100644 --- a/media/java/android/media/tv/TvInputInfo.java +++ b/media/java/android/media/tv/TvInputInfo.java @@ -16,6 +16,7 @@ package android.media.tv; +import android.annotation.NonNull; import android.annotation.SystemApi; import android.content.ComponentName; import android.content.Context; @@ -424,7 +425,7 @@ public final class TvInputInfo implements Parcelable { * @return a CharSequence containing the TV input's label. If the TV input does not have * a label, its name is returned. */ - public CharSequence loadLabel(Context context) { + public CharSequence loadLabel(@NonNull Context context) { if (TextUtils.isEmpty(mLabel)) { return mService.loadLabel(context.getPackageManager()); } else { @@ -452,7 +453,7 @@ public final class TvInputInfo implements Parcelable { * @return a Drawable containing the TV input's icon. If the TV input does not have an icon, * application's icon is returned. If it's unavailable too, {@code null} is returned. */ - public Drawable loadIcon(Context context) { + public Drawable loadIcon(@NonNull Context context) { if (mIconUri == null) { return loadServiceIcon(context); } @@ -506,7 +507,7 @@ public final class TvInputInfo 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) { dest.writeString(mId); dest.writeString(mParentId); mService.writeToParcel(dest, flags); diff --git a/media/java/android/media/tv/TvInputManager.java b/media/java/android/media/tv/TvInputManager.java index 105084e3fd3e..0f265de74ce8 100644 --- a/media/java/android/media/tv/TvInputManager.java +++ b/media/java/android/media/tv/TvInputManager.java @@ -16,6 +16,7 @@ package android.media.tv; +import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.graphics.Rect; @@ -932,7 +933,7 @@ public final class TvInputManager { * @return the {@link TvInputInfo} for a given TV input. {@code null} if not found. */ @Nullable - public TvInputInfo getTvInputInfo(String inputId) { + public TvInputInfo getTvInputInfo(@NonNull String inputId) { if (inputId == null) { throw new IllegalArgumentException("inputId cannot be null"); } @@ -956,7 +957,7 @@ public final class TvInputManager { * @param inputId The id of the TV input. * @throws IllegalArgumentException if the argument is {@code null}. */ - public int getInputState(String inputId) { + public int getInputState(@NonNull String inputId) { if (inputId == null) { throw new IllegalArgumentException("inputId cannot be null"); } @@ -977,7 +978,7 @@ public final class TvInputManager { * @param handler A {@link Handler} that the status change will be delivered to. * @throws IllegalArgumentException if any of the arguments is {@code null}. */ - public void registerCallback(TvInputCallback callback, Handler handler) { + public void registerCallback(@NonNull TvInputCallback callback, @NonNull Handler handler) { if (callback == null) { throw new IllegalArgumentException("callback cannot be null"); } @@ -995,7 +996,7 @@ public final class TvInputManager { * @param callback The existing callback to remove. * @throws IllegalArgumentException if any of the arguments is {@code null}. */ - public void unregisterCallback(final TvInputCallback callback) { + public void unregisterCallback(@NonNull final TvInputCallback callback) { if (callback == null) { throw new IllegalArgumentException("callback cannot be null"); } @@ -1047,7 +1048,7 @@ public final class TvInputManager { * @param rating The TV content rating to check. * @return {@code true} if the given TV content rating is blocked, {@code false} otherwise. */ - public boolean isRatingBlocked(TvContentRating rating) { + public boolean isRatingBlocked(@NonNull TvContentRating rating) { if (rating == null) { throw new IllegalArgumentException("rating cannot be null"); } diff --git a/media/java/android/media/tv/TvInputService.java b/media/java/android/media/tv/TvInputService.java index 382ec91b5e80..4258534a0014 100644 --- a/media/java/android/media/tv/TvInputService.java +++ b/media/java/android/media/tv/TvInputService.java @@ -16,6 +16,7 @@ package android.media.tv; +import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SuppressLint; import android.annotation.SystemApi; @@ -314,7 +315,7 @@ public abstract class TvInputService extends Service { @SystemApi public void notifySessionEvent(final String eventType, final Bundle eventArgs) { if (eventType == null) { - throw new IllegalArgumentException("eventType should not be null."); + throw new IllegalArgumentException("eventType cannot be null"); } executeOrPostRunnable(new Runnable() { @Override @@ -544,7 +545,10 @@ public abstract class TvInputService extends Service { * @see #notifyContentAllowed * @see TvInputManager */ - public void notifyContentBlocked(final TvContentRating rating) { + public void notifyContentBlocked(@NonNull final TvContentRating rating) { + if (rating == null) { + throw new IllegalArgumentException("rating cannot be null"); + } executeOrPostRunnable(new Runnable() { @Override public void run() { @@ -828,7 +832,7 @@ public abstract class TvInputService extends Service { * @hide */ @SystemApi - public void onAppPrivateCommand(String action, Bundle data) { + public void onAppPrivateCommand(@NonNull String action, Bundle data) { } /** diff --git a/media/java/android/media/tv/TvView.java b/media/java/android/media/tv/TvView.java index 645604996d6f..d248b1232221 100644 --- a/media/java/android/media/tv/TvView.java +++ b/media/java/android/media/tv/TvView.java @@ -16,6 +16,7 @@ package android.media.tv; +import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.content.Context; @@ -273,7 +274,7 @@ public class TvView extends ViewGroup { * @param inputId The ID of TV input which will play the given channel. * @param channelUri The URI of a channel. */ - public void tune(String inputId, Uri channelUri) { + public void tune(@NonNull String inputId, Uri channelUri) { tune(inputId, channelUri, null); } @@ -494,7 +495,7 @@ public class TvView extends ViewGroup { * @hide */ @SystemApi - public void sendAppPrivateCommand(String action, Bundle data) { + public void sendAppPrivateCommand(@NonNull String action, Bundle data) { if (TextUtils.isEmpty(action)) { throw new IllegalArgumentException("action cannot be null or an empty string"); } |