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

Commit 350ce51a authored by Nathalie Le Clair's avatar Nathalie Le Clair Committed by Android (Google) Code Review
Browse files

Merge changes from topics "audiodescriptor_apis", "hdmiportinfo_apis"

* changes:
  Parse raw eARC capabilities
  Process eARC capabilities reported by the HAL
  Process eARC status updates from HAL
  Enable and disable eARC in the HAL
  Add HdmiEarcController stub
  Add eARC info to HdmiPortInfo
  Create and remove HdmiEarcLocalDeviceTx
parents e157dd3e 8658ee82
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -20429,6 +20429,8 @@ package android.media {
    field @NonNull public static final android.os.Parcelable.Creator<android.media.AudioDescriptor> CREATOR;
    field public static final int STANDARD_EDID = 1; // 0x1
    field public static final int STANDARD_NONE = 0; // 0x0
    field public static final int STANDARD_SADB = 2; // 0x2
    field public static final int STANDARD_VSADB = 3; // 0x3
  }
  public abstract class AudioDeviceCallback {
+2 −0
Original line number Diff line number Diff line
@@ -4531,12 +4531,14 @@ package android.hardware.hdmi {
  public final class HdmiPortInfo implements android.os.Parcelable {
    ctor public HdmiPortInfo(int, int, int, boolean, boolean, boolean);
    ctor public HdmiPortInfo(int, int, int, boolean, boolean, boolean, boolean);
    method public int describeContents();
    method public int getAddress();
    method public int getId();
    method public int getType();
    method public boolean isArcSupported();
    method public boolean isCecSupported();
    method public boolean isEarcSupported();
    method public boolean isMhlSupported();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.hdmi.HdmiPortInfo> CREATOR;
+35 −5
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ import android.os.Parcelable;

/**
 * A class to encapsulate HDMI port information. Contains the capability of the ports such as
 * HDMI-CEC, MHL, ARC(Audio Return Channel), and physical address assigned to each port.
 * HDMI-CEC, MHL, ARC(Audio Return Channel), eARC and physical address assigned to each port.
 *
 * @hide
 */
@@ -40,6 +40,7 @@ public final class HdmiPortInfo implements Parcelable {
    private final int mAddress;
    private final boolean mCecSupported;
    private final boolean mArcSupported;
    private final boolean mEarcSupported;
    private final boolean mMhlSupported;

    /**
@@ -53,11 +54,28 @@ public final class HdmiPortInfo implements Parcelable {
     * @param arc {@code true} if audio return channel is supported on the port
     */
    public HdmiPortInfo(int id, int type, int address, boolean cec, boolean mhl, boolean arc) {
        this(id, type, address, cec, mhl, arc, false);
    }

    /**
     * Constructor.
     *
     * @param id identifier assigned to each port. 1 for HDMI port 1
     * @param type HDMI port input/output type
     * @param address physical address of the port
     * @param cec {@code true} if HDMI-CEC is supported on the port
     * @param mhl {@code true} if MHL is supported on the port
     * @param arc {@code true} if audio return channel is supported on the port
     * @param earc {@code true} if eARC is supported on the port
     */
    public HdmiPortInfo(int id, int type, int address,
            boolean cec, boolean mhl, boolean arc, boolean earc) {
        mId = id;
        mType = type;
        mAddress = address;
        mCecSupported = cec;
        mArcSupported = arc;
        mEarcSupported = earc;
        mMhlSupported = mhl;
    }

@@ -115,6 +133,15 @@ public final class HdmiPortInfo implements Parcelable {
        return mArcSupported;
    }

    /**
     * Returns {@code true} if the port supports eARC.
     *
     * @return {@code true} if the port supports eARC.
     */
    public boolean isEarcSupported() {
        return mEarcSupported;
    }

    /**
     * Describes the kinds of special objects contained in this Parcelable's
     * marshalled representation.
@@ -138,7 +165,8 @@ public final class HdmiPortInfo implements Parcelable {
                    boolean cec = (source.readInt() == 1);
                    boolean arc = (source.readInt() == 1);
                    boolean mhl = (source.readInt() == 1);
                    return new HdmiPortInfo(id, type, address, cec, mhl, arc);
                    boolean earc = (source.readInt() == 1);
                    return new HdmiPortInfo(id, type, address, cec, mhl, arc, earc);
                }

                @Override
@@ -164,6 +192,7 @@ public final class HdmiPortInfo implements Parcelable {
        dest.writeInt(mCecSupported ? 1 : 0);
        dest.writeInt(mArcSupported ? 1 : 0);
        dest.writeInt(mMhlSupported ? 1 : 0);
        dest.writeInt(mEarcSupported ? 1 : 0);
    }

    @NonNull
@@ -175,7 +204,8 @@ public final class HdmiPortInfo implements Parcelable {
        s.append("address: ").append(String.format("0x%04x", mAddress)).append(", ");
        s.append("cec: ").append(mCecSupported).append(", ");
        s.append("arc: ").append(mArcSupported).append(", ");
        s.append("mhl: ").append(mMhlSupported);
        s.append("mhl: ").append(mMhlSupported).append(", ");
        s.append("earc: ").append(mEarcSupported);
        return s.toString();
    }

@@ -187,12 +217,12 @@ public final class HdmiPortInfo implements Parcelable {
        final HdmiPortInfo other = (HdmiPortInfo) o;
        return mId == other.mId && mType == other.mType && mAddress == other.mAddress
                && mCecSupported == other.mCecSupported && mArcSupported == other.mArcSupported
                && mMhlSupported == other.mMhlSupported;
                && mMhlSupported == other.mMhlSupported && mEarcSupported == other.mEarcSupported;
    }

    @Override
    public int hashCode() {
        return java.util.Objects.hash(
                mId, mType, mAddress, mCecSupported, mArcSupported, mMhlSupported);
                mId, mType, mAddress, mCecSupported, mArcSupported, mMhlSupported, mEarcSupported);
    }
}
+8 −0
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@ namespace android {
// keep these values in sync with ExtraAudioDescriptor.java
#define STANDARD_NONE 0
#define STANDARD_EDID 1
#define STANDARD_SADB 2
#define STANDARD_VSADB 3

static inline status_t audioStandardFromNative(audio_standard_t nStandard, int* standard) {
    status_t result = NO_ERROR;
@@ -35,6 +37,12 @@ static inline status_t audioStandardFromNative(audio_standard_t nStandard, int*
        case AUDIO_STANDARD_EDID:
            *standard = STANDARD_EDID;
            break;
        case AUDIO_STANDARD_SADB:
            *standard = STANDARD_SADB;
            break;
        case AUDIO_STANDARD_VSADB:
            *standard = STANDARD_VSADB;
            break;
        default:
            result = BAD_VALUE;
    }
+20 −8
Original line number Diff line number Diff line
@@ -37,26 +37,38 @@ public class HdmiPortInfoTest {
        boolean isCec = true;
        boolean isMhl = false;
        boolean isArcSupported = false;
        boolean isEarcSupported = false;

        new EqualsTester()
                .addEqualityGroup(
                        new HdmiPortInfo(portId, portType, address, isCec, isMhl, isArcSupported),
                        new HdmiPortInfo(portId, portType, address, isCec, isMhl, isArcSupported))
                        new HdmiPortInfo(portId, portType, address, isCec, isMhl, isArcSupported,
                                isEarcSupported),
                        new HdmiPortInfo(portId, portType, address, isCec, isMhl, isArcSupported,
                                isEarcSupported))
                .addEqualityGroup(
                        new HdmiPortInfo(
                                portId + 1, portType, address, isCec, isMhl, isArcSupported))
                                portId + 1, portType, address, isCec, isMhl, isArcSupported,
                                isEarcSupported))
                .addEqualityGroup(
                        new HdmiPortInfo(
                                portId, portType + 1, address, isCec, isMhl, isArcSupported))
                                portId, portType + 1, address, isCec, isMhl, isArcSupported,
                                isEarcSupported))
                .addEqualityGroup(
                        new HdmiPortInfo(
                                portId, portType, address + 1, isCec, isMhl, isArcSupported))
                                portId, portType, address + 1, isCec, isMhl, isArcSupported,
                                isEarcSupported))
                .addEqualityGroup(
                        new HdmiPortInfo(portId, portType, address, !isCec, isMhl, isArcSupported))
                        new HdmiPortInfo(portId, portType, address, !isCec, isMhl, isArcSupported,
                                isEarcSupported))
                .addEqualityGroup(
                        new HdmiPortInfo(portId, portType, address, isCec, !isMhl, isArcSupported))
                        new HdmiPortInfo(portId, portType, address, isCec, !isMhl, isArcSupported,
                                isEarcSupported))
                .addEqualityGroup(
                        new HdmiPortInfo(portId, portType, address, isCec, isMhl, !isArcSupported))
                        new HdmiPortInfo(portId, portType, address, isCec, isMhl, !isArcSupported,
                                isEarcSupported))
                .addEqualityGroup(
                        new HdmiPortInfo(portId, portType, address, isCec, isMhl, isArcSupported,
                                !isEarcSupported))
                .testEquals();
    }
}
Loading