Navbar orientation on big size DPI


#1

How to deactivate rotation Navbar on big size DPI?
I modif /frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java

mNavigationBarCanMove = width != height && shortSizeDp < 300;

after that NavBar does horizontal on dpi > 300, but sometime NavBar does vertical on some application…


#2

I don’t understand what you mean. Can you take a picture for me?
Thanks.


#4

this my vim2 - 1920108060Hz - 360dpi.
NavBar rotation


#5

You can try to modify two files

  • frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java

diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 01074f9..5691633 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -6819,7 +6819,17 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                         );
         }
 
-        if (mForceDefaultOrientation) {
+        /*
+        * property: persist.sys.app.rotation has three cases:
+        * 1.force_land: always show with landscape, if a portrait apk, system will scale up it
+        * 2.middle_port: if a portrait apk, will show in the middle of the screen, left and right will show black
+        * 3.original: original orientation, if a portrait apk, will rotate 270 degree
+        */
+        String rot = SystemProperties.get("persist.sys.app.rotation", "middle_port");
+        if (rot.equals("force_land"))
+            return mLandscapeRotation;
+
+        if (mForceDefaultOrientation && rot.equals("middle_port")) {
             return Surface.ROTATION_0;
         }
 
@@ -6975,6 +6985,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
 
     @Override
     public boolean rotationHasCompatibleMetricsLw(int orientation, int rotation) {
+        if (SystemProperties.get("persist.sys.app.rotation", "middle_port").equals("force_land"))
+            return true;
         switch (orientation) {
             case ActivityInfo.SCREEN_ORIENTATION_PORTRAIT:
             case ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT:

  • device/khadas/common/software.mk

diff --git a/common/software.mk b/common/software.mk
index cccc179..a182a3d 100644
--- a/common/software.mk
+++ b/common/software.mk
@@ -79,7 +79,7 @@ PRODUCT_PACKAGES += \
     libfwdlockengine
 
 PRODUCT_PROPERTY_OVERRIDES += \
-    persist.sys.app.rotation=middle_port
+    persist.sys.app.rotation=force_land



#6

@terry
Hi.

Horizontal mode works is perfect!
Thank you!

Please tell, How to get vertical orientation?


#7

You can refer to this post. Have a try for it. Thanks