RK Android 8.1强制第三方APK横屏
程序员文章站
2022-06-21 19:19:11
修改:frameworks\base\services\core\java\com\android\server\policy\PhoneWindowManager.java@Overridepublic int rotationForOrientationLw(int orientation, int lastRotation) { if (false) { Slog.v(TAG, "rotationForOrientationLw(orient="...
修改:
frameworks\base\services\core\java\com\android\server\policy\PhoneWindowManager.java
@Override
public int rotationForOrientationLw(int orientation, int lastRotation) {
if (false) {
Slog.v(TAG, "rotationForOrientationLw(orient="
+ orientation + ", last=" + lastRotation
+ "); user=" + mUserRotation + " "
+ ((mUserRotationMode == WindowManagerPolicy.USER_ROTATION_LOCKED)
? "USER_ROTATION_LOCKED" : "")
);
}
// if (mForceDefaultOrientation) {
if (true) {
//add pang将mForceDefaultOrientation 改为 true,
//默认返回 Surface.ROTATION_0 横屏
return Surface.ROTATION_0;// 默认横屏
}
synchronized (mLock) {
int sensorRotation = mOrientationListener.getProposedRotation(); // may be -1
if (sensorRotation < 0) {
sensorRotation = lastRotation;
}
将 mForceDefaultOrientation 改为 true,默认返回 Surface.ROTATION_0 横屏
修改:
frameworks\base\services\core\java\com\android\server\wm\DisplayContent.java
/**
* Update rotation of the display.
*
* Returns true if the rotation has been changed. In this case YOU MUST CALL
* {@link WindowManagerService#sendNewConfiguration(int)} TO UNFREEZE THE SCREEN.
*/
boolean updateRotationUnchecked(boolean inTransaction) {
//add by pang start
if (true) {
return true;
}
//add by pang end
if (mService.mDeferredRotationPauseCount > 0) {
// Rotation updates have been paused temporarily. Defer the update until
// updates have been resumed.
if (DEBUG_ORIENTATION) Slog.v(TAG_WM, "Deferring rotation, rotation is paused.");
return false;
//return true; //add pang
}
本文地址:https://blog.csdn.net/qq_38312843/article/details/108739448
上一篇: 2020-09-21
下一篇: 微信登录开发流程