RK3399|[RK3399][Android7.1] 双屏显示副屏旋转90°patch

Platform: RK3399
OS: Android 7.1
Kernel: v4.4.83
描述:
主屏edp+副屏HDMI
标准的sdk不会默认有旋转副屏为横屏显示为竖屏的功能,添加如下patch即可实现,
但是因为是双屏同显,副屏显示会有画面被压缩的现象。
【RK3399|[RK3399][Android7.1] 双屏显示副屏旋转90°patch】Patch:

diff --git a/services/core/java/com/android/server/display/LocalDisplayAdapter.java b/services/core/java/com/android/server/display/LocalDisplayAdapter.java index 7776d9f..b2aec0b 100755 --- a/services/core/java/com/android/server/display/LocalDisplayAdapter.java +++ b/services/core/java/com/android/server/display/LocalDisplayAdapter.java @@ -419,6 +419,7 @@ final class LocalDisplayAdapter extends DisplayAdapter { com.android.internal.R.string.display_manager_hdmi_display_name); mInfo.touch = DisplayDeviceInfo.TOUCH_EXTERNAL; mInfo.setAssumedDensityForExternalDisplay(phys.width, phys.height); +mInfo.rotation=Surface.ROTATION_90; // For demonstration purposes, allow rotation of the external display. // In the future we might allow the user to configure this directly. diff --git a/services/core/java/com/android/server/display/LogicalDisplay.java b/services/core/java/com/android/server/display/LogicalDisplay.java index 58ddae4..288508f 100755 --- a/services/core/java/com/android/server/display/LogicalDisplay.java +++ b/services/core/java/com/android/server/display/LogicalDisplay.java @@ -258,6 +258,13 @@ final class LogicalDisplay { mPrimaryDisplayDeviceInfo = deviceInfo; mInfo = null; +if(mDisplayId!=Display.DEFAULT_DISPLAY){ +mBaseDisplayInfo.appWidth = deviceInfo.height; +mBaseDisplayInfo.appHeight = deviceInfo.width; +mBaseDisplayInfo.logicalWidth = deviceInfo.height; +mBaseDisplayInfo.logicalHeight = deviceInfo.width; +} + } } @@ -314,6 +321,7 @@ final class LogicalDisplay { int orientation = Surface.ROTATION_0; if ((displayDeviceInfo.flags & DisplayDeviceInfo.FLAG_ROTATES_WITH_CONTENT) != 0) { orientation = displayInfo.rotation; + } // Apply the physical rotation of the display device itself. @@ -359,6 +367,13 @@ final class LogicalDisplay { mTempDisplayRect.right += mDisplayOffsetX; mTempDisplayRect.top += mDisplayOffsetY; mTempDisplayRect.bottom += mDisplayOffsetY; + +if(device.getDisplayDeviceInfoLocked().type!=Display.TYPE_BUILT_IN){ +mTempDisplayRect.left=0; +mTempDisplayRect.right=physWidth; +mTempDisplayRect.top=0; +mTempDisplayRect.bottom=physHeight; +} device.setProjectionInTransactionLocked(orientation, mTempLayerStackRect, mTempDisplayRect); } diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java old mode 100644 new mode 100755

    推荐阅读