android9.0 平板 横屏修改记录

横屏记录修改.

 

    P80 系统设置横屏显示

diff --git a/frameworks/base/cmds/bootanimation/BootAnimation.cpp b/frameworks/base/cmds/bootanimation/BootAnimation.cpp
old mode 100644
new mode 100755
index ed6c25d..3540099
--- a/frameworks/base/cmds/bootanimation/BootAnimation.cpp
+++ b/frameworks/base/cmds/bootanimation/BootAnimation.cpp
@@ -260,9 +260,18 @@ status_t BootAnimation::readyToRun() {
         return -1;
 
     // create the native surface
-    sp<SurfaceControl> control = session()->createSurface(String8("BootAnimation"),
-            dinfo.w, dinfo.h, PIXEL_FORMAT_RGB_565);
-
+	//hengping add land scap 20190727 
+	sp<SurfaceControl> control;
+	if(dinfo.w < dinfo.h)
+		control = session()->createSurface(String8("BootAnimation"),
+			dinfo.h, dinfo.w, PIXEL_FORMAT_RGB_565);
+	else
+		control = session()->createSurface(String8("BootAnimation"),
+			dinfo.w, dinfo.h, PIXEL_FORMAT_RGB_565);
+			
+ //   sp<SurfaceControl> control = session()->createSurface(String8("BootAnimation"),
+ //           dinfo.w, dinfo.h, PIXEL_FORMAT_RGB_565);
+	//hengping add land scap 20190727 
     SurfaceComposerClient::Transaction t;
     t.setLayer(control, 0x40000000)
         .apply();
diff --git a/frameworks/base/core/res/res/values/config.xml b/frameworks/base/core/res/res/values/config.xml
old mode 100644
new mode 100755
index ccb6ea2..a7f5cec
--- a/frameworks/base/core/res/res/values/config.xml
+++ b/frameworks/base/core/res/res/values/config.xml
@@ -783,7 +783,7 @@
          landscape will cause a clockwise rotation, and on a landscape device an
          app requesting portrait will cause a counter-clockwise rotation.  Setting
          true here reverses that logic. -->
-    <bool name="config_reverseDefaultRotation">false</bool>
+    <bool name="config_reverseDefaultRotation">true</bool>
 
     <!-- Sets the minimum and maximum tilt tolerance for each possible rotation.
          This array consists of 4 pairs of values which specify the minimum and maximum
@@ -826,7 +826,7 @@
 
     <!-- The number of degrees to rotate the display when the keyboard is open.
          A value of -1 means no change in orientation by default. -->
-    <integer name="config_lidOpenRotation">-1</integer>
+    <integer name="config_lidOpenRotation">270</integer>
 
     <!-- Indicate whether the lid state impacts the accessibility of
          the physical keyboard.  0 means it doesn't, 1 means it is accessible
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 7e1edc6..ee749a4 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
@@ -7575,7 +7575,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                     if (preferredRotation >= 0) {
                         return preferredRotation;
                     }
-                    return Surface.ROTATION_0;
+                 //   return Surface.ROTATION_0;
+                    return Surface.ROTATION_270;	//hengping add land scap 20190727 
             }
         }
     }
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
old mode 100644
new mode 100755
index 22ac65d..dd94473
--- 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,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
      *
      * @see #updateRotationUnchecked()
      */
-    private int mRotation = 0;
+  //  private int mRotation = 0;
+    private int mRotation =3;//hengping add land scap 20190727 
 
     /**
      * Last applied orientation of the display.
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
old mode 100644
new mode 100755
index a2a6ad0..3b9b352
--- a/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -269,6 +269,10 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
+
+
+import android.content.pm.ActivityInfo; 
+ 
 /** {@hide} */
 public class WindowManagerService extends IWindowManager.Stub
         implements Watchdog.Monitor, WindowManagerPolicy.WindowManagerFuncs {
@@ -2473,7 +2477,8 @@ public class WindowManagerService extends IWindowManager.Stub
         long ident = Binder.clearCallingIdentity();
         try {
             final DisplayContent dc = mRoot.getDisplayContent(displayId);
-            final int req = dc.getOrientation();
+           // final int req = dc.getOrientation();
+			int 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
old mode 100644
new mode 100755
index c359915..bcf05e1
--- a/frameworks/native/services/surfaceflinger/DisplayDevice.cpp
+++ b/frameworks/native/services/surfaceflinger/DisplayDevice.cpp
@@ -302,7 +302,8 @@ DisplayDevice::DisplayDevice(
     mHdrCapabilities = HdrCapabilities(types, maxLuminance, maxAverageLuminance, minLuminance);
 
     // initialize the display orientation transform.
-    setProjection(DisplayState::eOrientationDefault, mViewport, mFrame);
+  //  setProjection(DisplayState::eOrientationDefault, mViewport, mFrame);
+    setProjection(DisplayState::eOrientation270, mViewport, mFrame);
 }
 
 DisplayDevice::~DisplayDevice() = default;
@@ -583,7 +584,11 @@ void DisplayDevice::setProjection(int orientation,
     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(w, h);
+		if (w < h)
+			frame = Rect(h, w);
+		else
+			frame = Rect(w, h);
     }
 
     if (viewport.isEmpty()) {
	 
+++ b/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3977,7 +3977,8 @@ void SurfaceFlinger::onInitializeDisplays() {
              DisplayState::eLayerStackChanged;
     d.token = mBuiltinDisplays[DisplayDevice::DISPLAY_PRIMARY];
     d.layerStack = 0;
-    d.orientation = DisplayState::eOrientationDefault;
+//    d.orientation = DisplayState::eOrientationDefault;
+       d.orientation = DisplayState::eOrientation270;//hengp add for landscap
     d.frame.makeInvalid();
     d.viewport.makeInvalid();
     d.width = 0;	 

 

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值