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) {
相关推荐
Dnelic-3 小时前
【单元测试】【Android】JUnit 4 和 JUnit 5 的差异记录
android·junit·单元测试·android studio·自学笔记
Eastsea.Chen5 小时前
MTK Android12 user版本MtkLogger
android·framework
长亭外的少年12 小时前
Kotlin 编译失败问题及解决方案:从守护进程到 Gradle 配置
android·开发语言·kotlin
建群新人小猿15 小时前
会员等级经验问题
android·开发语言·前端·javascript·php
1024小神16 小时前
tauri2.0版本开发苹果ios和安卓android应用,环境搭建和最后编译为apk
android·ios·tauri
兰琛16 小时前
20241121 android中树结构列表(使用recyclerView实现)
android·gitee
Y多了个想法17 小时前
RK3568 android11 适配敦泰触摸屏 FocalTech-ft5526
android·rk3568·触摸屏·tp·敦泰·focaltech·ft5526
NotesChapter18 小时前
Android吸顶效果,并有着ViewPager左右切换
android
_祝你今天愉快19 小时前
分析android :The binary version of its metadata is 1.8.0, expected version is 1.5.
android
暮志未晚Webgl19 小时前
109. UE5 GAS RPG 实现检查点的存档功能
android·java·ue5