Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 43149717 authored by Jae Seo's avatar Jae Seo Committed by Android (Google) Code Review
Browse files

Merge "TIF: Start using the @NonNull annotation"

parents 6de5f439 c8b73564
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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);
+6 −5
Original line number Diff line number Diff line
@@ -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");
        }
+7 −3
Original line number Diff line number Diff line
@@ -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) {
        }

        /**
+3 −2
Original line number Diff line number Diff line
@@ -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");
        }