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

Commit 1ef588c5 authored by Nick Chalko's avatar Nick Chalko Committed by Android (Google) Code Review
Browse files

Merge "Update documentation for scan commmands"

parents 13d3d686 08d8aca4
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.content.Context;
import android.media.tv.tuner.TunerConstants.FilterStatus;
import android.media.tv.tuner.TunerConstants.FrontendScanType;
import android.media.tv.tuner.TunerConstants.Result;
import android.media.tv.tuner.dvr.Dvr;
import android.media.tv.tuner.dvr.DvrCallback;
@@ -281,17 +280,26 @@ public final class Tuner implements AutoCloseable {
    }

    /**
     * Scan channels.
     * Scan for channels.
     *
     * <p>Details for channels found are returned via {@link ScanCallback}.
     *
     * @param settings A {@link FrontendSettings} to configure the frontend.
     * @param scanType The scan type.
     *
     * @throws SecurityException     if the caller does not have appropriate permissions.
     * @throws IllegalStateException if {@code scan} is called again before {@link #stopScan()} is
     *                               called.
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
    public int scan(@NonNull FrontendSettings settings, @FrontendScanType int scanType,
    public int scan(@NonNull FrontendSettings settings, @ScanCallback.ScanType int scanType,
            @NonNull @CallbackExecutor Executor executor, @NonNull ScanCallback scanCallback) {
        TunerUtils.checkTunerPermission(mContext);
        if (mScanCallback != null || mScanCallbackExecutor != null) {
            throw new IllegalStateException(
                    "Scan already in progress.  stopScan must be called before a new scan can be "
                            + "started.");
        }
        mScanCallback = scanCallback;
        mScanCallbackExecutor = executor;
        return nativeScan(settings.getType(), settings, scanType);
@@ -306,6 +314,7 @@ public final class Tuner implements AutoCloseable {
     * <p>
     * If the method completes successfully, the frontend stopped previous scanning.
     *
     * @throws SecurityException if the caller does not have appropriate permissions.
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.ACCESS_TV_TUNER)
+0 −14
Original line number Diff line number Diff line
@@ -218,20 +218,6 @@ public final class TunerConstants {
    public static final int SC_HEVC_INDEX_SLICE_TRAIL_CRA =
            Constants.DemuxScHevcIndex.SLICE_TRAIL_CRA;


    /** @hide */
    @IntDef({FRONTEND_SCAN_UNDEFINED, FRONTEND_SCAN_AUTO, FRONTEND_SCAN_BLIND})
    @Retention(RetentionPolicy.SOURCE)
    public @interface FrontendScanType {}
    /** @hide */
    public static final int FRONTEND_SCAN_UNDEFINED = Constants.FrontendScanType.SCAN_UNDEFINED;
    /** @hide */
    public static final int FRONTEND_SCAN_AUTO = Constants.FrontendScanType.SCAN_AUTO;
    /** @hide */
    public static final int FRONTEND_SCAN_BLIND = Constants.FrontendScanType.SCAN_BLIND;



    /** @hide */
    @LongDef({FEC_UNDEFINED, FEC_AUTO, FEC_1_2, FEC_1_3, FEC_1_4, FEC_1_5, FEC_2_3, FEC_2_5,
            FEC_2_9, FEC_3_4, FEC_3_5, FEC_4_5, FEC_4_15, FEC_5_6, FEC_5_9, FEC_6_7, FEC_7_8,
+30 −2
Original line number Diff line number Diff line
@@ -16,6 +16,11 @@

package android.media.tv.tuner.frontend;

import android.annotation.IntDef;
import android.hardware.tv.tuner.V1_0.Constants;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * Scan callback.
@@ -23,11 +28,34 @@ package android.media.tv.tuner.frontend;
 * @hide
 */
public interface ScanCallback {

    /** @hide */
    @IntDef(prefix = "SCAN_TYPE_", value = {SCAN_TYPE_UNDEFINED, SCAN_TYPE_AUTO, SCAN_TYPE_BLIND})
    @Retention(RetentionPolicy.SOURCE)
    @interface ScanType {}
    /**
     * Scan type undefined.
     */
    int SCAN_TYPE_UNDEFINED = Constants.FrontendScanType.SCAN_UNDEFINED;
    /**
     * Scan type auto.
     *
     * <p> Tuner will send {@link #onLocked}
     */
    int SCAN_TYPE_AUTO = Constants.FrontendScanType.SCAN_AUTO;
    /**
     * Blind scan.
     *
     * <p>Frequency range is not specified. The {@link android.media.tv.tuner.Tuner} will scan an
     * implementation specific range.
     */
    int SCAN_TYPE_BLIND = Constants.FrontendScanType.SCAN_BLIND;

    /** Scan locked the signal. */
    void onLocked(boolean isLocked);
    void onLocked();

    /** Scan stopped. */
    void onEnd(boolean isEnd);
    void onScanStopped();

    /** scan progress percent (0..100) */
    void onProgress(int percent);