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、进入/\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

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值