Merge "Replace public constructors by builders"

This commit is contained in:
Nathalie Le Clair
2023-01-24 13:28:15 +00:00
committed by Android (Google) Code Review
19 changed files with 373 additions and 115 deletions

View File

@@ -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);

View File

@@ -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;
}
}
}

View File

@@ -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();
}
}

View File

@@ -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;

View File

@@ -469,9 +469,12 @@ public class HdmiCecNetwork {
ArrayList<HdmiPortInfo> 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);
}

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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);

View File

@@ -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();

View File

@@ -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();

View File

@@ -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);

View File

@@ -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();

View File

@@ -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();

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);