关于Android4.x系统默认显示方向各种修改
1.设置属性值
在device.mk文件中加入
PRODUCT_PROPERTY_OVERRIDES += \
ro.sf.hwrotation=180
2.设置屏幕默认显示方向
在frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp文件中找到方法
GraphicPlane::setDisplayHardware(DisplayHardware *hw)
if (property_get("ro.sf.hwrotation", property, NULL) > 0) {
//displayOrientation
switch (atoi(property)) {
case 90:
displayOrientation = ISurfaceComposer::eOrientation90;
break;
case 270:
displayOrientation = ISurfaceComposer::eOrientation270;
break;
case 180://=============add========
displayOrientation = ISurfaceComposer::eOrientation180;
break;//=============add========
}
}
3.设置屏幕显示动画旋转方向
1).在frameworks/base/core/java/android/view/Surface.java 加入方法
/**
* @hide
*/
public static int getDefaultRotation() {
return android.os.SystemProperties.getInt("ro.sf.hwrotation", 0);
}
/**
* @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;
}
2).在frameworks/base/services/java/com/android/server/wm/ScreenRotationAnimation.java
文件中找到(android4.1) 方法setRotation
或(android4.2)方法setRotationInTransaction
修改 deltaRotation(rotation,Surface.ROTATION_0);
为deltaRotation(rotation,Surface. getDefaultRotationIndex());
3 .长按Home键,最近程序视图方向
在frameworks/base/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java 文件中修改如下
private int mThumbnailHeight;//================add============
在方法中添加
public void updateValuesFromResources() {
final Resources res = mContext.getResources();
mThumbnailWidth = Math.round(res.getDimension(R.dimen.status_bar_recents_thumbnail_width));
//==========================xjf=========================
mThumbnailHeight = Math.round(res.getDimension(R.dimen.status_bar_recents_thumbnail_height));
//==========================xjf=========================
mFitThumbnailToXY = res.getBoolean(R.bool.config_recents_thumbnail_image_fits_to_xy);
}
在方法中添加
private void updateThumbnail(ViewHolder h, Bitmap thumbnail, boolean show, boolean anim) {
。。。。。。。。。。。。。。。。
if (mFitThumbnailToXY) {
h.thumbnailViewImage.setScaleType(ScaleType.FIT_XY);
} else {
Matrix scaleMatrix = new Matrix();
float scale = mThumbnailWidth / (float) thumbnail.getWidth();
scaleMatrix.setScale(scale, scale);
h.thumbnailViewImage.setScaleType(ScaleType.MATRIX);
h.thumbnailViewImage.setImageMatrix(scaleMatrix);
//==========================xjf=========================
if(android.view.Surface.getDefaultRotation() > 0){
Matrix rotateMatrix = new Matrix();
rotateMatrix.setRotate(android.view.Surface.getDefaultRotation(),mThumbnailWidth/2, mThumbnailHeight/2);
h.thumbnailViewImage.setImageMatrix(rotateMatrix);
}
//==========================xjf=========================
}
}
4.电源键加音量减,截屏图片方向
在/opt/xiejifu/20141005/20141005/frameworks/base/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java 文件中找到takeScreenshot方法
修改 float degrees = getDegreesForRotation(mDisplay.getRotation());
void takeScreenshot(Runnable finisher, boolean statusBarVisible, boolean navBarVisible) {
// We need to orient the screenshot correctly (and the Surface api seems to take screenshots
// only in the natural orientation of the device :!)
mDisplay.getRealMetrics(mDisplayMetrics);
float[] dims = {mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels};
//==========================xjf=========================
//float degrees = getDegreesForRotation(mDisplay.getRotation());
int rotation = mDisplay.getRotation();
if(Surface.getDefaultRotation() > 0){
rotation = (rotation + Surface.getDefaultRotationIndex())%4;
}//get def rotation
float degrees = getDegreesForRotation(rotation);
//==========================xjf=========================
boolean requiresRotation = (degrees > 0);
if (requiresRotation) {
// Get the dimensions of the device in its native orientation
mDisplayMatrix.reset();
mDisplayMatrix.preRotate(-degrees);
mDisplayMatrix.mapPoints(dims);
dims[0] = Math.abs(dims[0]);
dims[1] = Math.abs(dims[1]);
}
.........
}
5.NFC点对点,发送截屏图片
packages/apps/Nfc/src/com/android/nfc/SendUi.java
Bitmap createScreenshot() {
.......
//==========================xjf=========================
//float degrees = getDegreesForRotation(mDisplay.getRotation());
int rotation = mDisplay.getRotation();
if(Surface.getDefaultRotation() > 0){
rotation = (rotation + Surface.getDefaultRotationIndex())%4;
}//get def rotation
float degrees = getDegreesForRotation(rotation);
//==========================xjf=========================
.......
}
除了截图,其他修改应该都是全局的。
关于Android4.x系统默认显示方向各种修改的更多相关文章
- Android系统移植与调试之------->如何修改Android系统默认显示【开发者选项】并默认打开【USB调试】和【未知来源】开关
今天有个用户对[设置]有个特殊的要求,即: 1.开机的时候默认显示[开发者选项]并打开[USB调试]开关 ([Developer options]-->[USB debugging]) 2 ...
- 「linux」win+linux 双系统 默认启动项 的修改
修改/etc/default/grub文件,其中的GRUB_DEFAULT表示默认启动项: sudo gedit /etc/default/grub 注意:启动项是从0开始计数. 要使修改生效需要运行 ...
- linux上修改系统默认语言设置
locale命令设置语言环境(临时修改) [keysystem@localhost ~]$ date Fri Feb :: CST [keysystem@localhost ~]$ locale LA ...
- Django - 权限(4)- queryset、二级菜单的默认显示、动态显示按钮权限
一.queryset Queryset是django中构建的一种数据结构,ORM查询集往往是queryset数据类型,我们来进一步了解一下queryset的特点. 1.可切片 使用Python 的切片 ...
- android如何调用显示和隐藏系统默认的输入法(一)
1.调用显示系统默认的输入法 方法一. InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_MET ...
- 使用storyboard显示UITableView时,如果不修改系统默认生成的tableView:cellForRowAtIndexPath:方法中的代码,则必须为UITableViewCell注册(填写)重用标识符:identifier.必须要代码方法中的标识符一致.
CHENYILONG Blog 使用storyboard显示UITableView时,如果不修改系统默认生成的tableView:cellForRowAtIndexPath:方法中的代码,则必须为UI ...
- 时间操作(JavaScript版)—年月日三级联动(默认显示系统时间)
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/wangshuxuncom/article/details/35263317 这个功能 ...
- Ubuntu18.04系统下安装Pycharm&vim设置自动缩进及默认显示行号
Ubuntu18.04系统自带python3.6及python2.7,Pycharm是一款非常强大的IDE.目前Pycharm有两个版本:专业版和Community社区,区别是专业版是收费,而且功能更 ...
- Android 系统默认参数的修改
转自: http://www.th7.cn/Program/Android/201505/447097.shtml 写在前面的话 一般在新项目开始之初,我们需要针对客户需求进行各种系统默认属性的配置, ...
随机推荐
- office web apps
http://technet.microsoft.com/zh-cn/library/ff431687.aspx http://www.cnblogs.com/erucy/archive/2012/0 ...
- Unity 截取图片并且显示出来
Unity 截取图片并且显示出来 近期用到了unity的截图,并且把他显示出来,摸索了很多! 讲解一个东西,android可以存储一些文件在本地,比如配置文件等! 对于不同的系统,方法不一! if ( ...
- 初次踏上GUI编程之路(有点意思,详细介绍了菜鸟的学习之路)
初次踏上GUI编程之路 —— 我的Qt学习方法及对Qt认识的不断转变 -> 开始接触GUI与开始接触Qt: 话说,我第一次看见“Qt”这一个名词,好像是在CSDN网站的主页上吧,因为CSDN好像 ...
- Microsoft Internet Explorer 远程代码执行漏洞(CVE-2013-3186)(MS13-059)
漏洞版本: Microsoft Internet Explorer 6 - 10 漏洞描述: BUGTRAQ ID: 61663 CVE(CAN) ID: CVE-2013-3186 Windows ...
- 对于利用pca 和 cca 进行fmri激活区识别的理解
1.pca 抛开fmri研究这个范畴,我们有一个超长向量,这个超长向量在fmri研究中,就是体素数据.向量中的每个数值,都代表在相应坐标轴下的坐标值.这些坐标轴所组成的坐标系,其实是标准单位坐标系.向 ...
- (转)ASP.NET MVC路由配置
一.命名参数规范+匿名对象 1 routes.MapRoute(name: "Default", 2 url: "{controller}/{action}/{id}&q ...
- Linux学习笔记11——文件I/O之二
一.文件共享 内核使用三种数据结构表示打开的文件,它们之间的关系决定了在文件共享方面一个进程对另一个进程可能产生的影响. 1.每个进程在进程表中都有一个记录项,记录项中包含有一张打开文件描述表 2.内 ...
- [QT]Qt+VS2012+Win8 64Bit安装
学习Qt鸟,当年没听@Coding_Peon(http://weibo.com/u/1764451551?topnav=1&wvr=5&topsug=1)话好好学习QT和Python之 ...
- Install Asterisk 11 on Ubuntu 12.04 LTS
http://blogs.digium.com/2012/11/14/how-to-install-asterisk-11-on-ubuntu-12-4-lts/ Last week I put up ...
- 【大盛】HTC one/M7 ROM 最新本地化OrDroid8.2.6 高级、快速设置 永久root 更多自定义 稳定 流畅
了解更多:点击下载ROM和学习更多 ROM版本 HTC-one_OrDroid8.2.6 ROM作者 雪狼团队·大盛 http://weibo.com/DaShengdd Android版本 Andr ...