网站首页 全球最实用的IT互联网站!

人工智能P2P分享Wind搜索发布信息网站地图标签大全

当前位置:诺佳网 > 电子/半导体 > 嵌入式技术 >

如何基于开发板RK3568 Android 11强制所有应用横屏展

时间:2025-11-07 16:07

人气:

作者:admin

标签:

导读:RK3568 Android 11强制所有应用横屏展示,1、打开frameworks/base/core/java/android/content/pm/parsing/component/ParsedActivityUtils.java文件,定位到parseActivityOrReceiver方法的int screenOrientation = sa.ge...

RK3568 Android 11强制所有应用横屏展示

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 } }

温馨提示:以上内容整理于网络,仅供参考,如果对您有帮助,留下您的阅读感言吧!
相关阅读
本类排行
相关标签
本类推荐

CPU | 内存 | 硬盘 | 显卡 | 显示器 | 主板 | 电源 | 键鼠 | 网站地图

Copyright © 2025-2035 诺佳网 版权所有 备案号:赣ICP备2025066733号
本站资料均来源互联网收集整理,作品版权归作者所有,如果侵犯了您的版权,请跟我们联系。

关注微信