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 curre

本文介绍了如何在基于Android 11的RK3568开发平台上强制所有应用横屏展示。通过修改ParsedActivityUtils.java和Activity.java文件,实现了针对不同应用uid的屏幕方向控制,确保特定应用始终处于横屏模式。
最低0.47元/天 解锁文章
1960

被折叠的 条评论
为什么被折叠?



