android5.1设置默认开机横屏

1、进入framework/base/core/res/res/values/config.xml
    修改config_lidOpenRotation = 0 ;---->  config_lidOpenRotation  = 90 ;
2、进入framework/base/services/core/java/com/android/server/wm/WindowMangerService.java
    修改int mRotation = 0 ;-----> int mRotation = 1 ;
3、 进入framework/base/services/surfaceflinger/DisplayDevice.cpp
    修改setProjection(Displaystate::eOrientationDefault, mViewprot ,mFrame )------>
    setProjection( Displaystate::eOrientation90 ,mViewprot , mFrame  )
编译成功刷入系统会出现开机动画部分只显示3/4解决方案如下:
1、进入framework/base/cmds/bootanimation/BootAnimation.cpp
    修改status_t   BootAnimation::readyToRun函数中的                                                        
  spcontrol=session()-   >createsurface(String8("BootAnimation"),dinfo.w,dinfo.h.PIXEL_FORMAT_RGB_565);   
 为:
  spcontrol=session()-   >createsurface(String8"BootAnimation"),dinfo.h,dinfo.w.PIXEL_FORMAT_RGB_565);
2、进入/framework/native/services/surfaceflinger/DisplayDevice.cpp
   修改函数 void DisplayDevice::setProjection(intorientation, conts Rect&newViewport,constRect&newFrame)中
if(!frame.isValid()){
frame = Rect(w,h);----->frame = Rect(h,w);
}
    在Transform R;  下面添加
    orientation = DisplayState::eorientation90;
3、 进入/framework/native/services/surfaceflinger/surfaceFlinger.cpp
    修改函数voidSurfaceFlinger::onInitializeDisplay()中:
d.orientation = DisplayState::eOrientationDefault ;-----> d.orientation=DisplayState::eOrientatio90;

最后编译生成镜像,问题解决。 


转载自http://weibo.com/p/230418142aca4390102x6e4

你可能感兴趣的:(android5.1设置默认开机横屏)