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

Commit fd45899a authored by Shubang Lu's avatar Shubang Lu Committed by Android (Google) Code Review
Browse files

Merge "TIAF cleanup: add nullability"

parents 00b850f4 f3fbc88d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ import android.os.Parcelable;
public final class AitInfo implements Parcelable {
    static final String TAG = "AitInfo";

    public static final Creator<AitInfo> CREATOR = new Creator<AitInfo>() {
    public static final @NonNull Creator<AitInfo> CREATOR = new Creator<AitInfo>() {
        @Override
        public AitInfo createFromParcel(Parcel in) {
            return new AitInfo(in);
+7 −4
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.media.tv.interactive;

import android.annotation.NonNull;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -55,13 +56,13 @@ public final class TvIAppInfo implements Parcelable {
        mTypes = types;
    }

    protected TvIAppInfo(Parcel in) {
    private TvIAppInfo(@NonNull Parcel in) {
        mService = ResolveInfo.CREATOR.createFromParcel(in);
        mId = in.readString();
        in.readStringList(mTypes);
    }

    public static final Creator<TvIAppInfo> CREATOR = new Creator<TvIAppInfo>() {
    public static final @NonNull Creator<TvIAppInfo> CREATOR = new Creator<TvIAppInfo>() {
        @Override
        public TvIAppInfo createFromParcel(Parcel in) {
            return new TvIAppInfo(in);
@@ -79,12 +80,13 @@ public final class TvIAppInfo implements Parcelable {
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        mService.writeToParcel(dest, flags);
        dest.writeString(mId);
        dest.writeStringList(mTypes);
    }

    @NonNull
    public String getId() {
        return mId;
    }
@@ -120,7 +122,7 @@ public final class TvIAppInfo implements Parcelable {
         * @param component The name of the application component to be used for the
         *                  {@link TvIAppService}.
         */
        public Builder(Context context, ComponentName component) {
        public Builder(@NonNull Context context, @NonNull ComponentName component) {
            if (context == null) {
                throw new IllegalArgumentException("context cannot be null.");
            }
@@ -140,6 +142,7 @@ public final class TvIAppInfo implements Parcelable {
         *
         * @return TvIAppInfo containing information about this TV IApp service.
         */
        @NonNull
        public TvIAppInfo build() {
            ComponentName componentName = new ComponentName(mResolveInfo.serviceInfo.packageName,
                    mResolveInfo.serviceInfo.name);
+8 −7
Original line number Diff line number Diff line
@@ -337,7 +337,7 @@ public final class TvIAppManager {
         *
         * @param iAppServiceId The ID of the TV IApp service.
         */
        public void onIAppServiceAdded(String iAppServiceId) {
        public void onIAppServiceAdded(@NonNull String iAppServiceId) {
        }

        /**
@@ -348,7 +348,7 @@ public final class TvIAppManager {
         *
         * @param iAppServiceId The ID of the TV IApp service.
         */
        public void onIAppServiceRemoved(String iAppServiceId) {
        public void onIAppServiceRemoved(@NonNull String iAppServiceId) {
        }

        /**
@@ -359,7 +359,7 @@ public final class TvIAppManager {
         *
         * @param iAppServiceId The ID of the TV IApp service.
         */
        public void onIAppServiceUpdated(String iAppServiceId) {
        public void onIAppServiceUpdated(@NonNull String iAppServiceId) {
        }

        /**
@@ -372,7 +372,7 @@ public final class TvIAppManager {
         *
         * @param iAppInfo The <code>TvIAppInfo</code> object that contains new information.
         */
        public void onTvIAppInfoUpdated(TvIAppInfo iAppInfo) {
        public void onTvIAppInfoUpdated(@NonNull TvIAppInfo iAppInfo) {
        }


@@ -381,7 +381,7 @@ public final class TvIAppManager {
         * @hide
         */
        public void onTvIAppServiceStateChanged(
                String iAppServiceId, int type, @TvIAppRteState int state) {
                @NonNull String iAppServiceId, int type, @TvIAppRteState int state) {
        }
    }

@@ -485,6 +485,7 @@ public final class TvIAppManager {
     *         information.
     * @hide
     */
    @NonNull
    public List<TvIAppInfo> getTvIAppServiceList() {
        try {
            return mService.getTvIAppServiceList(mUserId);
@@ -497,7 +498,7 @@ public final class TvIAppManager {
     * Prepares TV IApp service for the given type.
     * @hide
     */
    public void prepare(String tvIAppServiceId, int type) {
    public void prepare(@NonNull String tvIAppServiceId, int type) {
        try {
            mService.prepare(tvIAppServiceId, type, mUserId);
        } catch (RemoteException e) {
@@ -509,7 +510,7 @@ public final class TvIAppManager {
     * Notifies app link info.
     * @hide
     */
    public void notifyAppLinkInfo(String tvIAppServiceId, Bundle appLinkInfo) {
    public void notifyAppLinkInfo(@NonNull String tvIAppServiceId, @NonNull Bundle appLinkInfo) {
        try {
            mService.notifyAppLinkInfo(tvIAppServiceId, appLinkInfo, mUserId);
        } catch (RemoteException e) {
+11 −10
Original line number Diff line number Diff line
@@ -244,7 +244,7 @@ public abstract class TvIAppService extends Service {
         *
         * @param context The context of the application
         */
        public Session(Context context) {
        public Session(@NonNull Context context) {
            mContext = context;
            mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
            mHandler = new Handler(context.getMainLooper());
@@ -332,6 +332,7 @@ public abstract class TvIAppService extends Service {
         *
         * @return a view attached to the media window
         */
        @Nullable
        public View onCreateMediaView() {
            return null;
        }
@@ -347,14 +348,14 @@ public abstract class TvIAppService extends Service {
         * Called when the corresponding TV input tuned to a channel.
         * @hide
         */
        public void onTuned(Uri channelUri) {
        public void onTuned(@NonNull Uri channelUri) {
        }

        /**
         * Called when a broadcast info response is received.
         * @hide
         */
        public void onBroadcastInfoResponse(BroadcastInfoResponse response) {
        public void onBroadcastInfoResponse(@NonNull BroadcastInfoResponse response) {
        }

        /**
@@ -362,7 +363,7 @@ public abstract class TvIAppService extends Service {
         * @hide
         */
        @Override
        public boolean onKeyDown(int keyCode, KeyEvent event) {
        public boolean onKeyDown(int keyCode, @NonNull KeyEvent event) {
            return false;
        }

@@ -370,7 +371,7 @@ public abstract class TvIAppService extends Service {
         * @hide
         */
        @Override
        public boolean onKeyLongPress(int keyCode, KeyEvent event) {
        public boolean onKeyLongPress(int keyCode, @NonNull KeyEvent event) {
            return false;
        }

@@ -378,7 +379,7 @@ public abstract class TvIAppService extends Service {
         * @hide
         */
        @Override
        public boolean onKeyMultiple(int keyCode, int count, KeyEvent event) {
        public boolean onKeyMultiple(int keyCode, int count, @NonNull KeyEvent event) {
            return false;
        }

@@ -386,28 +387,28 @@ public abstract class TvIAppService extends Service {
         * @hide
         */
        @Override
        public boolean onKeyUp(int keyCode, KeyEvent event) {
        public boolean onKeyUp(int keyCode, @NonNull KeyEvent event) {
            return false;
        }

        /**
         * @hide
         */
        public boolean onTouchEvent(MotionEvent event) {
        public boolean onTouchEvent(@NonNull MotionEvent event) {
            return false;
        }

        /**
         * @hide
         */
        public boolean onTrackballEvent(MotionEvent event) {
        public boolean onTrackballEvent(@NonNull MotionEvent event) {
            return false;
        }

        /**
         * @hide
         */
        public boolean onGenericMotionEvent(MotionEvent event) {
        public boolean onGenericMotionEvent(@NonNull MotionEvent event) {
            return false;
        }

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

package android.media.tv.interactive;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.content.res.Resources;
@@ -104,11 +105,11 @@ public class TvIAppView extends ViewGroup {
        }
    };

    public TvIAppView(Context context) {
    public TvIAppView(@NonNull Context context) {
        this(context, null, 0);
    }

    public TvIAppView(Context context, AttributeSet attrs, int defStyleAttr) {
    public TvIAppView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, /* attrs = */null, /* defStyleAttr = */0);
        int sourceResId = Resources.getAttributeSetSourceResId(attrs);
        if (sourceResId != Resources.ID_NULL) {
@@ -266,7 +267,7 @@ public class TvIAppView extends ViewGroup {
    /**
     * Prepares the interactive application.
     */
    public void prepareIApp(String iAppServiceId, int type) {
    public void prepareIApp(@NonNull String iAppServiceId, int type) {
        // TODO: document and handle the cases that this method is called multiple times.
        if (DEBUG) {
            Log.d(TAG, "prepareIApp");