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