Loading libs/ui/include/ui/DeviceProductInfo.h +9 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,10 @@ using PnpId = std::array<char, 4>; // product information about the intermediate device. struct DeviceProductInfo { static constexpr size_t TEXT_BUFFER_SIZE = 20; static constexpr size_t RELATIVE_ADDRESS_SIZE = 4; using RelativeAddress = std::array<uint8_t, RELATIVE_ADDRESS_SIZE>; static constexpr RelativeAddress NO_RELATIVE_ADDRESS = {0xff, 0xff, 0xff, 0xff}; struct ModelYear { uint32_t year; Loading @@ -54,6 +58,11 @@ struct DeviceProductInfo { using ManufactureOrModelDate = std::variant<ModelYear, ManufactureYear, ManufactureWeekAndYear>; ManufactureOrModelDate manufactureOrModelDate; // Relative address in the display network. Unavailable address is indicated // by all elements equal to 255. // For example, for HDMI connected device this will be the physical address. RelativeAddress relativeAddress; }; } // namespace android services/surfaceflinger/DisplayHardware/DisplayIdentification.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,12 @@ DeviceProductInfo buildDeviceProductInfo(const Edid& edid) { info.manufactureOrModelDate = date; } if (edid.cea861Block && edid.cea861Block->hdmiVendorDataBlock) { const auto& address = edid.cea861Block->hdmiVendorDataBlock->physicalAddress; info.relativeAddress = {address.a, address.b, address.c, address.d}; } else { info.relativeAddress = DeviceProductInfo::NO_RELATIVE_ADDRESS; } return info; } Loading services/surfaceflinger/DisplayHardware/DisplayIdentification.h +1 −1 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ struct HdmiPhysicalAddress { }; struct HdmiVendorDataBlock { std::optional<HdmiPhysicalAddress> physicalAddress; HdmiPhysicalAddress physicalAddress; }; struct Cea861ExtensionBlock : ExtensionBlock { Loading services/surfaceflinger/tests/unittests/DisplayIdentificationTest.cpp +19 −15 Original line number Diff line number Diff line Loading @@ -209,12 +209,11 @@ TEST(DisplayIdentificationTest, parseEdid) { EXPECT_EQ(41, edid->manufactureWeek); ASSERT_TRUE(edid->cea861Block); ASSERT_TRUE(edid->cea861Block->hdmiVendorDataBlock); ASSERT_TRUE(edid->cea861Block->hdmiVendorDataBlock->physicalAddress); auto physicalAddress = edid->cea861Block->hdmiVendorDataBlock->physicalAddress; EXPECT_EQ(2, physicalAddress->a); EXPECT_EQ(0, physicalAddress->b); EXPECT_EQ(0, physicalAddress->c); EXPECT_EQ(0, physicalAddress->d); EXPECT_EQ(2, physicalAddress.a); EXPECT_EQ(0, physicalAddress.b); EXPECT_EQ(0, physicalAddress.c); EXPECT_EQ(0, physicalAddress.d); edid = parseEdid(getPanasonicTvEdid()); ASSERT_TRUE(edid); Loading @@ -227,12 +226,11 @@ TEST(DisplayIdentificationTest, parseEdid) { EXPECT_EQ(0, edid->manufactureWeek); ASSERT_TRUE(edid->cea861Block); ASSERT_TRUE(edid->cea861Block->hdmiVendorDataBlock); ASSERT_TRUE(edid->cea861Block->hdmiVendorDataBlock->physicalAddress); physicalAddress = edid->cea861Block->hdmiVendorDataBlock->physicalAddress; EXPECT_EQ(2, physicalAddress->a); EXPECT_EQ(0, physicalAddress->b); EXPECT_EQ(0, physicalAddress->c); EXPECT_EQ(0, physicalAddress->d); EXPECT_EQ(2, physicalAddress.a); EXPECT_EQ(0, physicalAddress.b); EXPECT_EQ(0, physicalAddress.c); EXPECT_EQ(0, physicalAddress.d); edid = parseEdid(getHisenseTvEdid()); ASSERT_TRUE(edid); Loading @@ -245,12 +243,11 @@ TEST(DisplayIdentificationTest, parseEdid) { EXPECT_EQ(18, edid->manufactureWeek); ASSERT_TRUE(edid->cea861Block); ASSERT_TRUE(edid->cea861Block->hdmiVendorDataBlock); ASSERT_TRUE(edid->cea861Block->hdmiVendorDataBlock->physicalAddress); physicalAddress = edid->cea861Block->hdmiVendorDataBlock->physicalAddress; EXPECT_EQ(1, physicalAddress->a); EXPECT_EQ(2, physicalAddress->b); EXPECT_EQ(3, physicalAddress->c); EXPECT_EQ(4, physicalAddress->d); EXPECT_EQ(1, physicalAddress.a); EXPECT_EQ(2, physicalAddress.b); EXPECT_EQ(3, physicalAddress.c); EXPECT_EQ(4, physicalAddress.d); edid = parseEdid(getCtlDisplayEdid()); ASSERT_TRUE(edid); Loading Loading @@ -315,6 +312,7 @@ TEST(DisplayIdentificationTest, deviceProductInfo) { using ManufactureYear = DeviceProductInfo::ManufactureYear; using ManufactureWeekAndYear = DeviceProductInfo::ManufactureWeekAndYear; using ModelYear = DeviceProductInfo::ModelYear; using RelativeAddress = DeviceProductInfo::RelativeAddress; { const auto displayIdInfo = parseDisplayIdentificationData(0, getInternalEdid()); Loading @@ -326,6 +324,7 @@ TEST(DisplayIdentificationTest, deviceProductInfo) { EXPECT_STREQ("12610", info.productId.data()); ASSERT_TRUE(std::holds_alternative<ManufactureYear>(info.manufactureOrModelDate)); EXPECT_EQ(2011, std::get<ManufactureYear>(info.manufactureOrModelDate).year); EXPECT_EQ(DeviceProductInfo::NO_RELATIVE_ADDRESS, info.relativeAddress); } { const auto displayIdInfo = parseDisplayIdentificationData(0, getExternalEdid()); Loading @@ -339,6 +338,7 @@ TEST(DisplayIdentificationTest, deviceProductInfo) { const auto& date = std::get<ManufactureWeekAndYear>(info.manufactureOrModelDate); EXPECT_EQ(2012, date.year); EXPECT_EQ(2, date.week); EXPECT_EQ(DeviceProductInfo::NO_RELATIVE_ADDRESS, info.relativeAddress); } { const auto displayIdInfo = parseDisplayIdentificationData(0, getExternalEedid()); Loading @@ -352,6 +352,7 @@ TEST(DisplayIdentificationTest, deviceProductInfo) { const auto& date = std::get<ManufactureWeekAndYear>(info.manufactureOrModelDate); EXPECT_EQ(2011, date.year); EXPECT_EQ(41, date.week); EXPECT_EQ((RelativeAddress{{2, 0, 0, 0}}), info.relativeAddress); } { const auto displayIdInfo = parseDisplayIdentificationData(0, getPanasonicTvEdid()); Loading @@ -364,6 +365,7 @@ TEST(DisplayIdentificationTest, deviceProductInfo) { ASSERT_TRUE(std::holds_alternative<ManufactureYear>(info.manufactureOrModelDate)); const auto& date = std::get<ManufactureYear>(info.manufactureOrModelDate); EXPECT_EQ(2019, date.year); EXPECT_EQ((RelativeAddress{{2, 0, 0, 0}}), info.relativeAddress); } { const auto displayIdInfo = parseDisplayIdentificationData(0, getHisenseTvEdid()); Loading @@ -377,6 +379,7 @@ TEST(DisplayIdentificationTest, deviceProductInfo) { const auto& date = std::get<ManufactureWeekAndYear>(info.manufactureOrModelDate); EXPECT_EQ(2019, date.year); EXPECT_EQ(18, date.week); EXPECT_EQ((RelativeAddress{{1, 2, 3, 4}}), info.relativeAddress); } { const auto displayIdInfo = parseDisplayIdentificationData(0, getCtlDisplayEdid()); Loading @@ -388,6 +391,7 @@ TEST(DisplayIdentificationTest, deviceProductInfo) { EXPECT_STREQ("9373", info.productId.data()); ASSERT_TRUE(std::holds_alternative<ModelYear>(info.manufactureOrModelDate)); EXPECT_EQ(2013, std::get<ModelYear>(info.manufactureOrModelDate).year); EXPECT_EQ(DeviceProductInfo::NO_RELATIVE_ADDRESS, info.relativeAddress); } } Loading Loading
libs/ui/include/ui/DeviceProductInfo.h +9 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,10 @@ using PnpId = std::array<char, 4>; // product information about the intermediate device. struct DeviceProductInfo { static constexpr size_t TEXT_BUFFER_SIZE = 20; static constexpr size_t RELATIVE_ADDRESS_SIZE = 4; using RelativeAddress = std::array<uint8_t, RELATIVE_ADDRESS_SIZE>; static constexpr RelativeAddress NO_RELATIVE_ADDRESS = {0xff, 0xff, 0xff, 0xff}; struct ModelYear { uint32_t year; Loading @@ -54,6 +58,11 @@ struct DeviceProductInfo { using ManufactureOrModelDate = std::variant<ModelYear, ManufactureYear, ManufactureWeekAndYear>; ManufactureOrModelDate manufactureOrModelDate; // Relative address in the display network. Unavailable address is indicated // by all elements equal to 255. // For example, for HDMI connected device this will be the physical address. RelativeAddress relativeAddress; }; } // namespace android
services/surfaceflinger/DisplayHardware/DisplayIdentification.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,12 @@ DeviceProductInfo buildDeviceProductInfo(const Edid& edid) { info.manufactureOrModelDate = date; } if (edid.cea861Block && edid.cea861Block->hdmiVendorDataBlock) { const auto& address = edid.cea861Block->hdmiVendorDataBlock->physicalAddress; info.relativeAddress = {address.a, address.b, address.c, address.d}; } else { info.relativeAddress = DeviceProductInfo::NO_RELATIVE_ADDRESS; } return info; } Loading
services/surfaceflinger/DisplayHardware/DisplayIdentification.h +1 −1 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ struct HdmiPhysicalAddress { }; struct HdmiVendorDataBlock { std::optional<HdmiPhysicalAddress> physicalAddress; HdmiPhysicalAddress physicalAddress; }; struct Cea861ExtensionBlock : ExtensionBlock { Loading
services/surfaceflinger/tests/unittests/DisplayIdentificationTest.cpp +19 −15 Original line number Diff line number Diff line Loading @@ -209,12 +209,11 @@ TEST(DisplayIdentificationTest, parseEdid) { EXPECT_EQ(41, edid->manufactureWeek); ASSERT_TRUE(edid->cea861Block); ASSERT_TRUE(edid->cea861Block->hdmiVendorDataBlock); ASSERT_TRUE(edid->cea861Block->hdmiVendorDataBlock->physicalAddress); auto physicalAddress = edid->cea861Block->hdmiVendorDataBlock->physicalAddress; EXPECT_EQ(2, physicalAddress->a); EXPECT_EQ(0, physicalAddress->b); EXPECT_EQ(0, physicalAddress->c); EXPECT_EQ(0, physicalAddress->d); EXPECT_EQ(2, physicalAddress.a); EXPECT_EQ(0, physicalAddress.b); EXPECT_EQ(0, physicalAddress.c); EXPECT_EQ(0, physicalAddress.d); edid = parseEdid(getPanasonicTvEdid()); ASSERT_TRUE(edid); Loading @@ -227,12 +226,11 @@ TEST(DisplayIdentificationTest, parseEdid) { EXPECT_EQ(0, edid->manufactureWeek); ASSERT_TRUE(edid->cea861Block); ASSERT_TRUE(edid->cea861Block->hdmiVendorDataBlock); ASSERT_TRUE(edid->cea861Block->hdmiVendorDataBlock->physicalAddress); physicalAddress = edid->cea861Block->hdmiVendorDataBlock->physicalAddress; EXPECT_EQ(2, physicalAddress->a); EXPECT_EQ(0, physicalAddress->b); EXPECT_EQ(0, physicalAddress->c); EXPECT_EQ(0, physicalAddress->d); EXPECT_EQ(2, physicalAddress.a); EXPECT_EQ(0, physicalAddress.b); EXPECT_EQ(0, physicalAddress.c); EXPECT_EQ(0, physicalAddress.d); edid = parseEdid(getHisenseTvEdid()); ASSERT_TRUE(edid); Loading @@ -245,12 +243,11 @@ TEST(DisplayIdentificationTest, parseEdid) { EXPECT_EQ(18, edid->manufactureWeek); ASSERT_TRUE(edid->cea861Block); ASSERT_TRUE(edid->cea861Block->hdmiVendorDataBlock); ASSERT_TRUE(edid->cea861Block->hdmiVendorDataBlock->physicalAddress); physicalAddress = edid->cea861Block->hdmiVendorDataBlock->physicalAddress; EXPECT_EQ(1, physicalAddress->a); EXPECT_EQ(2, physicalAddress->b); EXPECT_EQ(3, physicalAddress->c); EXPECT_EQ(4, physicalAddress->d); EXPECT_EQ(1, physicalAddress.a); EXPECT_EQ(2, physicalAddress.b); EXPECT_EQ(3, physicalAddress.c); EXPECT_EQ(4, physicalAddress.d); edid = parseEdid(getCtlDisplayEdid()); ASSERT_TRUE(edid); Loading Loading @@ -315,6 +312,7 @@ TEST(DisplayIdentificationTest, deviceProductInfo) { using ManufactureYear = DeviceProductInfo::ManufactureYear; using ManufactureWeekAndYear = DeviceProductInfo::ManufactureWeekAndYear; using ModelYear = DeviceProductInfo::ModelYear; using RelativeAddress = DeviceProductInfo::RelativeAddress; { const auto displayIdInfo = parseDisplayIdentificationData(0, getInternalEdid()); Loading @@ -326,6 +324,7 @@ TEST(DisplayIdentificationTest, deviceProductInfo) { EXPECT_STREQ("12610", info.productId.data()); ASSERT_TRUE(std::holds_alternative<ManufactureYear>(info.manufactureOrModelDate)); EXPECT_EQ(2011, std::get<ManufactureYear>(info.manufactureOrModelDate).year); EXPECT_EQ(DeviceProductInfo::NO_RELATIVE_ADDRESS, info.relativeAddress); } { const auto displayIdInfo = parseDisplayIdentificationData(0, getExternalEdid()); Loading @@ -339,6 +338,7 @@ TEST(DisplayIdentificationTest, deviceProductInfo) { const auto& date = std::get<ManufactureWeekAndYear>(info.manufactureOrModelDate); EXPECT_EQ(2012, date.year); EXPECT_EQ(2, date.week); EXPECT_EQ(DeviceProductInfo::NO_RELATIVE_ADDRESS, info.relativeAddress); } { const auto displayIdInfo = parseDisplayIdentificationData(0, getExternalEedid()); Loading @@ -352,6 +352,7 @@ TEST(DisplayIdentificationTest, deviceProductInfo) { const auto& date = std::get<ManufactureWeekAndYear>(info.manufactureOrModelDate); EXPECT_EQ(2011, date.year); EXPECT_EQ(41, date.week); EXPECT_EQ((RelativeAddress{{2, 0, 0, 0}}), info.relativeAddress); } { const auto displayIdInfo = parseDisplayIdentificationData(0, getPanasonicTvEdid()); Loading @@ -364,6 +365,7 @@ TEST(DisplayIdentificationTest, deviceProductInfo) { ASSERT_TRUE(std::holds_alternative<ManufactureYear>(info.manufactureOrModelDate)); const auto& date = std::get<ManufactureYear>(info.manufactureOrModelDate); EXPECT_EQ(2019, date.year); EXPECT_EQ((RelativeAddress{{2, 0, 0, 0}}), info.relativeAddress); } { const auto displayIdInfo = parseDisplayIdentificationData(0, getHisenseTvEdid()); Loading @@ -377,6 +379,7 @@ TEST(DisplayIdentificationTest, deviceProductInfo) { const auto& date = std::get<ManufactureWeekAndYear>(info.manufactureOrModelDate); EXPECT_EQ(2019, date.year); EXPECT_EQ(18, date.week); EXPECT_EQ((RelativeAddress{{1, 2, 3, 4}}), info.relativeAddress); } { const auto displayIdInfo = parseDisplayIdentificationData(0, getCtlDisplayEdid()); Loading @@ -388,6 +391,7 @@ TEST(DisplayIdentificationTest, deviceProductInfo) { EXPECT_STREQ("9373", info.productId.data()); ASSERT_TRUE(std::holds_alternative<ModelYear>(info.manufactureOrModelDate)); EXPECT_EQ(2013, std::get<ModelYear>(info.manufactureOrModelDate).year); EXPECT_EQ(DeviceProductInfo::NO_RELATIVE_ADDRESS, info.relativeAddress); } } Loading