1)kernel 竖屏
选中:
make menuconfig ---> Device Drivers ---> Graphics support ---> Console display driver support ---> Framebuffer Console Rotation
make menuconfig
---> Boot options 启动参数修改为:console=ttySAC2,115200 init=/linuxrc fbcon=rotate:1
说明: fbcon=rotate: This option changes the orientation angle of the console display. The value 'n' accepts the following: 0 - normal orientation (0 degree) 1 - clockwise orientation (90 degrees) 2 - upside down orientation (180 degrees) 3 - counterclockwise orientation (270 degrees) 2)Android OS 竖屏 文件:./native/services/surfaceflinger/SurfaceFlinger.cpp status_t SurfaceFlinger::getDisplayInfo(const sp& display, DisplayInfo* info) { ... 738 // int displayOrientation = DisplayState::eOrientationDefault; int displayOrientation = isplayState::eOrientation90; // 加上这行 740 char property[PROPERTY_VALUE_MAX]; 741 if (type == DisplayDevice::DISPLAY_PRIMARY) { 742 if (property_get("ro.sf.hwrotation", property, NULL) > 0) { 743 switch (atoi(property)) { 744 case 90: 745 displayOrientation = DisplayState::eOrientation90; 746 break; 747 case 270: 748 displayOrientation = DisplayState::eOrientation270; 749 break; 750 } 751 } 752 } 753 754 if (displayOrientation & DisplayState::eOrientationSwapMask) { 755 swap(width, height); 756 } 757 758 info->w = width; 759 info->h = height; 760 info->xdpi = xdpi; 761 info->ydpi = ydpi; 762 info->fps = float(1e9 / hwc.getRefreshPeriod(type)); 763 764 // All non-virtual displays are currently considered secure. 765 info->secure = true; 766 767 return NO_ERROR; 768 } 2)device 中init.rc修改 竖屏 zhz@zhz:~/imx6-android-4.4.3/android/device/fsl/sabresd_6dq$ vim init.rc #Define the config for dual camera setprop camera.disable_zsl_mode 1 #For landscape mode, orient is 0 #For portrait mode, orient is 90 #the android before honycomb are all in portrait mode setprop back_camera_name ov5640_mipi setprop back_camera_orient 0 setprop front_camera_name uvc,ov5642_camera,ov5640_camera setprop front_camera_orient 0 # Set OpenGLES version setprop ro.opengles.version 196608 # Set rotation to 270 to cofigure as portrait mode setprop ro.sf.hwrotation 0 #指定默认输出不旋转(我们默认输出时竖屏) #setprop ro.sf.hwrotation 270 指定旋转270度输出 # Set the density to 160dpi, default 128dpi is not good setprop ro.sf.lcd_density 160 2. 这个指定角度,Android默认只有0度和270度有效,180度无效,如果想使用180度,需要修改源码 修改文件frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp if (type == DisplayDevice::DISPLAY_PRIMARY) { if (property_get("ro.sf.hwrotation", property, NULL) > 0) { switch (atoi(property)) { case 90: displayOrientation = DisplayState::eOrientation90; break; case 270: displayOrientation = DisplayState::eOrientation270; break; case 180: displayOrientation = DisplayState::eOrientation180; break; } } } 这样子就支持了180度了在方法 3. 还有更详细的 - Android 4.1 默认窗体旋转180度 1).设置属性值 在/out/target/product/sabresd_6dq/system/build.prop文件中加入 ro.sf.hwrotation=180 2).设置窗体默认显示方向 在frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp文件中找到方法 getDisplayInfo switch (atoi(property)) 加入 case 180: displayOrientation = DisplayState::eOrientation180; break; 3).设置窗体动画旋转方向 a > 在frameworks/base/core/java/android/view/Surface.java 加入方法 public static int getDefaultRotation(){ return android.os.SystemProperties.getInt("ro.sf.hwrotation", 0);//180 } /** * @hide */ public static int getDefaultRotationIndex(){ int rotation = getDefaultRotation(); switch(rotation){ case 0: return ROTATION_0; case 90: return ROTATION_90; case 180: return ROTATION_180; case 270: return ROTATION_270; } return ROTATION_0; } b > 在frameworks/base/services/java/com/android/server/vm/ScreenRotationAnimation.java 文件中找到(android4.1) 方法setRotation 或(android4.2)方法setRotationInTransaction 修改 deltaRotation(rotation,Surface.ROTATION_0); 为deltaRotation(rotation,Surface. getDefaultRotationIndex()); 4). 修改最近程序视图方向 在frameworks/base/packages/systemui/src/com/android/systemui/RecentsPanelView.java 文件中修改如下 private int mThumbnailHeight;//add 在方法中添加 写博客,送money、送书、送C币啦 7-8月博乐推荐文章 砸BUG 得大奖 100%中奖率 微信开发学习路线高级篇上线 恭喜博主周兆熊新书发售 Android启动默认是横屏或者竖屏 分类: android驱动JNI 2014-03-28 15:59 4222人阅读 评论(0) 收藏 举报 Android启动默认是横屏或者竖屏 我们的TV本来是横屏显示,但是有客户竟然要竖屏显示,昨天快下班收到的需求,竟然说7.19就要搞定。思路有2个,一个就是修改LCD的默认输出,但是这个不是我这个水平能轻而易举搞定的。另外一个就是底层应该给上层porting出接口。像这种系统性的接口一般在build.prop里。 找到一个相关度比较大的属性ro.sf.hwrotation=270,和旋转有关的,联想到0,90,180,270.试试吧,将其改为ro.sf.hwrotation=0,测试了一下,OK,满足客户要求了,就早点下班了。 /device/samsung/smdk4x12/system.prop (ro.sf.hwrotation) 今天来了搜了一下相关的内容,还是发现了不少知识 1. 可以在init.rc里指定系统是横屏还是竖屏 [plain] view plaincopy setprop ro.sf.hwrotation 0 指定默认输出不旋转(我们默认输出时竖屏) #setprop ro.sf.hwrotation 270 指定旋转270度输出 2. 这个指定角度,Android默认只有0度和270度有效,180度无效,如果想使用180度,需要修改源码 修改文件frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp 在方法 [cpp] view plaincopy void GraphicPlane::setDisplayHardware(DisplayHardware *hw)里加 case 180: displayOrientation = ISurfaceComposer::eOrientation180; break; 这样子就支持了180度了 3. 还有更详细的 - Android 4.1 默认窗体旋转180度 1).设置属性值 在system/build.prop文件中加入 ro.sf.hwrotation=180 2).设置窗体默认显示方向 在frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp文件中找到方法 setDisplayHardware 在switch中加入 [cpp] view plaincopy case 180: displayOrientation = ISurfaceComposer::eOrientation180; break; 3).设置窗体动画旋转方向 a > 在frameworks/base/core/java/android/view/Surface.java 加入方法 [cpp] view plaincopy /** * @hide */ public static int getDefaultRotation(){ return android.os.SystemProperties.getInt("ro.sf.hwrotation", 0);//180 } /** * @hide */ public static int getDefaultRotationIndex(){ int rotation = getDefaultRotation(); switch(rotation){ case 0: return ROTATION_0; case 90: return ROTATION_90; case 180: return ROTATION_180; case 270: return ROTATION_270; } return ROTATION_0; } b > 在frameworks/base/services/java/com/android/server/vm/ScreenRotationAnimation.java 文件中找到(android4.1) 方法setRotation 或(android4.2)方法setRotationInTransaction 修改 deltaRotation(rotation,Surface.ROTATION_0); 为deltaRotation(rotation,Surface. getDefaultRotationIndex()); 4). 修改最近程序视图方向 在frameworks/base/packages/systemui/src/com/android/systemui/RecentsPanelView.java 文件中修改如下 private int mThumbnailHeight;//add 在方法中添加 [cpp] view plaincopy 写博客,送money、送书、送C币啦 7-8月博乐推荐文章 砸BUG 得大奖 100%中奖率 微信开发学习路线高级篇上线 恭喜博主周兆熊新书发售 Android启动默认是横屏或者竖屏 分类: android驱动JNI 2014-03-28 15:59 4222人阅读 评论(0) 收藏 举报 Android启动默认是横屏或者竖屏 我们的TV本来是横屏显示,但是有客户竟然要竖屏显示,昨天快下班收到的需求,竟然说7.19就要搞定。思路有2个,一个就是修改LCD的默认输出,但是这个不是我这个水平能轻而易举搞定的。另外一个就是底层应该给上层porting出接口。像这种系统性的接口一般在build.prop里。 找到一个相关度比较大的属性ro.sf.hwrotation=270,和旋转有关的,联想到0,90,180,270.试试吧,将其改为ro.sf.hwrotation=0,测试了一下,OK,满足客户要求了,就早点下班了。 /device/samsung/smdk4x12/system.prop (ro.sf.hwrotation) 今天来了搜了一下相关的内容,还是发现了不少知识 1. 可以在init.rc里指定系统是横屏还是竖屏 [plain] view plaincopy setprop ro.sf.hwrotation 0 指定默认输出不旋转(我们默认输出时竖屏) #setprop ro.sf.hwrotation 270 指定旋转270度输出 2. 这个指定角度,Android默认只有0度和270度有效,180度无效,如果想使用180度,需要修改源码 修改文件frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp 在方法 [cpp] view plaincopy void GraphicPlane::setDisplayHardware(DisplayHardware *hw)里加 case 180: displayOrientation = ISurfaceComposer::eOrientation180; break; 这样子就支持了180度了 3. 还有更详细的 - Android 4.1 默认窗体旋转180度 1).设置属性值 在system/build.prop文件中加入 ro.sf.hwrotation=180 2).设置窗体默认显示方向 在frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp文件中找到方法 setDisplayHardware 在switch中加入 [cpp] view plaincopy case 180: displayOrientation = ISurfaceComposer::eOrientation180; break; 3).设置窗体动画旋转方向 a > 在frameworks/base/core/java/android/view/Surface.java 加入方法 [cpp] view plaincopy /** * @hide */ public static int getDefaultRotation(){ return android.os.SystemProperties.getInt("ro.sf.hwrotation", 0);//180 } /** * @hide */ public static int getDefaultRotationIndex(){ int rotation = getDefaultRotation(); switch(rotation){ case 0: return ROTATION_0; case 90: return ROTATION_90; case 180: return ROTATION_180; case 270: return ROTATION_270; } return ROTATION_0; } b > 在frameworks/base/services/java/com/android/server/vm/ScreenRotationAnimation.java 文件中找到(android4.1) 方法setRotation 或(android4.2)方法setRotationInTransaction 修改 deltaRotation(rotation,Surface.ROTATION_0); 为deltaRotation(rotation,Surface. getDefaultRotationIndex()); 4). 修改最近程序视图方向 在frameworks/base/packages/systemui/src/com/android/systemui/RecentsPanelView.java 文件中修改如下 private int mThumbnailHeight;//add 在方法中添加 [cpp] view plaincopy 写博客,送money、送书、送C币啦 7-8月博乐推荐文章 砸BUG 得大奖 100%中奖率 微信开发学习路线高级篇上线 恭喜博主周兆熊新书发售 Android启动默认是横屏或者竖屏 分类: android驱动JNI 2014-03-28 15:59 4222人阅读 评论(0) 收藏 举报 Android启动默认是横屏或者竖屏 我们的TV本来是横屏显示,但是有客户竟然要竖屏显示,昨天快下班收到的需求,竟然说7.19就要搞定。思路有2个,一个就是修改LCD的默认输出,但是这个不是我这个水平能轻而易举搞定的。另外一个就是底层应该给上层porting出接口。像这种系统性的接口一般在build.prop里。 找到一个相关度比较大的属性ro.sf.hwrotation=270,和旋转有关的,联想到0,90,180,270.试试吧,将其改为ro.sf.hwrotation=0,测试了一下,OK,满足客户要求了,就早点下班了。 /device/samsung/smdk4x12/system.prop (ro.sf.hwrotation) 今天来了搜了一下相关的内容,还是发现了不少知识 1. 可以在init.rc里指定系统是横屏还是竖屏 [plain] view plaincopy setprop ro.sf.hwrotation 0 指定默认输出不旋转(我们默认输出时竖屏) #setprop ro.sf.hwrotation 270 指定旋转270度输出 2. 这个指定角度,Android默认只有0度和270度有效,180度无效,如果想使用180度,需要修改源码 修改文件frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp 在方法 [cpp] view plaincopy void GraphicPlane::setDisplayHardware(DisplayHardware *hw)里加 case 180: displayOrientation = ISurfaceComposer::eOrientation180; break; 这样子就支持了180度了 3. 还有更详细的 - Android 4.1 默认窗体旋转180度 1).设置属性值 在system/build.prop文件中加入 ro.sf.hwrotation=180 2).设置窗体默认显示方向 在frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp文件中找到方法 setDisplayHardware 在switch中加入 [cpp] view plaincopy case 180: displayOrientation = ISurfaceComposer::eOrientation180; break; 3).设置窗体动画旋转方向 a > 在frameworks/base/core/java/android/view/Surface.java 加入方法 [cpp] view plaincopy /** * @hide */ public static int getDefaultRotation(){ return android.os.SystemProperties.getInt("ro.sf.hwrotation", 0);//180 } /** * @hide */ public static int getDefaultRotationIndex(){ int rotation = getDefaultRotation(); switch(rotation){ case 0: return ROTATION_0; case 90: return ROTATION_90; case 180: return ROTATION_180; case 270: return ROTATION_270; } return ROTATION_0; } b > 在frameworks/base/services/java/com/android/server/vm/ScreenRotationAnimation.java 文件中找到(android4.1) 方法setRotation 或(android4.2)方法setRotationInTransaction 修改 deltaRotation(rotation,Surface.ROTATION_0); 为deltaRotation(rotation,Surface. getDefaultRotationIndex()); 4). 修改最近程序视图方向 在frameworks/base/packages/systemui/src/com/android/systemui/RecentsPanelView.java 文件中修改如下 private int mThumbnailHeight;//add 在方法中添加 [cpp] view plaincopy 写博客,送money、送书、送C币啦 7-8月博乐推荐文章 砸BUG 得大奖 100%中奖率 微信开发学习路线高级篇上线 恭喜博主周兆熊新书发售 Android启动默认是横屏或者竖屏 分类: android驱动JNI 2014-03-28 15:59 4222人阅读 评论(0) 收藏 举报 Android启动默认是横屏或者竖屏 我们的TV本来是横屏显示,但是有客户竟然要竖屏显示,昨天快下班收到的需求,竟然说7.19就要搞定。思路有2个,一个就是修改LCD的默认输出,但是这个不是我这个水平能轻而易举搞定的。另外一个就是底层应该给上层porting出接口。像这种系统性的接口一般在build.prop里。 找到一个相关度比较大的属性ro.sf.hwrotation=270,和旋转有关的,联想到0,90,180,270.试试吧,将其改为ro.sf.hwrotation=0,测试了一下,OK,满足客户要求了,就早点下班了。 /device/samsung/smdk4x12/system.prop (ro.sf.hwrotation) 今天来了搜了一下相关的内容,还是发现了不少知识 1. 可以在init.rc里指定系统是横屏还是竖屏 [plain] view plaincopy setprop ro.sf.hwrotation 0 指定默认输出不旋转(我们默认输出时竖屏) #setprop ro.sf.hwrotation 270 指定旋转270度输出 2. 这个指定角度,Android默认只有0度和270度有效,180度无效,如果想使用180度,需要修改源码 修改文件frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp 在方法 [cpp] view plaincopy void GraphicPlane::setDisplayHardware(DisplayHardware *hw)里加 case 180: displayOrientation = ISurfaceComposer::eOrientation180; break; 这样子就支持了180度了 3. 还有更详细的 - Android 4.1 默认窗体旋转180度 1).设置属性值 在system/build.prop文件中加入 ro.sf.hwrotation=180 2).设置窗体默认显示方向 在frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp文件中找到方法 setDisplayHardware 在switch中加入 [cpp] view plaincopy case 180: displayOrientation = ISurfaceComposer::eOrientation180; break; 3).设置窗体动画旋转方向 a > 在frameworks/base/core/java/android/view/Surface.java 加入方法 [cpp] view plaincopy /** * @hide */ public static int getDefaultRotation(){ return android.os.SystemProperties.getInt("ro.sf.hwrotation", 0);//180 } /** * @hide */ public static int getDefaultRotationIndex(){ int rotation = getDefaultRotation(); switch(rotation){ case 0: return ROTATION_0; case 90: return ROTATION_90; case 180: return ROTATION_180; case 270: return ROTATION_270; } return ROTATION_0; } b > 在frameworks/base/services/java/com/android/server/vm/ScreenRotationAnimation.java 文件中找到(android4.1) 方法setRotation 或(android4.2)方法setRotationInTransaction 修改 deltaRotation(rotation,Surface.ROTATION_0); 为deltaRotation(rotation,Surface. getDefaultRotationIndex()); 4). 修改最近程序视图方向 在frameworks/base/packages/systemui/src/com/android/systemui/RecentsPanelView.java 文件中修改如下 private int mThumbnailHeight;//add 在方法中添加 [cpp] view plaincopy 写博客,送money、送书、送C币啦 7-8月博乐推荐文章 砸BUG 得大奖 100%中奖率 微信开发学习路线高级篇上线 恭喜博主周兆熊新书发售 Android启动默认是横屏或者竖屏 分类: android驱动JNI 2014-03-28 15:59 4222人阅读 评论(0) 收藏 举报 Android启动默认是横屏或者竖屏 我们的TV本来是横屏显示,但是有客户竟然要竖屏显示,昨天快下班收到的需求,竟然说7.19就要搞定。思路有2个,一个就是修改LCD的默认输出,但是这个不是我这个水平能轻而易举搞定的。另外一个就是底层应该给上层porting出接口。像这种系统性的接口一般在build.prop里。 找到一个相关度比较大的属性ro.sf.hwrotation=270,和旋转有关的,联想到0,90,180,270.试试吧,将其改为ro.sf.hwrotation=0,测试了一下,OK,满足客户要求了,就早点下班了。 /device/samsung/smdk4x12/system.prop (ro.sf.hwrotation) 今天来了搜了一下相关的内容,还是发现了不少知识 1. 可以在init.rc里指定系统是横屏还是竖屏 [plain] view plaincopy setprop ro.sf.hwrotation 0 指定默认输出不旋转(我们默认输出时竖屏) #setprop ro.sf.hwrotation 270 指定旋转270度输出 2. 这个指定角度,Android默认只有0度和270度有效,180度无效,如果想使用180度,需要修改源码 修改文件frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp 在方法 [cpp] view plaincopy void GraphicPlane::setDisplayHardware(DisplayHardware *hw)里加 case 180: displayOrientation = ISurfaceComposer::eOrientation180; break; 这样子就支持了180度了 3. 还有更详细的 - Android 4.1 默认窗体旋转180度 1).设置属性值 在system/build.prop文件中加入 ro.sf.hwrotation=180 2).设置窗体默认显示方向 在frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp文件中找到方法 setDisplayHardware 在switch中加入 [cpp] view plaincopy case 180: displayOrientation = ISurfaceComposer::eOrientation180; break; 3).设置窗体动画旋转方向 a > 在frameworks/base/core/java/android/view/Surface.java 加入方法 [cpp] view plaincopy /** * @hide */ public static int getDefaultRotation(){ return android.os.SystemProperties.getInt("ro.sf.hwrotation", 0);//180 } /** * @hide */ public static int getDefaultRotationIndex(){ int rotation = getDefaultRotation(); switch(rotation){ case 0: return ROTATION_0; case 90: return ROTATION_90; case 180: return ROTATION_180; case 270: return ROTATION_270; } return ROTATION_0; } b > 在frameworks/base/services/java/com/android/server/vm/ScreenRotationAnimation.java 文件中找到(android4.1) 方法setRotation 或(android4.2)方法setRotationInTransaction 修改 deltaRotation(rotation,Surface.ROTATION_0); 为deltaRotation(rotation,Surface. getDefaultRotationIndex()); 4). 修改最近程序视图方向 在frameworks/base/packages/systemui/src/com/android/systemui/RecentsPanelView.java 文件中修改如下 private int mThumbnailHeight;//add 在方法中添加 写博客,送money、送书、送C币啦 7-8月博乐推荐文章 砸BUG 得大奖 100%中奖率 微信开发学习路线高级篇上线 恭喜博主周兆熊新书发售 Android启动默认是横屏或者竖屏 分类: android驱动JNI 2014-03-28 15:59 4222人阅读 评论(0) 收藏 举报 Android启动默认是横屏或者竖屏 我们的TV本来是横屏显示,但是有客户竟然要竖屏显示,昨天快下班收到的需求,竟然说7.19就要搞定。思路有2个,一个就是修改LCD的默认输出,但是这个不是我这个水平能轻而易举搞定的。另外一个就是底层应该给上层porting出接口。像这种系统性的接口一般在build.prop里。 找到一个相关度比较大的属性ro.sf.hwrotation=270,和旋转有关的,联想到0,90,180,270.试试吧,将其改为ro.sf.hwrotation=0,测试了一下,OK,满足客户要求了,就早点下班了。 /device/samsung/smdk4x12/system.prop (ro.sf.hwrotation) 今天来了搜了一下相关的内容,还是发现了不少知识 1. 可以在init.rc里指定系统是横屏还是竖屏 [plain] view plaincopy setprop ro.sf.hwrotation 0 指定默认输出不旋转(我们默认输出时竖屏) #setprop ro.sf.hwrotation 270 指定旋转270度输出 2. 这个指定角度,Android默认只有0度和270度有效,180度无效,如果想使用180度,需要修改源码 修改文件frameworks/base/services/surfaceflinger/SurfaceFlinger.cpp 在方法 [cpp] view plaincopy void GraphicPlane::setDisplayHardware(DisplayHardware *hw)里加 case 180: displayOrientation = ISurfaceComposer::eOrientation180; break; 这样子就支持了180度了 3. 还有更详细的 - Android 4.1 默认窗体旋转180度 1).设置属性值 在system/build.prop文件中加入 ro.sf.hwrotation=180 2).设置窗体默认显示方向 在frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp文件中找到方法 setDisplayHardware 在switch中加入 [cpp] view plaincopy case 180: displayOrientation = ISurfaceComposer::eOrientation180; break; 3).设置窗体动画旋转方向 a > 在frameworks/base/core/java/android/view/Surface.java 加入方法 [cpp] view plaincopy /** * @hide */ public static int getDefaultRotation(){ return android.os.SystemProperties.getInt("ro.sf.hwrotation", 0);//180 } /** * @hide */ public static int getDefaultRotationIndex(){ int rotation = getDefaultRotation(); switch(rotation){ case 0: return ROTATION_0; case 90: return ROTATION_90; case 180: return ROTATION_180; case 270: return ROTATION_270; } return ROTATION_0; } b > 在frameworks/base/services/java/com/android/server/vm/ScreenRotationAnimation.java 文件中找到(android4.1) 方法setRotation 或(android4.2)方法setRotationInTransaction 修改 deltaRotation(rotation,Surface.ROTATION_0); 为deltaRotation(rotation,Surface. getDefaultRotationIndex()); 4). 修改最近程序视图方向 在frameworks/base/packages/systemui/src/com/android/systemui/RecentsPanelView.java 文件中修改如下 private int mThumbnailHeight;//add 在方法中添加 public void updateVoluesFromResources(){ ……………………………………………….. mThumbnailHeight = Math.round(res.getDimension(R.dimen.status_bar_recents_thumbnail_height));//add } 在方法中添加 private void updateThumbnail(…) { else { Matrix scaleMatrix = new Matrix(); float scale = mThumbnailWidth / (float) thumbnail.getWidth(); scaleMatrix.postScale(scale, scale);//setScale h.thumbnailViewImage.setScaleType(ScaleType.MATRIX); h.thumbnailViewImage.setImageMatrix(scaleMatrix); //add if(Surface.getDefaultRotation() > 0){ Matrix rotateMatrix = new Matrix(); rotateMatrix.setRotate(Surface.getDefaultRotation(),mThumbnailWidth/2,mThumbnailHeight/2); h.thumbnailViewImage.setImageMatrix(rotateMatrix); } //add end } 5).修改截屏图片方向 在frameworks/base/pacikages/systemui/src/com/android/systemui/GlobalScreenshot.java 文件中找到takeScreenshot方法 修改 float degrees = getDegreesForRotation(mDisplay.getRotation()); int rotation = mDisplay.getRotation(); if(Surface.getDefaultRotation() > 0){ rotation = (rotation + Surface.getDefaultRotationIndex())%4; } float degrees = getDegreesForRotation(rotation);