Need GSI to support landscape LCM
When device uses landscape LCM, the nature of the screen shows that
the device is a portrait device. After we flash with GSI, there is
vendor solution for landscape LCM used at portrait device. As the
result, the screen displays landscape layout and orientation while
device is at portrait orientation. In addition, the sensor coordinate
system mismatches with android coordinate system.
We suggest Google can add config to handle the case "portrait device
uses landscape LCM or landscape device uses portrait LCM".
Bug: 69691076
Test: We verified following test cases for this patch on Android O-MR1.
1. Make sure homescreen is normal
2. Rotate device and make sure screen is normal
3. Grab screen shot and check if screen shot is normal
4. Connect to Wi-Fi display and make sure WFD screen is normal
Test: Tested 1, 2 and 3 on Pixel 2.
Test: artifially setup 90 degree rotation on Pixel and make sure that
screenshots are aligned to the screen.
Change-Id: Ib42c9a216e8a6fe465139d6eece152fb1765b422
diff --git a/services/surfaceflinger/RenderArea.cpp b/services/surfaceflinger/RenderArea.cpp
index 46ec8e6..1a8edf3 100644
--- a/services/surfaceflinger/RenderArea.cpp
+++ b/services/surfaceflinger/RenderArea.cpp
@@ -1,5 +1,7 @@
#include "RenderArea.h"
+#include <gui/LayerState.h>
+
namespace android {
float RenderArea::getCaptureFillValue(CaptureFill captureFill) {
@@ -15,7 +17,7 @@
* Checks that the requested width and height are valid and updates them to the render area
* dimensions if they are set to 0
*/
-status_t RenderArea::updateDimensions() {
+status_t RenderArea::updateDimensions(int displayRotation) {
// get screen geometry
uint32_t width = getWidth();
@@ -25,6 +27,10 @@
std::swap(width, height);
}
+ if (displayRotation & DisplayState::eOrientationSwapMask) {
+ std::swap(width, height);
+ }
+
if ((mReqWidth > width) || (mReqHeight > height)) {
ALOGE("size mismatch (%d, %d) > (%d, %d)", mReqWidth, mReqHeight, width, height);
return BAD_VALUE;
@@ -40,4 +46,4 @@
return NO_ERROR;
}
-} // namespace android
\ No newline at end of file
+} // namespace android