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

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

Return error if the a new tune() is called with different frontend type.

Bug: 204235120
Test: atest android.media.tv.tuner.cts
Change-Id: I914df11fc223d2902ecbdb20a9cecbbe726c904f
parent 62429f16
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -751,8 +751,13 @@ public class Tuner implements AutoCloseable {
     */
    @Result
    public int tune(@NonNull FrontendSettings settings) {
        Log.d(TAG, "Tune to " + settings.getFrequency());
        mFrontendType = settings.getType();
        final int type = settings.getType();
        if (mFrontendHandle != null && type != mFrontendType) {
            Log.e(TAG, "Frontend was opened with type " + mFrontendType + ", new type is " + type);
            return RESULT_INVALID_STATE;
        }
        Log.d(TAG, "Tune to " + settings.getFrequencyLong());
        mFrontendType = type;
        if (mFrontendType == FrontendSettings.TYPE_DTMB) {
            if (!TunerVersionChecker.checkHigherOrEqualVersionTo(
                    TunerVersionChecker.TUNER_VERSION_1_1, "Tuner with DTMB Frontend")) {