Add requestStopRecording APIs
Bug: 256713311 Test: atest Change-Id: I007f77f9480546095e98eb17670169b1861685d1
This commit is contained in:
@@ -45,6 +45,7 @@ oneway interface ITvInteractiveAppClient {
|
||||
void onRequestTrackInfoList(int seq);
|
||||
void onRequestCurrentTvInputId(int seq);
|
||||
void onRequestStartRecording(in Uri programUri, int seq);
|
||||
void onRequestStopRecording(in String recordingId, int seq);
|
||||
void onRequestSigning(
|
||||
in String id, in String algorithm, in String alias, in byte[] data, int seq);
|
||||
void onAdRequest(in AdRequest request, int Seq);
|
||||
|
||||
@@ -44,6 +44,7 @@ oneway interface ITvInteractiveAppSessionCallback {
|
||||
void onRequestTrackInfoList();
|
||||
void onRequestCurrentTvInputId();
|
||||
void onRequestStartRecording(in Uri programUri);
|
||||
void onRequestStopRecording(in String recordingId);
|
||||
void onRequestSigning(in String id, in String algorithm, in String alias, in byte[] data);
|
||||
void onAdRequest(in AdRequest request);
|
||||
}
|
||||
|
||||
@@ -498,6 +498,18 @@ public final class TvInteractiveAppManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestStopRecording(String recordingId, int seq) {
|
||||
synchronized (mSessionCallbackRecordMap) {
|
||||
SessionCallbackRecord record = mSessionCallbackRecordMap.get(seq);
|
||||
if (record == null) {
|
||||
Log.e(TAG, "Callback not found for seq " + seq);
|
||||
return;
|
||||
}
|
||||
record.postRequestStopRecording(recordingId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestSigning(
|
||||
String id, String algorithm, String alias, byte[] data, int seq) {
|
||||
@@ -1729,6 +1741,15 @@ public final class TvInteractiveAppManager {
|
||||
});
|
||||
}
|
||||
|
||||
void postRequestStopRecording(String recordingId) {
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mSessionCallback.onRequestStopRecording(mSession, recordingId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void postRequestSigning(String id, String algorithm, String alias, byte[] data) {
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
@@ -1884,10 +1905,21 @@ public final class TvInteractiveAppManager {
|
||||
* called.
|
||||
*
|
||||
* @param session A {@link TvInteractiveAppService.Session} associated with this callback.
|
||||
* @param programUri The Uri of the program to be recorded.
|
||||
*/
|
||||
public void onRequestStartRecording(Session session, Uri programUri) {
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called when {@link TvInteractiveAppService.Session#RequestStopRecording} is
|
||||
* called.
|
||||
*
|
||||
* @param session A {@link TvInteractiveAppService.Session} associated with this callback.
|
||||
* @param recordingId The recordingId of the recording to be stopped.
|
||||
*/
|
||||
public void onRequestStopRecording(Session session, String recordingId) {
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called when
|
||||
* {@link TvInteractiveAppService.Session#requestSigning(String, String, String, byte[])} is
|
||||
|
||||
@@ -941,6 +941,33 @@ public abstract class TvInteractiveAppService extends Service {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests starting of recording
|
||||
*
|
||||
* <p> This is used to request the active {@link android.media.tv.TvRecordingClient} to
|
||||
* call {@link android.media.tv.TvRecordingClient#stopRecording()}.
|
||||
* @see android.media.tv.TvRecordingClient#stopRecording()
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@CallSuper
|
||||
public void requestStopRecording(@NonNull String recordingId) {
|
||||
executeOrPostRunnableOnMainThread(() -> {
|
||||
try {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "requestStopRecording");
|
||||
}
|
||||
if (mSessionCallback != null) {
|
||||
mSessionCallback.onRequestStopRecording(recordingId);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "error in requestStopRecording", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Requests signing of the given data.
|
||||
*
|
||||
|
||||
@@ -866,6 +866,19 @@ public class TvInteractiveAppView extends ViewGroup {
|
||||
@Nullable Uri programUri) {
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called when {@link TvInteractiveAppService.Session#requestStopRecording()}
|
||||
* is called.
|
||||
*
|
||||
* @param iAppServiceId The ID of the TV interactive app service bound to this view.
|
||||
* @param recordingId The ID of the recording to stop.
|
||||
* @hide
|
||||
*/
|
||||
public void onRequestStopRecording(
|
||||
@NonNull String iAppServiceId,
|
||||
@NonNull String recordingId) {
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called when
|
||||
* {@link TvInteractiveAppService.Session#requestSigning(String, String, String, byte[])} is
|
||||
@@ -1203,6 +1216,20 @@ public class TvInteractiveAppView extends ViewGroup {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestStopRecording(Session session, String recordingId) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "onRequestStopRecording");
|
||||
}
|
||||
if (this != mSessionCallback) {
|
||||
Log.w(TAG, "onRequestStopRecording - session not created");
|
||||
return;
|
||||
}
|
||||
if (mCallback != null) {
|
||||
mCallback.onRequestStopRecording(mIAppServiceId, recordingId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestSigning(
|
||||
Session session, String id, String algorithm, String alias, byte[] data) {
|
||||
|
||||
@@ -2252,6 +2252,23 @@ public class TvInteractiveAppManagerService extends SystemService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestStopRecording(String recordingId) {
|
||||
synchronized (mLock) {
|
||||
if (DEBUG) {
|
||||
Slogf.d(TAG, "onRequestStopRecording");
|
||||
}
|
||||
if (mSessionState.mSession == null || mSessionState.mClient == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
mSessionState.mClient.onRequestStopRecording(recordingId, mSessionState.mSeq);
|
||||
} catch (RemoteException e) {
|
||||
Slogf.e(TAG, "error in onRequestStopRecording", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestSigning(String id, String algorithm, String alias, byte[] data) {
|
||||
synchronized (mLock) {
|
||||
|
||||
Reference in New Issue
Block a user