android11-修改屏幕显示方向和触摸方向

方向定义

参数0表示12点钟方向显示
参数90表示3点钟方向显示
参数180表示6点钟方向显示
参数270表示9点钟方向显示

修改显示方向

/android11/device/rockchip/rk356x/BoardConfig.mk
diff --git a/device/rockchip/rk356x/BoardConfig.mk b/device/rockchip/rk356x/BoardConfig.mk
index e2773c1369..68dcf6222d 100644
--- a/device/rockchip/rk356x/BoardConfig.mk
+++ b/device/rockchip/rk356x/BoardConfig.mk
@@ -26,7 +26,7 @@ PRODUCT_KERNEL_DTS ?= rk3568-evb1-ddr4-v10
 PRODUCT_KERNEL_CONFIG ?= rockchip_defconfig
 
 # BOARD_AVB_ENABLE := true
-SF_PRIMARY_DISPLAY_ORIENTATION := 0
+SF_PRIMARY_DISPLAY_ORIENTATION := 90

修改触摸方向

/android11/build/make/tools/buildinfo.sh
diff --git a/build/make/tools/buildinfo.sh b/build/make/tools/buildinfo.sh
index 9bee115484..55d80d705b 100755
--- a/build/make/tools/buildinfo.sh
+++ b/build/make/tools/buildinfo.sh
@@ -54,3 +54,4 @@ if [ -n "$BUILD_THUMBPRINT" ] ; then
 fi
 
 echo "# end build properties"
+echo "persist.sys.touch.rotation=90"
/android11/frameworks/native/services/inputflinger/reader/mapper/TouchInputMapper.cpp
diff --git a/frameworks/native/services/inputflinger/reader/mapper/TouchInputMapper.cpp b/framewo
rks/native/services/inputflinger/reader/mapper/TouchInputMapper.cpp
index 99a572a5fd..5af877855f 100644
--- a/frameworks/native/services/inputflinger/reader/mapper/TouchInputMapper.cpp
+++ b/frameworks/native/services/inputflinger/reader/mapper/TouchInputMapper.cpp
@@ -22,6 +22,7 @@
 #include "CursorScrollAccumulator.h"
 #include "TouchButtonAccumulator.h"
 #include "TouchCursorInputMapperCommon.h"
+#include <cutils/properties.h>
 
 namespace android {
 
@@ -674,6 +675,26 @@ void TouchInputMapper::configureSurface(nsecs_t when, bool* outResetNeeded) {
             int32_t naturalPhysicalWidth, naturalPhysicalHeight;
             int32_t naturalPhysicalLeft, naturalPhysicalTop;
             int32_t naturalDeviceWidth, naturalDeviceHeight;
+           char value[PROPERTY_VALUE_MAX];
+           int orientation = 0;
+           property_get("persist.sys.touch.rotation", value, "90");
+            switch(atoi(value)){
+                case 90:
+                    orientation = DISPLAY_ORIENTATION_90;
+                    break;
+                case 180:
+                    orientation = DISPLAY_ORIENTATION_180;
+                    break;
+                case 270:
+                    orientation = DISPLAY_ORIENTATION_270;
+                    break;
+                case 0:
+                default:
+                    orientation = DISPLAY_ORIENTATION_0;
+                    break;
+            }
+            mViewport.orientation = (mViewport.orientation + orientation) % 4;
+
             switch (mViewport.orientation) {
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Paper_Love

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值