Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 007c4c6c authored by Ray Chin's avatar Ray Chin Committed by Android (Google) Code Review
Browse files

Merge "Add setStatusCheckIntervalHint method"

parents 38ffc8c2 f0a1ec8e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -7132,6 +7132,7 @@ package android.media.tv.tuner {
    field public static final int TUNER_VERSION_1_0 = 65536; // 0x10000
    field public static final int TUNER_VERSION_1_1 = 65537; // 0x10001
    field public static final int TUNER_VERSION_2_0 = 131072; // 0x20000
    field public static final int TUNER_VERSION_3_0 = 196608; // 0x30000
    field public static final int TUNER_VERSION_UNKNOWN = 0; // 0x0
  }
@@ -7149,6 +7150,7 @@ package android.media.tv.tuner.dvr {
    method public long read(@NonNull byte[], long, long);
    method public long seek(long);
    method public void setFileDescriptor(@NonNull android.os.ParcelFileDescriptor);
    method public int setPlaybackBufferStatusCheckIntervalHint(long);
    method public int start();
    method public int stop();
    field public static final int PLAYBACK_STATUS_ALMOST_EMPTY = 2; // 0x2
@@ -7164,6 +7166,7 @@ package android.media.tv.tuner.dvr {
    method public int detachFilter(@NonNull android.media.tv.tuner.filter.Filter);
    method public int flush();
    method public void setFileDescriptor(@NonNull android.os.ParcelFileDescriptor);
    method public int setRecordBufferStatusCheckIntervalHint(long);
    method public int start();
    method public int stop();
    method public long write(long);
+4 −0
Original line number Diff line number Diff line
@@ -59,6 +59,10 @@ public final class TunerVersionChecker {
     * Tuner version 2.0.
     */
    public static final int TUNER_VERSION_2_0 = (2 << 16);
    /**
     * Tuner version 3.0.
     */
    public static final int TUNER_VERSION_3_0 = (3 << 16);

    /**
     * Get the current running Tuner version.
+31 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.annotation.SystemApi;
import android.media.tv.tuner.Tuner;
import android.media.tv.tuner.Tuner.Result;
import android.media.tv.tuner.TunerUtils;
import android.media.tv.tuner.TunerVersionChecker;
import android.media.tv.tuner.filter.Filter;
import android.os.ParcelFileDescriptor;
import android.os.Process;
@@ -91,6 +92,7 @@ public class DvrPlayback implements AutoCloseable {
    private native int nativeAttachFilter(Filter filter);
    private native int nativeDetachFilter(Filter filter);
    private native int nativeConfigureDvr(DvrSettings settings);
    private native int nativeSetStatusCheckIntervalHint(long durationInMs);
    private native int nativeStartDvr();
    private native int nativeStopDvr();
    private native int nativeFlushDvr();
@@ -176,6 +178,35 @@ public class DvrPlayback implements AutoCloseable {
        return nativeConfigureDvr(settings);
    }

    /**
     * Set playback buffer status check time interval.
     *
     * This status check time interval will be used by the Dvr to decide how often to evaluate
     * data. The default value will be decided by HAL if it’s not set.
     *
     * <p>This functionality is only available in Tuner version 3.0 and higher and will otherwise
     * return a {@link Tuner#RESULT_UNAVAILABLE}. Use {@link TunerVersionChecker#getTunerVersion()}
     * to get the version information.
     *
     * @param durationInMs specifies the duration of the delay in milliseconds.
     *
     * @return one of the following results:
     * {@link Tuner#RESULT_SUCCESS} if succeed,
     * {@link Tuner#RESULT_UNAVAILABLE} if Dvr is unavailable or unsupported HAL versions,
     * {@link Tuner#RESULT_NOT_INITIALIZED} if Dvr is not initialized,
     * {@link Tuner#RESULT_INVALID_STATE} if Dvr is in a wrong state,
     * {@link Tuner#RESULT_INVALID_ARGUMENT}  if the input parameter is invalid.
     */
    @Result
    public int setPlaybackBufferStatusCheckIntervalHint(long durationInMs) {
        if (!TunerVersionChecker.checkHigherOrEqualVersionTo(
                TunerVersionChecker.TUNER_VERSION_3_0, "Set status check interval hint")) {
            // no-op
            return Tuner.RESULT_UNAVAILABLE;
        }
        return nativeSetStatusCheckIntervalHint(durationInMs);
    }

    /**
     * Starts DVR.
     *
+31 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.annotation.SystemApi;
import android.media.tv.tuner.Tuner;
import android.media.tv.tuner.Tuner.Result;
import android.media.tv.tuner.TunerUtils;
import android.media.tv.tuner.TunerVersionChecker;
import android.media.tv.tuner.filter.Filter;
import android.os.ParcelFileDescriptor;
import android.os.Process;
@@ -53,6 +54,7 @@ public class DvrRecorder implements AutoCloseable {
    private native int nativeAttachFilter(Filter filter);
    private native int nativeDetachFilter(Filter filter);
    private native int nativeConfigureDvr(DvrSettings settings);
    private native int nativeSetStatusCheckIntervalHint(long durationInMs);
    private native int nativeStartDvr();
    private native int nativeStopDvr();
    private native int nativeFlushDvr();
@@ -130,6 +132,35 @@ public class DvrRecorder implements AutoCloseable {
        return nativeConfigureDvr(settings);
    }

    /**
     * Set record buffer status check time interval.
     *
     * This status check time interval will be used by the Dvr to decide how often to evaluate
     * data. The default value will be decided by HAL if it’s not set.
     *
     * <p>This functionality is only available in Tuner version 3.0 and higher and will otherwise
     * return a {@link Tuner#RESULT_UNAVAILABLE}. Use {@link TunerVersionChecker#getTunerVersion()}
     * to get the version information.
     *
     * @param durationInMs specifies the duration of the delay in milliseconds.
     *
     * @return one of the following results:
     * {@link Tuner#RESULT_SUCCESS} if succeed,
     * {@link Tuner#RESULT_UNAVAILABLE} if Dvr is unavailable or unsupported HAL versions,
     * {@link Tuner#RESULT_NOT_INITIALIZED} if Dvr is not initialized,
     * {@link Tuner#RESULT_INVALID_STATE} if Dvr is in a wrong state,
     * {@link Tuner#RESULT_INVALID_ARGUMENT}  if the input parameter is invalid.
     */
    @Result
    public int setRecordBufferStatusCheckIntervalHint(long durationInMs) {
        if (!TunerVersionChecker.checkHigherOrEqualVersionTo(
                TunerVersionChecker.TUNER_VERSION_3_0, "Set status check interval hint")) {
            // no-op
            return Tuner.RESULT_UNAVAILABLE;
        }
        return nativeSetStatusCheckIntervalHint(durationInMs);
    }

    /**
     * Starts DVR.
     *
+1 −1
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ cc_library_shared {

    shared_libs: [
        "android.hardware.graphics.bufferqueue@2.0",
        "android.hardware.tv.tuner-V1-ndk",
        "android.hardware.tv.tuner-V2-ndk",
        "libbinder_ndk",
        "libandroid_runtime",
        "libcutils",
Loading