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

Commit ba6afd88 authored by Gil Dekel's avatar Gil Dekel
Browse files

libs/ui: Remove getManufacturerId() from DisplayId

There are currently no clients of DisplayId who use getManufacturerId().

This CL removes the parsing and serving of the manufacturer's ID from
DisplayID's API, together with the only client
getPnpId(PhysicalDisplayId), which also isn't use in real use cases
(only tests).

See: go/edid-display-ids-al13

Flag: com.android.graphics.surfaceflinger.flags.stable_edid_ids
Bug: 390689046
Test: Display{Id|Identification} & libsurfaceflinger_unittest
Change-Id: I03db2f6d71b32fcb387e99d9bc2730ab21760012
parent 5aab65d9
Loading
Loading
Loading
Loading
+0 −4
Original line number Original line Diff line number Diff line
@@ -392,10 +392,6 @@ std::optional<PnpId> getPnpId(uint16_t manufacturerId) {
    return a && b && c ? std::make_optional(PnpId{a, b, c}) : std::nullopt;
    return a && b && c ? std::make_optional(PnpId{a, b, c}) : std::nullopt;
}
}


std::optional<PnpId> getPnpId(PhysicalDisplayId displayId) {
    return getPnpId(displayId.getManufacturerId());
}

std::optional<DisplayIdentificationInfo> parseDisplayIdentificationData(
std::optional<DisplayIdentificationInfo> parseDisplayIdentificationData(
        uint8_t port, const DisplayIdentificationData& data) {
        uint8_t port, const DisplayIdentificationData& data) {
    if (data.empty()) {
    if (data.empty()) {
+0 −1
Original line number Original line Diff line number Diff line
@@ -97,7 +97,6 @@ struct PhysicalDisplayId : DisplayId {
    // TODO(b/162612135) Remove default constructor
    // TODO(b/162612135) Remove default constructor
    PhysicalDisplayId() = default;
    PhysicalDisplayId() = default;


    constexpr uint16_t getManufacturerId() const { return static_cast<uint16_t>(value >> 40); }
    constexpr uint8_t getPort() const { return static_cast<uint8_t>(value); }
    constexpr uint8_t getPort() const { return static_cast<uint8_t>(value); }


private:
private:
+0 −1
Original line number Original line Diff line number Diff line
@@ -85,7 +85,6 @@ struct Edid {
bool isEdid(const DisplayIdentificationData&);
bool isEdid(const DisplayIdentificationData&);
std::optional<Edid> parseEdid(const DisplayIdentificationData&);
std::optional<Edid> parseEdid(const DisplayIdentificationData&);
std::optional<PnpId> getPnpId(uint16_t manufacturerId);
std::optional<PnpId> getPnpId(uint16_t manufacturerId);
std::optional<PnpId> getPnpId(PhysicalDisplayId);


std::optional<DisplayIdentificationInfo> parseDisplayIdentificationData(
std::optional<DisplayIdentificationInfo> parseDisplayIdentificationData(
        uint8_t port, const DisplayIdentificationData&);
        uint8_t port, const DisplayIdentificationData&);
+0 −1
Original line number Original line Diff line number Diff line
@@ -26,7 +26,6 @@ TEST(DisplayIdTest, createPhysicalIdFromEdid) {
    constexpr uint32_t modelHash = 42;
    constexpr uint32_t modelHash = 42;
    const PhysicalDisplayId id = PhysicalDisplayId::fromEdid(port, manufacturerId, modelHash);
    const PhysicalDisplayId id = PhysicalDisplayId::fromEdid(port, manufacturerId, modelHash);
    EXPECT_EQ(port, id.getPort());
    EXPECT_EQ(port, id.getPort());
    EXPECT_EQ(manufacturerId, id.getManufacturerId());
    EXPECT_FALSE(VirtualDisplayId::tryCast(id));
    EXPECT_FALSE(VirtualDisplayId::tryCast(id));
    EXPECT_FALSE(HalVirtualDisplayId::tryCast(id));
    EXPECT_FALSE(HalVirtualDisplayId::tryCast(id));
    EXPECT_FALSE(GpuVirtualDisplayId::tryCast(id));
    EXPECT_FALSE(GpuVirtualDisplayId::tryCast(id));
+0 −12
Original line number Original line Diff line number Diff line
@@ -462,18 +462,6 @@ TEST(DisplayIdentificationTest, deviceProductInfo) {
    }
    }
}
}


TEST(DisplayIdentificationTest, fromPort) {
    // Manufacturer ID should be invalid.
    ASSERT_FALSE(getPnpId(PhysicalDisplayId::fromPort(0)));
    ASSERT_FALSE(getPnpId(PhysicalDisplayId::fromPort(0xffu)));
}

TEST(DisplayIdentificationTest, getVirtualDisplayId) {
    // Manufacturer ID should be invalid.
    ASSERT_FALSE(getPnpId(getVirtualDisplayId(0)));
    ASSERT_FALSE(getPnpId(getVirtualDisplayId(0xffff'ffffu)));
}

} // namespace android
} // namespace android


// TODO(b/129481165): remove the #pragma below and fix conversion issues
// TODO(b/129481165): remove the #pragma below and fix conversion issues