Android9.0平板项目强制横屏模式

高通平台android9.0,由于项目需求需要把原来竖屏强制为横屏并去掉开机动画、导航栏及相关系统kernel裁剪,应用裁剪,后续会补上相关教程,供大家学习交流。

diff --git a/device/qcom/sdm660_64/system.prop b/device/qcom/sdm660_64/system.prop
index 97946130fb..24a7ecda66 100755
--- a/device/qcom/sdm660_64/system.prop
+++ b/device/qcom/sdm660_64/system.prop
@@ -211,10 +211,10 @@ persist.vendor.overlay.izat.optin=rro
 # network location provider is not functional
 ro.location.osnlp.package=com.google.android.gms
 ro.location.osnlp.region.package=
-
-persist.panel.orientation=0
+# wph  modify 0 to 90
+persist.panel.orientation=90
 
 #set device to certification mode when it set true
 persist.certification.mode=true
 
-persist.vendor.usb.config.extra=serial_cdev,diag
\ No newline at end of file
+persist.vendor.usb.config.extra=serial_cdev,diag
diff --git a/frameworks/base/core/res/res/values/config.xml b/frameworks/base/core/res/res/values/config.xml
index 933787df55..08bef27e70 100755
--- a/frameworks/base/core/res/res/values/config.xml
+++ b/frameworks/base/core/res/res/values/config.xml
@@ -773,7 +773,8 @@
          settings are omitted from the system UI.  In certain situations we may
          still use the accelerometer to determine the orientation, such as when
          docked if the dock is configured to enable the accelerometer. -->
-    <bool name="config_supportAutoRotation">true</bool>
+	<!--wph modify true to false-->
+    <bool name="config_supportAutoRotation">false</bool>
 
     <!-- If true, the screen can be rotated via the accelerometer in all 4
          rotations as the default behavior. -->
@@ -828,7 +829,8 @@
 
     <!-- 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>
+	<!--wph modify -1 to 90-->
+    <integer name="config_lidOpenRotation">90</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/packages/SettingsProvider/res/values/defaults.xml b/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
index c4c407cd31..b56018916c 100644
--- a/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
+++ b/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
@@ -115,7 +115,8 @@
     <bool name="def_accessibility_display_magnification_auto_update">true</bool>
 
     <!-- Default for Settings.System.USER_ROTATION -->
-    <integer name="def_user_rotation">0</integer>
+    <!--wph modify 0 to 1-->
+    <integer name="def_user_rotation">1</integer>
 
     <!-- Default for Settings.Secure.DOWNLOAD_MAX_BYTES_OVER_MOBILE. <=0 if no limit -->
     <integer name="def_download_manager_max_bytes_over_mobile">-1</integer>
diff --git a/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
old mode 100644
new mode 100755
index 67bacf050a..a6ca73f0b9
--- a/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -2341,6 +2341,7 @@ class DatabaseHelper extends SQLiteOpenHelper {
 
         loadIntegerSetting(stmt, Settings.System.LOCKSCREEN_SOUNDS_ENABLED,
             R.integer.def_lockscreen_sounds_enabled);
+		
     }
 
     private void loadDefaultAnimationSettings(SQLiteStatement stmt) {
@@ -2394,6 +2395,8 @@ class DatabaseHelper extends SQLiteOpenHelper {
 
             loadBooleanSetting(stmt, Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD,
                     R.bool.def_accessibility_speak_password);
+	    // wph add
+	    loadIntegerSetting(stmt, Settings.System.USER_ROTATION, R.integer.def_user_rotation);
 
             if (SystemProperties.getBoolean("ro.lockscreen.disable.default", false) == true) {
                 loadSetting(stmt, Settings.System.LOCKSCREEN_DISABLED, "1");
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
old mode 100644
new mode 100755
index 29c931e1b7..7d45f5dbeb
--- a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -7571,7 +7571,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                     if (preferredRotation >= 0) {
                         return preferredRotation;
                     }
-                    return mDefaultOrientation;
+		   //wph add 
+                   int orient = SystemProperties.getInt("persist.panel.orientation", 0);
+                    if (orient == 90) {
+                        return Surface.ROTATION_90;
+                    }
+		    //end
+                     return Surface.ROTATION_0;
             }
         }
     }

你可能感兴趣的:(Android)