diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 681a94752e5bb..a1671ab575791 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -4596,8 +4596,7 @@ 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); + ctor @Deprecated public HdmiPortInfo(int, int, int, boolean, boolean, boolean); method public int describeContents(); method public int getAddress(); method public int getId(); @@ -4612,6 +4611,15 @@ package android.hardware.hdmi { field public static final int PORT_OUTPUT = 1; // 0x1 } + public static final class HdmiPortInfo.Builder { + ctor public HdmiPortInfo.Builder(int, int, int); + method @NonNull public android.hardware.hdmi.HdmiPortInfo build(); + method @NonNull public android.hardware.hdmi.HdmiPortInfo.Builder setArcSupported(boolean); + method @NonNull public android.hardware.hdmi.HdmiPortInfo.Builder setCecSupported(boolean); + method @NonNull public android.hardware.hdmi.HdmiPortInfo.Builder setEarcSupported(boolean); + method @NonNull public android.hardware.hdmi.HdmiPortInfo.Builder setMhlSupported(boolean); + } + public abstract class HdmiRecordListener { ctor public HdmiRecordListener(); method public void onClearTimerRecordingResult(int, int); diff --git a/core/java/android/hardware/hdmi/HdmiPortInfo.java b/core/java/android/hardware/hdmi/HdmiPortInfo.java index 5bb1f035f8487..561541886cfdf 100644 --- a/core/java/android/hardware/hdmi/HdmiPortInfo.java +++ b/core/java/android/hardware/hdmi/HdmiPortInfo.java @@ -15,14 +15,20 @@ */ package android.hardware.hdmi; +import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; +import androidx.annotation.IntRange; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + /** - * A class to encapsulate HDMI port information. Contains the capability of the ports such as + * Encapsulates HDMI port information. Contains the capability of the ports such as * HDMI-CEC, MHL, ARC(Audio Return Channel), eARC and physical address assigned to each port. * * @hide @@ -35,6 +41,18 @@ public final class HdmiPortInfo implements Parcelable { /** HDMI port type: Output */ public static final int PORT_OUTPUT = 1; + /** + * @hide + * + * @see HdmiPortInfo#getType() + */ + @IntDef(prefix = { "PORT_" }, value = { + PORT_INPUT, + PORT_OUTPUT + }) + @Retention(RetentionPolicy.SOURCE) + public @interface PortType {} + private final int mId; private final int mType; private final int mAddress; @@ -46,43 +64,48 @@ public final class HdmiPortInfo implements Parcelable { /** * Constructor. * - * @param id identifier assigned to each port. 1 for HDMI port 1 + * @param id identifier assigned to each port. 1 for HDMI OUT 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 - */ - 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 + * @deprecated use {@link Builder()} instead */ - public HdmiPortInfo(int id, int type, int address, - boolean cec, boolean mhl, boolean arc, boolean earc) { + @Deprecated + public HdmiPortInfo(int id, @PortType int type, + @IntRange(from = 0) int address, boolean cec, boolean mhl, boolean arc) { mId = id; mType = type; mAddress = address; mCecSupported = cec; mArcSupported = arc; - mEarcSupported = earc; + mEarcSupported = false; mMhlSupported = mhl; } /** - * Returns the port id. + * Converts an instance to a builder * - * @return port id + * @hide + */ + public Builder toBuilder() { + return new Builder(this); + } + + private HdmiPortInfo(Builder builder) { + this.mId = builder.mId; + this.mType = builder.mType; + this.mAddress = builder.mAddress; + this.mCecSupported = builder.mCecSupported; + this.mArcSupported = builder.mArcSupported; + this.mEarcSupported = builder.mEarcSupported; + this.mMhlSupported = builder.mMhlSupported; + } + + /** + * Returns the port id. */ public int getId() { return mId; @@ -90,26 +113,22 @@ public final class HdmiPortInfo implements Parcelable { /** * Returns the port type. - * - * @return port type */ + @PortType public int getType() { return mType; } /** * Returns the port address. - * - * @return port address */ + @IntRange(from = 0) public int getAddress() { return mAddress; } /** * Returns {@code true} if the port supports HDMI-CEC signaling. - * - * @return {@code true} if the port supports HDMI-CEC signaling. */ public boolean isCecSupported() { return mCecSupported; @@ -117,8 +136,6 @@ public final class HdmiPortInfo implements Parcelable { /** * Returns {@code true} if the port supports MHL signaling. - * - * @return {@code true} if the port supports MHL signaling. */ public boolean isMhlSupported() { return mMhlSupported; @@ -126,8 +143,6 @@ public final class HdmiPortInfo implements Parcelable { /** * Returns {@code true} if the port supports audio return channel. - * - * @return {@code true} if the port supports audio return channel */ public boolean isArcSupported() { return mArcSupported; @@ -135,8 +150,6 @@ public final class HdmiPortInfo implements Parcelable { /** * Returns {@code true} if the port supports eARC. - * - * @return {@code true} if the port supports eARC. */ public boolean isEarcSupported() { return mEarcSupported; @@ -166,7 +179,12 @@ public final class HdmiPortInfo implements Parcelable { boolean arc = (source.readInt() == 1); boolean mhl = (source.readInt() == 1); boolean earc = (source.readInt() == 1); - return new HdmiPortInfo(id, type, address, cec, mhl, arc, earc); + return new Builder(id, type, address) + .setCecSupported(cec) + .setArcSupported(arc) + .setEarcSupported(earc) + .setMhlSupported(mhl) + .build(); } @Override @@ -225,4 +243,95 @@ public final class HdmiPortInfo implements Parcelable { return java.util.Objects.hash( mId, mType, mAddress, mCecSupported, mArcSupported, mMhlSupported, mEarcSupported); } + + /** + * Builder for {@link HdmiPortInfo} instances. + */ + public static final class Builder { + // Required parameters + private int mId; + private int mType; + private int mAddress; + + // Optional parameters that are set to false by default. + private boolean mCecSupported; + private boolean mArcSupported; + private boolean mEarcSupported; + private boolean mMhlSupported; + + /** + * Constructor + * + * @param id identifier assigned to each port. 1 for HDMI OUT port 1 + * @param type HDMI port input/output type + * @param address physical address of the port + * @throws IllegalArgumentException if the parameters are invalid + */ + public Builder(int id, @PortType int type, @IntRange(from = 0) int address) { + if (type != PORT_INPUT && type != PORT_OUTPUT) { + throw new IllegalArgumentException( + "type should be " + PORT_INPUT + " or " + PORT_OUTPUT + "."); + } + if (address < 0) { + throw new IllegalArgumentException("address should be positive."); + } + mId = id; + mType = type; + mAddress = address; + } + + private Builder(@NonNull HdmiPortInfo hdmiPortInfo) { + mId = hdmiPortInfo.mId; + mType = hdmiPortInfo.mType; + mAddress = hdmiPortInfo.mAddress; + mCecSupported = hdmiPortInfo.mCecSupported; + mArcSupported = hdmiPortInfo.mArcSupported; + mEarcSupported = hdmiPortInfo.mEarcSupported; + mMhlSupported = hdmiPortInfo.mMhlSupported; + } + + /** + * Create a new {@link HdmiPortInfo} object. + */ + @NonNull + public HdmiPortInfo build() { + return new HdmiPortInfo(this); + } + + /** + * Sets the value for whether the port supports HDMI-CEC signaling. + */ + @NonNull + public Builder setCecSupported(boolean supported) { + mCecSupported = supported; + return this; + } + + /** + * Sets the value for whether the port supports audio return channel. + */ + @NonNull + public Builder setArcSupported(boolean supported) { + mArcSupported = supported; + return this; + } + + /** + * Sets the value for whether the port supports eARC. + */ + @NonNull + public Builder setEarcSupported(boolean supported) { + mEarcSupported = supported; + return this; + } + + /** + * Sets the value for whether the port supports MHL signaling. + */ + @NonNull + public Builder setMhlSupported(boolean supported) { + mMhlSupported = supported; + return this; + } + } } diff --git a/core/tests/hdmitests/src/android/hardware/hdmi/HdmiPortInfoTest.java b/core/tests/hdmitests/src/android/hardware/hdmi/HdmiPortInfoTest.java index 64df3487bf530..e82b69903d180 100755 --- a/core/tests/hdmitests/src/android/hardware/hdmi/HdmiPortInfoTest.java +++ b/core/tests/hdmitests/src/android/hardware/hdmi/HdmiPortInfoTest.java @@ -41,34 +41,58 @@ public class HdmiPortInfoTest { new EqualsTester() .addEqualityGroup( - new HdmiPortInfo(portId, portType, address, isCec, isMhl, isArcSupported, - isEarcSupported), - new HdmiPortInfo(portId, portType, address, isCec, isMhl, isArcSupported, - isEarcSupported)) + new HdmiPortInfo.Builder(portId, portType, address) + .setCecSupported(isCec) + .setMhlSupported(isMhl) + .setArcSupported(isArcSupported) + .setEarcSupported(isEarcSupported), + new HdmiPortInfo.Builder(portId, portType, address) + .setCecSupported(isCec) + .setMhlSupported(isMhl) + .setArcSupported(isArcSupported) + .setEarcSupported(isEarcSupported)) .addEqualityGroup( - new HdmiPortInfo( - portId + 1, portType, address, isCec, isMhl, isArcSupported, - isEarcSupported)) + new HdmiPortInfo.Builder(portId + 1, portType, address) + .setCecSupported(isCec) + .setMhlSupported(isMhl) + .setArcSupported(isArcSupported) + .setEarcSupported(isEarcSupported)) .addEqualityGroup( - new HdmiPortInfo( - portId, portType + 1, address, isCec, isMhl, isArcSupported, - isEarcSupported)) + new HdmiPortInfo.Builder(portId, portType + 1, address) + .setCecSupported(isCec) + .setMhlSupported(isMhl) + .setArcSupported(isArcSupported) + .setEarcSupported(isEarcSupported)) .addEqualityGroup( - new HdmiPortInfo( - portId, portType, address + 1, isCec, isMhl, isArcSupported, - isEarcSupported)) + new HdmiPortInfo.Builder(portId, portType, address + 1) + .setCecSupported(isCec) + .setMhlSupported(isMhl) + .setArcSupported(isArcSupported) + .setEarcSupported(isEarcSupported)) .addEqualityGroup( - new HdmiPortInfo(portId, portType, address, !isCec, isMhl, isArcSupported, - isEarcSupported)) + new HdmiPortInfo.Builder(portId, portType, address) + .setCecSupported(!isCec) + .setMhlSupported(isMhl) + .setArcSupported(isArcSupported) + .setEarcSupported(isEarcSupported)) .addEqualityGroup( - new HdmiPortInfo(portId, portType, address, isCec, !isMhl, isArcSupported, - isEarcSupported)) + new HdmiPortInfo.Builder(portId, portType, address) + .setCecSupported(isCec) + .setMhlSupported(!isMhl) + .setArcSupported(isArcSupported) + .setEarcSupported(isEarcSupported)) .addEqualityGroup( - new HdmiPortInfo(portId, portType, address, isCec, isMhl, !isArcSupported, - isEarcSupported)) + new HdmiPortInfo.Builder(portId, portType, address) + .setCecSupported(isCec) + .setMhlSupported(isMhl) + .setArcSupported(!isArcSupported) + .setEarcSupported(isEarcSupported)) .addEqualityGroup( - new HdmiPortInfo(portId, portType, address, isCec, isMhl, isArcSupported, - !isEarcSupported)) + new HdmiPortInfo.Builder(portId, portType, address) + .setCecSupported(isCec) + .setMhlSupported(isMhl) + .setArcSupported(isArcSupported) + .setEarcSupported(!isEarcSupported)) .testEquals(); } } diff --git a/services/core/java/com/android/server/hdmi/HdmiCecController.java b/services/core/java/com/android/server/hdmi/HdmiCecController.java index ceb8785574d00..96faee207e58d 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecController.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecController.java @@ -1096,15 +1096,15 @@ final class HdmiCecController { HdmiPortInfo[] hdmiPortInfo = new HdmiPortInfo[hdmiPortInfos.length]; int i = 0; for (android.hardware.tv.hdmi.connection.HdmiPortInfo portInfo : hdmiPortInfos) { - hdmiPortInfo[i] = - new HdmiPortInfo( + hdmiPortInfo[i] = new HdmiPortInfo.Builder( portInfo.portId, portInfo.type, - portInfo.physicalAddress, - portInfo.cecSupported, - false, - portInfo.arcSupported, - false); + portInfo.physicalAddress) + .setCecSupported(portInfo.cecSupported) + .setMhlSupported(false) + .setArcSupported(portInfo.arcSupported) + .setEarcSupported(false) + .build(); i++; } return hdmiPortInfo; @@ -1260,13 +1260,15 @@ final class HdmiCecController { HdmiPortInfo[] hdmiPortInfo = new HdmiPortInfo[hdmiPortInfos.size()]; int i = 0; for (android.hardware.tv.cec.V1_0.HdmiPortInfo portInfo : hdmiPortInfos) { - hdmiPortInfo[i] = new HdmiPortInfo(portInfo.portId, + hdmiPortInfo[i] = new HdmiPortInfo.Builder( + portInfo.portId, portInfo.type, - portInfo.physicalAddress, - portInfo.cecSupported, - false, - portInfo.arcSupported, - false); + portInfo.physicalAddress) + .setCecSupported(portInfo.cecSupported) + .setMhlSupported(false) + .setArcSupported(portInfo.arcSupported) + .setEarcSupported(false) + .build(); i++; } return hdmiPortInfo; @@ -1442,13 +1444,15 @@ final class HdmiCecController { HdmiPortInfo[] hdmiPortInfo = new HdmiPortInfo[hdmiPortInfos.size()]; int i = 0; for (android.hardware.tv.cec.V1_0.HdmiPortInfo portInfo : hdmiPortInfos) { - hdmiPortInfo[i] = new HdmiPortInfo(portInfo.portId, + hdmiPortInfo[i] = new HdmiPortInfo.Builder( + portInfo.portId, portInfo.type, - portInfo.physicalAddress, - portInfo.cecSupported, - false, - portInfo.arcSupported, - false); + portInfo.physicalAddress) + .setCecSupported(portInfo.cecSupported) + .setMhlSupported(false) + .setArcSupported(portInfo.arcSupported) + .setEarcSupported(false) + .build(); i++; } return hdmiPortInfo; diff --git a/services/core/java/com/android/server/hdmi/HdmiCecNetwork.java b/services/core/java/com/android/server/hdmi/HdmiCecNetwork.java index a57292af70286..18a69c8e9d81b 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecNetwork.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecNetwork.java @@ -469,9 +469,12 @@ public class HdmiCecNetwork { ArrayList result = new ArrayList<>(cecPortInfo.length); for (HdmiPortInfo info : cecPortInfo) { if (mhlSupportedPorts.contains(info.getId())) { - result.add(new HdmiPortInfo(info.getId(), info.getType(), info.getAddress(), - info.isCecSupported(), true, info.isArcSupported(), - info.isEarcSupported())); + result.add(new HdmiPortInfo.Builder(info.getId(), info.getType(), info.getAddress()) + .setCecSupported(info.isCecSupported()) + .setMhlSupported(true) + .setArcSupported(info.isArcSupported()) + .setEarcSupported(info.isEarcSupported()) + .build()); } else { result.add(info); } diff --git a/services/tests/servicestests/src/com/android/server/hdmi/BaseAbsoluteVolumeControlTest.java b/services/tests/servicestests/src/com/android/server/hdmi/BaseAbsoluteVolumeControlTest.java index 93b151ec19eaf..9f295b8f42c2f 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/BaseAbsoluteVolumeControlTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/BaseAbsoluteVolumeControlTest.java @@ -175,7 +175,11 @@ public abstract class BaseAbsoluteVolumeControlTest { HdmiPortInfo[] hdmiPortInfos = new HdmiPortInfo[1]; hdmiPortInfos[0] = - new HdmiPortInfo(1, HdmiPortInfo.PORT_OUTPUT, 0x0000, true, false, false); + new HdmiPortInfo.Builder(1, HdmiPortInfo.PORT_OUTPUT, 0x0000) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .build(); mNativeWrapper.setPortInfo(hdmiPortInfos); mNativeWrapper.setPortConnectionStatus(1, true); diff --git a/services/tests/servicestests/src/com/android/server/hdmi/DeviceSelectActionFromTvTest.java b/services/tests/servicestests/src/com/android/server/hdmi/DeviceSelectActionFromTvTest.java index 4d8d25aeb2f63..9c1b67010d033 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/DeviceSelectActionFromTvTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/DeviceSelectActionFromTvTest.java @@ -137,11 +137,17 @@ public class DeviceSelectActionFromTvTest { mHdmiControlService.setHdmiMhlController(HdmiMhlControllerStub.create(mHdmiControlService)); HdmiPortInfo[] hdmiPortInfos = new HdmiPortInfo[2]; hdmiPortInfos[0] = - new HdmiPortInfo(1, HdmiPortInfo.PORT_INPUT, PHYSICAL_ADDRESS_PLAYBACK_1, - true, false, false); + new HdmiPortInfo.Builder(1, HdmiPortInfo.PORT_INPUT, PHYSICAL_ADDRESS_PLAYBACK_1) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .build(); hdmiPortInfos[1] = - new HdmiPortInfo(2, HdmiPortInfo.PORT_INPUT, PHYSICAL_ADDRESS_PLAYBACK_2, - true, false, false); + new HdmiPortInfo.Builder(2, HdmiPortInfo.PORT_INPUT, PHYSICAL_ADDRESS_PLAYBACK_2) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .build(); mNativeWrapper.setPortInfo(hdmiPortInfos); mHdmiControlService.initService(); mHdmiControlService.onBootPhase(PHASE_SYSTEM_SERVICES_READY); diff --git a/services/tests/servicestests/src/com/android/server/hdmi/FakeNativeWrapper.java b/services/tests/servicestests/src/com/android/server/hdmi/FakeNativeWrapper.java index bb50a89efe832..93508d0281cef 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/FakeNativeWrapper.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/FakeNativeWrapper.java @@ -112,7 +112,11 @@ final class FakeNativeWrapper implements NativeWrapper { public HdmiPortInfo[] nativeGetPortInfos() { if (mHdmiPortInfo == null) { mHdmiPortInfo = new HdmiPortInfo[1]; - mHdmiPortInfo[0] = new HdmiPortInfo(1, 1, 0x1000, true, true, true); + mHdmiPortInfo[0] = new HdmiPortInfo.Builder(1, 1, 0x1000) + .setCecSupported(true) + .setMhlSupported(true) + .setArcSupported(true) + .build(); } return mHdmiPortInfo; } diff --git a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecAtomLoggingTest.java b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecAtomLoggingTest.java index f27587e39a994..e3d95586f9436 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecAtomLoggingTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecAtomLoggingTest.java @@ -118,7 +118,11 @@ public class HdmiCecAtomLoggingTest { HdmiPortInfo[] hdmiPortInfos = new HdmiPortInfo[1]; hdmiPortInfos[0] = - new HdmiPortInfo(1, HdmiPortInfo.PORT_OUTPUT, 0x0000, true, false, false); + new HdmiPortInfo.Builder(1, HdmiPortInfo.PORT_OUTPUT, 0x0000) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .build(); mNativeWrapper.setPortInfo(hdmiPortInfos); mNativeWrapper.setPortConnectionStatus(1, true); diff --git a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystemTest.java b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystemTest.java index 90acc9951dcde..f5c0f2a0a4b68 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystemTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystemTest.java @@ -197,17 +197,29 @@ public class HdmiCecLocalDeviceAudioSystemTest { mHdmiCecLocalDeviceAudioSystem.setRoutingControlFeatureEnabled(true); mHdmiPortInfo = new HdmiPortInfo[4]; mHdmiPortInfo[0] = - new HdmiPortInfo( - 0, HdmiPortInfo.PORT_INPUT, SELF_PHYSICAL_ADDRESS, true, false, false); + new HdmiPortInfo.Builder(0, HdmiPortInfo.PORT_INPUT, SELF_PHYSICAL_ADDRESS) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .build(); mHdmiPortInfo[1] = - new HdmiPortInfo( - 2, HdmiPortInfo.PORT_INPUT, HDMI_1_PHYSICAL_ADDRESS, true, false, false); + new HdmiPortInfo.Builder(2, HdmiPortInfo.PORT_INPUT, HDMI_1_PHYSICAL_ADDRESS) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .build(); mHdmiPortInfo[2] = - new HdmiPortInfo( - 1, HdmiPortInfo.PORT_INPUT, HDMI_2_PHYSICAL_ADDRESS, true, false, false); + new HdmiPortInfo.Builder(1, HdmiPortInfo.PORT_INPUT, HDMI_2_PHYSICAL_ADDRESS) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .build(); mHdmiPortInfo[3] = - new HdmiPortInfo( - 4, HdmiPortInfo.PORT_INPUT, HDMI_3_PHYSICAL_ADDRESS, true, false, false); + new HdmiPortInfo.Builder(4, HdmiPortInfo.PORT_INPUT, HDMI_3_PHYSICAL_ADDRESS) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .build(); mNativeWrapper.setPortInfo(mHdmiPortInfo); mHdmiControlService.initService(); mHdmiControlService.onBootPhase(PHASE_SYSTEM_SERVICES_READY); diff --git a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDevicePlaybackTest.java b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDevicePlaybackTest.java index dfab207beccd8..beba9c64a88f2 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDevicePlaybackTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDevicePlaybackTest.java @@ -150,7 +150,11 @@ public class HdmiCecLocalDevicePlaybackTest { mHdmiControlService.setHdmiMhlController(HdmiMhlControllerStub.create(mHdmiControlService)); HdmiPortInfo[] hdmiPortInfos = new HdmiPortInfo[1]; hdmiPortInfos[0] = - new HdmiPortInfo(1, HdmiPortInfo.PORT_OUTPUT, 0x0000, true, false, false); + new HdmiPortInfo.Builder(1, HdmiPortInfo.PORT_OUTPUT, 0x0000) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .build(); mNativeWrapper.setPortInfo(hdmiPortInfos); mNativeWrapper.setPortConnectionStatus(1, true); mHdmiControlService.initService(); diff --git a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTest.java b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTest.java index 3796ce9a5d808..9c5c0d4dd66f0 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTest.java @@ -189,7 +189,11 @@ public class HdmiCecLocalDeviceTest { mLocalDevices.add(mHdmiLocalDevice); HdmiPortInfo[] hdmiPortInfos = new HdmiPortInfo[1]; hdmiPortInfos[0] = - new HdmiPortInfo(1, HdmiPortInfo.PORT_OUTPUT, 0x0000, true, false, false); + new HdmiPortInfo.Builder(1, HdmiPortInfo.PORT_OUTPUT, 0x0000) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .build(); mNativeWrapper.setPortInfo(hdmiPortInfos); mNativeWrapper.setPortConnectionStatus(1, true); mHdmiControlService.initService(); diff --git a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTvTest.java b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTvTest.java index cb1e78b567cec..ccfc2b969745f 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTvTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecLocalDeviceTvTest.java @@ -193,10 +193,19 @@ public class HdmiCecLocalDeviceTvTest { mHdmiControlService.setEarcController(mHdmiEarcController); mHdmiControlService.setHdmiMhlController(HdmiMhlControllerStub.create(mHdmiControlService)); HdmiPortInfo[] hdmiPortInfos = new HdmiPortInfo[2]; - hdmiPortInfos[0] = - new HdmiPortInfo(1, HdmiPortInfo.PORT_INPUT, 0x1000, true, false, false, false); + hdmiPortInfos[0] = new HdmiPortInfo.Builder(1, HdmiPortInfo.PORT_INPUT, 0x1000) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .setEarcSupported(false) + .build(); hdmiPortInfos[1] = - new HdmiPortInfo(2, HdmiPortInfo.PORT_INPUT, 0x2000, true, false, true, true); + new HdmiPortInfo.Builder(2, HdmiPortInfo.PORT_INPUT, 0x2000) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(true) + .setEarcSupported(true) + .build(); mNativeWrapper.setPortInfo(hdmiPortInfos); mHdmiControlService.initService(); mHdmiControlService.onBootPhase(PHASE_SYSTEM_SERVICES_READY); diff --git a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecNetworkTest.java b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecNetworkTest.java index a82a79f06f456..d341153ac0ce1 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecNetworkTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecNetworkTest.java @@ -92,15 +92,35 @@ public class HdmiCecNetworkTest { mHdmiPortInfo = new HdmiPortInfo[5]; mHdmiPortInfo[0] = - new HdmiPortInfo(1, HdmiPortInfo.PORT_INPUT, 0x2100, true, false, false); + new HdmiPortInfo.Builder(1, HdmiPortInfo.PORT_INPUT, 0x2100) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .build(); mHdmiPortInfo[1] = - new HdmiPortInfo(2, HdmiPortInfo.PORT_INPUT, 0x2200, true, false, false); + new HdmiPortInfo.Builder(2, HdmiPortInfo.PORT_INPUT, 0x2200) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .build(); mHdmiPortInfo[2] = - new HdmiPortInfo(3, HdmiPortInfo.PORT_INPUT, 0x2000, true, false, false); + new HdmiPortInfo.Builder(3, HdmiPortInfo.PORT_INPUT, 0x2000) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .build(); mHdmiPortInfo[3] = - new HdmiPortInfo(4, HdmiPortInfo.PORT_INPUT, 0x3000, true, false, false); + new HdmiPortInfo.Builder(4, HdmiPortInfo.PORT_INPUT, 0x3000) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .build(); mHdmiPortInfo[4] = - new HdmiPortInfo(5, HdmiPortInfo.PORT_OUTPUT, 0x0000, true, false, false); + new HdmiPortInfo.Builder(5, HdmiPortInfo.PORT_OUTPUT, 0x0000) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .build(); mNativeWrapper.setPortInfo(mHdmiPortInfo); mHdmiCecNetwork.initPortInfo(); diff --git a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecPowerStatusControllerTest.java b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecPowerStatusControllerTest.java index 8e5bb133f16ca..55e8b20ca7f01 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecPowerStatusControllerTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecPowerStatusControllerTest.java @@ -99,7 +99,11 @@ public class HdmiCecPowerStatusControllerTest { mHdmiControlService.setHdmiMhlController(HdmiMhlControllerStub.create(mHdmiControlService)); HdmiPortInfo[] hdmiPortInfos = new HdmiPortInfo[1]; hdmiPortInfos[0] = - new HdmiPortInfo(1, HdmiPortInfo.PORT_OUTPUT, 0x0000, true, false, false); + new HdmiPortInfo.Builder(1, HdmiPortInfo.PORT_OUTPUT, 0x0000) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .build(); mNativeWrapper.setPortInfo(hdmiPortInfos); mNativeWrapper.setPortConnectionStatus(1, true); mHdmiControlService.initService(); diff --git a/services/tests/servicestests/src/com/android/server/hdmi/HdmiControlServiceTest.java b/services/tests/servicestests/src/com/android/server/hdmi/HdmiControlServiceTest.java index cd6dfbfbb18d4..8baad61b40fb8 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiControlServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiControlServiceTest.java @@ -139,13 +139,33 @@ public class HdmiControlServiceTest { mLocalDevices.add(mPlaybackDeviceSpy); mHdmiPortInfo = new HdmiPortInfo[4]; mHdmiPortInfo[0] = - new HdmiPortInfo(1, HdmiPortInfo.PORT_INPUT, 0x2100, true, false, false, false); + new HdmiPortInfo.Builder(1, HdmiPortInfo.PORT_INPUT, 0x2100) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .setEarcSupported(false) + .build(); mHdmiPortInfo[1] = - new HdmiPortInfo(2, HdmiPortInfo.PORT_INPUT, 0x2200, true, false, false, false); + new HdmiPortInfo.Builder(2, HdmiPortInfo.PORT_INPUT, 0x2200) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .setEarcSupported(false) + .build(); mHdmiPortInfo[2] = - new HdmiPortInfo(3, HdmiPortInfo.PORT_INPUT, 0x2000, true, false, true, true); + new HdmiPortInfo.Builder(3, HdmiPortInfo.PORT_INPUT, 0x2000) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(true) + .setEarcSupported(true) + .build(); mHdmiPortInfo[3] = - new HdmiPortInfo(4, HdmiPortInfo.PORT_INPUT, 0x3000, true, false, false, false); + new HdmiPortInfo.Builder(4, HdmiPortInfo.PORT_INPUT, 0x3000) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .setEarcSupported(false) + .build(); mNativeWrapper.setPortInfo(mHdmiPortInfo); mHdmiControlServiceSpy.initService(); mPowerManager = new FakePowerManagerWrapper(mContextSpy); diff --git a/services/tests/servicestests/src/com/android/server/hdmi/PowerStatusMonitorActionTest.java b/services/tests/servicestests/src/com/android/server/hdmi/PowerStatusMonitorActionTest.java index a623841caa02f..89743cdeabf57 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/PowerStatusMonitorActionTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/PowerStatusMonitorActionTest.java @@ -102,9 +102,17 @@ public class PowerStatusMonitorActionTest { mTestLooper.dispatchAll(); HdmiPortInfo[] hdmiPortInfo = new HdmiPortInfo[2]; hdmiPortInfo[0] = - new HdmiPortInfo(1, HdmiPortInfo.PORT_INPUT, 0x1000, true, false, false); + new HdmiPortInfo.Builder(1, HdmiPortInfo.PORT_INPUT, 0x1000) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .build(); hdmiPortInfo[1] = - new HdmiPortInfo(2, HdmiPortInfo.PORT_INPUT, 0x2000, true, false, false); + new HdmiPortInfo.Builder(2, HdmiPortInfo.PORT_INPUT, 0x2000) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .build(); mNativeWrapper.setPortInfo(hdmiPortInfo); mHdmiControlService.initService(); mHdmiControlService.onBootPhase(PHASE_SYSTEM_SERVICES_READY); diff --git a/services/tests/servicestests/src/com/android/server/hdmi/RoutingControlActionTest.java b/services/tests/servicestests/src/com/android/server/hdmi/RoutingControlActionTest.java index 4e8cf4aea9254..5b1bdf6916da7 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/RoutingControlActionTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/RoutingControlActionTest.java @@ -180,8 +180,11 @@ public class RoutingControlActionTest { mHdmiControlService.setHdmiMhlController(HdmiMhlControllerStub.create(mHdmiControlService)); HdmiPortInfo[] hdmiPortInfos = new HdmiPortInfo[1]; hdmiPortInfos[0] = - new HdmiPortInfo(1, HdmiPortInfo.PORT_INPUT, PHYSICAL_ADDRESS_AVR, - true, false, false); + new HdmiPortInfo.Builder(1, HdmiPortInfo.PORT_INPUT, PHYSICAL_ADDRESS_AVR) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .build(); mNativeWrapper.setPortInfo(hdmiPortInfos); mHdmiControlService.initService(); mHdmiControlService.onBootPhase(PHASE_SYSTEM_SERVICES_READY); diff --git a/services/tests/servicestests/src/com/android/server/hdmi/SystemAudioAutoInitiationActionTest.java b/services/tests/servicestests/src/com/android/server/hdmi/SystemAudioAutoInitiationActionTest.java index 70f9e5cb6e6c6..c40cd0eeaf7e8 100644 --- a/services/tests/servicestests/src/com/android/server/hdmi/SystemAudioAutoInitiationActionTest.java +++ b/services/tests/servicestests/src/com/android/server/hdmi/SystemAudioAutoInitiationActionTest.java @@ -102,9 +102,17 @@ public class SystemAudioAutoInitiationActionTest { mHdmiControlService.setHdmiMhlController(HdmiMhlControllerStub.create(mHdmiControlService)); HdmiPortInfo[] hdmiPortInfos = new HdmiPortInfo[2]; hdmiPortInfos[0] = - new HdmiPortInfo(1, HdmiPortInfo.PORT_INPUT, 0x1000, true, false, false); + new HdmiPortInfo.Builder(1, HdmiPortInfo.PORT_INPUT, 0x1000) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(false) + .build(); hdmiPortInfos[1] = - new HdmiPortInfo(2, HdmiPortInfo.PORT_INPUT, 0x2000, true, false, true); + new HdmiPortInfo.Builder(2, HdmiPortInfo.PORT_INPUT, 0x2000) + .setCecSupported(true) + .setMhlSupported(false) + .setArcSupported(true) + .build(); mNativeWrapper.setPortInfo(hdmiPortInfos); mHdmiControlService.initService(); mHdmiControlService.onBootPhase(PHASE_SYSTEM_SERVICES_READY);