修改:
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
px30_android-8.1/frameworks/base/services/core/java/com/android/server/wm$ git diff DisplayContent.java
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
old mode 100644
new mode 100755
index ba99f38f4c3..8a9cd8c76e4
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -915,6 +915,13 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
* {@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.
@@ -929,7 +936,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
// animation is still in progress. Skip this update. We will try updating
// again after the animation is finished and the display is unfrozen.
if (DEBUG_ORIENTATION) Slog.v(TAG_WM, "Deferring rotation, animation in progress.");
- return false;
+ // return false;
+ return true; //add pang
}
if (mService.mDisplayFrozen) {
// Even if the screen rotation animation has finished (e.g. isAnimating
@@ -937,7 +945,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
// the display. We also need to abort rotation here.
if (DEBUG_ORIENTATION) Slog.v(TAG_WM,
"Deferring rotation, still finishing previous rotation");
- return false;
+ // return false;
+ return true; //add pang
}
if (!mService.mDisplayEnabled) {