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

Commit 7771d4e1 authored by Dongwon Kang's avatar Dongwon Kang Committed by Android (Google) Code Review
Browse files

Merge "TIF: start using @Nullable annotation."

parents d8c3b151 4bf607b0
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.media.tv;

import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.content.ComponentName;
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
     *            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);
    }

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

package android.media.tv;

import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.graphics.Rect;
import android.media.MediaPlayer;
@@ -229,7 +230,7 @@ public final class TvInputManager {
         * @param session A {@link TvInputManager.Session} instance created. This can be
         *            {@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
         *            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.
     * @return the {@link TvInputInfo} for a given TV input. {@code null} if not found.
     */
    @Nullable
    public TvInputInfo getTvInputInfo(String inputId) {
        if (inputId == null) {
            throw new IllegalArgumentException("inputId cannot be null");
@@ -1501,7 +1503,7 @@ public final class TvInputManager {
         *            track of the given type will be unselected.
         * @see #getTracks
         */
        public void selectTrack(int type, String trackId) {
        public void selectTrack(int type, @Nullable String trackId) {
            synchronized (mMetadataLock) {
                if (type == TvTrackInfo.TYPE_AUDIO) {
                    if (trackId != null && !containsTrack(mAudioTracks, trackId)) {
@@ -1550,6 +1552,7 @@ public final class TvInputManager {
         *            {@link TvTrackInfo#TYPE_VIDEO} or {@link TvTrackInfo#TYPE_SUBTITLE}.
         * @return the list of tracks for the given type.
         */
        @Nullable
        public List<TvTrackInfo> getTracks(int type) {
            synchronized (mMetadataLock) {
                if (type == TvTrackInfo.TYPE_AUDIO) {
@@ -1579,6 +1582,7 @@ public final class TvInputManager {
         * @return the ID of the selected track.
         * @see #selectTrack
         */
        @Nullable
        public String getSelectedTrack(int type) {
            synchronized (mMetadataLock) {
                if (type == TvTrackInfo.TYPE_AUDIO) {
+8 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.media.tv;

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

    /**
@@ -176,6 +178,7 @@ public abstract class TvInputService extends Service {
     * @param hardwareInfo {@link TvInputHardwareInfo} object just added.
     * @hide
     */
    @Nullable
    @SystemApi
    public TvInputInfo onHardwareAdded(TvInputHardwareInfo hardwareInfo) {
        return null;
@@ -189,6 +192,7 @@ public abstract class TvInputService extends Service {
     * @param hardwareInfo {@link TvInputHardwareInfo} object just removed.
     * @hide
     */
    @Nullable
    @SystemApi
    public String onHardwareRemoved(TvInputHardwareInfo hardwareInfo) {
        return null;
@@ -202,6 +206,7 @@ public abstract class TvInputService extends Service {
     * @param deviceInfo {@link HdmiDeviceInfo} object just added.
     * @hide
     */
    @Nullable
    @SystemApi
    public TvInputInfo onHdmiDeviceAdded(HdmiDeviceInfo deviceInfo) {
        return null;
@@ -215,6 +220,7 @@ public abstract class TvInputService extends Service {
     * @param deviceInfo {@link HdmiDeviceInfo} object just removed.
     * @hide
     */
    @Nullable
    @SystemApi
    public String onHdmiDeviceRemoved(HdmiDeviceInfo deviceInfo) {
        return null;
@@ -707,7 +713,7 @@ public abstract class TvInputService extends Service {
         *            input session.
         * @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
@@ -812,7 +818,7 @@ public abstract class TvInputService extends Service {
         * @return {@code true} if the track selection was successful, {@code false} otherwise.
         * @see #notifyTrackSelected
         */
        public boolean onSelectTrack(int type, String trackId) {
        public boolean onSelectTrack(int type, @Nullable String trackId) {
            return false;
        }

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

package android.media.tv;

import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.content.Context;
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
     *            callback.
     */
    public void setCallback(TvInputCallback callback) {
    public void setCallback(@Nullable TvInputCallback 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}
     *            removes the existing callback.
     */
    public void setTimeShiftPositionCallback(TimeShiftPositionCallback callback) {
    public void setTimeShiftPositionCallback(@Nullable TimeShiftPositionCallback callback) {
        mTimeShiftPositionCallback = callback;
        ensurePositionTracking();
    }