代码路径:
frameworks/native/services/surfaceflinger/DisplayDevice.cpp
在DisplayDevice.cpp文件中setProjection()方法中
— a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -231,6 +231,9 @@ void DisplayDevice::setProjection(int orientation,
// the destination frame can be invalid if it has never been set,
// in that case we assume the whole display frame.
frame = Rect(w, h);
if ((R.getOrientation() & ui::Transform::ROT_90) || (mFlinger->primaryDisplayOrientation & DisplayState::eOrientationSwapMask)) {
std::swap(frame.right, frame.bottom);
}
}
if (viewport.isEmpty()) {
@@ -239,7 +242,7 @@ void DisplayDevice::setProjection(int orientation,
// it’s also invalid to have an empty viewport, so we handle that
// case in