0

Due to hardware issue, we have to mount our developed Android tablet up-side-down 180 degrees. We managed to flip the screen back to correct orientation by making the following changes:

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

void GraphicPlane::setDisplayHardware(DisplayHardware *hw) . . displayOrientation = ISurfaceComposer::eOrientation90; break; + case 180: + displayOrientation = ISurfaceComposer::eOrientation180; //cdh + break; case 270: displayOrientation = ISurfaceComposer::eOrientation270; break;

"system/core/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

Everything looks OK but somehow the screen will flip 180 degrees before showing the correct orientation during rotation. The tablet is running on Android ICS with gyroscope and accelerometer sensors.

I tried checking Window Orientation Listener log from "frameworks/base/core/jave/android/view/WindowOrientationListener.java" and made sure that the orientation during the rotation was correct.

I made some changes to sensor axes direction (on sensor driver) but somehow that did not help. Any suggestions that can help to solve this issue?

Appreciate all comments.

Thanks, MM

4

1 回答 1

1

Take a look at the "frameworks/base/services/surfaceflinger/LayerScreenshot.cpp" and its method: "LayerScreenshot::initTexture". modify these parameters:

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

as:

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

or others that can fix your situation. hope that can help you

于 2013-07-12T09:38:14.100 回答