Merge "TIF: Separate service connection errors from recording errors" into nyc-dev

This commit is contained in:
Jae Seo
2016-02-12 00:05:00 +00:00
committed by Android (Google) Code Review
6 changed files with 54 additions and 38 deletions

View File

@@ -22950,10 +22950,8 @@ package android.media.tv {
field public static final int INPUT_STATE_CONNECTED_STANDBY = 1; // 0x1
field public static final int INPUT_STATE_DISCONNECTED = 2; // 0x2
field public static final java.lang.String META_DATA_CONTENT_RATING_SYSTEMS = "android.media.tv.metadata.CONTENT_RATING_SYSTEMS";
field public static final int RECORDING_ERROR_CONNECTION_FAILED = 1; // 0x1
field public static final int RECORDING_ERROR_DISCONNECTED = 2; // 0x2
field public static final int RECORDING_ERROR_INSUFFICIENT_SPACE = 3; // 0x3
field public static final int RECORDING_ERROR_RESOURCE_BUSY = 4; // 0x4
field public static final int RECORDING_ERROR_INSUFFICIENT_SPACE = 1; // 0x1
field public static final int RECORDING_ERROR_RESOURCE_BUSY = 2; // 0x2
field public static final int RECORDING_ERROR_UNKNOWN = 0; // 0x0
field public static final long TIME_SHIFT_INVALID_TIME = -9223372036854775808L; // 0x8000000000000000L
field public static final int TIME_SHIFT_STATUS_AVAILABLE = 3; // 0x3
@@ -23053,6 +23051,8 @@ package android.media.tv {
public static abstract class TvRecordingClient.RecordingCallback {
ctor public TvRecordingClient.RecordingCallback();
method public void onConnectionFailed(java.lang.String);
method public void onDisconnected(java.lang.String);
method public void onError(int);
method public void onRecordingStopped(android.net.Uri);
method public void onTuned();

View File

@@ -24649,10 +24649,8 @@ package android.media.tv {
field public static final int INPUT_STATE_CONNECTED_STANDBY = 1; // 0x1
field public static final int INPUT_STATE_DISCONNECTED = 2; // 0x2
field public static final java.lang.String META_DATA_CONTENT_RATING_SYSTEMS = "android.media.tv.metadata.CONTENT_RATING_SYSTEMS";
field public static final int RECORDING_ERROR_CONNECTION_FAILED = 1; // 0x1
field public static final int RECORDING_ERROR_DISCONNECTED = 2; // 0x2
field public static final int RECORDING_ERROR_INSUFFICIENT_SPACE = 3; // 0x3
field public static final int RECORDING_ERROR_RESOURCE_BUSY = 4; // 0x4
field public static final int RECORDING_ERROR_INSUFFICIENT_SPACE = 1; // 0x1
field public static final int RECORDING_ERROR_RESOURCE_BUSY = 2; // 0x2
field public static final int RECORDING_ERROR_UNKNOWN = 0; // 0x0
field public static final long TIME_SHIFT_INVALID_TIME = -9223372036854775808L; // 0x8000000000000000L
field public static final int TIME_SHIFT_STATUS_AVAILABLE = 3; // 0x3
@@ -24811,6 +24809,8 @@ package android.media.tv {
public static abstract class TvRecordingClient.RecordingCallback {
ctor public TvRecordingClient.RecordingCallback();
method public void onConnectionFailed(java.lang.String);
method public void onDisconnected(java.lang.String);
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);

View File

@@ -22959,10 +22959,8 @@ package android.media.tv {
field public static final int INPUT_STATE_CONNECTED_STANDBY = 1; // 0x1
field public static final int INPUT_STATE_DISCONNECTED = 2; // 0x2
field public static final java.lang.String META_DATA_CONTENT_RATING_SYSTEMS = "android.media.tv.metadata.CONTENT_RATING_SYSTEMS";
field public static final int RECORDING_ERROR_CONNECTION_FAILED = 1; // 0x1
field public static final int RECORDING_ERROR_DISCONNECTED = 2; // 0x2
field public static final int RECORDING_ERROR_INSUFFICIENT_SPACE = 3; // 0x3
field public static final int RECORDING_ERROR_RESOURCE_BUSY = 4; // 0x4
field public static final int RECORDING_ERROR_INSUFFICIENT_SPACE = 1; // 0x1
field public static final int RECORDING_ERROR_RESOURCE_BUSY = 2; // 0x2
field public static final int RECORDING_ERROR_UNKNOWN = 0; // 0x0
field public static final long TIME_SHIFT_INVALID_TIME = -9223372036854775808L; // 0x8000000000000000L
field public static final int TIME_SHIFT_STATUS_AVAILABLE = 3; // 0x3
@@ -23062,6 +23060,8 @@ package android.media.tv {
public static abstract class TvRecordingClient.RecordingCallback {
ctor public TvRecordingClient.RecordingCallback();
method public void onConnectionFailed(java.lang.String);
method public void onDisconnected(java.lang.String);
method public void onError(int);
method public void onRecordingStopped(android.net.Uri);
method public void onTuned();

View File

@@ -156,36 +156,23 @@ public final class TvInputManager {
*/
public static final int RECORDING_ERROR_UNKNOWN = 0;
/**
* Error for {@link TvRecordingClient.RecordingCallback#onError(int)}: The recording client has
* failed to establish a connection to a recording session.
*/
public static final int RECORDING_ERROR_CONNECTION_FAILED = 1;
/**
* Error for {@link TvRecordingClient.RecordingCallback#onError(int)}: The recording client has
* been disconnected from the current recording session.
*/
public static final int RECORDING_ERROR_DISCONNECTED = 2;
/**
* Error for {@link TvInputService.RecordingSession#notifyError(int)} and
* {@link TvRecordingClient.RecordingCallback#onError(int)}: Recording cannot proceed due to
* insufficient storage space.
*/
public static final int RECORDING_ERROR_INSUFFICIENT_SPACE = 3;
public static final int RECORDING_ERROR_INSUFFICIENT_SPACE = 1;
/**
* Error for {@link TvInputService.RecordingSession#notifyError(int)} and
* {@link TvRecordingClient.RecordingCallback#onError(int)}: Recording cannot proceed because
* a required recording resource was not able to be allocated.
*/
public static final int RECORDING_ERROR_RESOURCE_BUSY = 4;
public static final int RECORDING_ERROR_RESOURCE_BUSY = 2;
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef({RECORDING_ERROR_UNKNOWN, RECORDING_ERROR_CONNECTION_FAILED,
RECORDING_ERROR_DISCONNECTED, RECORDING_ERROR_INSUFFICIENT_SPACE,
@IntDef({RECORDING_ERROR_UNKNOWN, RECORDING_ERROR_INSUFFICIENT_SPACE,
RECORDING_ERROR_RESOURCE_BUSY})
public @interface RecordingError {}

View File

@@ -1584,6 +1584,10 @@ public abstract class TvInputService extends Service {
* new data entry in the {@link TvContract.RecordedPrograms} table that describes the newly
* recorded program.
*
* <p>The recording session must call this method in response to {@link #onStopRecording()}.
* The session may call it even before receiving a call to {@link #onStopRecording()} if a
* partially recorded program is available when there is an error.
*
* @param recordedProgramUri The URI of the newly recorded program.
*/
public void notifyRecordingStopped(final Uri recordedProgramUri) {
@@ -1604,8 +1608,14 @@ public abstract class TvInputService extends Service {
}
/**
* Informs the application that there is an error. It may be called at any time after this
* recording session is created until {@link #onRelease()} is called.
* Informs the application that there is an error and this recording session is no longer
* able to start or continue recording. It may be called at any time after the recording
* session is created until {@link #onRelease()} is called.
*
* <p>The application may release the current session upon receiving the error code through
* {@link TvRecordingClient.RecordingCallback#onError(int)}. The session may call
* {@link #notifyRecordingStopped(Uri)} if a partially recorded but still playable program
* is available, before calling this method.
*
* @param error The error code. Should be one of the followings.
* <ul>

View File

@@ -68,7 +68,7 @@ public class TvRecordingClient {
/**
* Tunes to a given channel for TV program recording. The first tune request will create a new
* recording session for the corresponding TV input and establish the connection between the
* recording session for the corresponding TV input and establish a connection between the
* application and the session. If recording has already started in the current recording
* session, this method throws an exception.
*
@@ -88,7 +88,7 @@ public class TvRecordingClient {
/**
* Tunes to a given channel for TV program recording. The first tune request will create a new
* recording session for the corresponding TV input and establish the connection between the
* recording session for the corresponding TV input and establish a connection between the
* application and the session. If recording has already started in the current recording
* session, this method throws an exception.
*
@@ -225,6 +225,23 @@ public class TvRecordingClient {
* {@link android.media.tv.TvInputService.RecordingSession}
*/
public abstract static class RecordingCallback {
/**
* This is called when an error occurred while establishing a connection to the recording
* session for the corresponding TV input.
*
* @param inputId The ID of the TV input bound to the current TvRecordingClient.
*/
public void onConnectionFailed(String inputId) {
}
/**
* This is called when the connection to the current recording session is lost.
*
* @param inputId The ID of the TV input bound to the current TvRecordingClient.
*/
public void onDisconnected(String inputId) {
}
/**
* This is called when the recording session has been tuned to the given channel and is
* ready to start recording.
@@ -249,8 +266,6 @@ public class TvRecordingClient {
* @param error The error code. Should be one of the followings.
* <ul>
* <li>{@link TvInputManager#RECORDING_ERROR_UNKNOWN}
* <li>{@link TvInputManager#RECORDING_ERROR_CONNECTION_FAILED}
* <li>{@link TvInputManager#RECORDING_ERROR_DISCONNECTED}
* <li>{@link TvInputManager#RECORDING_ERROR_INSUFFICIENT_SPACE}
* <li>{@link TvInputManager#RECORDING_ERROR_RESOURCE_BUSY}
* </ul>
@@ -305,7 +320,9 @@ public class TvRecordingClient {
mSession.tune(mChannelUri, mConnectionParams);
} else {
mSessionCallback = null;
mCallback.onError(TvInputManager.RECORDING_ERROR_CONNECTION_FAILED);
if (mCallback != null) {
mCallback.onConnectionFailed(mInputId);
}
}
}
@@ -331,11 +348,13 @@ public class TvRecordingClient {
Log.w(TAG, "onSessionReleased - session not created");
return;
}
mSessionCallback = null;
mSession = null;
mIsTuned = false;
mIsRecordingStarted = false;
mCallback.onError(TvInputManager.RECORDING_ERROR_DISCONNECTED);
mSessionCallback = null;
mSession = null;
if (mCallback != null) {
mCallback.onDisconnected(mInputId);
}
}
@Override