MTK 屏幕旋转90度

http://blog.csdn.net/ouo555/article/details/44806837

1.屏幕显示顺时针旋转90度

lk 横屏logo,顺时针旋转90度显示修改
bootable/bootloader/lk/project/len6735_65u_vo.mk

BOOT_LOGO = wxganl  
MTK_LCM_PHYSICAL_ROTATION = 90 

framebuffer顺时针旋转90度的修改:

device/lentek/len6735_65u_vo/ProjectConfig.mk

MTK_LCM_PHYSICAL_ROTATION = 90  

2.触摸屏上报坐标映射

由于LCD显示旋转了90度,对应的触摸屏上报坐标的也需要重新进行映射:
sudo subl ./kernel-3.10/drivers/input/touchscreen/mediatek/GT9XX/focaltech_core.c中修改static int fts_report_value(struct ts_event *data)
            input_report_abs(tpd->dev, ABS_MT_POSITION_X, data->au16_x[i]);//delete by dh
            input_report_abs(tpd->dev, ABS_MT_POSITION_Y, data->au16_y[i]);//delete by dh
            touchs |= BIT(data->au8_finger_id[i]);
            data->touchs |= BIT(data->au8_finger_id[i]);

3.重力传感器方向修改

由于屏幕默认显示方向逆时针旋转90度,默认的重力传感器的方向也需要对应修改:kernel-3.10/drivers/misc/mediatek/mach/mt6735/len6735_65u_vo/accelerometer/mc3xxx_auto/mc3xxx_cust_acc.c
static struct acc_hw mc3xxx_cust_acc_hw = {  
     .i2c_num = 2,  
     //.direction = 4,  
     .direction = 7,  
     .power_id = MT65XX_POWER_NONE,  /*!< LDO is not used */  
     .power_vol= VOL_DEFAULT,        /*!< LDO is not used */  
     .firlen = 0, //old value 16                /*!< don't enable low pass fileter */  
     .is_batch_supported = false,  
 };  

4.默认屏幕方向设置

进入framework/base/services/core/java/com/android/server/wm/WindowMangerService.java

  修改int mRotation = 0 ;为:
int mRotation = 1 ;

5、开机动画显示半屏的原因,也旋转90度

修改frameworks/native/services/surfaceflinger/DisplayDevice.cpp

setProjection(DisplayState::eOrientation90, mViewport, mFrame);

6.编译成功刷入系统会出现开机动画部分只显示3/4解决方案如下: 

进入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);

进入/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;
 

进入/framework/native/services/surfaceflinger/SurfaceFlinger.cpp

修改函数voidSurfaceFlinger::onInitializeDisplay()中:
d.orientation = DisplayState::eOrientationDefault ;为:
d.orientation=DisplayState::eOrientatio90;

 7.开机动画显示任然竖屏一会儿的问题

进入PhoneWindowManager.java文件 5993行修改默认返回值

 public class PhoneWindowManager implements WindowManagerPolicy {
                     if (preferredRotation >= 0) {
                         return preferredRotation;
                     }
-                    return Surface.ROTATION_0;
+                    return Surface.ROTATION_90;
             }
原文地址:https://www.cnblogs.com/zxouxuewei/p/8260605.html