Merge "TIF: Address API review comments" into nyc-dev

am: 9cd89a403e

* commit '9cd89a403e60f6be665a6068be76b805c8b83402':
  TIF: Address API review comments

(cherry picked from commit f6c9dc9594)
This commit is contained in:
Dongwon Kang
2016-03-01 22:55:19 +00:00
committed by Brian Carlstrom
parent 73d9f95ada
commit 176facba14
10 changed files with 47 additions and 37 deletions

View File

@@ -22969,7 +22969,7 @@ package android.media.tv {
}
public static final class TvInputInfo.Builder {
ctor public TvInputInfo.Builder(android.content.Context, java.lang.Class<?>);
ctor public TvInputInfo.Builder(android.content.Context, android.content.ComponentName);
method public android.media.tv.TvInputInfo build() throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public android.media.tv.TvInputInfo.Builder setCanRecord(boolean);
method public android.media.tv.TvInputInfo.Builder setTunerCount(int);
@@ -23037,7 +23037,7 @@ package android.media.tv {
ctor public TvInputService.RecordingSession(android.content.Context);
method public void notifyError(int);
method public void notifyRecordingStopped(android.net.Uri);
method public void notifyTuned();
method public void notifyTuned(android.net.Uri);
method public abstract void onRelease();
method public abstract void onStartRecording(android.net.Uri);
method public abstract void onStopRecording();
@@ -23096,7 +23096,7 @@ package android.media.tv {
method public void onDisconnected(java.lang.String);
method public void onError(int);
method public void onRecordingStopped(android.net.Uri);
method public void onTuned();
method public void onTuned(android.net.Uri);
}
public final class TvTrackInfo implements android.os.Parcelable {

View File

@@ -24656,7 +24656,7 @@ package android.media.tv {
}
public static final class TvInputInfo.Builder {
ctor public TvInputInfo.Builder(android.content.Context, java.lang.Class<?>);
ctor public TvInputInfo.Builder(android.content.Context, android.content.ComponentName);
method public android.media.tv.TvInputInfo build() throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public android.media.tv.TvInputInfo.Builder setCanRecord(boolean);
method public android.media.tv.TvInputInfo.Builder setHdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo);
@@ -24801,7 +24801,7 @@ package android.media.tv {
method public void notifyError(int);
method public void notifyRecordingStopped(android.net.Uri);
method public void notifySessionEvent(java.lang.String, android.os.Bundle);
method public void notifyTuned();
method public void notifyTuned(android.net.Uri);
method public void onAppPrivateCommand(java.lang.String, android.os.Bundle);
method public abstract void onRelease();
method public abstract void onStartRecording(android.net.Uri);
@@ -24869,7 +24869,7 @@ package android.media.tv {
method public void onError(int);
method public void onEvent(java.lang.String, java.lang.String, android.os.Bundle);
method public void onRecordingStopped(android.net.Uri);
method public void onTuned();
method public void onTuned(android.net.Uri);
}
public class TvStreamConfig implements android.os.Parcelable {

View File

@@ -22980,7 +22980,7 @@ package android.media.tv {
}
public static final class TvInputInfo.Builder {
ctor public TvInputInfo.Builder(android.content.Context, java.lang.Class<?>);
ctor public TvInputInfo.Builder(android.content.Context, android.content.ComponentName);
method public android.media.tv.TvInputInfo build() throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
method public android.media.tv.TvInputInfo.Builder setCanRecord(boolean);
method public android.media.tv.TvInputInfo.Builder setTunerCount(int);
@@ -23048,7 +23048,7 @@ package android.media.tv {
ctor public TvInputService.RecordingSession(android.content.Context);
method public void notifyError(int);
method public void notifyRecordingStopped(android.net.Uri);
method public void notifyTuned();
method public void notifyTuned(android.net.Uri);
method public abstract void onRelease();
method public abstract void onStartRecording(android.net.Uri);
method public abstract void onStopRecording();
@@ -23107,7 +23107,7 @@ package android.media.tv {
method public void onDisconnected(java.lang.String);
method public void onError(int);
method public void onRecordingStopped(android.net.Uri);
method public void onTuned();
method public void onTuned(android.net.Uri);
}
public final class TvTrackInfo implements android.os.Parcelable {

View File

@@ -45,7 +45,7 @@ oneway interface ITvInputClient {
void onTimeShiftCurrentPositionChanged(long timeMs, int seq);
// For the recording session
void onTuned(int seq);
void onTuned(int seq, in Uri channelUri);
void onRecordingStopped(in Uri recordedProgramUri, int seq);
void onError(int error, int seq);
}

View File

@@ -42,7 +42,7 @@ oneway interface ITvInputSessionCallback {
void onTimeShiftCurrentPositionChanged(long timeMs);
// For the recording session
void onTuned();
void onTuned(in Uri channelUri);
void onRecordingStopped(in Uri recordedProgramUri);
void onError(int error);
}

View File

@@ -677,11 +677,12 @@ public final class TvInputInfo implements Parcelable {
* Constructs a new builder for {@link TvInputInfo}.
*
* @param context A Context of the application package implementing this class.
* @param cls The component class that is to be used for the {@link TvInputService}.
* @param component The name of the application component to be used for the
* {@link TvInputService}.
*/
public Builder(Context context, Class<?> cls) {
public Builder(Context context, ComponentName component) {
mContext = context;
Intent intent = new Intent(TvInputService.SERVICE_INTERFACE).setClass(context, cls);
Intent intent = new Intent(TvInputService.SERVICE_INTERFACE).setComponent(component);
mResolveInfo = context.getPackageManager().resolveService(intent,
PackageManager.GET_SERVICES | PackageManager.GET_META_DATA);
}

View File

@@ -478,8 +478,10 @@ public final class TvInputManager {
/**
* This is called when the recording session has been tuned to the given channel and is
* ready to start recording.
*
* @param channelUri The URI of a channel.
*/
void onTuned(Session session) {
void onTuned(Session session, Uri channelUri) {
}
// For the recording session only
@@ -653,11 +655,11 @@ public final class TvInputManager {
}
// For the recording session only
void postTuned() {
void postTuned(final Uri channelUri) {
mHandler.post(new Runnable() {
@Override
public void run() {
mSessionCallback.onTuned(mSession);
mSessionCallback.onTuned(mSession, channelUri);
}
});
}
@@ -1013,14 +1015,14 @@ public final class TvInputManager {
}
@Override
public void onTuned(int seq) {
public void onTuned(int seq, Uri channelUri) {
synchronized (mSessionCallbackRecordMap) {
SessionCallbackRecord record = mSessionCallbackRecordMap.get(seq);
if (record == null) {
Log.e(TAG, "Callback not found for seq " + seq);
return;
}
record.postTuned();
record.postTuned(channelUri);
}
}

View File

@@ -1567,8 +1567,10 @@ public abstract class TvInputService extends Service {
* passed channel and call this method to indicate that it is now available for immediate
* recording. When {@link #onStartRecording(Uri)} is called, recording must start with
* minimal delay.
*
* @param channelUri The URI of a channel.
*/
public void notifyTuned() {
public void notifyTuned(Uri channelUri) {
executeOrPostRunnableOnMainThread(new Runnable() {
@MainThread
@Override
@@ -1576,7 +1578,7 @@ public abstract class TvInputService extends Service {
try {
if (DEBUG) Log.d(TAG, "notifyTuned");
if (mSessionCallback != null) {
mSessionCallback.onTuned();
mSessionCallback.onTuned(channelUri);
}
} catch (RemoteException e) {
Log.w(TAG, "error in notifyTuned", e);
@@ -1679,7 +1681,7 @@ public abstract class TvInputService extends Service {
* <p>The application may call this method before starting or after stopping recording, but
* not during recording.
*
* <p>The session must call {@link #notifyTuned()} if the tune request was fulfilled, or
* <p>The session must call {@link #notifyTuned(Uri)} if the tune request was fulfilled, or
* {@link #notifyError(int)} otherwise.
*
* @param channelUri The URI of a channel.
@@ -1708,8 +1710,8 @@ public abstract class TvInputService extends Service {
* Called when the application requests to start TV program recording. Recording must start
* immediately when this method is called.
*
* <p>The application may supply the URI for a TV program as a hint for filling in program
* specific data fields in the {@link android.media.tv.TvContract.RecordedPrograms} table.
* <p>The application may supply the URI for a TV program for filling in program specific
* data fields in the {@link android.media.tv.TvContract.RecordedPrograms} table.
* A non-null {@code programHint} implies the started recording should be of that specific
* program, whereas null {@code programHint} does not impose such a requirement and the
* recording can span across multiple TV programs. In either case, the application must call
@@ -1718,10 +1720,10 @@ public abstract class TvInputService extends Service {
* <p>The session must call {@link #notifyError(int)} if the start request cannot be
* fulfilled.
*
* @param programHint The URI for the TV program to record as a hint, built by
* @param programUri The URI for the TV program to record, built by
* {@link TvContract#buildProgramUri(long)}. Can be {@code null}.
*/
public abstract void onStartRecording(@Nullable Uri programHint);
public abstract void onStartRecording(@Nullable Uri programUri);
/**
* Called when the application requests to stop TV program recording. Recording must stop

View File

@@ -76,11 +76,12 @@ public class TvRecordingClient {
* during recording.
*
* <p>The recording session will respond by calling
* {@link RecordingCallback#onTuned()} if the tune request was fulfilled, or
* {@link RecordingCallback#onTuned(Uri)} if the tune request was fulfilled, or
* {@link RecordingCallback#onError(int)} otherwise.
*
* @param inputId The ID of the TV input for the given channel.
* @param channelUri The URI of a channel.
* @throws IllegalStateException If recording is already started.
*/
public void tune(String inputId, Uri channelUri) {
tune(inputId, channelUri, null);
@@ -102,6 +103,7 @@ public class TvRecordingClient {
* @param inputId The ID of the TV input for the given channel.
* @param channelUri The URI of a channel.
* @param params Extra parameters.
* @throws IllegalStateException If recording is already started.
* @hide
*/
@SystemApi
@@ -152,8 +154,8 @@ public class TvRecordingClient {
* immediately when this method is called. If the current recording session has not yet tuned to
* any channel, this method throws an exception.
*
* <p>The application may supply the URI for a TV program as a hint for filling in program
* specific data fields in the {@link android.media.tv.TvContract.RecordedPrograms} table.
* <p>The application may supply the URI for a TV program for filling in program specific data
* fields in the {@link android.media.tv.TvContract.RecordedPrograms} table.
* A non-null {@code programHint} implies the started recording should be of that specific
* program, whereas null {@code programHint} does not impose such a requirement and the
* recording can span across multiple TV programs. In either case, the application must call
@@ -162,15 +164,16 @@ public class TvRecordingClient {
* <p>The recording session will respond by calling {@link RecordingCallback#onError(int)} if
* the start request cannot be fulfilled.
*
* @param programHint The URI for the TV program to record as a hint, built by
* @param programUri The URI for the TV program to record, built by
* {@link TvContract#buildProgramUri(long)}. Can be {@code null}.
* @throws IllegalStateException If {@link #tune} request hasn't been handled yet.
*/
public void startRecording(@Nullable Uri programHint) {
public void startRecording(@Nullable Uri programUri) {
if (!mIsTuned) {
throw new IllegalStateException("startRecording failed - not yet tuned");
}
if (mSession != null) {
mSession.startRecording(programHint);
mSession.startRecording(programUri);
mIsRecordingStarted = true;
}
}
@@ -245,8 +248,10 @@ public class TvRecordingClient {
/**
* This is called when the recording session has been tuned to the given channel and is
* ready to start recording.
*
* @param channelUri The URI of a channel.
*/
public void onTuned() {
public void onTuned(Uri channelUri) {
}
/**
@@ -327,7 +332,7 @@ public class TvRecordingClient {
}
@Override
void onTuned(TvInputManager.Session session) {
void onTuned(TvInputManager.Session session, Uri channelUri) {
if (DEBUG) {
Log.d(TAG, "onTuned()");
}
@@ -336,7 +341,7 @@ public class TvRecordingClient {
return;
}
mIsTuned = true;
mCallback.onTuned();
mCallback.onTuned(channelUri);
}
@Override

View File

@@ -2512,7 +2512,7 @@ public final class TvInputManagerService extends SystemService {
// For the recording session only
@Override
public void onTuned() {
public void onTuned(Uri channelUri) {
synchronized (mLock) {
if (DEBUG) {
Slog.d(TAG, "onTuned()");
@@ -2521,7 +2521,7 @@ public final class TvInputManagerService extends SystemService {
return;
}
try {
mSessionState.client.onTuned(mSessionState.seq);
mSessionState.client.onTuned(mSessionState.seq, channelUri);
} catch (RemoteException e) {
Slog.e(TAG, "error in onTuned", e);
}