Android13.0 修改屏幕显示方向

Android13默认显示方向是0, 大屏幕产品是固定方向放置的,由于接口走向差异有些屏幕按照0度方向显示是倒的,需要旋转180 可以修改这些默认显示方向

java 复制代码
diff --git a/services/core/java/com/android/server/wm/DisplayRotation.java b/services/core/java/com/android/server/wm/DisplayRotation.java
index c8137925923f..4f5f2323c761 100644
--- a/services/core/java/com/android/server/wm/DisplayRotation.java
+++ b/services/core/java/com/android/server/wm/DisplayRotation.java
@@ -194,7 +194,7 @@ public class DisplayRotation {
     private int mUserRotationMode = WindowManagerPolicy.USER_ROTATION_FREE;
 
     @Surface.Rotation
-    private int mUserRotation = Surface.ROTATION_0;
+    private int mUserRotation = Surface.ROTATION_180;
     private int mBuiltInUserRotation = SystemProperties.getInt("persist.sys.builtinrotation", -1);
 
     private static final int CAMERA_ROTATION_DISABLED = 0;
@@ -282,7 +282,7 @@ public class DisplayRotation {
     @Surface.Rotation
     private int readDefaultDisplayRotation(DisplayAddress displayAddress) {
         if (!(displayAddress instanceof DisplayAddress.Physical)) {
-            return Surface.ROTATION_0;
+            return Surface.ROTATION_180;
         }
         final DisplayAddress.Physical physicalAddress = (DisplayAddress.Physical) displayAddress;
         String syspropValue = SystemProperties.get(
@@ -295,7 +295,7 @@ public class DisplayRotation {
         } else if (syspropValue.equals("ORIENTATION_270")) {
             return Surface.ROTATION_270;
         }
-        return Surface.ROTATION_0;
+        return Surface.ROTATION_180;
     }
 
     private int readRotation(int resID) {
@@ -825,7 +825,7 @@ public class DisplayRotation {
         if (userRotation < Surface.ROTATION_0 || userRotation > Surface.ROTATION_270) {
             Slog.w(TAG, "Trying to restore an invalid user rotation " + userRotation
                     + " for " + mDisplayContent);
-            userRotation = Surface.ROTATION_0;
+            userRotation = Surface.ROTATION_180;
         }
         mUserRotationMode = userRotationMode;
         mUserRotation = userRotation;
@@ -1304,7 +1304,7 @@ public class DisplayRotation {
                 if (preferredRotation >= 0) {
                     return preferredRotation;
                 }
-                return Surface.ROTATION_0;
+                return Surface.ROTATION_180;
         }
     }
 
@@ -1491,7 +1491,7 @@ public class DisplayRotation {
 
             // Configure rotation lock.
             int userRotation = Settings.System.getIntForUser(resolver,
-                    Settings.System.USER_ROTATION, Surface.ROTATION_0,
+                    Settings.System.USER_ROTATION, Surface.ROTATION_180,
                     UserHandle.USER_CURRENT);
 
                        /*if (mBuiltInUserRotation > -1 && mBuiltInUserRotation < 4) {
相关推荐
恋猫de小郭14 小时前
Android Studio 正式版 10 周年回顾,承载 Androider 的峥嵘十年
android·ide·android studio
aaaweiaaaaaa17 小时前
php的使用及 phpstorm环境部署
android·web安全·网络安全·php·storm
工程师老罗19 小时前
Android记事本App设计开发项目实战教程2025最新版Android Studio
android
pengyu1 天前
系统化掌握 Dart 编程之异常处理(二):从防御到艺术的进阶之路
android·flutter·dart
消失的旧时光-19431 天前
android Camera 的进化
android
基哥的奋斗历程1 天前
Openfga 授权模型搭建
android·adb
Pakho love1 天前
Linux:文件与fd(被打开的文件)
android·linux·c语言·c++
勿忘初心912 天前
Android车机DIY开发之软件篇(九) NXP AutomotiveOS编译
android·arm开发·经验分享·嵌入式硬件·mcu
lingllllove2 天前
PHP中配置 variables_order详解
android·开发语言·php
消失的旧时光-19432 天前
Android-音频采集
android·音视频