From bddaa2414e35c6e455de0863a2e91ade3695bf59 Mon Sep 17 00:00:00 2001 From: Gil Dekel Date: Wed, 29 Jan 2025 17:31:34 -0500 Subject: SF: Turn DisplayId::fromValue to an explicit wrapper Currently, fromValue() would run a tryCast() check before returning an object, otherwise returning a nullopt. This is now an issue because tryCast() is reading the bits in the ID value, which is something we are trying to eliminate. Remove the tryCast() checks from fromValue(), thus relaxing it and turning it into a simple wrapper. Since fromValue() can no longer fail, make it always return the requested type. It is now up to SF to validate given DisplayIds via its different APIs. Flag: com.android.graphics.surfaceflinger.flags.stable_edid_ids Bug: 393193354 Test: Display{Id | Identification}Test && libsurfaceflinger_unittest Change-Id: I0858567a1769bd94609919bd64bc471f4310ae55 --- libs/ui/DisplayIdentification.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libs/ui/DisplayIdentification.cpp') diff --git a/libs/ui/DisplayIdentification.cpp b/libs/ui/DisplayIdentification.cpp index b7ef9b3738..78e84fc4dc 100644 --- a/libs/ui/DisplayIdentification.cpp +++ b/libs/ui/DisplayIdentification.cpp @@ -444,7 +444,7 @@ PhysicalDisplayId generateEdidDisplayId(const Edid& edid) { (edid.hashedBlockZeroSerialNumberOpt.value_or(0) >> 11) ^ (edid.hashedDescriptorBlockSerialNumberOpt.value_or(0) << 23); - return PhysicalDisplayId::fromEdidHash(id); + return PhysicalDisplayId::fromValue(id); } } // namespace android -- cgit v1.2.3-59-g8ed1b