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

Commit 8bf4bf76 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Make TimeFilter @SystemApi"

parents 29d2fc2f 2ac4284c
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -4723,6 +4723,7 @@ package android.media.tv.tuner {
    method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public android.media.tv.tuner.filter.Filter openFilter(int, int, long, @Nullable java.util.concurrent.Executor, @Nullable android.media.tv.tuner.filter.FilterCallback);
    method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public android.media.tv.tuner.Lnb openLnb(@Nullable java.util.concurrent.Executor, @Nullable android.media.tv.tuner.LnbCallback);
    method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public android.media.tv.tuner.Lnb openLnbByName(@Nullable String, @Nullable java.util.concurrent.Executor, @NonNull android.media.tv.tuner.LnbCallback);
    method @Nullable public android.media.tv.tuner.filter.TimeFilter openTimeFilter();
    method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public void setOnTuneEventListener(@NonNull java.util.concurrent.Executor, @NonNull android.media.tv.tuner.frontend.OnTuneEventListener);
    method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public int stopTune();
    method @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public int tune(@NonNull android.media.tv.tuner.frontend.FrontendSettings);
@@ -5077,6 +5078,15 @@ package android.media.tv.tuner.filter {
    method public long getPts();
  }
  public class TimeFilter implements java.lang.AutoCloseable {
    method public int clearTimestamp();
    method public void close();
    method public long getSourceTime();
    method public long getTimeStamp();
    method public int setCurrentTimestamp(long);
    field public static final long TIMESTAMP_UNAVAILABLE = -1L; // 0xffffffffffffffffL
  }
  public class TlvFilterConfiguration extends android.media.tv.tuner.filter.FilterConfiguration {
    method @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER) public static android.media.tv.tuner.filter.TlvFilterConfiguration.Builder builder(@NonNull android.content.Context);
    method public int getPacketType();
+10 −0
Original line number Diff line number Diff line
@@ -590,6 +590,16 @@ public final class Tuner implements AutoCloseable {
        return new Lnb(0);
    }

    /**
     * Open a time filter object.
     *
     * @return the opened time filter object. {@code null} if the operation failed.
     */
    @Nullable
    public TimeFilter openTimeFilter() {
        return nativeOpenTimeFilter();
    }

    private List<Integer> getLnbIds() {
        mLnbIds = nativeGetLnbIds();
        return mLnbIds;
+27 −10
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

package android.media.tv.tuner.filter;

import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.media.tv.tuner.TunerConstants.Result;

/**
@@ -30,7 +30,21 @@ import android.media.tv.tuner.TunerConstants.Result;
 *
 * @hide
 */
@SystemApi
public class TimeFilter implements AutoCloseable {

    /**
     * Timestamp is unavailable.
     *
     * <p>Returned by {@link #getSourceTime()} or {@link #getTimeStamp()} when the requested
     * timestamp is not available.
     *
     * @see #getSourceTime()
     * @see #getTimeStamp()
     */
    public static final long TIMESTAMP_UNAVAILABLE = -1L;


    private native int nativeSetTimestamp(long timestamp);
    private native int nativeClearTimestamp();
    private native Long nativeGetTimestamp();
@@ -39,6 +53,10 @@ public class TimeFilter implements AutoCloseable {

    private boolean mEnable = false;

    // Called by JNI code
    private TimeFilter() {
    }

    /**
     * Set timestamp for time based filter.
     *
@@ -86,13 +104,12 @@ public class TimeFilter implements AutoCloseable {
     *
     * @return current timestamp in the time filter. It's based on the 90KHz counter, and it's
     * the same format as PTS (Presentation Time Stamp) defined in ISO/IEC 13818-1:2019. The
     * timestamps may or may not be related to PTS or DTS. {@code null} if the timestamp is
     * never set.
     * timestamps may or may not be related to PTS or DTS. Returns {@link #TIMESTAMP_UNAVAILABLE}
     * if the timestamp is never set.
     */
    @Nullable
    public Long getTimeStamp() {
    public long getTimeStamp() {
        if (!mEnable) {
            return null;
            return TIMESTAMP_UNAVAILABLE;
        }
        return nativeGetTimestamp();
    }
@@ -104,12 +121,12 @@ public class TimeFilter implements AutoCloseable {
     *
     * @return first timestamp of incoming data stream. It's based on the 90KHz counter, and
     * it's the same format as PTS (Presentation Time Stamp) defined in ISO/IEC 13818-1:2019.
     * The timestamps may or may not be related to PTS or DTS.
     * The timestamps may or may not be related to PTS or DTS. Returns
     * {@link #TIMESTAMP_UNAVAILABLE} if the timestamp is not available.
     */
    @Nullable
    public Long getSourceTime() {
    public long getSourceTime() {
        if (!mEnable) {
            return null;
            return TIMESTAMP_UNAVAILABLE;
        }
        return nativeGetSourceTime();
    }