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

Commit 341508ff authored by shubang's avatar shubang
Browse files

Clean up FrontendCapabilities, FrontendInfo, and FrontendStatus

Test: make
Change-Id: I3e4413071056b7cd5ca1017a6f3296e2f6e5cc22
parent b69a2c9c
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ public final class Tuner implements AutoCloseable {
    private native int nativeStopScan();
    private native int nativeSetLnb(int lnbId);
    private native int nativeSetLna(boolean enable);
    private native FrontendStatus[] nativeGetFrontendStatus(int[] statusTypes);
    private native FrontendStatus nativeGetFrontendStatus(int[] statusTypes);
    private native int nativeGetAvSyncHwId(Filter filter);
    private native long nativeGetAvSyncTime(int avSyncId);
    private native int nativeConnectCiCam(int ciCamId);
@@ -297,11 +297,11 @@ public final class Tuner implements AutoCloseable {
     *
     * @param statusTypes an array of status type which the caller request.
     *
     * @return statuses an array of statuses which response the caller's
     *         request.
     * @return statuses which response the caller's requests.
     * @hide
     */
    public FrontendStatus[] getFrontendStatus(int[] statusTypes) {
    @Nullable
    public FrontendStatus getFrontendStatus(int[] statusTypes) {
        return nativeGetFrontendStatus(statusTypes);
    }

+0 −150
Original line number Diff line number Diff line
@@ -322,156 +322,6 @@ public final class TunerConstants {
    public static final int FRONTEND_SCAN_BLIND = Constants.FrontendScanType.SCAN_BLIND;


    /** @hide */
    @IntDef({FRONTEND_STATUS_TYPE_DEMOD_LOCK, FRONTEND_STATUS_TYPE_SNR, FRONTEND_STATUS_TYPE_BER,
            FRONTEND_STATUS_TYPE_PER, FRONTEND_STATUS_TYPE_PRE_BER,
            FRONTEND_STATUS_TYPE_SIGNAL_QUALITY, FRONTEND_STATUS_TYPE_SIGNAL_STRENGTH,
            FRONTEND_STATUS_TYPE_SYMBOL_RATE, FRONTEND_STATUS_TYPE_FEC,
            FRONTEND_STATUS_TYPE_MODULATION, FRONTEND_STATUS_TYPE_SPECTRAL,
            FRONTEND_STATUS_TYPE_LNB_VOLTAGE, FRONTEND_STATUS_TYPE_PLP_ID,
            FRONTEND_STATUS_TYPE_EWBS, FRONTEND_STATUS_TYPE_AGC, FRONTEND_STATUS_TYPE_LNA,
            FRONTEND_STATUS_TYPE_LAYER_ERROR, FRONTEND_STATUS_TYPE_VBER_CN,
            FRONTEND_STATUS_TYPE_LBER_CN, FRONTEND_STATUS_TYPE_XER_CN, FRONTEND_STATUS_TYPE_MER,
            FRONTEND_STATUS_TYPE_FREQ_OFFSET, FRONTEND_STATUS_TYPE_HIERARCHY,
            FRONTEND_STATUS_TYPE_RF_LOCK, FRONTEND_STATUS_TYPE_ATSC3_PLP_INFO})
    @Retention(RetentionPolicy.SOURCE)
    public @interface FrontendStatusType {}

    /**
     * Lock status for Demod.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_DEMOD_LOCK =
            Constants.FrontendStatusType.DEMOD_LOCK;
    /**
     * Signal to Noise Ratio.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_SNR = Constants.FrontendStatusType.SNR;
    /**
     * Bit Error Ratio.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_BER = Constants.FrontendStatusType.BER;
    /**
     * Packages Error Ratio.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_PER = Constants.FrontendStatusType.PER;
    /**
     * Bit Error Ratio before FEC.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_PRE_BER = Constants.FrontendStatusType.PRE_BER;
    /**
     * Signal Quality (0..100). Good data over total data in percent can be
     * used as a way to present Signal Quality.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_SIGNAL_QUALITY =
            Constants.FrontendStatusType.SIGNAL_QUALITY;
    /**
     * Signal Strength.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_SIGNAL_STRENGTH =
            Constants.FrontendStatusType.SIGNAL_STRENGTH;
    /**
     * Symbol Rate.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_SYMBOL_RATE =
            Constants.FrontendStatusType.SYMBOL_RATE;
    /**
     * Forward Error Correction Type.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_FEC = Constants.FrontendStatusType.FEC;
    /**
     * Modulation Type.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_MODULATION =
            Constants.FrontendStatusType.MODULATION;
    /**
     * Spectral Inversion Type.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_SPECTRAL = Constants.FrontendStatusType.SPECTRAL;
    /**
     * LNB Voltage.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_LNB_VOLTAGE =
            Constants.FrontendStatusType.LNB_VOLTAGE;
    /**
     * Physical Layer Pipe ID.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_PLP_ID = Constants.FrontendStatusType.PLP_ID;
    /**
     * Status for Emergency Warning Broadcasting System.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_EWBS = Constants.FrontendStatusType.EWBS;
    /**
     * Automatic Gain Control.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_AGC = Constants.FrontendStatusType.AGC;
    /**
     * Low Noise Amplifier.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_LNA = Constants.FrontendStatusType.LNA;
    /**
     * Error status by layer.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_LAYER_ERROR =
            Constants.FrontendStatusType.LAYER_ERROR;
    /**
     * CN value by VBER.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_VBER_CN = Constants.FrontendStatusType.VBER_CN;
    /**
     * CN value by LBER.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_LBER_CN = Constants.FrontendStatusType.LBER_CN;
    /**
     * CN value by XER.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_XER_CN = Constants.FrontendStatusType.XER_CN;
    /**
     * Moduration Error Ratio.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_MER = Constants.FrontendStatusType.MER;
    /**
     * Difference between tuning frequency and actual locked frequency.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_FREQ_OFFSET =
            Constants.FrontendStatusType.FREQ_OFFSET;
    /**
     * Hierarchy for DVBT.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_HIERARCHY = Constants.FrontendStatusType.HIERARCHY;
    /**
     * Lock status for RF.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_RF_LOCK = Constants.FrontendStatusType.RF_LOCK;
    /**
     * PLP information in a frequency band for ATSC3.0 frontend.
     * @hide
     */
    public static final int FRONTEND_STATUS_TYPE_ATSC3_PLP_INFO =
            Constants.FrontendStatusType.ATSC3_PLP_INFO;

    /** @hide */
    @LongDef({FEC_UNDEFINED, FEC_AUTO, FEC_1_2, FEC_1_3, FEC_1_4, FEC_1_5, FEC_2_3, FEC_2_5,
+10 −5
Original line number Diff line number Diff line
@@ -17,26 +17,31 @@
package android.media.tv.tuner.frontend;

/**
 * Analog Capabilities.
 * Capabilities for analog tuners.
 *
 * @hide
 */
public class AnalogFrontendCapabilities extends FrontendCapabilities {
    @AnalogFrontendSettings.SignalType
    private final int mTypeCap;
    @AnalogFrontendSettings.SifStandard
    private final int mSifStandardCap;

    AnalogFrontendCapabilities(int typeCap, int sifStandardCap) {
    // Called by JNI code.
    private AnalogFrontendCapabilities(int typeCap, int sifStandardCap) {
        mTypeCap = typeCap;
        mSifStandardCap = sifStandardCap;
    }

    /**
     * Gets type capability.
     * Gets analog signal type capability.
     */
    @AnalogFrontendSettings.SignalType
    public int getTypeCapability() {
    public int getSignalTypeCapability() {
        return mTypeCap;
    }
    /**
     * Gets SIF standard capability.
     * Gets Standard Interchange Format (SIF) capability.
     */
    @AnalogFrontendSettings.SifStandard
    public int getSifStandardCapability() {
+2 −1
Original line number Diff line number Diff line
@@ -17,7 +17,8 @@
package android.media.tv.tuner.frontend;

/**
 * Frontend Capabilities.
 * Frontend capabilities.
 *
 * @hide
 */
public abstract class FrontendCapabilities {
+51 −30
Original line number Diff line number Diff line
@@ -16,77 +16,98 @@

package android.media.tv.tuner.frontend;

import android.annotation.NonNull;
import android.media.tv.tuner.frontend.FrontendSettings.Type;
import android.media.tv.tuner.frontend.FrontendStatus.FrontendStatusType;
import android.util.Range;

/**
 * Frontend info.
 * This class is used to specify meta information of a frontend.
 *
 * @hide
 */
public class FrontendInfo {
    private final int mId;
    private final int mType;
    private final int mMinFrequency;
    private final int mMaxFrequency;
    private final int mMinSymbolRate;
    private final int mMaxSymbolRate;
    private final Range<Integer> mFrequencyRange;
    private final Range<Integer> mSymbolRateRange;
    private final int mAcquireRange;
    private final int mExclusiveGroupId;
    private final int[] mStatusCaps;
    private final FrontendCapabilities mFrontendCap;

    FrontendInfo(int id, int type, int minFrequency, int maxFrequency, int minSymbolRate,
    private FrontendInfo(int id, int type, int minFrequency, int maxFrequency, int minSymbolRate,
            int maxSymbolRate, int acquireRange, int exclusiveGroupId, int[] statusCaps,
            FrontendCapabilities frontendCap) {
        mId = id;
        mType = type;
        mMinFrequency = minFrequency;
        mMaxFrequency = maxFrequency;
        mMinSymbolRate = minSymbolRate;
        mMaxSymbolRate = maxSymbolRate;
        mFrequencyRange = new Range<>(minFrequency, maxFrequency);
        mSymbolRateRange = new Range<>(minSymbolRate, maxSymbolRate);
        mAcquireRange = acquireRange;
        mExclusiveGroupId = exclusiveGroupId;
        mStatusCaps = statusCaps;
        mFrontendCap = frontendCap;
    }

    /** Gets frontend ID. */
    /**
     * Gets frontend ID.
     */
    public int getId() {
        return mId;
    }
    /** Gets frontend type. */
    /**
     * Gets frontend type.
     */
    @Type
    public int getType() {
        return mType;
    }
    /** Gets min frequency. */
    public int getMinFrequency() {
        return mMinFrequency;
    }
    /** Gets max frequency. */
    public int getMaxFrequency() {
        return mMaxFrequency;
    }
    /** Gets min symbol rate. */
    public int getMinSymbolRate() {
        return mMinSymbolRate;

    /**
     * Gets supported frequency range in Hz.
     */
    @NonNull
    public Range<Integer> getFrequencyRange() {
        return mFrequencyRange;
    }
    /** Gets max symbol rate. */
    public int getMaxSymbolRate() {
        return mMaxSymbolRate;

    /**
     * Gets symbol rate range in symbols per second.
     */
    @NonNull
    public Range<Integer> getSymbolRateRange() {
        return mSymbolRateRange;
    }
    /** Gets acquire range. */

    /**
     * Gets acquire range in Hz.
     *
     * <p>The maximum frequency difference the frontend can detect.
     */
    public int getAcquireRange() {
        return mAcquireRange;
    }
    /** Gets exclusive group ID. */
    /**
     * Gets exclusive group ID.
     *
     * <p>Frontends with the same exclusive group ID indicates they can't function at same time. For
     * instance, they share some hardware modules.
     */
    public int getExclusiveGroupId() {
        return mExclusiveGroupId;
    }
    /** Gets status capabilities. */
    /**
     * Gets status capabilities.
     *
     * @return An array of supported status types.
     */
    @FrontendStatusType
    public int[] getStatusCapabilities() {
        return mStatusCaps;
    }
    /** Gets frontend capability. */
    /**
     * Gets frontend capabilities.
     */
    public FrontendCapabilities getFrontendCapability() {
        return mFrontendCap;
    }
Loading