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

Commit b8b1e1da authored by Hongguang's avatar Hongguang Committed by Hongguang Chen
Browse files

Add ISDB-T Multi-Layer Support.

Because ISDB-T has up to three layers
(1) It is necessary to be able to obtain the hierarchical structure and
information of each hierarchy by getFrontendStatus. Various transmission
parameters, partial reception flags, error states at each level, etc.
(2) It is necessary to be able to set the transmission parameters of
each layer at the time of request. Various transmission parameters and
partial reception flags.

android.Manifest.permission.ACCESS_TV_TUNER is the overall control to
the tuner resources, it's already checked before querying frontend
status.

Bug: 171537116
Test: atest android.media.tv.tuner.cts on AIDL and HAL HALs.
Change-Id: I0d5a6056a09de5509be0a45cac435da4a43ab55f
parent 642488e7
Loading
Loading
Loading
Loading
+48 −4
Original line number Diff line number Diff line
@@ -7261,6 +7261,8 @@ package android.media.tv.tuner.frontend {
    method public int getHierarchy();
    method public long getInnerFec();
    method @NonNull public int[] getInterleaving();
    method public int getIsdbtMode();
    method public int getIsdbtPartialReceptionFlag();
    method @IntRange(from=0, to=255) @NonNull public int[] getIsdbtSegment();
    method @NonNull public boolean[] getLayerErrors();
    method public int getLnbVoltage();
@@ -7299,6 +7301,8 @@ package android.media.tv.tuner.frontend {
    field public static final int FRONTEND_STATUS_TYPE_GUARD_INTERVAL = 26; // 0x1a
    field public static final int FRONTEND_STATUS_TYPE_HIERARCHY = 19; // 0x13
    field public static final int FRONTEND_STATUS_TYPE_INTERLEAVINGS = 30; // 0x1e
    field public static final int FRONTEND_STATUS_TYPE_ISDBT_MODE = 37; // 0x25
    field public static final int FRONTEND_STATUS_TYPE_ISDBT_PARTIAL_RECEPTION_FLAG = 38; // 0x26
    field public static final int FRONTEND_STATUS_TYPE_ISDBT_SEGMENTS = 31; // 0x1f
    field public static final int FRONTEND_STATUS_TYPE_IS_LINEAR = 35; // 0x23
    field public static final int FRONTEND_STATUS_TYPE_IS_MISO_ENABLED = 34; // 0x22
@@ -7431,15 +7435,20 @@ package android.media.tv.tuner.frontend {
    method public int getGuardIntervalCapability();
    method public int getModeCapability();
    method public int getModulationCapability();
    method public int getTimeInterleaveModeCapability();
    method public boolean isFullSegmentSupported();
    method public boolean isSegmentAutoSupported();
  }
  public class IsdbtFrontendSettings extends android.media.tv.tuner.frontend.FrontendSettings {
    method @NonNull public static android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder builder();
    method public int getBandwidth();
    method public int getCodeRate();
    method @Deprecated public int getCodeRate();
    method public int getGuardInterval();
    method @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.IsdbtLayerSettings[] getLayerSettings();
    method public int getMode();
    method public int getModulation();
    method @Deprecated public int getModulation();
    method public int getPartialReceptionFlag();
    method public int getServiceAreaId();
    method public int getType();
    field public static final int BANDWIDTH_6MHZ = 8; // 0x8
@@ -7458,20 +7467,55 @@ package android.media.tv.tuner.frontend {
    field public static final int MODULATION_MOD_DQPSK = 2; // 0x2
    field public static final int MODULATION_MOD_QPSK = 4; // 0x4
    field public static final int MODULATION_UNDEFINED = 0; // 0x0
    field public static final int PARTIAL_RECEPTION_FLAG_FALSE = 2; // 0x2
    field public static final int PARTIAL_RECEPTION_FLAG_TRUE = 4; // 0x4
    field public static final int PARTIAL_RECEPTION_FLAG_UNDEFINED = 0; // 0x0
    field public static final int TIME_INTERLEAVE_MODE_1_0 = 2; // 0x2
    field public static final int TIME_INTERLEAVE_MODE_1_16 = 16; // 0x10
    field public static final int TIME_INTERLEAVE_MODE_1_4 = 4; // 0x4
    field public static final int TIME_INTERLEAVE_MODE_1_8 = 8; // 0x8
    field public static final int TIME_INTERLEAVE_MODE_2_0 = 32; // 0x20
    field public static final int TIME_INTERLEAVE_MODE_2_2 = 64; // 0x40
    field public static final int TIME_INTERLEAVE_MODE_2_4 = 128; // 0x80
    field public static final int TIME_INTERLEAVE_MODE_2_8 = 256; // 0x100
    field public static final int TIME_INTERLEAVE_MODE_3_0 = 512; // 0x200
    field public static final int TIME_INTERLEAVE_MODE_3_1 = 1024; // 0x400
    field public static final int TIME_INTERLEAVE_MODE_3_2 = 2048; // 0x800
    field public static final int TIME_INTERLEAVE_MODE_3_4 = 4096; // 0x1000
    field public static final int TIME_INTERLEAVE_MODE_AUTO = 1; // 0x1
    field public static final int TIME_INTERLEAVE_MODE_UNDEFINED = 0; // 0x0
  }
  public static class IsdbtFrontendSettings.Builder {
    method @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings build();
    method @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder setBandwidth(int);
    method @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder setCodeRate(int);
    method @Deprecated @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder setCodeRate(int);
    method @Deprecated @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder setFrequency(int);
    method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder setFrequencyLong(long);
    method @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder setGuardInterval(int);
    method @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder setLayerSettings(@NonNull android.media.tv.tuner.frontend.IsdbtFrontendSettings.IsdbtLayerSettings[]);
    method @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder setMode(int);
    method @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder setModulation(int);
    method @Deprecated @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder setModulation(int);
    method @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder setPartialReceptionFlag(int);
    method @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder setServiceAreaId(int);
  }
  public static final class IsdbtFrontendSettings.IsdbtLayerSettings {
    method @NonNull public static android.media.tv.tuner.frontend.IsdbtFrontendSettings.IsdbtLayerSettings.Builder builder();
    method public int getCodeRate();
    method public int getModulation();
    method @IntRange(from=0, to=255) public int getNumOfSegment();
    method public int getTimeInterleaveMode();
  }
  public static final class IsdbtFrontendSettings.IsdbtLayerSettings.Builder {
    method @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.IsdbtLayerSettings build();
    method @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.IsdbtLayerSettings.Builder setCodeRate(int);
    method @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.IsdbtLayerSettings.Builder setModulation(int);
    method @IntRange(from=0, to=255) @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.IsdbtLayerSettings.Builder setNumOfSegment(int);
    method @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.IsdbtLayerSettings.Builder setTimeInterleaveMode(int);
  }
  public interface OnTuneEventListener {
    method public void onTuneEvent(int);
    field public static final int SIGNAL_LOCKED = 0; // 0x0
+12 −0
Original line number Diff line number Diff line
@@ -749,6 +749,12 @@ public class Tuner implements AutoCloseable {
     * supported in Tuner 1.1 or higher version. Unsupported version will cause no-op. Use {@link
     * TunerVersionChecker#getTunerVersion()} to get the version information.
     *
     * <p>Tuning with {@link
     * android.media.tv.tuner.frontend.IsdbtFrontendSettings.PartialReceptionFlag} or {@link
     * android.media.tv.tuner.frontend.IsdbtFrontendSettings.IsdbtLayerSettings} is only supported
     * in Tuner 2.0 or higher version. Unsupported version will cause no-op. Use {@link
     * TunerVersionChecker#getTunerVersion()} to get the version information.
     *
     * @param settings Signal delivery information the frontend uses to
     *                 search and lock the signal.
     * @return result status of tune operation.
@@ -803,6 +809,12 @@ public class Tuner implements AutoCloseable {
     * supported in Tuner 1.1 or higher version. Unsupported version will cause no-op. Use {@link
     * TunerVersionChecker#getTunerVersion()} to get the version information.
     *
     * * <p>Scanning with {@link
     * android.media.tv.tuner.frontend.IsdbtFrontendSettings.PartialReceptionFlag} or {@link
     * android.media.tv.tuner.frontend.IsdbtFrontendSettings.IsdbtLayerSettings} is only supported
     * in Tuner 2.0 or higher version. Unsupported version will cause no-op. Use {@link
     * TunerVersionChecker#getTunerVersion()} to get the version information.
     *
     * @param settings A {@link FrontendSettings} to configure the frontend.
     * @param scanType The scan type.
     * @throws SecurityException     if the caller does not have appropriate permissions.
+63 −3
Original line number Diff line number Diff line
@@ -52,7 +52,8 @@ public class FrontendStatus {
            FRONTEND_STATUS_TYPE_ISDBT_SEGMENTS, FRONTEND_STATUS_TYPE_TS_DATA_RATES,
            FRONTEND_STATUS_TYPE_MODULATIONS_EXT, FRONTEND_STATUS_TYPE_ROLL_OFF,
            FRONTEND_STATUS_TYPE_IS_MISO_ENABLED, FRONTEND_STATUS_TYPE_IS_LINEAR,
            FRONTEND_STATUS_TYPE_IS_SHORT_FRAMES_ENABLED})
            FRONTEND_STATUS_TYPE_IS_SHORT_FRAMES_ENABLED, FRONTEND_STATUS_TYPE_ISDBT_MODE,
            FRONTEND_STATUS_TYPE_ISDBT_PARTIAL_RECEPTION_FLAG})
    @Retention(RetentionPolicy.SOURCE)
    public @interface FrontendStatusType {}

@@ -242,6 +243,16 @@ public class FrontendStatus {
     */
    public static final int FRONTEND_STATUS_TYPE_IS_SHORT_FRAMES_ENABLED =
            android.hardware.tv.tuner.FrontendStatusType.IS_SHORT_FRAMES;
    /**
     * ISDB-T mode. Only supported in Tuner HAL 2.0 or higher.
     */
    public static final int FRONTEND_STATUS_TYPE_ISDBT_MODE =
            android.hardware.tv.tuner.FrontendStatusType.ISDBT_MODE;
    /**
     * ISDB-T partial reception flag. Only supported in Tuner HAL 2.0 or higher.
     */
    public static final int FRONTEND_STATUS_TYPE_ISDBT_PARTIAL_RECEPTION_FLAG =
            android.hardware.tv.tuner.FrontendStatusType.ISDBT_PARTIAL_RECEPTION_FLAG;

    /** @hide */
    @IntDef(value = {
@@ -337,7 +348,21 @@ public class FrontendStatus {
            DvbcFrontendSettings.TIME_INTERLEAVE_MODE_8_16,
            DvbcFrontendSettings.TIME_INTERLEAVE_MODE_128_2,
            DvbcFrontendSettings.TIME_INTERLEAVE_MODE_128_3,
            DvbcFrontendSettings.TIME_INTERLEAVE_MODE_128_4})
            DvbcFrontendSettings.TIME_INTERLEAVE_MODE_128_4,
            IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_UNDEFINED,
            IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_AUTO,
            IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_1_0,
            IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_1_4,
            IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_1_8,
            IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_1_16,
            IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_2_0,
            IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_2_2,
            IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_2_4,
            IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_2_8,
            IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_3_0,
            IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_3_1,
            IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_3_2,
            IsdbtFrontendSettings.TIME_INTERLEAVE_MODE_3_4})
    @Retention(RetentionPolicy.SOURCE)
    public @interface FrontendInterleaveMode {}

@@ -466,7 +491,8 @@ public class FrontendStatus {
    private Boolean mIsMisoEnabled;
    private Boolean mIsLinear;
    private Boolean mIsShortFrames;

    private Integer mIsdbtMode;
    private Integer mIsdbtPartialReceptionFlag;

    // Constructed and fields set by JNI code.
    private FrontendStatus() {
@@ -940,6 +966,40 @@ public class FrontendStatus {
        return mIsShortFrames;
    }

    /**
     * Gets ISDB-T mode.
     *
     * <p>This query is only supported by Tuner HAL 2.0 or higher. Unsupported version or if HAL
     * doesn't return ISDB-T mode status will throw IllegalStateException. Use
     * {@link TunerVersionChecker#getTunerVersion()} to check the version.
     */
    @IsdbtFrontendSettings.Mode
    public int getIsdbtMode() {
        TunerVersionChecker.checkHigherOrEqualVersionTo(
                TunerVersionChecker.TUNER_VERSION_2_0, "IsdbtMode status");
        if (mIsdbtMode == null) {
            throw new IllegalStateException("IsdbtMode status is empty");
        }
        return mIsdbtMode;
    }

    /**
     * Gets ISDB-T partial reception flag.
     *
     * <p>This query is only supported by Tuner HAL 2.0 or higher. Unsupported version or if HAL
     * doesn't return partial reception flag status will throw IllegalStateException. Use
     * {@link TunerVersionChecker#getTunerVersion()} to check the version.
     */
    @IsdbtFrontendSettings.PartialReceptionFlag
    public int getIsdbtPartialReceptionFlag() {
        TunerVersionChecker.checkHigherOrEqualVersionTo(
                TunerVersionChecker.TUNER_VERSION_2_0, "IsdbtPartialReceptionFlag status");
        if (mIsdbtPartialReceptionFlag == null) {
            throw new IllegalStateException("IsdbtPartialReceptionFlag status is empty");
        }
        return mIsdbtPartialReceptionFlag;
    }

    /**
     * Information of each tuning Physical Layer Pipes.
     */
+40 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.media.tv.tuner.frontend;

import android.annotation.SystemApi;
import android.media.tv.tuner.TunerVersionChecker;

/**
 * ISDBT Capabilities.
@@ -30,14 +31,21 @@ public class IsdbtFrontendCapabilities extends FrontendCapabilities {
    private final int mModulationCap;
    private final int mCodeRateCap;
    private final int mGuardIntervalCap;
    private final int mTimeInterleaveCap;
    private final boolean mIsSegmentAutoSupported;
    private final boolean mIsFullSegmentSupported;

    private IsdbtFrontendCapabilities(int modeCap, int bandwidthCap, int modulationCap,
            int codeRateCap, int guardIntervalCap) {
            int codeRateCap, int guardIntervalCap, int timeInterleaveCap,
            boolean isSegmentAutoSupported, boolean isFullSegmentSupported) {
        mModeCap = modeCap;
        mBandwidthCap = bandwidthCap;
        mModulationCap = modulationCap;
        mCodeRateCap = codeRateCap;
        mGuardIntervalCap = guardIntervalCap;
        mTimeInterleaveCap = timeInterleaveCap;
        mIsSegmentAutoSupported = isSegmentAutoSupported;
        mIsFullSegmentSupported = isFullSegmentSupported;
    }

    /**
@@ -75,4 +83,35 @@ public class IsdbtFrontendCapabilities extends FrontendCapabilities {
    public int getGuardIntervalCapability() {
        return mGuardIntervalCap;
    }
    /**
     * Gets time interleave mode capability.
     *
     * <p>This query is only supported by Tuner HAL 2.0 or higher. Unsupported version will
     * return {@link IsdbtFrontendSettings#TIME_INTERLEAVE_MODE_UNDEFINED}.
     * Use {@link TunerVersionChecker#getTunerVersion()} to check the version.
     */
    @IsdbtFrontendSettings.TimeInterleaveMode
    public int getTimeInterleaveModeCapability() {
        return mTimeInterleaveCap;
    }
    /**
     * If auto segment is supported or not.
     *
     * <p>This query is only supported by Tuner HAL 2.0 or higher. Unsupported version will
     * return false.
     * Use {@link TunerVersionChecker#getTunerVersion()} to check the version.
     */
    public boolean isSegmentAutoSupported() {
        return mIsSegmentAutoSupported;
    }
    /**
     * If full segment is supported or not.
     *
     * <p>This query is only supported by Tuner HAL 2.0 or higher. Unsupported version will
     * return false.
     * Use {@link TunerVersionChecker#getTunerVersion()} to check the version.
     */
    public boolean isFullSegmentSupported() {
        return mIsFullSegmentSupported;
    }
}
+359 −15

File changed.

Preview size limit exceeded, changes collapsed.

Loading