Ensure display metrics on display service creation
This fixes a potential race condition where a VR app could request the
display metrics from the VR display service before it actually queries
them from the HWC.
Bug: None
Test: Compiled and ran Vr app.
Change-Id: Ie95b7f5a8ef2e286c7b2994ca94fd87214567e24
diff --git a/libs/vr/libvrflinger/display_service.cpp b/libs/vr/libvrflinger/display_service.cpp
index 5309acf..bb70c5c 100644
--- a/libs/vr/libvrflinger/display_service.cpp
+++ b/libs/vr/libvrflinger/display_service.cpp
@@ -25,7 +25,13 @@
DisplayService::DisplayService(Hwc2::Composer* hidl)
: BASE("DisplayService", Endpoint::Create(DisplayRPC::kClientPath)),
- hardware_composer_(hidl) {}
+ hardware_composer_(hidl) {
+ hardware_composer_.Initialize();
+}
+
+bool DisplayService::IsInitialized() const {
+ return BASE::IsInitialized() && hardware_composer_.IsInitialized();
+}
std::string DisplayService::DumpState(size_t max_length) {
std::vector<char> buffer(max_length);