diff options
| -rw-r--r-- | api/current.txt | 6 | ||||
| -rw-r--r-- | api/system-current.txt | 6 | ||||
| -rw-r--r-- | api/test-current.txt | 6 | ||||
| -rw-r--r-- | media/java/android/media/tv/ITvInputClient.aidl | 2 | ||||
| -rw-r--r-- | media/java/android/media/tv/ITvInputSessionCallback.aidl | 2 | ||||
| -rw-r--r-- | media/java/android/media/tv/TvInputInfo.java | 7 | ||||
| -rw-r--r-- | media/java/android/media/tv/TvInputManager.java | 12 | ||||
| -rw-r--r-- | media/java/android/media/tv/TvInputService.java | 16 | ||||
| -rw-r--r-- | media/java/android/media/tv/TvRecordingClient.java | 23 | ||||
| -rw-r--r-- | services/core/java/com/android/server/tv/TvInputManagerService.java | 4 |
10 files changed, 47 insertions, 37 deletions
diff --git a/api/current.txt b/api/current.txt index adfb1967de7c..e444e20b47cd 100644 --- a/api/current.txt +++ b/api/current.txt @@ -22965,7 +22965,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); @@ -23033,7 +23033,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(); @@ -23092,7 +23092,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 { diff --git a/api/system-current.txt b/api/system-current.txt index 4fd0baaac6a7..7389a069e8dd 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -24633,7 +24633,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); @@ -24778,7 +24778,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); @@ -24846,7 +24846,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 { diff --git a/api/test-current.txt b/api/test-current.txt index 3b85f5cff74c..0bf42c3e82e8 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -22976,7 +22976,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); @@ -23044,7 +23044,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(); @@ -23103,7 +23103,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 { diff --git a/media/java/android/media/tv/ITvInputClient.aidl b/media/java/android/media/tv/ITvInputClient.aidl index 5dd4e85efa2c..72f8b5773c9e 100644 --- a/media/java/android/media/tv/ITvInputClient.aidl +++ b/media/java/android/media/tv/ITvInputClient.aidl @@ -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); } diff --git a/media/java/android/media/tv/ITvInputSessionCallback.aidl b/media/java/android/media/tv/ITvInputSessionCallback.aidl index 60d6f0df9855..af76f9033b25 100644 --- a/media/java/android/media/tv/ITvInputSessionCallback.aidl +++ b/media/java/android/media/tv/ITvInputSessionCallback.aidl @@ -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); } diff --git a/media/java/android/media/tv/TvInputInfo.java b/media/java/android/media/tv/TvInputInfo.java index 6e0f5f2c1a43..63e3edcffa40 100644 --- a/media/java/android/media/tv/TvInputInfo.java +++ b/media/java/android/media/tv/TvInputInfo.java @@ -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); } diff --git a/media/java/android/media/tv/TvInputManager.java b/media/java/android/media/tv/TvInputManager.java index 2703b1ae13e8..59dfbeebfd80 100644 --- a/media/java/android/media/tv/TvInputManager.java +++ b/media/java/android/media/tv/TvInputManager.java @@ -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); } } diff --git a/media/java/android/media/tv/TvInputService.java b/media/java/android/media/tv/TvInputService.java index db851a31d363..8fb58b5ce068 100644 --- a/media/java/android/media/tv/TvInputService.java +++ b/media/java/android/media/tv/TvInputService.java @@ -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 diff --git a/media/java/android/media/tv/TvRecordingClient.java b/media/java/android/media/tv/TvRecordingClient.java index 1c920f57de2a..d48ea21e07d9 100644 --- a/media/java/android/media/tv/TvRecordingClient.java +++ b/media/java/android/media/tv/TvRecordingClient.java @@ -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 diff --git a/services/core/java/com/android/server/tv/TvInputManagerService.java b/services/core/java/com/android/server/tv/TvInputManagerService.java index 8a2729eec805..49aaa4aa1047 100644 --- a/services/core/java/com/android/server/tv/TvInputManagerService.java +++ b/services/core/java/com/android/server/tv/TvInputManagerService.java @@ -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); } |