"); //-->
1、打开frameworks/base/core/java/android/content/pm/parsing/component/ParsedActivityUtils.java文件,定位到parseActivityOrReceiver方法的int screenOrientation = sa.getInt(R.styleable.AndroidManifestActivity_screenOrientation, SCREEN_ORIENTATION_UNSPECIFIED);这一行,注释掉该行并添加如下代码:// int screenOrientation = sa.getInt(R.styleable.AndroidManifestActivity_screenOrientation, SCREEN_ORIENTATION_UNSPECIFIED);
// Edit by jgduan
int screenOrientation;
if(pkg.getSharedUserId() == null){
screenOrientation = 0;
} else {
screenOrientation = sa.getInt(R.styleable.AndroidManifestActivity_screenOrientation, SCREEN_ORIENTATION_UNSPECIFIED);
}
// End
2、打开frameworks/base/core/java/android/app/Activity.java文件,对setRequestedOrientation方法进行如下修改: /**
* Change the desired orientation of this activity. If the activity
* is currently in the foreground or otherwise impacting the screen
* orientation, the screen will immediately be changed (possibly causing
* the activity to be restarted). Otherwise, this will be used the next
* time the activity is visible.
*
* @param requestedOrientation An orientation constant as used in
* {@link ActivityInfo#screenOrientation ActivityInfo.screenOrientation}.
*/
public void setRequestedOrientation(@ActivityInfo.ScreenOrientation int requestedOrientation) {
if (mParent == null) {
try {
// Edit by jgduan
//ActivityTaskManager.getService().setRequestedOrientation(
// mToken, requestedOrientation);
if(mApplication != null && mApplication.getApplicationInfo() != null
&& mApplication.getApplicationInfo().uid > 10000){
ActivityTaskManager.getService().setRequestedOrientation(
mToken, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} else {
ActivityTaskManager.getService().setRequestedOrientation(
mToken, requestedOrientation);
}
// End
} catch (RemoteException e) {
// Empty
}
} else {
// Edit by jgduan
// mParent.setRequestedOrientation(requestedOrientation);
if(mApplication != null && mApplication.getApplicationInfo() != null
&& mApplication.getApplicationInfo().uid > 10000){
mParent.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}else{
mParent.setRequestedOrientation(requestedOrientation);
}
// End
}
}
-END-
专栏文章内容及配图由作者撰写发布,仅供工程师学习之用,如有侵权或者其他违规问题,请联系本站处理。 联系我们
相关推荐
意法半导体出厂中国制造的STM32 MCU
Windows CE 开发初步(第一部)
嵌入式操作系统大比拼
汽车存储器新突破:8nm128Mb嵌入式MRAM的研发
嵌入式U盘读写器接口技术和系统设计
RK3576 + ROS2 SLAM建图与导航实战
华清远见嵌入式在线视频教程——3、嵌入式Linux开发应用介绍
大家在互相借鉴吧!--嵌入式系统词汇表
从COM到SMARC再到OSM:嵌入式计算模块的发展
展会预告!米尔邀您相约德国嵌入式展 2026Embedded World
IAR 扩展了嵌入式开发平台,提供 LTS 服务
USB-HOST实时数据采集嵌入式模块的实现
大家在互相借鉴吧!--嵌入式系统词汇表
浅谈嵌入式LINUX系统教与学
华清远见嵌入式在线视频教程——1、走近嵌入式系统
华清远见嵌入式在线视频教程——5、嵌入式Linux移植和u-boot
LAN91C111型控制器在嵌入式以太网接口中的应用
华清远见嵌入式在线视频教程——4、基于ARM的嵌入式开发
大家在互相借鉴吧!--嵌入式系统词汇表
米尔亮相德国嵌入式展2026 Embedded World
嵌入式看门狗如何提升系统稳定性
第一讲:嵌入式系统概述
未来倾向于UFS用于高性能嵌入式闪存
陈渝大侠翻译的 uClinux2.6入门
嵌入式系统方案设计
嵌入式系统的实时数据接口扩展
TI将边缘AI微控制器更深入地融入嵌入式设计
大家在互相借鉴吧!--嵌入式系统词汇表
LCD驱动器SD0432与嵌入式系统的接口设计
华清远见嵌入式在线视频教程——2、嵌入式系统的选择与开发