TIAF cleanup: add nullability
Required when unhide APIs
Bug: 211841925
Test: mmm
Change-Id: I336e4dd135be6fb862ad25aa96ec330a0bb32062
diff --git a/media/java/android/media/tv/AitInfo.java b/media/java/android/media/tv/AitInfo.java
index 5f8487d..ff4c625 100644
--- a/media/java/android/media/tv/AitInfo.java
+++ b/media/java/android/media/tv/AitInfo.java
@@ -27,7 +27,7 @@
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);
diff --git a/media/java/android/media/tv/interactive/TvIAppInfo.java b/media/java/android/media/tv/interactive/TvIAppInfo.java
index de3a47e..6d5e561 100644
--- a/media/java/android/media/tv/interactive/TvIAppInfo.java
+++ b/media/java/android/media/tv/interactive/TvIAppInfo.java
@@ -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 @@
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 @@
}
@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 @@
* @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 @@
*
* @return TvIAppInfo containing information about this TV IApp service.
*/
+ @NonNull
public TvIAppInfo build() {
ComponentName componentName = new ComponentName(mResolveInfo.serviceInfo.packageName,
mResolveInfo.serviceInfo.name);
diff --git a/media/java/android/media/tv/interactive/TvIAppManager.java b/media/java/android/media/tv/interactive/TvIAppManager.java
index 9390d8d..e3ccaf3 100644
--- a/media/java/android/media/tv/interactive/TvIAppManager.java
+++ b/media/java/android/media/tv/interactive/TvIAppManager.java
@@ -337,7 +337,7 @@
*
* @param iAppServiceId The ID of the TV IApp service.
*/
- public void onIAppServiceAdded(String iAppServiceId) {
+ public void onIAppServiceAdded(@NonNull String iAppServiceId) {
}
/**
@@ -348,7 +348,7 @@
*
* @param iAppServiceId The ID of the TV IApp service.
*/
- public void onIAppServiceRemoved(String iAppServiceId) {
+ public void onIAppServiceRemoved(@NonNull String iAppServiceId) {
}
/**
@@ -359,7 +359,7 @@
*
* @param iAppServiceId The ID of the TV IApp service.
*/
- public void onIAppServiceUpdated(String iAppServiceId) {
+ public void onIAppServiceUpdated(@NonNull String iAppServiceId) {
}
/**
@@ -372,7 +372,7 @@
*
* @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 @@
* @hide
*/
public void onTvIAppServiceStateChanged(
- String iAppServiceId, int type, @TvIAppRteState int state) {
+ @NonNull String iAppServiceId, int type, @TvIAppRteState int state) {
}
}
@@ -485,6 +485,7 @@
* information.
* @hide
*/
+ @NonNull
public List<TvIAppInfo> getTvIAppServiceList() {
try {
return mService.getTvIAppServiceList(mUserId);
@@ -497,7 +498,7 @@
* 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 @@
* 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) {
diff --git a/media/java/android/media/tv/interactive/TvIAppService.java b/media/java/android/media/tv/interactive/TvIAppService.java
index 6475f90..b4be17f 100644
--- a/media/java/android/media/tv/interactive/TvIAppService.java
+++ b/media/java/android/media/tv/interactive/TvIAppService.java
@@ -244,7 +244,7 @@
*
* @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 @@
*
* @return a view attached to the media window
*/
+ @Nullable
public View onCreateMediaView() {
return null;
}
@@ -347,14 +348,14 @@
* 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 @@
* @hide
*/
@Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
+ public boolean onKeyDown(int keyCode, @NonNull KeyEvent event) {
return false;
}
@@ -370,7 +371,7 @@
* @hide
*/
@Override
- public boolean onKeyLongPress(int keyCode, KeyEvent event) {
+ public boolean onKeyLongPress(int keyCode, @NonNull KeyEvent event) {
return false;
}
@@ -378,7 +379,7 @@
* @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 @@
* @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;
}
diff --git a/media/java/android/media/tv/interactive/TvIAppView.java b/media/java/android/media/tv/interactive/TvIAppView.java
index efbe9e3..a062f6d 100644
--- a/media/java/android/media/tv/interactive/TvIAppView.java
+++ b/media/java/android/media/tv/interactive/TvIAppView.java
@@ -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 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 @@
/**
* 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");