Android横屏方案修改

diff --git a/frameworks/base/cmds/bootanimation/BootAnimation.cpp b/frameworks/base/cmds/bootanimation/BootAnimation.cpp
index ed6c25d..899cec5 100644
--- a/frameworks/base/cmds/bootanimation/BootAnimation.cpp
+++ b/frameworks/base/cmds/bootanimation/BootAnimation.cpp
@@ -261,7 +261,7 @@
 
     // create the native surface
     sp control = session()->createSurface(String8("BootAnimation"),
-            dinfo.w, dinfo.h, PIXEL_FORMAT_RGB_565);
+            dinfo.h, dinfo.w, PIXEL_FORMAT_RGB_565);
 
     SurfaceComposerClient::Transaction t;
     t.setLayer(control, 0x40000000)
diff --git a/frameworks/base/core/java/com/android/internal/view/RotationPolicy.java b/frameworks/base/core/java/com/android/internal/view/RotationPolicy.java
index e9472fa..7e9bb83 100644
--- a/frameworks/base/core/java/com/android/internal/view/RotationPolicy.java
+++ b/frameworks/base/core/java/com/android/internal/view/RotationPolicy.java
@@ -42,7 +42,7 @@
     private static final String TAG = "RotationPolicy";
     private static final int CURRENT_ROTATION = -1;
 
-    public static final int NATURAL_ROTATION = Surface.ROTATION_0;
+    public static final int NATURAL_ROTATION = Surface.ROTATION_90;
 
     private RotationPolicy() {
     }
@@ -203,4 +203,4 @@
 
         public abstract void onChange();
     }
-}
\ No newline at end of file
+}
diff --git a/frameworks/base/core/res/res/values/config.xml b/frameworks/base/core/res/res/values/config.xml
index 32ab74e..4c03a95 100755
--- a/frameworks/base/core/res/res/values/config.xml
+++ b/frameworks/base/core/res/res/values/config.xml
@@ -1216,7 +1216,7 @@
     false
 
     
-    false
+    true
 
     
     true
diff --git a/frameworks/base/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java b/frameworks/base/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java
index 28b047b..fddceb9 100644
--- a/frameworks/base/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java
+++ b/frameworks/base/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java
@@ -89,7 +89,7 @@
 
     public static boolean isCurrentOrientationLockPortrait(RotationLockController controller,
             Context context) {
-        int lockOrientation = controller.getRotationLockOrientation();
+    /*    int lockOrientation = controller.getRotationLockOrientation();
         if (lockOrientation == Configuration.ORIENTATION_UNDEFINED) {
             // Freely rotating device; use current rotation
             return context.getResources().getConfiguration().orientation
@@ -97,6 +97,8 @@
         } else {
             return lockOrientation != Configuration.ORIENTATION_LANDSCAPE;
         }
+        */
+        return false;
     }
 
     @Override
diff --git a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 6ebd09e..6186f04 100755
--- a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -7618,7 +7618,7 @@
                     if (preferredRotation >= 0) {
                         return preferredRotation;
                     }
-                    return Surface.ROTATION_0;
+                    return Surface.ROTATION_90;
             }
         }
     }
diff --git a/frameworks/base/services/core/java/com/android/server/wm/DisplayContent.java b/frameworks/base/services/core/java/com/android/server/wm/DisplayContent.java
index 22ac65d..07c0210 100644
--- a/frameworks/base/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/frameworks/base/services/core/java/com/android/server/wm/DisplayContent.java
@@ -259,7 +259,7 @@
      *
      * @see #updateRotationUnchecked()
      */
-    private int mRotation = 0;
+    private int mRotation = 1;
 

diff --git a/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java b/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
index a2a6ad0..5fb15db 100644
--- a/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -126,6 +126,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.pm.ActivityInfo;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.PackageManagerInternal;
@@ -2473,7 +2474,8 @@
         long ident = Binder.clearCallingIdentity();
         try {
             final DisplayContent dc = mRoot.getDisplayContent(displayId);
-            final int req = dc.getOrientation();
+            int req = dc.getOrientation();
+                req = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
             if (req != dc.getLastOrientation() || forceUpdate) {
                 dc.setLastOrientation(req);
                 //send a message to Policy indicating orientation change to take
diff --git a/frameworks/native/services/surfaceflinger/DisplayDevice.cpp b/frameworks/native/services/surfaceflinger/DisplayDevice.cpp
index c359915..7737e5b 100644
--- a/frameworks/native/services/surfaceflinger/DisplayDevice.cpp
+++ b/frameworks/native/services/surfaceflinger/DisplayDevice.cpp
@@ -302,7 +302,7 @@
     mHdrCapabilities = HdrCapabilities(types, maxLuminance, maxAverageLuminance, minLuminance);
 
     // initialize the display orientation transform.
-    setProjection(DisplayState::eOrientationDefault, mViewport, mFrame);
+    setProjection(DisplayState::eOrientation90, mViewport, mFrame);
 }
 
 DisplayDevice::~DisplayDevice() = default;
@@ -578,12 +578,13 @@
     const int h = mDisplayHeight;
 
     Transform R;
+    orientation = DisplayState::eOrientation90;
     DisplayDevice::orientationToTransfrom(orientation, w, h, &R);
 
     if (!frame.isValid()) {
         // the destination frame can be invalid if it has never been set,
         // in that case we assume the whole display frame.
-        frame = Rect(w, h);
+        frame = Rect(h, w);
     }
 
     if (viewport.isEmpty()) {
diff --git a/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp b/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
index 12015da..dfcdc77 100644
--- a/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
@@ -4016,7 +4016,7 @@
              DisplayState::eLayerStackChanged;
     d.token = mBuiltinDisplays[DisplayDevice::DISPLAY_PRIMARY];
     d.layerStack = 0;
-    d.orientation = DisplayState::eOrientationDefault;
+    d.orientation = DisplayState::eOrientation90;
     d.frame.makeInvalid();
     d.viewport.makeInvalid();
     d.width = 0;

你可能感兴趣的:(Android横屏方案修改)