Reland "ui: Refactor stable ID generation for GPU virtual displays"
This is a partial port of ag/17832464 for main with additional tests.
Use ftl::stable_hash to generate stable ID from uniqueId for GPU virtual
displays. This allows FLAG_STABLE consistent with PhysicalDisplayId that
uses a unique EDID, as well as being stable across reboots when using
hardcoded or static unique ID.
Add DisplayId.isStable()/isVirtual() interfaces and refactor previous
legacy usages.
Bug: 339525838
Bug: 137375833
Bug: 194863377
Test: atest libsurfaceflinger_unittest
Test: atest libcompositionengine_test
Test: atest DisplayIdGeneratorTest
Change-Id: I441046f95860bbcaf837468a3c3f5c944225adde
diff --git a/services/surfaceflinger/DisplayDevice.h b/services/surfaceflinger/DisplayDevice.h
index b339bc6..a21559f 100644
--- a/services/surfaceflinger/DisplayDevice.h
+++ b/services/surfaceflinger/DisplayDevice.h
@@ -89,7 +89,7 @@
return mCompositionDisplay;
}
- bool isVirtual() const { return VirtualDisplayId::tryCast(getId()).has_value(); }
+ bool isVirtual() const { return getId().isVirtual(); }
bool isPrimary() const { return mIsPrimary; }
// isSecure indicates whether this display can be trusted to display