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

Commit 87c9da55 authored by Nick Chalko's avatar Nick Chalko
Browse files

Move ScanMessage to frontend package

Move the SCAN_MESSAGE constants to ScanMessage also.

Test: m framework-minus-apex
Change-Id: I56f94cb31bf6d3d1923966e5fa7562430d750377
parent a2030eb2
Loading
Loading
Loading
Loading
+0 −35
Original line number Diff line number Diff line
@@ -227,41 +227,6 @@ public final class TunerConstants {
    /** @hide */
    public static final int FRONTEND_SCAN_BLIND = Constants.FrontendScanType.SCAN_BLIND;

    /** @hide */
    @IntDef({SCAN_MESSAGE_TYPE_LOCKED, SCAN_MESSAGE_TYPE_END, SCAN_MESSAGE_TYPE_PROGRESS_PERCENT,
            SCAN_MESSAGE_TYPE_FREQUENCY, SCAN_MESSAGE_TYPE_SYMBOL_RATE, SCAN_MESSAGE_TYPE_PLP_IDS,
            SCAN_MESSAGE_TYPE_GROUP_IDS, SCAN_MESSAGE_TYPE_INPUT_STREAM_IDS,
            SCAN_MESSAGE_TYPE_STANDARD, SCAN_MESSAGE_TYPE_ATSC3_PLP_INFO})
    @Retention(RetentionPolicy.SOURCE)
    public @interface ScanMessageType {}
    /** @hide */
    public static final int SCAN_MESSAGE_TYPE_LOCKED = Constants.FrontendScanMessageType.LOCKED;
    /** @hide */
    public static final int SCAN_MESSAGE_TYPE_END = Constants.FrontendScanMessageType.END;
    /** @hide */
    public static final int SCAN_MESSAGE_TYPE_PROGRESS_PERCENT =
            Constants.FrontendScanMessageType.PROGRESS_PERCENT;
    /** @hide */
    public static final int SCAN_MESSAGE_TYPE_FREQUENCY =
            Constants.FrontendScanMessageType.FREQUENCY;
    /** @hide */
    public static final int SCAN_MESSAGE_TYPE_SYMBOL_RATE =
            Constants.FrontendScanMessageType.SYMBOL_RATE;
    /** @hide */
    public static final int SCAN_MESSAGE_TYPE_PLP_IDS = Constants.FrontendScanMessageType.PLP_IDS;
    /** @hide */
    public static final int SCAN_MESSAGE_TYPE_GROUP_IDS =
            Constants.FrontendScanMessageType.GROUP_IDS;
    /** @hide */
    public static final int SCAN_MESSAGE_TYPE_INPUT_STREAM_IDS =
            Constants.FrontendScanMessageType.INPUT_STREAM_IDS;
    /** @hide */
    public static final int SCAN_MESSAGE_TYPE_STANDARD =
            Constants.FrontendScanMessageType.STANDARD;
    /** @hide */
    public static final int SCAN_MESSAGE_TYPE_ATSC3_PLP_INFO =
            Constants.FrontendScanMessageType.ATSC3_PLP_INFO;


    /** @hide */
    @IntDef({FRONTEND_STATUS_TYPE_DEMOD_LOCK, FRONTEND_STATUS_TYPE_SNR, FRONTEND_STATUS_TYPE_BER,
+0 −2
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package android.media.tv.tuner.frontend;

import android.media.tv.tuner.ScanMessage;

/**
 * Frontend Callback.
 *
+55 −14
Original line number Diff line number Diff line
/*
 * Copyright 2019 The Android Open Source Project
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -14,9 +14,13 @@
 * limitations under the License.
 */

package android.media.tv.tuner;
package android.media.tv.tuner.frontend;

import android.media.tv.tuner.TunerConstants.ScanMessageType;
import android.annotation.IntDef;
import android.hardware.tv.tuner.V1_0.Constants;

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

/**
 * Message from frontend during scan operations.
@@ -24,6 +28,43 @@ import android.media.tv.tuner.TunerConstants.ScanMessageType;
 * @hide
 */
public class ScanMessage {

    /** @hide */
    @IntDef({
        LOCKED,
        END,
        PROGRESS_PERCENT,
        FREQUENCY,
        SYMBOL_RATE,
        PLP_IDS,
        GROUP_IDS,
        INPUT_STREAM_IDS,
        STANDARD,
        ATSC3_PLP_INFO
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface Type {}
    /** @hide */
    public static final int LOCKED = Constants.FrontendScanMessageType.LOCKED;
    /** @hide */
    public static final int END = Constants.FrontendScanMessageType.END;
    /** @hide */
    public static final int PROGRESS_PERCENT = Constants.FrontendScanMessageType.PROGRESS_PERCENT;
    /** @hide */
    public static final int FREQUENCY = Constants.FrontendScanMessageType.FREQUENCY;
    /** @hide */
    public static final int SYMBOL_RATE = Constants.FrontendScanMessageType.SYMBOL_RATE;
    /** @hide */
    public static final int PLP_IDS = Constants.FrontendScanMessageType.PLP_IDS;
    /** @hide */
    public static final int GROUP_IDS = Constants.FrontendScanMessageType.GROUP_IDS;
    /** @hide */
    public static final int INPUT_STREAM_IDS = Constants.FrontendScanMessageType.INPUT_STREAM_IDS;
    /** @hide */
    public static final int STANDARD = Constants.FrontendScanMessageType.STANDARD;
    /** @hide */
    public static final int ATSC3_PLP_INFO = Constants.FrontendScanMessageType.ATSC3_PLP_INFO;

    private final int mType;
    private final Object mValue;

@@ -33,69 +74,69 @@ public class ScanMessage {
    }

    /** Gets scan message type. */
    @ScanMessageType
    @Type
    public int getMessageType() {
        return mType;
    }
    /** Message indicates whether frontend is locked or not. */
    public boolean getIsLocked() {
        if (mType != TunerConstants.SCAN_MESSAGE_TYPE_LOCKED) {
        if (mType != LOCKED) {
            throw new IllegalStateException();
        }
        return (Boolean) mValue;
    }
    /** Message indicates whether the scan has reached the end or not. */
    public boolean getIsEnd() {
        if (mType != TunerConstants.SCAN_MESSAGE_TYPE_END) {
        if (mType != END) {
            throw new IllegalStateException();
        }
        return (Boolean) mValue;
    }
    /** Progress message in percent. */
    public int getProgressPercent() {
        if (mType != TunerConstants.SCAN_MESSAGE_TYPE_PROGRESS_PERCENT) {
        if (mType != PROGRESS_PERCENT) {
            throw new IllegalStateException();
        }
        return (Integer) mValue;
    }
    /** Gets frequency. */
    public int getFrequency() {
        if (mType != TunerConstants.SCAN_MESSAGE_TYPE_FREQUENCY) {
        if (mType != FREQUENCY) {
            throw new IllegalStateException();
        }
        return (Integer) mValue;
    }
    /** Gets symbol rate. */
    public int getSymbolRate() {
        if (mType != TunerConstants.SCAN_MESSAGE_TYPE_SYMBOL_RATE) {
        if (mType != SYMBOL_RATE) {
            throw new IllegalStateException();
        }
        return (Integer) mValue;
    }
    /** Gets PLP IDs. */
    public int[] getPlpIds() {
        if (mType != TunerConstants.SCAN_MESSAGE_TYPE_PLP_IDS) {
        if (mType != PLP_IDS) {
            throw new IllegalStateException();
        }
        return (int[]) mValue;
    }
    /** Gets group IDs. */
    public int[] getGroupIds() {
        if (mType != TunerConstants.SCAN_MESSAGE_TYPE_GROUP_IDS) {
        if (mType != GROUP_IDS) {
            throw new IllegalStateException();
        }
        return (int[]) mValue;
    }
    /** Gets Input stream IDs. */
    public int[] getInputStreamIds() {
        if (mType != TunerConstants.SCAN_MESSAGE_TYPE_INPUT_STREAM_IDS) {
        if (mType != INPUT_STREAM_IDS) {
            throw new IllegalStateException();
        }
        return (int[]) mValue;
    }
    /** Gets the DVB-T or DVB-S standard. */
    public int getStandard() {
        if (mType != TunerConstants.SCAN_MESSAGE_TYPE_STANDARD) {
        if (mType != STANDARD) {
            throw new IllegalStateException();
        }
        return (int) mValue;
@@ -103,7 +144,7 @@ public class ScanMessage {

    /** Gets PLP information for ATSC3. */
    public Atsc3PlpInfo[] getAtsc3PlpInfos() {
        if (mType != TunerConstants.SCAN_MESSAGE_TYPE_ATSC3_PLP_INFO) {
        if (mType != ATSC3_PLP_INFO) {
            throw new IllegalStateException();
        }
        return (Atsc3PlpInfo[]) mValue;