RK Android7.1 双屏显示旋转方向

 

 一.参考 Rockchip_Developer_Guide_Dual_Display_Rotation_Direction_Debugging_CN.pdf

1
2
3
4
persist.sys.rotation.einit = 0 / 1 / 2 / 3
persist.sys.rotation.efull = false / true
备注:当主副屏宽高比不同时,persist.sys.rotation.efull 为 false,则副屏会出现黑边,
所以这种情况,建议将 persist.sys.rotation.efull 设置为 true,些许的拉伸不会影响显示效果。

二.frameworks\base\services\core\java\com\android\server\display\LogicalDisplay.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
public DisplayInfo getDisplayInfoLocked() {
    if (mInfo == null) {
        mInfo = new DisplayInfo();
        mInfo.copyFrom(mBaseDisplayInfo);
        if (mOverrideDisplayInfo != null) {
            mInfo.appWidth = mOverrideDisplayInfo.appWidth;
            mInfo.appHeight = mOverrideDisplayInfo.appHeight;
            mInfo.smallestNominalAppWidth = mOverrideDisplayInfo.smallestNominalAppWidth;
            mInfo.smallestNominalAppHeight = mOverrideDisplayInfo.smallestNominalAppHeight;
            mInfo.largestNominalAppWidth = mOverrideDisplayInfo.largestNominalAppWidth;
            mInfo.largestNominalAppHeight = mOverrideDisplayInfo.largestNominalAppHeight;
            mInfo.logicalWidth = mOverrideDisplayInfo.logicalWidth;
            mInfo.logicalHeight = mOverrideDisplayInfo.logicalHeight;
            mInfo.overscanLeft = mOverrideDisplayInfo.overscanLeft;
            mInfo.overscanTop = mOverrideDisplayInfo.overscanTop;
            mInfo.overscanRight = mOverrideDisplayInfo.overscanRight;
            mInfo.overscanBottom = mOverrideDisplayInfo.overscanBottom;
            mInfo.rotation = mOverrideDisplayInfo.rotation;
            mInfo.logicalDensityDpi = mOverrideDisplayInfo.logicalDensityDpi;
            mInfo.physicalXDpi = mOverrideDisplayInfo.physicalXDpi;
            mInfo.physicalYDpi = mOverrideDisplayInfo.physicalYDpi;
        }
        if(mDisplayId!=Display.DEFAULT_DISPLAY){
            String rotation = SystemProperties.get("persist.sys.rotation.einit","0");
            if(Integer.valueOf(rotation)%2!=0) {
 
 
                mInfo.appWidth = mPrimaryDisplayDeviceInfo.height;
                mInfo.appHeight = mPrimaryDisplayDeviceInfo.width;
                mInfo.logicalWidth = mPrimaryDisplayDeviceInfo.height;
                mInfo.logicalHeight=mPrimaryDisplayDeviceInfo.width;
 
            }else{
                mInfo.appWidth = mPrimaryDisplayDeviceInfo.width;
                mInfo.appHeight = mPrimaryDisplayDeviceInfo.height;
                mInfo.logicalWidth = mPrimaryDisplayDeviceInfo.width;
                mInfo.logicalHeight=mPrimaryDisplayDeviceInfo.height;
            }
        }
    }

 双屏属性

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Dual - display configuration
# 主屏 eDP
sys.hwc.device.primary=eDP
# 副屏
sys.hwc.device.extend=LVDS
#persist.sys.framebuffer.main=800x1280
persist.sys.resolution.main=1920x1080
persist.sys.resolution.aux=800x1280
 
#  副屏是否全屏显示
persist.sys.rotation.efull = true
 
# 主屏的旋转方向(0 90 180 270)
ro.sf.hwrotation=0
 
# 副屏输出旋转方向对应 0 / 90 / 180 / 270(0 1 2 3)
+persist.sys.rotation.einit =1
 
#副屏也随着 g-sensor 旋转(只关注方向,黑边不关注)
ro.sys.rotation.sensor =false
 
// 主副屏orientaion是否相同
ro.same.orientation=false
 
// 副屏是否随主屏旋转
ro.rotation.external=false

  

 三.写了个apk 控制属性 

3.1.布局

3.2.code

  

  

  

posted @   CrushGirl  阅读(2226)  评论(0编辑  收藏  举报
(评论功能已被禁用)
编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】
点击右上角即可分享
微信分享提示