Android P DisplayManager多屏相关

Android  多屏相关信息

此处从上层介绍屏幕管理相关信息,底层HAL层请参考https://my.oschina.net/yuyang/blog/1862234

SurfaceControl.java   里定义了

    /**                                                         
     * Built-in physical display id: Main display.
     * Use only with {@link SurfaceControl#getBuiltInDisplay(int)}.
     */                                       
    public static final int BUILT_IN_DISPLAY_ID_MAIN = 0;                                                                  
    /**                                        
     * Built-in physical display id: Attached HDMI display.
     * Use only with {@link SurfaceControl#getBuiltInDisplay(int)}.
     */                                                  
    public static final int BUILT_IN_DISPLAY_ID_HDMI = 1;

final class LocalDisplayAdapter extends DisplayAdapter 里定义了

 private static final int[] BUILT_IN_DISPLAY_IDS_TO_SCAN = new int[] {
            SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN,
            SurfaceControl.BUILT_IN_DISPLAY_ID_HDMI,
    };

DisplayManagerService启动--->onStart()---->发送MSG_REGISTER_DEFAULT_DISPLAY_ADAPTERS --------->处理MSG_REGISTER_DEFAULT_DISPLAY_ADAPTERS消息
调用registerDefaultDisplayAdapters()--->registerDisplayAdapterLocked()--->(DisplayAdapter)LocalDisplayAdapter::LocalDisplayAdapter()
(DisplayAdapter)LocalDisplayAdapter::tryConnectDisplayLocked()

 SurfaceFlinger应用接口
显示设备信息-----java接口SurfaceControl.getDisplayConfigs()------->status_t SurfaceFlinger::getDisplayConfigs()

struct __attribute__ ((__packed__)) DisplayInfo {                                                                       
    uint32_t w{0};                                                                                                      
    uint32_t h{0};                                                                                                      
    float xdpi{0};                                                                                                      
    float ydpi{0};                                                                                                      
    float fps{0};                                                                                                       
    float density{0};                                                                                                   
    uint8_t orientation{0};                                                                                             
    bool secure{false};                                                                                                 
    nsecs_t appVsyncOffset{0};                                                                                          
    nsecs_t presentationDeadline{0};                                                                                    
}; 

SurfaceFlinger通过interface IComposerClient接口调用HAL层具体实现,详见:
https://source.android.google.cn/reference/hidl/android/hardware/graphics/composer/2.1/IComposerClient#getdisplayattribute
SurfaceFlinger是使用HIDL与HWC通信的,详见 https://source.android.google.cn/devices/architecture/hidl
具体HWC HAL层的加载与接口见https://my.oschina.net/yuyang/blog/1862234

总体多屏的识别过程是

HAL 通过回调传到SurfaceFlinger,DisplayManagerService通过Binder通信向SurfaceFlinger获取屏幕个数及其基础信息。

在HAL层上报了新的屏幕信息后,SurfaceFlinger会通过SurfaceFlinger::determineDisplayType函数来确认上报新的屏幕应该是主屏还是扩展屏幕。
SurfaceFlinger只接收连接两个屏幕,且第一个上来的是主屏幕,如果需要支持第三个屏幕则需要修改此处

显示流程参考https://blog.csdn.net/jiang19921002/article/details/78977560
https://blog.csdn.net/dongge825/article/details/54412723

转载于:https://my.oschina.net/yuyang/blog/3002874

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值