Add portId to HPD-related methods
Test: lunch cf_x86_tv-userdebug; make; atest VtsHalTvHdmiConnectionAidlTargetTest; Bug: 266178786 Change-Id: I58aff832606156bd529f2640541cad530953bd67
This commit is contained in:
parent
2d24cc70f7
commit
4eaa178ddf
5 changed files with 36 additions and 23 deletions
|
@ -37,6 +37,6 @@ interface IHdmiConnection {
|
|||
android.hardware.tv.hdmi.connection.HdmiPortInfo[] getPortInfo();
|
||||
boolean isConnected(in int portId);
|
||||
void setCallback(in android.hardware.tv.hdmi.connection.IHdmiConnectionCallback callback);
|
||||
void setHpdSignal(android.hardware.tv.hdmi.connection.HpdSignal signal);
|
||||
android.hardware.tv.hdmi.connection.HpdSignal getHpdSignal();
|
||||
void setHpdSignal(android.hardware.tv.hdmi.connection.HpdSignal signal, in int portId);
|
||||
android.hardware.tv.hdmi.connection.HpdSignal getHpdSignal(in int portId);
|
||||
}
|
||||
|
|
|
@ -55,16 +55,22 @@ interface IHdmiConnection {
|
|||
* signaling EDID updates). By default, the HAL will use {@code HDMI_HPD_PHYSICAL} (the physical
|
||||
* hotplug signal). When set to {@code HDMI_HPD_STATUS_BIT} the HAL should use the HDP status
|
||||
* bit.
|
||||
*
|
||||
* @param signal The HPD signal type to use.
|
||||
* @param portId id of the port on which the HPD signal should be set.
|
||||
*
|
||||
* @throws ServiceSpecificException with error code set to
|
||||
* {@code Result::FAILURE_NOT_SUPPORTED} if the signal type is not supported.
|
||||
* {@code Result::FAILURE_INVALID_ARGS} if the signal type is invalid.
|
||||
* {@code Result::FAILURE_UNKNOWN} if the signal type could not be set because of an
|
||||
* unknown failure.
|
||||
*/
|
||||
void setHpdSignal(HpdSignal signal);
|
||||
void setHpdSignal(HpdSignal signal, in int portId);
|
||||
|
||||
/**
|
||||
* Get the current signal the HAL is using for HPD
|
||||
*
|
||||
* @param portId id of the port of which the current HPD signal is queried.
|
||||
*/
|
||||
HpdSignal getHpdSignal();
|
||||
HpdSignal getHpdSignal(in int portId);
|
||||
}
|
||||
|
|
|
@ -69,9 +69,9 @@ ScopedAStatus HdmiConnectionMock::setCallback(
|
|||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiConnectionMock::setHpdSignal(HpdSignal signal) {
|
||||
ScopedAStatus HdmiConnectionMock::setHpdSignal(HpdSignal signal, int32_t portId) {
|
||||
if (mHdmiThreadRun) {
|
||||
mHpdSignal = signal;
|
||||
mHpdSignal.at(portId - 1) = signal;
|
||||
return ScopedAStatus::ok();
|
||||
} else {
|
||||
return ScopedAStatus::fromServiceSpecificError(
|
||||
|
@ -79,8 +79,8 @@ ScopedAStatus HdmiConnectionMock::setHpdSignal(HpdSignal signal) {
|
|||
}
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiConnectionMock::getHpdSignal(HpdSignal* _aidl_return) {
|
||||
*_aidl_return = mHpdSignal;
|
||||
ScopedAStatus HdmiConnectionMock::getHpdSignal(int32_t portId, HpdSignal* _aidl_return) {
|
||||
*_aidl_return = mHpdSignal.at(portId - 1);
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
|
@ -179,6 +179,7 @@ HdmiConnectionMock::HdmiConnectionMock() {
|
|||
mCallback = nullptr;
|
||||
mPortInfos.resize(mTotalPorts);
|
||||
mPortConnectionStatus.resize(mTotalPorts);
|
||||
mHpdSignal.resize(mTotalPorts);
|
||||
mPortInfos[0] = {.type = HdmiPortType::OUTPUT,
|
||||
.portId = static_cast<uint32_t>(1),
|
||||
.cecSupported = true,
|
||||
|
@ -186,6 +187,7 @@ HdmiConnectionMock::HdmiConnectionMock() {
|
|||
.eArcSupported = false,
|
||||
.physicalAddress = mPhysicalAddress};
|
||||
mPortConnectionStatus[0] = false;
|
||||
mHpdSignal[0] = HpdSignal::HDMI_HPD_PHYSICAL;
|
||||
mDeathRecipient = ndk::ScopedAIBinder_DeathRecipient(AIBinder_DeathRecipient_new(serviceDied));
|
||||
}
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ struct HdmiConnectionMock : public BnHdmiConnection {
|
|||
::ndk::ScopedAStatus isConnected(int32_t portId, bool* _aidl_return) override;
|
||||
::ndk::ScopedAStatus setCallback(
|
||||
const std::shared_ptr<IHdmiConnectionCallback>& callback) override;
|
||||
::ndk::ScopedAStatus setHpdSignal(HpdSignal signal) override;
|
||||
::ndk::ScopedAStatus getHpdSignal(HpdSignal* _aidl_return) override;
|
||||
::ndk::ScopedAStatus setHpdSignal(HpdSignal signal, int32_t portId) override;
|
||||
::ndk::ScopedAStatus getHpdSignal(int32_t portId, HpdSignal* _aidl_return) override;
|
||||
|
||||
void printEventBuf(const char* msg_buf, int len);
|
||||
|
||||
|
@ -70,7 +70,7 @@ struct HdmiConnectionMock : public BnHdmiConnection {
|
|||
int mTotalPorts = 1;
|
||||
|
||||
// HPD Signal being used
|
||||
HpdSignal mHpdSignal = HpdSignal::HDMI_HPD_PHYSICAL;
|
||||
std::vector<HpdSignal> mHpdSignal;
|
||||
|
||||
// Testing variables
|
||||
// Input file descriptor
|
||||
|
|
|
@ -93,8 +93,8 @@ TEST_P(HdmiConnectionTest, GetPortInfo) {
|
|||
for (size_t i = 0; i < ports.size(); ++i) {
|
||||
EXPECT_TRUE((ports[i].type == HdmiPortType::OUTPUT) ||
|
||||
(ports[i].type == HdmiPortType::INPUT));
|
||||
if (ports[i].portId == 0) {
|
||||
ALOGW("%s: Port id should start from 1", __func__);
|
||||
if (ports[i].type == HdmiPortType::OUTPUT && ports[i].portId <= 0) {
|
||||
ALOGW("%s: Port id for output ports should start from 1", __func__);
|
||||
}
|
||||
cecSupportedOnDevice = cecSupportedOnDevice | ports[i].cecSupported;
|
||||
}
|
||||
|
@ -111,16 +111,21 @@ TEST_P(HdmiConnectionTest, IsConnected) {
|
|||
}
|
||||
|
||||
TEST_P(HdmiConnectionTest, HdpSignal) {
|
||||
std::vector<HdmiPortInfo> ports;
|
||||
ASSERT_TRUE(hdmiConnection->getPortInfo(&ports).isOk());
|
||||
HpdSignal originalSignal;
|
||||
HpdSignal signal = HpdSignal::HDMI_HPD_STATUS_BIT;
|
||||
HpdSignal readSignal;
|
||||
ASSERT_TRUE(hdmiConnection->getHpdSignal(&originalSignal).isOk());
|
||||
ASSERT_TRUE(hdmiConnection->setHpdSignal(signal).isOk());
|
||||
ASSERT_TRUE(hdmiConnection->getHpdSignal(&readSignal).isOk());
|
||||
EXPECT_EQ(readSignal, signal);
|
||||
signal = HpdSignal::HDMI_HPD_PHYSICAL;
|
||||
ASSERT_TRUE(hdmiConnection->setHpdSignal(signal).isOk());
|
||||
ASSERT_TRUE(hdmiConnection->getHpdSignal(&readSignal).isOk());
|
||||
EXPECT_EQ(readSignal, signal);
|
||||
ASSERT_TRUE(hdmiConnection->setHpdSignal(originalSignal).isOk());
|
||||
for (size_t i = 0; i < ports.size(); ++i) {
|
||||
int32_t portId = ports[i].portId;
|
||||
HpdSignal readSignal;
|
||||
ASSERT_TRUE(hdmiConnection->getHpdSignal(portId, &originalSignal).isOk());
|
||||
ASSERT_TRUE(hdmiConnection->setHpdSignal(signal, portId).isOk());
|
||||
ASSERT_TRUE(hdmiConnection->getHpdSignal(portId, &readSignal).isOk());
|
||||
EXPECT_EQ(readSignal, signal);
|
||||
signal = HpdSignal::HDMI_HPD_PHYSICAL;
|
||||
ASSERT_TRUE(hdmiConnection->setHpdSignal(signal, portId).isOk());
|
||||
ASSERT_TRUE(hdmiConnection->getHpdSignal(portId, &readSignal).isOk());
|
||||
EXPECT_EQ(readSignal, signal);
|
||||
ASSERT_TRUE(hdmiConnection->setHpdSignal(originalSignal, portId).isOk());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue