RK3288 6.0 双屏异显,横屏+竖屏【转】
本文转载自:http://blog.csdn.net/clx44551/article/details/78215730?locationNum=8&fps=1
RK3288 6.0 双屏异显,横屏+竖屏
由于是横屏+竖屏的组合,目前考虑两种实现方案。1.副屏存在黑边 2.对副屏内容进行拉伸。
默认情况下,我们设置的双屏初始rotation都为Surface.ROTATION_0,因此需将WSM中的updateRotationUncheckedLocked方法的该语句进行屏蔽。
- if (mRotateOnBoot) {
- mRotation = Surface.ROTATION_0;
- rotation = Surface.ROTATION_90;
- }
- /* display portrait, force android rotation according to 90 */
- if("true".equals(SystemProperties.get("persist.display.portrait","false"))){
- rotation = Surface.ROTATION_90;
- }
- //LQH
- // rotation = Surface.ROTATION_0;
- /* display portrait end */
- // if("vr".equals(SystemProperties.get("ro.target.product","tablet")))
- // rotation = Surface.ROTATION_0;
- if (mRotation == rotation && mAltOrientation == altOrientation) {
- // No change.
- return false;
- }
同时在该工程中集成了对于主屏和副屏初始角度控制的补丁,通过build.prop文件进行配置即可。
ro.sf.hwrotation=0 主屏初始方向 (在./native/services/surfaceflinger/SurfaceFlinger.cpp进行赋值)
ro.orientation.einit=90 副屏初始方向
ro.same.orientation=false 主副屏orientaion是否相同
ro.rotation.external=false 副屏是否随主屏旋转
参考http://blog.csdn.net/ljp1205/article/details/53405641,了解Display框架及其初始化过程,主要对Display初始化时的参数进行调整。
该部分的代码在base/services/core/java/com/android/server/display/LocalDisplayAdapter.java的getDisplayDeviceInfoLocked()方法下完成:
- @Override
- public DisplayDeviceInfo getDisplayDeviceInfoLocked() {
- if (mInfo == null) {
- SurfaceControl.PhysicalDisplayInfo phys = mDisplayInfos[mActivePhysIndex];
- mInfo = new DisplayDeviceInfo();
- mInfo.width = phys.width;
- mInfo.height = phys.height;
- mInfo.modeId = mActiveModeId;
- mInfo.defaultModeId = mDefaultModeId;
- mInfo.supportedModes = new Display.Mode[mSupportedModes.size()];
- for (int i = 0; i < mSupportedModes.size(); i++) {
- DisplayModeRecord record = mSupportedModes.valueAt(i);
- mInfo.supportedModes[i] = record.mMode;
- }
- mInfo.colorTransformId = mActiveColorTransformId;
- mInfo.defaultColorTransformId = mDefaultColorTransformId;
- mInfo.supportedColorTransforms =
- new Display.ColorTransform[mSupportedColorTransforms.size()];
- for (int i = 0; i < mSupportedColorTransforms.size(); i++) {
- mInfo.supportedColorTransforms[i] = mSupportedColorTransforms.valueAt(i);
- }
- mInfo.appVsyncOffsetNanos = phys.appVsyncOffsetNanos;
- mInfo.presentationDeadlineNanos = phys.presentationDeadlineNanos;
- mInfo.state = mState;
- mInfo.uniqueId = getUniqueId();
- // Assume that all built-in displays that have secure output (eg. HDCP) also
- // support compositing from gralloc protected buffers.
- if (phys.secure) {
- mInfo.flags = DisplayDeviceInfo.FLAG_SECURE
- | DisplayDeviceInfo.FLAG_SUPPORTS_PROTECTED_BUFFERS;
- }
- if (mBuiltInDisplayId == SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN) {
- final Resources res = getContext().getResources();
- mInfo.name = res.getString(
- com.android.internal.R.string.display_manager_built_in_display_name);
- mInfo.flags |= DisplayDeviceInfo.FLAG_DEFAULT_DISPLAY
- | DisplayDeviceInfo.FLAG_ROTATES_WITH_CONTENT;
- if (res.getBoolean(com.android.internal.R.bool.config_mainBuiltInDisplayIsRound)
- || (Build.HARDWARE.contains("goldfish")
- && SystemProperties.getBoolean(PROPERTY_EMULATOR_CIRCULAR, false))) {
- mInfo.flags |= DisplayDeviceInfo.FLAG_ROUND;
- }
- mInfo.type = Display.TYPE_BUILT_IN;
- mInfo.densityDpi = (int)(phys.density * 160 + 0.5f);
- mInfo.xDpi = phys.xDpi;
- mInfo.yDpi = phys.yDpi;
- mInfo.touch = DisplayDeviceInfo.TOUCH_INTERNAL;
- } else {
- mInfo.type = Display.TYPE_HDMI;
- mInfo.flags |= DisplayDeviceInfo.FLAG_PRESENTATION;
- boolean noRotate = "0".equals(SystemProperties.get("ro.sf.hwrotation"));
- if(noRotate && mBuiltInDisplayId == SurfaceControl.BUILT_IN_DISPLAY_ID_HDMI){
- if (SystemProperties.getBoolean("ro.rotation.external", false)) {
- mInfo.flags |= DisplayDeviceInfo.FLAG_ROTATES_WITH_CONTENT;
- }
- String value = SystemProperties.get("ro.orientation.einit");
- if ("0".equals(value)) {
- mInfo.rotation = Surface.ROTATION_0;
- } else if ("90".equals(value)) {
- mInfo.rotation = Surface.ROTATION_90;
- } else if ("180".equals(value)) {
- mInfo.rotation = Surface.ROTATION_180;
- } else if ("270".equals(value)) {
- mInfo.rotation = Surface.ROTATION_270;
- }
- }
- mInfo.name = getContext().getResources().getString(
- com.android.internal.R.string.display_manager_hdmi_display_name);
- mInfo.touch = DisplayDeviceInfo.TOUCH_EXTERNAL;
- mInfo.setAssumedDensityForExternalDisplay(phys.width, phys.height);
- // For demonstration purposes, allow rotation of the external display.
- // In the future we might allow the user to configure this directly.
- if ("portrait".equals(SystemProperties.get("persist.demo.hdmirotation"))) {
- mInfo.rotation = Surface.ROTATION_270;
- }
- // For demonstration purposes, allow rotation of the external display
- // to follow the built-in display.
- if (SystemProperties.getBoolean("persist.demo.hdmirotates", false)) {
- mInfo.flags |= DisplayDeviceInfo.FLAG_ROTATES_WITH_CONTENT;
- }
- }
- }
- return mInfo;
- }
最终显示的frame大小确定,在framework/native/service/surfaceflinger/DisplayDevice.cpp中
- bool isHdmiScreen = mType == DisplayDevice::DISPLAY_EXTERNAL;
- if (isHdmiScreen) {
- int eInitOrientation = 0;
- bool isSfHwrotated = false;
- bool isSupportRotation = false;
- bool isPrimaryExternalSameOrientation = false;
- Rect newFrame = Rect(0,0,getWidth(),getHeight());
- Rect newFrameRotated = Rect(0,0,getHeight(),getWidth());
- float frameRatio = (float)frame.getWidth() / frame.getHeight();
- char value[PROPERTY_VALUE_MAX];
- property_get("ro.sf.hwrotation", value, "0");
- isSfHwrotated = atoi(value) != 0;
- property_get("ro.same.orientation", value, "false");
- isPrimaryExternalSameOrientation = !strcmp(value,"true");
- if(!isSfHwrotated) {
- property_get("ro.orientation.einit", value, "0");
- eInitOrientation = atoi(value) / 90;
- property_get("ro.rotation.external", value, "false");
- isSupportRotation = !strcmp(value,"true");
- }
- if (isSupportRotation && !isPrimaryExternalSameOrientation) {
- mClientOrientation = orientation;
- if (eInitOrientation % 2 == 1) {
- frame = frameRatio > 1.0 ? frame : newFrameRotated;
- ALOGE("%d,[%d,%d]",__LINE__,frame.getWidth(),frame.getHeight());
- } else {
- frame = frameRatio > 1.0 ? newFrame : frame;
- ALOGE("%d,[%d,%d]",__LINE__,frame.getWidth(),frame.getHeight());
- }
- } else if (isSupportRotation) {
- mClientOrientation = orientation;
- if (eInitOrientation % 2 == 1) {
- //frame = frameRatio > 1.0 ? frame : frame;
- ALOGE("%d,[%d,%d]",__LINE__,frame.getWidth(),frame.getHeight());
- } else {
- frame = frameRatio > 1.0 ? newFrame : newFrameRotated;
- ALOGE("%d,[%d,%d]",__LINE__,frame.getWidth(),frame.getHeight());
- }
- } else if (eInitOrientation % 2 != 0) {
- if (isPrimaryExternalSameOrientation) {
- //frame = frameRatio > 1.0 ? frame : frame;
- ALOGE("%d,[%d,%d]",__LINE__,frame.getWidth(),frame.getHeight());
- } else {
- //应该走的这里
- frame = frameRatio > 1.0 ? frame : newFrameRotated;
- ALOGE("%d,[%d,%d]",__LINE__,frame.getWidth(),frame.getHeight());
- }
- } else if (eInitOrientation % 2 == 0) {
- if (isPrimaryExternalSameOrientation) {
- frame = frameRatio > 1.0 ? newFrame : frame;
- ALOGE("%d,[%d,%d]",__LINE__,frame.getWidth(),frame.getHeight());
- } else {
- frame = frameRatio > 1.0 ? newFrame : frame;
- ALOGE("%d,[%d,%d]",__LINE__,frame.getWidth(),frame.getHeight());
- }
- } else {
- frame = frameRatio > 1.0 ? newFrame : frame;
- ALOGE("%d,[%d,%d]",__LINE__,frame.getWidth(),frame.getHeight());
- }
- ALOGE("update frame [%d,%d]",frame.getWidth(),frame.getHeight());
- }
根据具体情况进行配置,即可实现 双屏异显,横屏+竖屏,竖屏存在黑边的效果。在上面的补丁中,可对frame进行强制定义为副屏大小,则可以实现拉伸效果,填充黑边。
- frame=Rect(0,0,getHeight(),getWidth());
但两块屏幕比例相差较大的情况下,拉伸显示的效果较差。
注:在设置中将g-sensor的旋转功能关闭,旋转对上述实现存在一定影响。
RK3288 6.0 双屏异显,横屏+竖屏【转】的更多相关文章
- RK3288 双屏异显,两屏默认方向不一致
CPU:RK3288 系统:Android 5.1 RK3288 支持双屏异显,一般都会同方向显示,如果遇到两个 lcd 的默认方向不一致,只需修改下面参数即可. 例如:主屏为mipi接口,分辨率为 ...
- RK3288 增加双屏异显 eDP+LVDS
CPU:RK3288 系统:Android 5.1 下面是官方文档中的信息. 1.rk3288 支持的显示接口可以任意组合. 2.双屏异显时,一个显示接口当主屏,另一个当副屏:主副屏由板级 dts 文 ...
- Rk3288 双屏异显单触摸
系统版本:RK3288 android 5.1 设备同时有两个lcd,主屏是mipi接口,带有触摸屏,触摸屏是usb接口,副屏是hdmi接口,没有触摸屏,正常情况下,两个lcd显示相同内容,触摸屏一切 ...
- RK3288 双屏异显时,触摸屏(USB接口)无反应
系统版本:RK3288 android 5.1 设备同时有两个lcd,主屏是mipi接口,带有触摸屏,触摸屏是usb接口,副屏是hdmi接口,没有触摸屏,正常情况下,两个lcd显示相同内容,触摸屏一切 ...
- [Android6.0][RK3399] 双屏异显代码实现流程分析(一)【转】
本文转载自:http://blog.csdn.net/dearsq/article/details/55049182 Platform: RK3399 OS: Android 6.0 Version: ...
- iTOP-4418/6818开发板支持双屏异显,双屏同显
iTOP-4418/6818开发板平台安卓系统下支持双屏异显,双屏同显,客户可按照不同用途,分别播放适合屏幕显示方式的内容 ,如HDMI屏幕和LCD屏幕显示不同内容, 一个屏幕播放广告,另一个屏幕运行 ...
- 【ARM开发板】迅为IMX6开发板QT下LVDS和HDMI双屏异显
本文转自迅为论坛:http://www.topeetboard.com 平台:迅为-IMX6开发板 首先开发板分别连接9.7寸屏和HDMI显示器,然后使用MfgTool工具烧写QT系统,然后拨码开关设 ...
- iTOP-iMX6开发板Android系统下LVDS和HDMI双屏异显方法
迅为iMX6 开发板 android 系统下 LVDS 和 HDMI 双屏异显的使用过程. 注意,iTOP-iMX6 开发板的 android 系统想要实现对 LVDS 和 HDMI 双屏异显功能的支 ...
- HTML5中判断横屏竖屏
在移动端中我们经常碰到横屏竖屏的问题,那么我们应该如何去判断或者针对横屏.竖屏来写不同的代码呢. 这里有两种方法: 一:CSS判断横屏竖屏 写在同一个CSS中 1 2 3 4 5 6 @media s ...
随机推荐
- 【thinking in java】反射
前言 反射是框架设计的灵魂,使用的前提条件:必须先得到字节码的Class,Class类用于表示字节码,字节码即是.class文件 概述 JAVA反射机制:在程序运行的过程中,对于任意一个类,都可以知道 ...
- ubuntu 安装 navicat
下载navicat解压到opt目录 创建桌面快捷方式sudo vim /usr/share/applications/navicat.desktop [Desktop Entry] Encoding= ...
- django-3 admin开启后台配置并展示表内容
设置了superuser 之后,可以在run server 后, 通过浏览器访问后台,进行界面配置. 1. python manage.py creatersuperuser 此命令在manage.p ...
- MongoDB数据库的安装
首先就是MongoDB的下载,可以去MongoDB官网进行下载,https://www.mongodb.com/download-center/community,也可以通过百度网盘直接下载, 链接: ...
- C#上位机开发(一)—— 了解上位机
在单片机项目开发中,上位机也是一个很重要的部分,主要用于数据显示(波形.温度等).用户控制(LED,继电器等),下位机(单片机)与 上位机之间要进行数据通信的两种方式都是基于串口的: USB转串口 — ...
- Jackson入门
Jackson 框架,轻易转换JSON Jackson可以轻松的将Java对象转换成json对象和xml文档,同样也可以将json.xml转换成Java对象. 前面有介绍过json-lib这个框架,在 ...
- 全文搜索(A-5)-推荐算法
基于内容的推荐算法: 协同过滤推荐算法: 混合推荐算法: 基于内容的推荐算法做了如下假设:用户会喜欢和原来喜欢的物品相类似的项目.
- [luoguP1494] 岳麓山上打水 && [luoguP2744] [USACO5.3]量取牛奶Milk Measuring
传送门 传送门 dfs选取集合,dp背包判断 虽然我觉的会TLE.. 但是的确是AC了 #include <cstdio> #include <cstring> #includ ...
- 解决Codeforces访问慢的本地方案
参考: http://m.blog.csdn.net/blog/Xiangamp/42245923#
- BNU2017校赛
A(模拟) 题意:求一个特殊图的最大流 分析:画画图发现就是for循环扫一遍 B(LCA) 题意:有n个点组成的树,有q个询问,每个询问(A,B,C),学生从B点走最短路径走到C点,再从C点走到根节点 ...