[SF] Use HWC api getPhysicalDisplayOrientation
With HWC3.0 we have the getPhysicalDisplayOrientation
api that can replace the sysprop ro.surface_flinger.primary_display_orientation
BUG: 184085132
Test: atest libsurfaceflinger_unittest
Change-Id: Ie2b0f8e1a81219dc8231a56b9e6174d549a4cbd1
diff --git a/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp b/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp
index 92592f7..8b376f1 100644
--- a/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp
+++ b/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp
@@ -249,6 +249,7 @@
case OptionalFeature::DisplayBrightnessCommand:
case OptionalFeature::BootDisplayConfig:
case OptionalFeature::KernelIdleTimer:
+ case OptionalFeature::PhysicalDisplayOrientation:
return true;
}
}
@@ -1126,5 +1127,17 @@
return Error::NONE;
}
+Error AidlComposer::getPhysicalDisplayOrientation(Display displayId,
+ AidlTransform* outDisplayOrientation) {
+ const auto status =
+ mAidlComposerClient->getDisplayPhysicalOrientation(translate<int64_t>(displayId),
+ outDisplayOrientation);
+ if (!status.isOk()) {
+ ALOGE("getPhysicalDisplayOrientation failed %s", status.getDescription().c_str());
+ return static_cast<Error>(status.getServiceSpecificError());
+ }
+ return Error::NONE;
+}
+
} // namespace Hwc2
} // namespace android