Android竖屏横屏显示

基本上竖屏改成横屏改这两个值就差不多了

frameworks/base/core/res/res/values/config.xml
false
90

但是很多客户的版本需要改PhoneWindowManager.java

public int rotationForOrientationLw(int orientation, int lastRotation) {
return rotation = Surface.ROTATION_90;
}

这样修改之后动画不会切换过去,所以开机后会在luncher界面有个旋转屏幕的画面。

如果想要动画也旋转,且进入launcher时屏幕没有旋转的过程,需要做如下修改:
1、进入framework/base/core/res/res/values/config.xml
修改config_lidOpenRotation = 0 ;----> config_lidOpenRotation = 90 ;
修改config_supportAutoRotation = true ;----> config_supportAutoRotation = false ;
2、进入framework/base/services/core/java/com/android/server/wm/WindowMangerService.java
修改int mRotation = 0 ;-----> int mRotation = 1 ;

修改函数updateOrientationFromAppTokensLocked中
在int req = getOrientationLocked();后面加上req = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; 

3、frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
public int rotationForOrientationLw(int orientation, int lastRotation) {
直接return Surface.ROTATION_90;
}
4、进入framework/native/services/surfaceflinger/DisplayDevice.cpp
修改setProjection(Displaystate::eOrientationDefault, mViewprot ,mFrame )------>
setProjection( Displaystate::eOrientation90 ,mViewprot , mFrame )

5、进入/framework/native/services/surfaceflinger/DisplayDevice.cpp
修改函数 void DisplayDevice::setProjection(intorientation, const Rect&newViewport,const Rect&newFrame)中
if(!frame.isValid()){
frame = Rect(w,h);----->frame = Rect(h,w);
}

6、进入framework/base/cmds/bootanimation/BootAnimation.cpp
修改status_t BootAnimation::readyToRun函数中的
sp control = session()->createsurface(String8(“BootAnimation”),dinfo.w,dinfo.h.PIXEL_FORMAT_RGB_565);
为:
sp control = session()->createsurface(String8(“BootAnimation”),dinfo.h,dinfo.w.PIXEL_FORMAT_RGB_565);

你可能感兴趣的:(Android竖屏横屏显示)