SF: Remove layer stack lookup for screencap
GPU virtual displays now have IDs, so the (ambiguous) fallback is no
longer necessary.
Remove PhysicalDisplayId constructor from uint64_t to enforce error
checking at compile time when upcasting or deserializing.
Bug: 162612135
Bug: 182939859
Test: screencap -d <id>
Test: DisplayId_test
Change-Id: I68fa0835cbc915975c7fa40c7d544d9491db9fa2
diff --git a/services/automotive/display/AutomotiveDisplayProxyService.cpp b/services/automotive/display/AutomotiveDisplayProxyService.cpp
index d6fc695..d205231 100644
--- a/services/automotive/display/AutomotiveDisplayProxyService.cpp
+++ b/services/automotive/display/AutomotiveDisplayProxyService.cpp
@@ -34,7 +34,10 @@
sp<IBinder> displayToken = nullptr;
sp<SurfaceControl> surfaceControl = nullptr;
if (it == mDisplays.end()) {
- displayToken = SurfaceComposerClient::getPhysicalDisplayToken(PhysicalDisplayId(id));
+ if (const auto displayId = DisplayId::fromValue<PhysicalDisplayId>(id)) {
+ displayToken = SurfaceComposerClient::getPhysicalDisplayToken(*displayId);
+ }
+
if (displayToken == nullptr) {
ALOGE("Given display id, 0x%lX, is invalid.", (unsigned long)id);
return nullptr;
@@ -157,7 +160,11 @@
HwDisplayConfig activeConfig;
HwDisplayState activeState;
- auto displayToken = SurfaceComposerClient::getPhysicalDisplayToken(PhysicalDisplayId(id));
+ sp<IBinder> displayToken;
+ if (const auto displayId = DisplayId::fromValue<PhysicalDisplayId>(id)) {
+ displayToken = SurfaceComposerClient::getPhysicalDisplayToken(*displayId);
+ }
+
if (displayToken == nullptr) {
ALOGE("Given display id, 0x%lX, is invalid.", (unsigned long)id);
} else {