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、进入/\frameworks/native/services/surfaceflinger/DisplayDevice.cpp
修改setProjection( Displaystate::eOrientationDefault, mViewprot , mFrame )------>
setProjection( Displaystate::eOrientation90 , mViewprot , mFrame )
4、进入frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java修改
删除if(false) 部分添加if(true)部分即可。
public int rotationForOrientationLw(int orientation, int lastRotation) {
+ if (true)
+ {
+ return Surface.ROTATION_90;
+ }
- if (false) {
- Slog.v(TAG, "rotationForOrientationLw(orient="
- + orientation + ", last=" + lastRotation
- + "); user=" + mUserRotation + " "
- + ((mUserRotationMode == WindowManagerPolicy.USER_ROTATION_LOCKED)
- ? "USER_ROTATION_LOCKED" : "")
- );
- }
编译成功刷入系统会出现开机动画部分只显示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(int orientation, conts Rect&newViewport,const Rect&newFrame)中
if(!frame.isValid()){
frame = Rect(w,h); ----->frame = Rect(h,w);
}
在Transform R; 下面添加
orientation = DisplayState::eorientation90;
3、进入/framework/native/services/surfaceflinger/surfaceFlinger.cpp
修改函数void SurfaceFlinger::onInitializeDisplay()中:
d.orientation = DisplayState::eOrientationDefault ; ----->d.orientation=DisplayState::eOrientatio90 ;
参考:https://blog.csdn.net/wlwl0071986/article/details/81285553