summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/Client.cpp
diff options
context:
space:
mode:
author Gil Dekel <gildekel@google.com> 2025-01-29 17:31:34 -0500
committer Gil Dekel <gildekel@google.com> 2025-02-05 13:15:17 -0500
commitbddaa2414e35c6e455de0863a2e91ade3695bf59 (patch)
tree18bf3d98a123cb6cdbfce07700ae7ef4aeb33387 /services/surfaceflinger/Client.cpp
parent3001fd617e795e68f67faae4151cf55012d411af (diff)
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
Diffstat (limited to 'services/surfaceflinger/Client.cpp')
-rw-r--r--services/surfaceflinger/Client.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/services/surfaceflinger/Client.cpp b/services/surfaceflinger/Client.cpp
index 77bf1457c3..6088e255df 100644
--- a/services/surfaceflinger/Client.cpp
+++ b/services/surfaceflinger/Client.cpp
@@ -110,8 +110,8 @@ binder::Status Client::mirrorDisplay(int64_t displayId, gui::CreateSurfaceResult
LayerCreationArgs args(mFlinger.get(), sp<Client>::fromExisting(this),
"MirrorRoot-" + std::to_string(displayId), 0 /* flags */,
gui::LayerMetadata());
- std::optional<DisplayId> id = DisplayId::fromValue(static_cast<uint64_t>(displayId));
- status_t status = mFlinger->mirrorDisplay(*id, args, *outResult);
+ const DisplayId id = DisplayId::fromValue(static_cast<uint64_t>(displayId));
+ status_t status = mFlinger->mirrorDisplay(id, args, *outResult);
return binderStatusFromStatusT(status);
}