[RK3288][Android6.0] Apk设置显示旋转过程小结
来源:互联网 发布:js获取一个input的值 编辑:程序博客网 时间:2024/06/07 11:22
Platform: Rockchip
OS: Android 6.0
Kernel: 3.10.92
setRequestedOrientation -> Activity.java
ActivityManagerNative.getDefault().setRequestedOrientation //client调用AMS
setRequestedOrientation -> ActivityManagerService.java
mWindowManager.setAppOrientation ->
setAppOrientation WindowManagerService.java //保存ap申请设置的dOrientation到apptoken中
mWindowManager.updateOrientationFromAppTokens ->
updateOrientationFromAppTokensLocked ->
updateOrientationFromAppTokensLocked ->
getOrientationLocked //获取上一次的Orientation,如何和mForcedAppOrientation不同,就要更新
mPolicy.setCurrentOrientationLw //通知Policy当前Orientation变化而执行一些动作,比如enable/disable sensor监听旋转
updateRotationUncheckedLocked -> 更新当前rotation,这个函数下面再描述
computeNewConfigurationLocked //如果updateOrientationFromAppTokensLocked返回ture,说明要旋转,更新displayinfo
updateRotationUncheckedLocked():
public boolean updateRotationUncheckedLocked(boolean inTransaction){ // TODO: Implement forced rotation changes. // Set mAltOrientation to indicate that the application is receiving // an orientation that has different metrics than it expected. // eg. Portrait instead of Landscape. //将gsensor,mRotation,activity的Orientation放一起计算当前要设置的rotation int rotation = mPolicy.rotationForOrientationLw(mForcedAppOrientation, mRotation); //看得到的rotation和mForcedAppOrientation是否兼容,也就是说app force不代表肯定如它愿 boolean altOrientation = !mPolicy.rotationHasCompatibleMetricsLw( mForcedAppOrientation, rotation); //系统开了个property让用户动态修改成竖屏 /* display portrait, force android rotation according to 90 */ if("true".equals(SystemProperties.get("persist.display.portrait","false"))){ rotation = Surface.ROTATION_90; } /* display portrait end */ //如果和上一次一样没变化,那就不需要更新 if (mRotation == rotation && mAltOrientation == altOrientation) { // No change. return false; } //保存当前rotation以及altOrientation信息 mRotation = rotation; mAltOrientation = altOrientation; mPolicy.setRotationLw(mRotation); // We need to update our screen size information to match the new rotation. If the rotation // has actually changed then this method will return true and, according to the comment at // the top of the method, the caller is obligated to call computeNewConfigurationLocked(). // By updating the Display info here it will be available to // computeScreenConfigurationLocked later. //当需要rotate之后,display里的宽高等信息也要跟着更新 updateDisplayAndOrientationLocked(); mDisplayManagerInternal.performTraversalInTransactionFromWindowManager(); return true;}
参考:
Android6.0 旋转屏幕(四)应用强制设置方向
- [RK3288][Android6.0] Apk设置显示旋转过程小结
- [RK3288][Android6.0] 设置中通过Sensor旋转显示画面小结
- [RK3288][Android6.0] USB 枚举过程小结
- [RK3288][Android6.0] USB 枚举过程小结
- [RK3288][Android6.0] MediaCodec初始化过程小结
- [RK3288][Android6.0] 调试笔记 --- 屏幕显示旋转方法
- [RK3288][Android6.0] WiFi在Setting中的开启过程小结
- [RK3288][Android6.0] Audio的音量计算过程小结
- [RK3288][Android6.0] Audio中的混音过程小结
- [RK3288][Android6.0] MediaCodec的configure配置过程小结
- [RK3288][Android6.0] WiFi的驱动初始化过程小结
- [RK3288][Android6.0] WiFi之Framework连接过程小结
- [RK3288][Android6.0] U-boot显示模块部分流程小结
- [RK3288][Android6.0] Audio录音frame rate设置流程小结
- [RK3288][Android6.0] Audio的音量设置流程小结
- [RK3288][Android6.0] ART虚拟机对APK的优化知识点小结
- [RK3288][Android6.0] Camera HAL流程小结
- [RK3288][Android6.0] StageFright解码流程小结
- 区块链与征信
- kali Linux 下 python 3.6.2 配置 +Pip3 配置
- SwipeRefreshLayout源码分析+自定义UC头条下拉刷新Demo
- hdu2048 神、上帝以及老天爷(C语言)
- RPC的理解
- [RK3288][Android6.0] Apk设置显示旋转过程小结
- 如何训练Tesseract 4.0
- SQL小测试
- Vend Aging Report数据存储转换图
- Eclipse svn插件安装详细教程
- HashMap
- android:supoort.v4.view.ViewCompat.getDisplay(Landroid/view/View;)Landroid/view/Display;
- String类——练习(4)
- ActiveMQ从初识到使用(一)