android5.1設定預設開機橫屏
阿新 • • 發佈:2019-02-08
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