Discuz! Board

标题: 爱奇艺的兼容 [打印本页]

作者: zangcf    时间: 2016-5-16 22:21
标题: 爱奇艺的兼容
首先要如下配置:
            mBaseDisplayInfo.type = deviceInfo.type;
            mBaseDisplayInfo.address = deviceInfo.address;
            mBaseDisplayInfo.name = deviceInfo.name;
            mBaseDisplayInfo.appWidth = deviceInfo.width*2;
            mBaseDisplayInfo.appHeight = deviceInfo.height/2;
            mBaseDisplayInfo.logicalWidth = deviceInfo.width;        //zcfdebug
            mBaseDisplayInfo.logicalHeight = deviceInfo.height/2;        //zcfdebug
            mBaseDisplayInfo.rotation = Surface.ROTATION_0;
            mBaseDisplayInfo.refreshRate = deviceInfo.refreshRate;
            mBaseDisplayInfo.supportedRefreshRates = Arrays.copyOf(
                    deviceInfo.supportedRefreshRates, deviceInfo.supportedRefreshRates.length);
            mBaseDisplayInfo.logicalDensityDpi = deviceInfo.densityDpi;
            mBaseDisplayInfo.physicalXDpi = deviceInfo.xDpi*2;
            mBaseDisplayInfo.physicalYDpi = deviceInfo.yDpi;
            mBaseDisplayInfo.appVsyncOffsetNanos = deviceInfo.appVsyncOffsetNanos;
            mBaseDisplayInfo.presentationDeadlineNanos = deviceInfo.presentationDeadlineNanos;
            mBaseDisplayInfo.state = deviceInfo.state;
            mBaseDisplayInfo.smallestNominalAppWidth = deviceInfo.width*2;
            mBaseDisplayInfo.smallestNominalAppHeight = deviceInfo.height/2;
            mBaseDisplayInfo.largestNominalAppWidth = deviceInfo.width*2;
            mBaseDisplayInfo.largestNominalAppHeight = deviceInfo.height/2;
            mBaseDisplayInfo.ownerUid = deviceInfo.ownerUid;
            mBaseDisplayInfo.ownerPackageName = deviceInfo.ownerPackageName;



作者: zangcf    时间: 2016-5-18 13:53
兼容还是靠dpi兼容的,
修改SurfaceFlinger.cpp
        //zcfdebug-- info.w = hwConfig.width;
                info.w = hwConfig.width;        //zcfdebug++
        info.h = hwConfig.height;
        info.xdpi = xdpi*2;
        info.ydpi = ydpi;        //zcfdebug--
        info.fps = float(1e9 / hwConfig.refresh);
        info.appVsyncOffset = VSYNC_EVENT_PHASE_OFFSET_NS;

然后
/media/doraemon/works/android/mtk/6735/vr_mouse/alps_VR_new/frameworks/base/services/core/java/com/android/server/display/LogicalDisplay.java
            mBaseDisplayInfo.type = deviceInfo.type;
            mBaseDisplayInfo.address = deviceInfo.address;
            mBaseDisplayInfo.name = deviceInfo.name;
            mBaseDisplayInfo.appWidth = deviceInfo.width;
            mBaseDisplayInfo.appHeight = deviceInfo.height;
            mBaseDisplayInfo.logicalWidth = deviceInfo.width;
            mBaseDisplayInfo.logicalHeight = deviceInfo.height/2;        //zcfdebug
            mBaseDisplayInfo.rotation = Surface.ROTATION_0;
            mBaseDisplayInfo.refreshRate = deviceInfo.refreshRate;
            mBaseDisplayInfo.supportedRefreshRates = Arrays.copyOf(
                    deviceInfo.supportedRefreshRates, deviceInfo.supportedRefreshRates.length);
            mBaseDisplayInfo.logicalDensityDpi = deviceInfo.densityDpi;
            mBaseDisplayInfo.physicalXDpi = deviceInfo.xDpi;
            mBaseDisplayInfo.physicalYDpi = deviceInfo.yDpi;
            mBaseDisplayInfo.appVsyncOffsetNanos = deviceInfo.appVsyncOffsetNanos;
            mBaseDisplayInfo.presentationDeadlineNanos = deviceInfo.presentationDeadlineNanos;
            mBaseDisplayInfo.state = deviceInfo.state;
            mBaseDisplayInfo.smallestNominalAppWidth = deviceInfo.width;
            mBaseDisplayInfo.smallestNominalAppHeight = deviceInfo.height;
            mBaseDisplayInfo.largestNominalAppWidth = deviceInfo.width;
            mBaseDisplayInfo.largestNominalAppHeight = deviceInfo.height;
            mBaseDisplayInfo.ownerUid = deviceInfo.ownerUid;
            mBaseDisplayInfo.ownerPackageName = deviceInfo.ownerPackageName;
只需修改一处就好了




欢迎光临 Discuz! Board (http://47.89.242.157:9000/bbs/discuz/) Powered by Discuz! X3.2