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

Commit 4bf607b0 authored by Dongwon Kang's avatar Dongwon Kang
Browse files

TIF: start using @Nullable annotation.

Added @Nullable annotation when the javadoc sprcifies the return value
or argument can be null.

Bug: 19941047
Change-Id: I823189a242fae10ca14788fee9747bf5d59f5eb3
parent 58885cc6
Loading
Loading
Loading
Loading
+7 −4
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package android.media.tv;
package android.media.tv;


import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.SystemApi;
import android.content.ComponentName;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.ContentResolver;
@@ -156,7 +157,7 @@ public final class TvContract {
     * @param inputId The ID of the TV input to build a channels URI for. If {@code null}, builds a
     * @param inputId The ID of the TV input to build a channels URI for. If {@code null}, builds a
     *            URI for all the TV inputs.
     *            URI for all the TV inputs.
     */
     */
    public static final Uri buildChannelsUriForInput(String inputId) {
    public static final Uri buildChannelsUriForInput(@Nullable String inputId) {
        return buildChannelsUriForInput(inputId, false);
        return buildChannelsUriForInput(inputId, false);
    }
    }


@@ -171,7 +172,8 @@ public final class TvContract {
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    public static final Uri buildChannelsUriForInput(String inputId, boolean browsableOnly) {
    public static final Uri buildChannelsUriForInput(@Nullable String inputId,
            boolean browsableOnly) {
        Uri.Builder builder = Channels.CONTENT_URI.buildUpon();
        Uri.Builder builder = Channels.CONTENT_URI.buildUpon();
        if (inputId != null) {
        if (inputId != null) {
            builder.appendQueryParameter(PARAM_INPUT, inputId);
            builder.appendQueryParameter(PARAM_INPUT, inputId);
@@ -193,8 +195,8 @@ public final class TvContract {
     * @hide
     * @hide
     */
     */
    @SystemApi
    @SystemApi
    public static final Uri buildChannelsUriForInput(String inputId, String genre,
    public static final Uri buildChannelsUriForInput(@Nullable String inputId,
            boolean browsableOnly) {
            @Nullable String genre, boolean browsableOnly) {
        if (genre == null) {
        if (genre == null) {
            return buildChannelsUriForInput(inputId, browsableOnly);
            return buildChannelsUriForInput(inputId, browsableOnly);
        }
        }
@@ -509,6 +511,7 @@ public final class TvContract {
         *         is not defined for the given video format.
         *         is not defined for the given video format.
         * @see #COLUMN_VIDEO_FORMAT
         * @see #COLUMN_VIDEO_FORMAT
         */
         */
        @Nullable
        public static final String getVideoResolution(String videoFormat) {
        public static final String getVideoResolution(String videoFormat) {
            return VIDEO_FORMAT_TO_RESOLUTION_MAP.get(videoFormat);
            return VIDEO_FORMAT_TO_RESOLUTION_MAP.get(videoFormat);
        }
        }
+7 −3
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package android.media.tv;
package android.media.tv;


import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.SystemApi;
import android.graphics.Rect;
import android.graphics.Rect;
import android.media.MediaPlayer;
import android.media.MediaPlayer;
@@ -229,7 +230,7 @@ public final class TvInputManager {
         * @param session A {@link TvInputManager.Session} instance created. This can be
         * @param session A {@link TvInputManager.Session} instance created. This can be
         *            {@code null} if the creation request failed.
         *            {@code null} if the creation request failed.
         */
         */
        public void onSessionCreated(Session session) {
        public void onSessionCreated(@Nullable Session session) {
        }
        }


        /**
        /**
@@ -270,7 +271,7 @@ public final class TvInputManager {
         * @param trackId The ID of the selected track. When {@code null} the currently selected
         * @param trackId The ID of the selected track. When {@code null} the currently selected
         *            track for a given type should be unselected.
         *            track for a given type should be unselected.
         */
         */
        public void onTrackSelected(Session session, int type, String trackId) {
        public void onTrackSelected(Session session, int type, @Nullable String trackId) {
        }
        }


        /**
        /**
@@ -930,6 +931,7 @@ public final class TvInputManager {
     * @param inputId The ID of the TV input.
     * @param inputId The ID of the TV input.
     * @return the {@link TvInputInfo} for a given TV input. {@code null} if not found.
     * @return the {@link TvInputInfo} for a given TV input. {@code null} if not found.
     */
     */
    @Nullable
    public TvInputInfo getTvInputInfo(String inputId) {
    public TvInputInfo getTvInputInfo(String inputId) {
        if (inputId == null) {
        if (inputId == null) {
            throw new IllegalArgumentException("inputId cannot be null");
            throw new IllegalArgumentException("inputId cannot be null");
@@ -1501,7 +1503,7 @@ public final class TvInputManager {
         *            track of the given type will be unselected.
         *            track of the given type will be unselected.
         * @see #getTracks
         * @see #getTracks
         */
         */
        public void selectTrack(int type, String trackId) {
        public void selectTrack(int type, @Nullable String trackId) {
            synchronized (mMetadataLock) {
            synchronized (mMetadataLock) {
                if (type == TvTrackInfo.TYPE_AUDIO) {
                if (type == TvTrackInfo.TYPE_AUDIO) {
                    if (trackId != null && !containsTrack(mAudioTracks, trackId)) {
                    if (trackId != null && !containsTrack(mAudioTracks, trackId)) {
@@ -1550,6 +1552,7 @@ public final class TvInputManager {
         *            {@link TvTrackInfo#TYPE_VIDEO} or {@link TvTrackInfo#TYPE_SUBTITLE}.
         *            {@link TvTrackInfo#TYPE_VIDEO} or {@link TvTrackInfo#TYPE_SUBTITLE}.
         * @return the list of tracks for the given type.
         * @return the list of tracks for the given type.
         */
         */
        @Nullable
        public List<TvTrackInfo> getTracks(int type) {
        public List<TvTrackInfo> getTracks(int type) {
            synchronized (mMetadataLock) {
            synchronized (mMetadataLock) {
                if (type == TvTrackInfo.TYPE_AUDIO) {
                if (type == TvTrackInfo.TYPE_AUDIO) {
@@ -1579,6 +1582,7 @@ public final class TvInputManager {
         * @return the ID of the selected track.
         * @return the ID of the selected track.
         * @see #selectTrack
         * @see #selectTrack
         */
         */
        @Nullable
        public String getSelectedTrack(int type) {
        public String getSelectedTrack(int type) {
            synchronized (mMetadataLock) {
            synchronized (mMetadataLock) {
                if (type == TvTrackInfo.TYPE_AUDIO) {
                if (type == TvTrackInfo.TYPE_AUDIO) {
+8 −2
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package android.media.tv;
package android.media.tv;


import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.annotation.SystemApi;
import android.app.Service;
import android.app.Service;
@@ -166,6 +167,7 @@ public abstract class TvInputService extends Service {
     * </p>
     * </p>
     * @param inputId The ID of the TV input associated with the session.
     * @param inputId The ID of the TV input associated with the session.
     */
     */
    @Nullable
    public abstract Session onCreateSession(String inputId);
    public abstract Session onCreateSession(String inputId);


    /**
    /**
@@ -176,6 +178,7 @@ public abstract class TvInputService extends Service {
     * @param hardwareInfo {@link TvInputHardwareInfo} object just added.
     * @param hardwareInfo {@link TvInputHardwareInfo} object just added.
     * @hide
     * @hide
     */
     */
    @Nullable
    @SystemApi
    @SystemApi
    public TvInputInfo onHardwareAdded(TvInputHardwareInfo hardwareInfo) {
    public TvInputInfo onHardwareAdded(TvInputHardwareInfo hardwareInfo) {
        return null;
        return null;
@@ -189,6 +192,7 @@ public abstract class TvInputService extends Service {
     * @param hardwareInfo {@link TvInputHardwareInfo} object just removed.
     * @param hardwareInfo {@link TvInputHardwareInfo} object just removed.
     * @hide
     * @hide
     */
     */
    @Nullable
    @SystemApi
    @SystemApi
    public String onHardwareRemoved(TvInputHardwareInfo hardwareInfo) {
    public String onHardwareRemoved(TvInputHardwareInfo hardwareInfo) {
        return null;
        return null;
@@ -202,6 +206,7 @@ public abstract class TvInputService extends Service {
     * @param deviceInfo {@link HdmiDeviceInfo} object just added.
     * @param deviceInfo {@link HdmiDeviceInfo} object just added.
     * @hide
     * @hide
     */
     */
    @Nullable
    @SystemApi
    @SystemApi
    public TvInputInfo onHdmiDeviceAdded(HdmiDeviceInfo deviceInfo) {
    public TvInputInfo onHdmiDeviceAdded(HdmiDeviceInfo deviceInfo) {
        return null;
        return null;
@@ -215,6 +220,7 @@ public abstract class TvInputService extends Service {
     * @param deviceInfo {@link HdmiDeviceInfo} object just removed.
     * @param deviceInfo {@link HdmiDeviceInfo} object just removed.
     * @hide
     * @hide
     */
     */
    @Nullable
    @SystemApi
    @SystemApi
    public String onHdmiDeviceRemoved(HdmiDeviceInfo deviceInfo) {
    public String onHdmiDeviceRemoved(HdmiDeviceInfo deviceInfo) {
        return null;
        return null;
@@ -707,7 +713,7 @@ public abstract class TvInputService extends Service {
         *            input session.
         *            input session.
         * @return {@code true} if the surface was set, {@code false} otherwise.
         * @return {@code true} if the surface was set, {@code false} otherwise.
         */
         */
        public abstract boolean onSetSurface(Surface surface);
        public abstract boolean onSetSurface(@Nullable Surface surface);


        /**
        /**
         * Called after any structural changes (format or size) have been made to the
         * Called after any structural changes (format or size) have been made to the
@@ -812,7 +818,7 @@ public abstract class TvInputService extends Service {
         * @return {@code true} if the track selection was successful, {@code false} otherwise.
         * @return {@code true} if the track selection was successful, {@code false} otherwise.
         * @see #notifyTrackSelected
         * @see #notifyTrackSelected
         */
         */
        public boolean onSelectTrack(int type, String trackId) {
        public boolean onSelectTrack(int type, @Nullable String trackId) {
            return false;
            return false;
        }
        }


+3 −2
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package android.media.tv;
package android.media.tv;


import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.SystemApi;
import android.content.Context;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Canvas;
@@ -174,7 +175,7 @@ public class TvView extends ViewGroup {
     * @param callback The callback to receive events. A value of {@code null} removes the existing
     * @param callback The callback to receive events. A value of {@code null} removes the existing
     *            callback.
     *            callback.
     */
     */
    public void setCallback(TvInputCallback callback) {
    public void setCallback(@Nullable TvInputCallback callback) {
        mCallback = callback;
        mCallback = callback;
    }
    }


@@ -473,7 +474,7 @@ public class TvView extends ViewGroup {
     * @param callback The callback to receive time shift position changes. A value of {@code null}
     * @param callback The callback to receive time shift position changes. A value of {@code null}
     *            removes the existing callback.
     *            removes the existing callback.
     */
     */
    public void setTimeShiftPositionCallback(TimeShiftPositionCallback callback) {
    public void setTimeShiftPositionCallback(@Nullable TimeShiftPositionCallback callback) {
        mTimeShiftPositionCallback = callback;
        mTimeShiftPositionCallback = callback;
        ensurePositionTracking();
        ensurePositionTracking();
    }
    }