Merge "API Review: Use intdef for TvMessageType" into udc-dev

This commit is contained in:
David Zhao
2023-03-09 17:29:20 +00:00
committed by Android (Google) Code Review
18 changed files with 51 additions and 45 deletions

View File

@@ -27343,8 +27343,9 @@ package android.media.tv {
field public static final int TIME_SHIFT_STATUS_UNKNOWN = 0; // 0x0
field public static final int TIME_SHIFT_STATUS_UNSUPPORTED = 1; // 0x1
field public static final String TV_MESSAGE_KEY_STREAM_ID = "android.media.tv.TvInputManager.stream_id";
field public static final String TV_MESSAGE_TYPE_CLOSED_CAPTION = "CC";
field public static final String TV_MESSAGE_TYPE_WATERMARK = "Watermark";
field public static final int TV_MESSAGE_TYPE_CLOSED_CAPTION = 2; // 0x2
field public static final int TV_MESSAGE_TYPE_OTHER = 1000; // 0x3e8
field public static final int TV_MESSAGE_TYPE_WATERMARK = 1; // 0x1
field public static final int VIDEO_UNAVAILABLE_REASON_AUDIO_ONLY = 4; // 0x4
field public static final int VIDEO_UNAVAILABLE_REASON_BUFFERING = 3; // 0x3
field public static final int VIDEO_UNAVAILABLE_REASON_CAS_BLACKOUT = 16; // 0x10
@@ -27435,7 +27436,7 @@ package android.media.tv {
method public void notifyTrackSelected(int, String);
method public void notifyTracksChanged(java.util.List<android.media.tv.TvTrackInfo>);
method public void notifyTuned(@NonNull android.net.Uri);
method public void notifyTvMessage(@NonNull String, @NonNull android.os.Bundle);
method public void notifyTvMessage(int, @NonNull android.os.Bundle);
method public void notifyVideoAvailable();
method public void notifyVideoUnavailable(int);
method public void onAdBufferReady(@NonNull android.media.tv.AdBuffer);
@@ -27457,7 +27458,7 @@ package android.media.tv {
method public void onSetInteractiveAppNotificationEnabled(boolean);
method public abstract void onSetStreamVolume(@FloatRange(from=0.0, to=1.0) float);
method public abstract boolean onSetSurface(@Nullable android.view.Surface);
method public void onSetTvMessageEnabled(@NonNull String, boolean);
method public void onSetTvMessageEnabled(int, boolean);
method public void onSurfaceChanged(int, int, int);
method public long onTimeShiftGetCurrentPosition();
method public long onTimeShiftGetStartPosition();
@@ -27600,7 +27601,7 @@ package android.media.tv {
method public void setOnUnhandledInputEventListener(android.media.tv.TvView.OnUnhandledInputEventListener);
method public void setStreamVolume(@FloatRange(from=0.0, to=1.0) float);
method public void setTimeShiftPositionCallback(@Nullable android.media.tv.TvView.TimeShiftPositionCallback);
method public void setTvMessageEnabled(@NonNull String, boolean);
method public void setTvMessageEnabled(int, boolean);
method public void setZOrderMediaOverlay(boolean);
method public void setZOrderOnTop(boolean);
method public void timeShiftPause();
@@ -27641,7 +27642,7 @@ package android.media.tv {
method public void onTrackSelected(String, int, String);
method public void onTracksChanged(String, java.util.List<android.media.tv.TvTrackInfo>);
method public void onTuned(@NonNull String, @NonNull android.net.Uri);
method public void onTvMessage(@NonNull String, @NonNull String, @NonNull android.os.Bundle);
method public void onTvMessage(@NonNull String, int, @NonNull android.os.Bundle);
method public void onVideoAvailable(String);
method public void onVideoSizeChanged(String, int, int);
method public void onVideoUnavailable(String, int);
@@ -27801,7 +27802,7 @@ package android.media.tv.interactive {
method public boolean onTrackballEvent(@NonNull android.view.MotionEvent);
method public void onTracksChanged(@NonNull java.util.List<android.media.tv.TvTrackInfo>);
method public void onTuned(@NonNull android.net.Uri);
method public void onTvMessage(@NonNull String, @NonNull android.os.Bundle);
method public void onTvMessage(int, @NonNull android.os.Bundle);
method public void onTvRecordingInfo(@Nullable android.media.tv.TvRecordingInfo);
method public void onTvRecordingInfoList(@NonNull java.util.List<android.media.tv.TvRecordingInfo>);
method public void onVideoAvailable();
@@ -27865,7 +27866,7 @@ package android.media.tv.interactive {
method public void notifyTimeShiftPlaybackParams(@NonNull android.media.PlaybackParams);
method public void notifyTimeShiftStartPositionChanged(@NonNull String, long);
method public void notifyTimeShiftStatusChanged(@NonNull String, int);
method public void notifyTvMessage(@NonNull String, @NonNull android.os.Bundle);
method public void notifyTvMessage(@NonNull int, @NonNull android.os.Bundle);
method public void onAttachedToWindow();
method public void onDetachedFromWindow();
method public void onLayout(boolean, int, int, int, int);

View File

@@ -1957,7 +1957,7 @@ package android.media.tv {
}
public class TvView extends android.view.ViewGroup {
method public void notifyTvMessage(@NonNull String, @NonNull android.os.Bundle);
method public void notifyTvMessage(int, @NonNull android.os.Bundle);
}
}

View File

@@ -55,7 +55,7 @@ oneway interface ITvInputClient {
void onCueingMessageAvailability(boolean available, int seq);
void onTimeShiftMode(int mode, int seq);
void onAvailableSpeeds(in float[] speeds, int seq);
void onTvMessage(in String type, in Bundle data, int seq);
void onTvMessage(int type, in Bundle data, int seq);
void onTuned(in Uri channelUri, int seq);
// For the recording session

View File

@@ -119,7 +119,7 @@ interface ITvInputManager {
void notifyAdBufferReady(in IBinder sessionToken, in AdBuffer buffer, int userId);
// For TV Message
void notifyTvMessage(in IBinder sessionToken, in String type, in Bundle data, int userId);
void notifyTvMessage(in IBinder sessionToken, int type, in Bundle data, int userId);
// For TV input hardware binding
List<TvInputHardwareInfo> getHardwareList();

View File

@@ -78,5 +78,5 @@ oneway interface ITvInputSession {
void notifyAdBufferReady(in AdBuffer buffer);
// For TV messages
void notifyTvMessage(in String type, in Bundle data);
void notifyTvMessage(int type, in Bundle data);
}

View File

@@ -66,5 +66,5 @@ oneway interface ITvInputSessionCallback {
void onAdBufferConsumed(in AdBuffer buffer);
// For messages sent from the TV input
void onTvMessage(in String type, in Bundle data);
void onTvMessage(int type, in Bundle data);
}

View File

@@ -267,7 +267,7 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
}
case DO_SET_TV_MESSAGE_ENABLED: {
SomeArgs args = (SomeArgs) msg.obj;
mTvInputSessionImpl.setTvMessageEnabled((String) args.arg1, (Boolean) args.arg2);
mTvInputSessionImpl.setTvMessageEnabled((Integer) args.arg1, (Boolean) args.arg2);
break;
}
case DO_REQUEST_AD: {
@@ -470,7 +470,7 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
}
@Override
public void notifyTvMessage(String type, Bundle data) {
public void notifyTvMessage(int type, Bundle data) {
mCaller.executeOrSendMessage(mCaller.obtainMessageOO(DO_NOTIFY_TV_MESSAGE, type, data));
}

View File

@@ -22,7 +22,6 @@ import android.annotation.IntRange;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.StringDef;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.TestApi;
@@ -134,14 +133,17 @@ public final class TvInputManager {
public @interface VideoUnavailableReason {}
/** Indicates that this TV message contains watermarking data */
public static final String TV_MESSAGE_TYPE_WATERMARK = "Watermark";
public static final int TV_MESSAGE_TYPE_WATERMARK = 1;
/** Indicates that this TV message contains Closed Captioning data */
public static final String TV_MESSAGE_TYPE_CLOSED_CAPTION = "CC";
public static final int TV_MESSAGE_TYPE_CLOSED_CAPTION = 2;
/** Indicates that this TV message contains other data */
public static final int TV_MESSAGE_TYPE_OTHER = 1000;
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@StringDef({TV_MESSAGE_TYPE_WATERMARK, TV_MESSAGE_TYPE_CLOSED_CAPTION})
@IntDef({TV_MESSAGE_TYPE_WATERMARK, TV_MESSAGE_TYPE_CLOSED_CAPTION, TV_MESSAGE_TYPE_OTHER})
public @interface TvMessageType {}
/**
@@ -802,7 +804,7 @@ public final class TvInputManager {
* @param type The type of message received, such as {@link #TV_MESSAGE_TYPE_WATERMARK}
* @param data The raw data of the message
*/
public void onTvMessage(Session session, @TvInputManager.TvMessageType String type,
public void onTvMessage(Session session, @TvInputManager.TvMessageType int type,
Bundle data) {
}
@@ -1081,7 +1083,7 @@ public final class TvInputManager {
});
}
void postTvMessage(String type, Bundle data) {
void postTvMessage(int type, Bundle data) {
mHandler.post(new Runnable() {
@Override
public void run() {
@@ -1620,7 +1622,7 @@ public final class TvInputManager {
}
@Override
public void onTvMessage(String type, Bundle data, int seq) {
public void onTvMessage(int type, Bundle data, int seq) {
synchronized (mSessionCallbackRecordMap) {
SessionCallbackRecord record = mSessionCallbackRecordMap.get(seq);
if (record == null) {
@@ -3230,7 +3232,7 @@ public final class TvInputManager {
/**
* Sends TV messages to the service for testing purposes
*/
public void notifyTvMessage(@NonNull @TvMessageType String type, @NonNull Bundle data) {
public void notifyTvMessage(@NonNull @TvMessageType int type, @NonNull Bundle data) {
try {
mService.notifyTvMessage(mToken, type, data, mUserId);
} catch (RemoteException e) {

View File

@@ -1032,7 +1032,7 @@ public abstract class TvInputService extends Service {
* {@link TvInputManager#TV_MESSAGE_TYPE_WATERMARK}
* @param data The data sent with the message.
*/
public void notifyTvMessage(@NonNull @TvInputManager.TvMessageType String type,
public void notifyTvMessage(@TvInputManager.TvMessageType int type,
@NonNull Bundle data) {
executeOrPostRunnableOnMainThread(new Runnable() {
@MainThread
@@ -1486,11 +1486,12 @@ public abstract class TvInputService extends Service {
/**
* Called when the application enables or disables the detection of the specified message
* type.
* @param type The {@link TvInputManager.TvMessageType} of message that was sent.
* @param type The type of message received, such as
* {@link TvInputManager#TV_MESSAGE_TYPE_WATERMARK}
* @param enabled {@code true} if TV message detection is enabled,
* {@code false} otherwise.
*/
public void onSetTvMessageEnabled(@NonNull @TvInputManager.TvMessageType String type,
public void onSetTvMessageEnabled(@TvInputManager.TvMessageType int type,
boolean enabled) {
}
@@ -1856,9 +1857,9 @@ public abstract class TvInputService extends Service {
}
/**
* Calls {@link #onSetTvMessageEnabled(String, boolean)}.
* Calls {@link #onSetTvMessageEnabled(int, boolean)}.
*/
void setTvMessageEnabled(String type, boolean enabled) {
void setTvMessageEnabled(int type, boolean enabled) {
onSetTvMessageEnabled(type, enabled);
}

View File

@@ -648,7 +648,7 @@ public class TvView extends ViewGroup {
* @hide
*/
@TestApi
public void notifyTvMessage(@TvInputManager.TvMessageType @NonNull String type,
public void notifyTvMessage(@TvInputManager.TvMessageType int type,
@NonNull Bundle data) {
if (mSession != null) {
mSession.notifyTvMessage(type, data);
@@ -738,11 +738,12 @@ public class TvView extends ViewGroup {
/**
* Enables or disables TV message detection in the stream of the bound TV input.
*
* @param type The type of {@link android.media.tv.TvInputManager.TvMessageType}
* @param type The type of message received, such as
* {@link TvInputManager#TV_MESSAGE_TYPE_WATERMARK}
* @param enabled {@code true} if you want to enable TV message detection
* {@code false} otherwise.
*/
public void setTvMessageEnabled(@NonNull @TvInputManager.TvMessageType String type,
public void setTvMessageEnabled(@TvInputManager.TvMessageType int type,
boolean enabled) {
}
@@ -1251,11 +1252,12 @@ public class TvView extends ViewGroup {
* This is called when a new TV Message has been received.
*
* @param inputId The ID of the TV input bound to this view.
* @param type The type of {@link android.media.tv.TvInputManager.TvMessageType}
* @param type The type of message received, such as
* {@link TvInputManager#TV_MESSAGE_TYPE_WATERMARK}
* @param data The raw data of the message
*/
public void onTvMessage(@NonNull String inputId,
@NonNull @TvInputManager.TvMessageType String type, @NonNull Bundle data) {
@TvInputManager.TvMessageType int type, @NonNull Bundle data) {
}
}
@@ -1670,7 +1672,7 @@ public class TvView extends ViewGroup {
}
@Override
public void onTvMessage(Session session, String type, Bundle data) {
public void onTvMessage(Session session, int type, Bundle data) {
if (DEBUG) {
Log.d(TAG, "onTvMessage(type=" + type + ", data=" + data + ")");
}

View File

@@ -94,7 +94,7 @@ interface ITvInteractiveAppManager {
void notifyRecordingStarted(in IBinder sessionToken, in String recordingId, String requestId,
int userId);
void notifyRecordingStopped(in IBinder sessionToken, in String recordingId, int userId);
void notifyTvMessage(in IBinder sessionToken, in String type, in Bundle data, int userId);
void notifyTvMessage(in IBinder sessionToken, in int type, in Bundle data, int userId);
void setSurface(in IBinder sessionToken, in Surface surface, int userId);
void dispatchSurfaceChanged(in IBinder sessionToken, int format, int width, int height,
int userId);

View File

@@ -72,7 +72,7 @@ oneway interface ITvInteractiveAppSession {
void notifySignalStrength(int strength);
void notifyRecordingStarted(in String recordingId, in String requestId);
void notifyRecordingStopped(in String recordingId);
void notifyTvMessage(in String type, in Bundle data);
void notifyTvMessage(int type, in Bundle data);
void setSurface(in Surface surface);
void dispatchSurfaceChanged(int format, int width, int height);
void notifyBroadcastInfoResponse(in BroadcastInfoResponse response);

View File

@@ -243,7 +243,7 @@ public class ITvInteractiveAppSessionWrapper
}
case DO_NOTIFY_TV_MESSAGE: {
SomeArgs args = (SomeArgs) msg.obj;
mSessionImpl.notifyTvMessage((String) args.arg1, (Bundle) args.arg2);
mSessionImpl.notifyTvMessage((Integer) args.arg1, (Bundle) args.arg2);
args.recycle();
break;
}
@@ -520,7 +520,7 @@ public class ITvInteractiveAppSessionWrapper
}
@Override
public void notifyTvMessage(String type, Bundle data) {
public void notifyTvMessage(int type, Bundle data) {
mCaller.executeOrSendMessage(
mCaller.obtainMessageOO(DO_NOTIFY_TV_MESSAGE, type, data));
}

View File

@@ -1751,7 +1751,7 @@ public final class TvInteractiveAppManager {
/**
* Notifies Interactive APP session when a new TV message is received.
*/
public void notifyTvMessage(String type, Bundle data) {
public void notifyTvMessage(int type, Bundle data) {
if (mToken == null) {
Log.w(TAG, "The session has been already released");
return;

View File

@@ -920,7 +920,7 @@ public abstract class TvInteractiveAppService extends Service {
* {@link TvInputManager#TV_MESSAGE_TYPE_WATERMARK}
* @param data The raw data of the message
*/
public void onTvMessage(@NonNull @TvInputManager.TvMessageType String type,
public void onTvMessage(@TvInputManager.TvMessageType int type,
@NonNull Bundle data) {
}
@@ -1765,7 +1765,7 @@ public abstract class TvInteractiveAppService extends Service {
onAdResponse(response);
}
void notifyTvMessage(String type, Bundle data) {
void notifyTvMessage(int type, Bundle data) {
if (DEBUG) {
Log.d(TAG, "notifyTvMessage (type=" + type + ", data= " + data + ")");
}

View File

@@ -946,7 +946,7 @@ public class TvInteractiveAppView extends ViewGroup {
* {@link TvInputManager#TV_MESSAGE_TYPE_WATERMARK}
* @param data The raw data of the message
*/
public void notifyTvMessage(@NonNull @TvInputManager.TvMessageType String type,
public void notifyTvMessage(@NonNull @TvInputManager.TvMessageType int type,
@NonNull Bundle data) {
if (DEBUG) {
Log.d(TAG, "notifyTvMessage type=" + type

View File

@@ -2125,7 +2125,7 @@ public final class TvInputManagerService extends SystemService {
}
@Override
public void notifyTvMessage(IBinder sessionToken, String type, Bundle data, int userId) {
public void notifyTvMessage(IBinder sessionToken, int type, Bundle data, int userId) {
final int callingUid = Binder.getCallingUid();
final int resolvedUserId = resolveCallingUserId(Binder.getCallingPid(), callingUid,
userId, "timeShiftEnablePositionTracking");
@@ -3765,7 +3765,7 @@ public final class TvInputManagerService extends SystemService {
}
@Override
public void onTvMessage(String type, Bundle data) {
public void onTvMessage(int type, Bundle data) {
synchronized (mLock) {
if (DEBUG) {
Slog.d(TAG, "onTvMessage(type=" + type + ", data=" + data + ")");

View File

@@ -1117,7 +1117,7 @@ public class TvInteractiveAppManagerService extends SystemService {
}
@Override
public void notifyTvMessage(IBinder sessionToken, String type, Bundle data, int userId) {
public void notifyTvMessage(IBinder sessionToken, int type, Bundle data, int userId) {
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
final int resolvedUserId = resolveCallingUserId(callingPid, callingUid, userId,