summaryrefslogtreecommitdiff
path: root/libs/ui/DisplayIdentification.cpp
diff options
context:
space:
mode:
author Gil Dekel <gildekel@google.com> 2024-11-14 14:14:25 -0500
committer Gil Dekel <gildekel@google.com> 2024-11-16 01:30:59 -0500
commitf9854d272c816ca2ad2fec085e17c6591721bff9 (patch)
tree0e57c8df7626ee83481719b73e025f0a0356ba35 /libs/ui/DisplayIdentification.cpp
parentc37c90444774da117f8a4eef14b091f0a54086f2 (diff)
SF: Hash and cache descriptor block serial number
More EDID fields are required as a part of migrating to EDID-based display IDs. This CL parses the device's serial number from the serial number descriptor bloc, (depicted by the FF marker), hashes it using a stable hash, and serves it as a part of the Edid struct. Later, amongst others, this value will be used to fabricate a unique display ID that is based on the display's EDID. See: 1. EDID spec: https://glenwing.github.io/docs/VESA-EEDID-A2.pdf 2. https://en.wikipedia.org/wiki/Extended_Display_Identification_Data#Structure,_version_1.4 Flag: com.android.graphics.surfaceflinger.flags.stable_edid_ids Bug: 378923759 Test: DisplayIdentification_test Change-Id: If9c9358b0d0850337496740d15419fd0ed330a02
Diffstat (limited to 'libs/ui/DisplayIdentification.cpp')
-rw-r--r--libs/ui/DisplayIdentification.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/libs/ui/DisplayIdentification.cpp b/libs/ui/DisplayIdentification.cpp
index 5cdaa71627..8d6f74b605 100644
--- a/libs/ui/DisplayIdentification.cpp
+++ b/libs/ui/DisplayIdentification.cpp
@@ -249,7 +249,8 @@ std::optional<Edid> parseEdid(const DisplayIdentificationData& edid) {
view = view.subspan(kDescriptorOffset);
std::string_view displayName;
- std::string_view serialNumber;
+ std::string_view descriptorBlockSerialNumber;
+ std::optional<uint64_t> hashedDescriptorBlockSNOpt = std::nullopt;
std::string_view asciiText;
ui::Size preferredDTDPixelSize;
ui::Size preferredDTDPhysicalSize;
@@ -274,7 +275,10 @@ std::optional<Edid> parseEdid(const DisplayIdentificationData& edid) {
asciiText = parseEdidText(descriptor);
break;
case 0xff:
- serialNumber = parseEdidText(descriptor);
+ descriptorBlockSerialNumber = parseEdidText(descriptor);
+ hashedDescriptorBlockSNOpt = descriptorBlockSerialNumber.empty()
+ ? std::nullopt
+ : ftl::stable_hash(descriptorBlockSerialNumber);
break;
}
} else if (isDetailedTimingDescriptor(view)) {
@@ -315,7 +319,7 @@ std::optional<Edid> parseEdid(const DisplayIdentificationData& edid) {
if (modelString.empty()) {
ALOGW("Invalid EDID: falling back to serial number due to missing display name.");
- modelString = serialNumber;
+ modelString = descriptorBlockSerialNumber;
}
if (modelString.empty()) {
ALOGW("Invalid EDID: falling back to ASCII text due to missing serial number.");
@@ -369,6 +373,7 @@ std::optional<Edid> parseEdid(const DisplayIdentificationData& edid) {
.manufacturerId = manufacturerId,
.productId = productId,
.hashedBlockZeroSerialNumberOpt = hashedBlockZeroSNOpt,
+ .hashedDescriptorBlockSerialNumberOpt = hashedDescriptorBlockSNOpt,
.pnpId = *pnpId,
.modelHash = modelHash,
.displayName = displayName,