• Android13.0 修改屏幕显示方向


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

    1. diff --git a/services/core/java/com/android/server/wm/DisplayRotation.java b/services/core/java/com/android/server/wm/DisplayRotation.java
    2. index c8137925923f..4f5f2323c761 100644
    3. --- a/services/core/java/com/android/server/wm/DisplayRotation.java
    4. +++ b/services/core/java/com/android/server/wm/DisplayRotation.java
    5. @@ -194,7 +194,7 @@ public class DisplayRotation {
    6. private int mUserRotationMode = WindowManagerPolicy.USER_ROTATION_FREE;
    7. @Surface.Rotation
    8. - private int mUserRotation = Surface.ROTATION_0;
    9. + private int mUserRotation = Surface.ROTATION_180;
    10. private int mBuiltInUserRotation = SystemProperties.getInt("persist.sys.builtinrotation", -1);
    11. private static final int CAMERA_ROTATION_DISABLED = 0;
    12. @@ -282,7 +282,7 @@ public class DisplayRotation {
    13. @Surface.Rotation
    14. private int readDefaultDisplayRotation(DisplayAddress displayAddress) {
    15. if (!(displayAddress instanceof DisplayAddress.Physical)) {
    16. - return Surface.ROTATION_0;
    17. + return Surface.ROTATION_180;
    18. }
    19. final DisplayAddress.Physical physicalAddress = (DisplayAddress.Physical) displayAddress;
    20. String syspropValue = SystemProperties.get(
    21. @@ -295,7 +295,7 @@ public class DisplayRotation {
    22. } else if (syspropValue.equals("ORIENTATION_270")) {
    23. return Surface.ROTATION_270;
    24. }
    25. - return Surface.ROTATION_0;
    26. + return Surface.ROTATION_180;
    27. }
    28. private int readRotation(int resID) {
    29. @@ -825,7 +825,7 @@ public class DisplayRotation {
    30. if (userRotation < Surface.ROTATION_0 || userRotation > Surface.ROTATION_270) {
    31. Slog.w(TAG, "Trying to restore an invalid user rotation " + userRotation
    32. + " for " + mDisplayContent);
    33. - userRotation = Surface.ROTATION_0;
    34. + userRotation = Surface.ROTATION_180;
    35. }
    36. mUserRotationMode = userRotationMode;
    37. mUserRotation = userRotation;
    38. @@ -1304,7 +1304,7 @@ public class DisplayRotation {
    39. if (preferredRotation >= 0) {
    40. return preferredRotation;
    41. }
    42. - return Surface.ROTATION_0;
    43. + return Surface.ROTATION_180;
    44. }
    45. }
    46. @@ -1491,7 +1491,7 @@ public class DisplayRotation {
    47. // Configure rotation lock.
    48. int userRotation = Settings.System.getIntForUser(resolver,
    49. - Settings.System.USER_ROTATION, Surface.ROTATION_0,
    50. + Settings.System.USER_ROTATION, Surface.ROTATION_180,
    51. UserHandle.USER_CURRENT);
    52. /*if (mBuiltInUserRotation > -1 && mBuiltInUserRotation < 4) {

  • 相关阅读:
    我的创作纪念日
    TikTok生态圈【6.27跨境日报】TikTok夏季大甩卖利用现场活动中的游戏化
    c++动态库调用
    知行之桥EDI系统2022版Tomcat部署
    九科-模块化-创建目录_如果不存在
    2024.6.12 玄子Share-Docker 安装与镜像拉取
    Markdown基础教程
    Excel函数公式大全—LOOKUP函数
    servlet笔记
    深入了解 Spring 篇之 BeanDefinition 结构
  • 原文地址:https://blog.csdn.net/zhaoyufei133/article/details/140051849