【问题标题】:Android screen flip 180 degrees before rotate to correct orientationAndroid 屏幕翻转 180 度,然后旋转到正确的方向
【发布时间】:2013-07-05 09:40:34
【问题描述】:

由于硬件问题,我们必须将我们开发的 Android 平板电脑倒置 180 度安装。通过进行以下更改,我们设法将屏幕翻转回正确的方向:

"frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp"

void GraphicPlane::setDisplayHardware(DisplayHardware *hw) . . displayOrientation = ISurfaceComposer::eOrientation90; 休息; + 案例 180: + displayOrientation = ISurfaceComposer::eOrientation180; //cdh +休息; 案例 270: displayOrientation = ISurfaceComposer::eOrientation270; 休息;

“系统/核心/rootdir/init.rc”

# Set this property so surfaceflinger is not started by system_init 
setprop system_init.startsurfaceflinger 0 
    +#cdh 
    + setprop ro.sf.hwrotation 180 

    class_start core 
    class_start main

一切看起来都不错,但屏幕会翻转 180 度,然后在旋转过程中显示正确的方向。该平板电脑在带有陀螺仪和加速度计传感器的 Android ICS 上运行。

我尝试从“frameworks/base/core/jave/android/view/WindowOrientationListener.java”检查窗口方向监听器日志,并确保旋转期间的方向正确。

我对传感器轴方向进行了一些更改(在传感器驱动程序上),但不知何故没有帮助。有什么建议可以帮助解决这个问题?

感谢所有的cmets。

谢谢, 嗯

【问题讨论】:

    标签: android rotation screen


    【解决方案1】:

    看看“frameworks/base/services/surfaceflinger/LayerScreenshot.cpp”及其方法:“LayerScreenshot::initTexture”。修改这些参数:

    mTexCoords[0] = 0;         mTexCoords[1] = v;
    mTexCoords[2] = 0;         mTexCoords[3] = 0;
    mTexCoords[4] = u;         mTexCoords[5] = 0;
    mTexCoords[6] = u;         mTexCoords[7] = v;
    

    作为:

    mTexCoords[0] = u;         mTexCoords[1] = 0;
    mTexCoords[2] = u;         mTexCoords[3] = v;
    mTexCoords[4] = 0;         mTexCoords[5] = v;
    mTexCoords[6] = 0;         mTexCoords[7] = 0;
    

    或其他可以解决您的问题的方法。 希望对你有帮助

    【讨论】:

    • 感谢您的建议。我设法通过在 frameworks/base/services/java/com/android/server/wm/ScreenRotationAnimation 的 createRotationMatrix () 旋转开关案例中交换矩阵旋转 (0 180; 90 270) 来解决这个问题。 java 文件。屏幕现在可以正确流畅地旋转了。
    猜你喜欢
    • 1970-01-01
    • 2023-04-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-19
    • 1970-01-01
    • 1970-01-01
    • 2012-11-09
    相关资源
    最近更新 更多