Merge "TIF: Change invalid error code to RECORDING_ERROR_UNKNOWN" into nyc-dev
This commit is contained in:
@@ -188,6 +188,9 @@ public final class TvInputManager {
|
|||||||
RECORDING_ERROR_RESOURCE_BUSY})
|
RECORDING_ERROR_RESOURCE_BUSY})
|
||||||
public @interface RecordingError {}
|
public @interface RecordingError {}
|
||||||
|
|
||||||
|
static final int RECORDING_ERROR_START = 0;
|
||||||
|
static final int RECORDING_ERROR_END = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error for {@link TvInputService.RecordingSession#notifyError(int)} and
|
* Error for {@link TvInputService.RecordingSession#notifyError(int)} and
|
||||||
* {@link TvRecordingClient.RecordingCallback#onError(int)}: The requested operation cannot be
|
* {@link TvRecordingClient.RecordingCallback#onError(int)}: The requested operation cannot be
|
||||||
@@ -195,7 +198,7 @@ public final class TvInputManager {
|
|||||||
* for the problem is defined on the higher version than application's
|
* for the problem is defined on the higher version than application's
|
||||||
* <code>android:targetSdkVersion</code>.
|
* <code>android:targetSdkVersion</code>.
|
||||||
*/
|
*/
|
||||||
public static final int RECORDING_ERROR_UNKNOWN = 0;
|
public static final int RECORDING_ERROR_UNKNOWN = RECORDING_ERROR_START;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error for {@link TvInputService.RecordingSession#notifyError(int)} and
|
* Error for {@link TvInputService.RecordingSession#notifyError(int)} and
|
||||||
@@ -209,7 +212,7 @@ public final class TvInputManager {
|
|||||||
* {@link TvRecordingClient.RecordingCallback#onError(int)}: Recording cannot proceed because
|
* {@link TvRecordingClient.RecordingCallback#onError(int)}: Recording cannot proceed because
|
||||||
* a required recording resource was not able to be allocated.
|
* a required recording resource was not able to be allocated.
|
||||||
*/
|
*/
|
||||||
public static final int RECORDING_ERROR_RESOURCE_BUSY = 2;
|
public static final int RECORDING_ERROR_RESOURCE_BUSY = RECORDING_ERROR_END;
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
|
|||||||
@@ -1613,7 +1613,14 @@ public abstract class TvInputService extends Service {
|
|||||||
* <li>{@link TvInputManager#RECORDING_ERROR_RESOURCE_BUSY}
|
* <li>{@link TvInputManager#RECORDING_ERROR_RESOURCE_BUSY}
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
public void notifyError(@TvInputManager.RecordingError final int error) {
|
public void notifyError(@TvInputManager.RecordingError int error) {
|
||||||
|
if (error < TvInputManager.RECORDING_ERROR_START
|
||||||
|
|| error > TvInputManager.RECORDING_ERROR_END) {
|
||||||
|
Log.w(TAG, "notifyError - invalid error code (" + error
|
||||||
|
+ ") is changed to RECORDING_ERROR_UNKNOWN.");
|
||||||
|
error = TvInputManager.RECORDING_ERROR_UNKNOWN;
|
||||||
|
}
|
||||||
|
final int validError = error;
|
||||||
executeOrPostRunnableOnMainThread(new Runnable() {
|
executeOrPostRunnableOnMainThread(new Runnable() {
|
||||||
@MainThread
|
@MainThread
|
||||||
@Override
|
@Override
|
||||||
@@ -1621,7 +1628,7 @@ public abstract class TvInputService extends Service {
|
|||||||
try {
|
try {
|
||||||
if (DEBUG) Log.d(TAG, "notifyError");
|
if (DEBUG) Log.d(TAG, "notifyError");
|
||||||
if (mSessionCallback != null) {
|
if (mSessionCallback != null) {
|
||||||
mSessionCallback.onError(error);
|
mSessionCallback.onError(validError);
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.w(TAG, "error in notifyError", e);
|
Log.w(TAG, "error in notifyError", e);
|
||||||
|
|||||||
Reference in New Issue
Block a user