RK3288[android 7.1]调试笔记 控制副屏旋转方向

RK3288[android 7.1]调试笔记 控制副屏旋转方向

1 在路径为\frameworks\base\core\java\android\view\IWindowManager.aidl文件打上如下补丁

dongsy@build-server-100:~/work/dsy/code_rk3288/frameworks/base((e845a29...))$
 git diff  core/java/android/view/IWindowManager.aidl
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/v
index 86b9d4f..406fa75 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -444,4 +444,5 @@ interface IWindowManager
     boolean isDualConfig();
     boolean getDualScreenFlag();
     int getSecondDisplayTaskId();
+    boolean isUseSecondDisplayInfo();
 }

2 在路径为\frameworks\base\core\java\android\view\WindowManagerPolicy.java文件打上如下补丁

dongsy@build-server-100:~/work/dsy/code_rk3288/frameworks/base((e845a29...))$
 git diff  core/java/android/view/WindowManagerPolicy.java
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/andr
index 5317b59..514e145 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -946,7 +946,7 @@ public interface WindowManagerPolicy {
      *                 so you can use its Rect.  Otherwise null.
      */
     public void layoutWindowLw(WindowState win, WindowState attached);
-    public void layoutWindowLw(WindowState win, WindowState attached,int wid
+       public void layoutWindowLw(WindowState win, WindowState attached,DisplayInfo info);
 
     /**

3 在路径为\frameworks\base\services\core\java\com\android\server\display\DisplayManagerService.java文件中打上如下补丁

dongsy@build-server-100:~/work/dsy/code_rk3288/frameworks/base((e845a29...))$ git diff services/core/java/com/android/server/display/DisplayManagerService.java
diff --git a/services/core/java/com/android/server/display/DisplayManagerService.java b/services/co
index 39f9d20..d09a288 100755
--- a/services/core/java/com/android/server/display/DisplayManagerService.java
+++ b/services/core/java/com/android/server/display/DisplayManagerService.java
@@ -52,6 +52,7 @@ import android.util.Slog;
 import android.util.SparseArray;
 import android.view.Display;
 import android.view.DisplayInfo;
+import android.view.IWindowManager;
 import android.view.Surface;
 import android.view.WindowManagerInternal;
 
@@ -881,13 +882,8 @@ public final class DisplayManagerService extends SystemService {
                 isDefaultDisplay = true;
             } else {
                 isDefaultDisplay = false;
-                String rotation = SystemProperties.get("persist.orientation.vhinit");
-                int default_value = (device.getDisplayDeviceInfoLocked().width < device.getDisplay
-                if(default_value == 1) {//竖屏
-                   device.getDisplayDeviceInfoLocked().rotation = ("0".equals(rotation))?1:0;
-                } else if(default_value == 0) {//横屏
-                   device.getDisplayDeviceInfoLocked().rotation = ("1".equals(rotation))?1:0;
-                }
+                String rotation = SystemProperties.get("persist.sys.rotation.einit","0");
+                device.getDisplayDeviceInfoLocked().rotation=Integer.valueOf(rotation);
             }
             configureDisplayInTransactionLocked(device);
             device.performTraversalInTransactionLocked();
@@ -980,7 +976,17 @@ public final class DisplayManagerService extends SystemService {
             return;
         }
         display.isDefaultDisplay  = isDefaultDisplay;
-        display.configureDisplayInTransactionLocked(device, info.state == Display.STATE_OFF, mLogicalDisplays.get(Display.DEFAULT_DISPLAY).mInfo);
+        try {
+             IWindowManager wm = IWindowManager.Stub.asInterface(ServiceManager.getService(Context.WINDOW_SERVICE));
+            if (!wm.isUseSecondDisplayInfo()) {
+                display.configureDisplayInTransactionLocked(device, info.state == Display.STATE_OFF, mLogicalDisplays.get(Display.DEFAULT_DISPLAY).mInfo);
+            } else {
+                display.configureDisplayInTransactionLocked(device, info.state == Display.STATE_OFF, null);
+            }
+        }catch(RemoteException e){
+            e.printStackTrace();
+        }
+
 
         // Update the viewports if needed.
         if (!mDefaultViewport.valid

4 在路径为\frameworks\base\services\core\java\com\android\server\display\LocalDisplayAdapter.java文件中打上如下补丁

dongsy@build-server-100:~/work/dsy/code_rk3288/frameworks/base((e845a29...))$ git diff services/core/java/com/android/server/display/LocalDisplayAdapter.java
diff --git a/services/core/java/com/android/server/display/LocalDisplayAdapter.java b/services/core
index bd718e1..16092fe 100755
--- a/services/core/java/com/android/server/display/LocalDisplayAdapter.java
+++ b/services/core/java/com/android/server/display/LocalDisplayAdapter.java
@@ -415,23 +415,8 @@ final class LocalDisplayAdapter extends DisplayAdapter {
                 } else {
                     mInfo.type = Display.TYPE_HDMI;
                     mInfo.flags |= DisplayDeviceInfo.FLAG_PRESENTATION;
-                    if( SystemProperties.getBoolean("ro.orientation.vhshow",false)) {
-                        boolean noRotate = "0".equals(SystemProperties.get("ro.sf.hwrotation"));
-                        if(noRotate && mBuiltInDisplayId == SurfaceControl.BUILT_IN_DISPLAY_ID_HDM
-                            if (SystemProperties.getBoolean("ro.rotation.external", false)) {
-                                mInfo.flags |= DisplayDeviceInfo.FLAG_ROTATES_WITH_CONTENT;
-                            }
-                            String value = SystemProperties.get("ro.orientation.einit");
-                            /*if ("0".equals(value)) {
-                                mInfo.rotation = Surface.ROTATION_0;
-                            } else if ("90".equals(value)) {
-                                mInfo.rotation = Surface.ROTATION_90;
-                            } else if ("180".equals(value)) {
-                                mInfo.rotation = Surface.ROTATION_180;
-                            } else if ("270".equals(value)) {
-                                mInfo.rotation = Surface.ROTATION_270;
-                            }*/
-                        }
+                    if (SystemProperties.getBoolean("ro.sys.rotation.sensor", false)) {
+                        mInfo.flags |= DisplayDeviceInfo.FLAG_ROTATES_WITH_CONTENT;
                     }
                     mInfo.name = getContext().getResources().getString(
                             com.android.internal.R.string.display_manager_hdmi_display_name);

5 在路径为\frameworks\base\services\core\java\com\android\server\display\LogicalDisplay.java文件中打上如下补丁

dongsy@build-server-100:~/work/dsy/code_rk3288/frameworks/base((e845a29...))$ git diff services/core/java/com/android/server/display/LogicalDisplay.java
diff --git a/services/core/java/com/android/server/display/LogicalDisplay.java b/services/core/java
old mode 100644
new mode 100755
index b02f8a7..6f2c920
--- a/services/core/java/com/android/server/display/LogicalDisplay.java
+++ b/services/core/java/com/android/server/display/LogicalDisplay.java
@@ -67,7 +67,7 @@ final class LogicalDisplay {
     private static final int BLANK_LAYER_STACK = -1;
 
     private static final String TAG_DUALSCREEN = "DualScreen";
-    private final boolean DEBUG_DUALSCREEN = false;
+    private final boolean DEBUG_DUALSCREEN = true;
     private final int mDisplayId;
     private final int mLayerStack;
     private DisplayInfo mOverrideDisplayInfo; // set by the window manager
@@ -79,6 +79,7 @@ final class LogicalDisplay {
     // The display device that this logical display is based on and which
     // determines the base metrics that it uses.
     private DisplayDevice mPrimaryDisplayDevice;
+
     private DisplayDeviceInfo mPrimaryDisplayDeviceInfo;
 
     // True if the logical display has unique content.
@@ -148,7 +149,26 @@ final class LogicalDisplay {
                 mInfo.physicalXDpi = mOverrideDisplayInfo.physicalXDpi;
                 mInfo.physicalYDpi = mOverrideDisplayInfo.physicalYDpi;
             }
+            if(mDisplayId!=Display.DEFAULT_DISPLAY){
+                 String rotation = SystemProperties.get("persist.sys.rotation.einit","0");
+                if(Integer.valueOf(rotation)%2!=0) {
+
+
+                    mInfo.appWidth = mPrimaryDisplayDeviceInfo.height;
+                    mInfo.appHeight = mPrimaryDisplayDeviceInfo.width;
+                    mInfo.logicalWidth = mPrimaryDisplayDeviceInfo.height;
+                    mInfo.logicalHeight=mPrimaryDisplayDeviceInfo.width;
+
+                }else{
+                    mInfo.appWidth = mPrimaryDisplayDeviceInfo.width;
+                    mInfo.appHeight = mPrimaryDisplayDeviceInfo.height;
+                    mInfo.logicalWidth = mPrimaryDisplayDeviceInfo.width;
+                    mInfo.logicalHeight=mPrimaryDisplayDeviceInfo.height;
+                }
+            }
         }
+
+
         return mInfo;
     }
 
@@ -267,6 +287,7 @@ final class LogicalDisplay {
            mPrimaryDisplayDeviceInfo = deviceInfo;
             mInfo = null;
+
         }
     }
 
@@ -303,6 +324,7 @@ final class LogicalDisplay {
 
         // Only grab the display info now as it may have been changed based on the requests above.
         DisplayInfo displayInfo = getDisplayInfoLocked();
+        Slog.d("dzy","---------displayInfo="+displayInfo+device.getDisplayDeviceInfoLocked()+"    "+device.getUniqueId());
         final DisplayDeviceInfo displayDeviceInfo = device.getDisplayDeviceInfoLocked();
         IWindowManager wm = IWindowManager.Stub.asInterface(ServiceManager.getService(Context.WINDOW_SERVI
         try{
@@ -310,7 +332,7 @@ final class LogicalDisplay {
                 isDualScreen = wm.getSecondDisplayTaskId() != -1;
                 if(wm.isDualConfig()){
                     displayInfo = info != null?info:getDisplayInfoLocked();
-                    if(DEBUG_DUALSCREEN) Slog.v(TAG_DUALSCREEN,"LogicalDisplay configurDisplay  displayInfo = "+displayInfo);
+                  /*if(DEBUG_DUALSCREEN)*/ Slog.v("dzy","LogicalDisplay configurDisplay  displayInfo = "+displayInfo);
                 }
             }
         }catch(Exception e){
@@ -374,55 +396,20 @@ final class LogicalDisplay {
         mTempDisplayRect.top += mDisplayOffsetY;
         mTempDisplayRect.bottom += mDisplayOffsetY;
         
-        if(SystemProperties.getBoolean("persist.orientation.vhshow",false)) {
-            Rect displayRect = new Rect(mTempLayerStackRect);
-            if (isDefaultDisplay == false) {
-                if (isDualScreen == true) {
-                    displayVhShow = true;
-                    if(diffStackRect != null) {
-                        displayRect = new Rect(diffStackRect);
-                    }
-                }
-                diffStackRect = new Rect(displayRect);     
-                int width=displayDeviceInfo.width;
-                int height=displayDeviceInfo.height;
-                 device.setProjectionInTransactionLocked(orientation, displayRect, new Rect(0,0,width,height));
-                return ;
-                //Keep mTempLayerStackRect、mTempDisplayRect、crop unchanged, will not stretch after rotation
-            }
-        } else {
-            try{
-                if(wm.getDualScreenFlag()) {
-                    Rect stackRect = new Rect(mTempLayerStackRect);
-                    Rect displayRect = new Rect(mTempDisplayRect);
-                    if(DEBUG_DUALSCREEN) Slog.v(TAG_DUALSCREEN,"mTempDisplayRect ="+mTempDisplayRect);
-                    if(displayVhShow == true) {
-                        displayVhShow = false;
-                      //  displayRect = new Rect(diffDisplayRect);                    
-                       if(DEBUG_DUALSCREEN) Slog.v(TAG_DUALSCREEN,"diffDisplayRect  ------------------ ="+diffDisplayRect);
-                        diffStackRect = null;
-                        diffDisplayRect = null;
-                    }
-                    if (isDefaultDisplay == false) {
-                        if (isDualScreen == true) {
-                            if(diffDisplayRect != null) {
-                                 displayRect = new Rect(diffDisplayRect);
-                            }
-                            if(diffStackRect != null) {
-                                stackRect = new Rect(diffStackRect);
-                            }
-                        }
-                        diffStackRect = new Rect(stackRect);
-                        diffDisplayRect = new Rect(displayRect);
-                        if(DEBUG_DUALSCREEN) Slog.v(TAG_DUALSCREEN,"diffDisplayRect ="+diffDisplayRect);
-                        device.setProjectionInTransactionLocked(orientation, stackRect, displayRect);
-                        return ;
-                    } 
-                }
-            }catch(Exception e){
-            //no handle
+
+        Slog.d(TAG_DUALSCREEN,"info=  "+device.getDisplayDeviceInfoLocked());
+        Slog.d(TAG_DUALSCREEN,"mTempDisplayRect="+mTempDisplayRect);
+        if(device.getDisplayDeviceInfoLocked().type==Display.TYPE_HDMI){
+            if(SystemProperties.getBoolean("persist.sys.rotation.efull",false)){
+               mTempDisplayRect.top=0;
+               mTempDisplayRect.left=0;
+               mTempDisplayRect.right=physWidth;
+               mTempDisplayRect.bottom=physHeight;
+
             }
+            Slog.d(TAG_DUALSCREEN,"+++++++++mTempDisplayRect="+mTempDisplayRect);
         }
+       Slog.d(TAG_DUALSCREEN,"-----------mTempDisplayRect="+mTempDisplayRect+"  orientation="+orientation);
         device.setProjectionInTransactionLocked(orientation, mTempLayerStackRect, mTempDisplayRect);
     }
     /**
@@ -507,5 +494,6 @@ final class LogicalDisplay {
                 mPrimaryDisplayDevice.getNameLocked() : "null"));
         pw.println("mBaseDisplayInfo=" + mBaseDisplayInfo);
         pw.println("mOverrideDisplayInfo=" + mOverrideDisplayInfo);
+        pw.println("mInfo=" + mInfo);
     }
 }

6 在路径为\frameworks\base\services\core\java\com\android\server\policy\PhoneWindowManager.java文件中打上如下补丁

dongsy@build-server-100:~/work/dsy/code_rk3288/frameworks/base((e845a29...))$ git diff 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/
index a55fee6..c0a9b31 100755
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -115,6 +115,7 @@ import android.util.Slog;
 import android.util.SparseArray;
 import android.util.LongSparseArray;
 import android.view.Display;
+import android.view.DisplayInfo;
 import android.view.Gravity;
 import android.view.HapticFeedbackConstants;
 import android.view.IApplicationToken;
@@ -4601,7 +4602,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
     public void layoutWindowLw(WindowState win, WindowState attached) {
     }
     
-    public void layoutWindowLw(WindowState win, WindowState attached, int width, int height) {
+    public void layoutWindowLw(WindowState win, WindowState attached, DisplayInfo info) {
         // We've already done the navigation bar and status bar. If the status bar can receive
         // input, we need to layout it again to accomodate for the IME window.
         if ((win == mStatusBar && !canReceiveInput(win)) || win == mNavigationBar) {
@@ -4655,11 +4656,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                         = mOverscanScreenLeft + mOverscanScreenWidth;
                 pf.bottom = df.bottom = of.bottom = cf.bottom
                         = mOverscanScreenTop + mOverscanScreenHeight;
-                
-                pf.left = df.left = of.left = cf.left = vf.left = 0;
-                pf.top = df.top = of.top = cf.top = vf.top = 0;
-                pf.right = df.right = of.right = cf.right = vf.right = width;
-                pf.bottom = df.bottom = of.bottom = cf.bottom = vf.bottom = height;
+                if(info!=null) {
+                    pf.left = df.left = of.left = cf.left = vf.left = 0;
+                    pf.top = df.top = of.top = cf.top = vf.top = 0;
+                    pf.right = df.right = of.right = cf.right = vf.right = info.logicalWidth;
+                    pf.bottom = df.bottom = of.bottom = cf.bottom = vf.bottom = info.logicalHeight;
+                }
             }
         } else if (attrs.type == TYPE_INPUT_METHOD) {
             pf.left = df.left = of.left = cf.left = vf.left = mDockLeft;

7 在路径为\frameworks\base\services\core\java\com\android\server\wm\WindowManagerService.java文件中打上如下补丁

dongsy@build-server-100:~/work/dsy/code_rk3288/frameworks/base((e845a29...))$ git diff services/core/java/com/android/server/wm/WindowManagerService.java
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/an
index f4ba143..c6545d1 100755
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -1540,6 +1540,9 @@ public class WindowManagerService extends IWindowManager.Stub
        public List getSecondTaskIds(){
                return mSecondTaskIds;
        }
+       public boolean isUseSecondDisplayInfo(){
+           return SystemProperties.get("persist.sys.draw.einfo","1").equals("1");
+    }
        
        
        //get All stacks

8 在路径为\frameworks\base\services\core\java\com\android\server\wm\WindowStateAnimator.java文件中打上如下补丁

dongsy@build-server-100:~/work/dsy/code_rk3288/frameworks/base((e845a29...))$ git diff services/core/java/com/android/server/wm/WindowStateAnimator.java
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/and
index 86ff7eb..bb93d4e 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -1235,7 +1235,7 @@ class WindowStateAnimator {
         if (!w.isDefaultDisplay()) {
             // On a different display there is no system decor.  Crop the window
             // by the screen boundaries
-            if(mService.getDualScreenFlag()) {
+            if(!mService.isUseSecondDisplayInfo()) {
                     if (tempInfo == null) {
                         tempInfo = new DisplayInfo(mService.getDefaultDisplayInfoLocked()); 
                     }

9 在路径为\frameworks\base\services\core\java\com\android\server\wm\WindowSurfacePlacer.java文件中打上如下补丁

dongsy@build-server-100:~/work/dsy/code_rk3288/frameworks/base((e845a29...))$ git diff services/core/java/com/android/server/wm/WindowSurfacePlacer.java
diff --git a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java b/services/core/java/com/and
old mode 100644
new mode 100755
index 2ffcd83..a9ef9d2
--- a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
+++ b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
@@ -991,9 +991,15 @@ class WindowSurfacePlacer {
                     }
                     win.mLayoutNeeded = false;
                     win.prelayout();
-                    //mService.mPolicy.layoutWindowLw(win, null);
-                    DisplayInfo defaultDisplayInfo = mService.getDefaultDisplayInfoLocked();
-                   mService.mPolicy.layoutWindowLw(win ,null ,defaultDisplayInfo.logicalWidth,defaultDisplayInfo.logicalHeight);
+
+                    if (!mService.isUseSecondDisplayInfo()) {
+                        DisplayInfo defaultDisplayInfo = mService.getDefaultDisplayInfoLocked();
+                        mService.mPolicy.layoutWindowLw(win, null, defaultDisplayInfo);
+                    } else {
+                        mService.mPolicy.layoutWindowLw(win, null, null);
+                    }
+
+
   
                     win.mLayoutSeq = seq;
                     // Window frames may have changed. Update dim layer with the new bounds.
                @@ -1046,9 +1052,14 @@ class WindowSurfacePlacer {
                     }
                     win.mLayoutNeeded = false;
                     win.prelayout();
-                    //mService.mPolicy.layoutWindowLw(win, win.mAttachedWindow);
-                    DisplayInfo defaultDisplayInfo = mService.getDefaultDisplayInfoLocked();
-                   mService.mPolicy.layoutWindowLw(win, win.mAttachedWindow, defaultDisplayInfo.logicalWidth,defaultDisplayInfo.logicalHeight);
+                    if(!mService.isUseSecondDisplayInfo()){
+                        DisplayInfo defaultDisplayInfo = mService.getDefaultDisplayInfoLocked();
+                        mService.mPolicy.layoutWindowLw(win, win.mAttachedWindow,defaultDisplayInfo);
+                    }else{
+                        mService.mPolicy.layoutWindowLw(win, win.mAttachedWindow,null);
+                    }
+
+
  
                     win.mLayoutSeq = seq;
                     if (DEBUG_LAYOUT) Slog.v(TAG,

10 在路径为\frameworks\native\services\surfaceflinger\DisplayDevice.cpp文件中打上如下补丁

dongsy@build-server-100:~/work/dsy/code_rk3288/frameworks/native((4e55453...))$ git diff services/surfaceflinger/DisplayDevice.cpp
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index 3b16130..7da6c31 100755
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -538,6 +538,8 @@ void DisplayDevice::setProjection(int orientation,
 #endif
 
 #if !RK_VR & RK_HW_ROTATION
+#if 0
+
     bool isHdmiScreen = mType == DisplayDevice::DISPLAY_EXTERNAL;
     if (isHdmiScreen) {
         int eInitOrientation = 0;
@@ -616,6 +618,7 @@ void DisplayDevice::setProjection(int orientation,
         }
         ALOGV("update frame [%d,%d]",frame.getWidth(),frame.getHeight());
     }
+#endif
     if (mType == DisplayDevice::DISPLAY_PRIMARY) {
         mClientOrientation = orientation;
         orientation = (mHardwareOrientation + orientation) % 4;

11 在路径为\packages\apps\Settings\res\values-zh-rCN\arrays.xml文件中打上如下补丁

dongsy@build-server-100:~/work/dsy/code_rk3288/packages/apps/Settings((465d84e...))$ git diff res/values-zh-rCN/arrays.xml
diff --git a/res/values-zh-rCN/arrays.xml b/res/values-zh-rCN/arrays.xml
index 2ef6881..e127220 100755
--- a/res/values-zh-rCN/arrays.xml
+++ b/res/values-zh-rCN/arrays.xml
@@ -29,10 +29,6 @@
     "太平洋"
     "全部"
   
-  
-    横向显示
-    纵向显示
-  
   

12 在路径为\packages\apps\Settings\res\values-zh-rCN\strings.xml文件中打上如下补丁

dongsy@build-server-100:~/work/dsy/code_rk3288/packages/apps/Settings((465d84e...))$ git diff res/values-zh-rCN/strings.xml
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index a602128..27c25dd 100755
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -3273,8 +3273,8 @@
    "屏幕缩放"
    屏幕旋转
    双屏异显
-   副屏旋转开关
-   横向或纵向显示
+   副屏满屏显示
+   副屏显示方向
    
    
     屏幕设置

13 在路径为\packages\apps\Settings\res\values\arrays.xml文件中打上如下补丁

dongsy@build-server-100:~/work/dsy/code_rk3288/packages/apps/Settings((465d84e...))$ git diff res/values/arrays.xml
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 012fae9..9c2bbc6 100755
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -1100,12 +1100,16 @@
     
 
     
-        Landscape
-        Portrait
+        0
+        90
+        180
+        270
     
     
         0
         1
+        2
+        3
     
 
     

14 在路径为\packages\apps\Settings\res\values\strings.xml文件中打上如下补丁

dongsy@build-server-100:~/work/dsy/code_rk3288/packages/apps/Settings((465d84e...))$ git diff res/values/strings.xml
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f051ccf..eeb8941 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -7960,8 +7960,8 @@
     HDMI is disconnected.
     HDMI Rotation
     dual screen
-    Vice screen rotation switch
-    Portrait or Landscape Display
+    Second screen full display
+    Second display rotation
 
     Screen
     Output Interface
@@ -7983,4 +7983,5 @@
     Color temperature mode
     
     Select Color temperature 
 

15 在路径为\packages\apps\Settings\src\com\android\settings\HdmiSettings.java文件中打上如下补丁

dongsy@build-server-100:~/work/dsy/code_rk3288/packages/apps/Settings((465d84e...))$ git diff src/com/android/settings/HdmiSettings.java
diff --git a/src/com/android/settings/HdmiSettings.java b/src/com/android/settings/HdmiSettings.java
index f21085c..9fe6a92 100755
--- a/src/com/android/settings/HdmiSettings.java
+++ b/src/com/android/settings/HdmiSettings.java
@@ -156,16 +156,12 @@ public class HdmiSettings extends SettingsPreferenceFragment
         mHdmiDualScreen.setOnPreferenceChangeListener(this);
  
         mHdmiDualScreenVH = (CheckBoxPreference)findPreference(KEY_HDMI_DUAL_SCREEN_VH);
-        mHdmiDualScreenVH.setEnabled(enable);
-        if(enable) {
-            mHdmiDualScreenVH.setChecked(SystemProperties.getBoolean("persist.orientation.vhshow", false));
-        }
+        mHdmiDualScreenVH.setChecked(SystemProperties.getBoolean("persist.sys.rotation.efull", false));
         mHdmiDualScreenVH.setOnPreferenceChangeListener(this);
         mHdmiDualScreenList = (ListPreference)findPreference(KEY_HDMI_DUAL_SCREEN_LIST);
         mHdmiDualScreenList.setOnPreferenceChangeListener(this);
         mHdmiDualScreenList.setOnPreferenceClickListener(this);
-        mHdmiDualScreenList.setEnabled(SystemProperties.getBoolean("persist.orientation.vhshow", false));
-        Log.d(TAG, "onCreate---------------------");
+        Log.d(TAG, "---------onCreate---------------------");
     }
 
 
 
@@ -205,16 +201,8 @@ public class HdmiSettings extends SettingsPreferenceFragment
         mDisplayManager.registerDisplayListener(mDisplayListener, null);
         if (android.provider.Settings.System.getInt(getActivity().getContentResolver(),DOUBLE_SCREEN_STATE,0) == 0) {
             mHdmiDualScreen.setEnabled(true);
-            if(android.provider.Settings.System.getInt(getActivity().getContentResolver(),DOUBLE_SCREEN_CONFIG,0) == 1) {
-                mHdmiDualScreenVH.setEnabled(true);
-            } else {
-                mHdmiDualScreenVH.setEnabled(false);
-            }
-            mHdmiDualScreenList.setEnabled(SystemProperties.getBoolean("persist.orientation.vhshow", false));
         } else {
             mHdmiDualScreen.setEnabled(false);
-            mHdmiDualScreenVH.setEnabled(false);
-            mHdmiDualScreenList.setEnabled(false);
         }
     }
 
@@ -288,12 +276,6 @@ public class HdmiSettings extends SettingsPreferenceFragment
             mHdmiResolution.setEnabled(false);
             mHdmiScale.setEnabled(false);
             mHdmiRotation.setEnabled(false);
-               //mHdmiDualScreen.setEnabled(false);
-               //mHdmiDualScreenVH.setEnabled(false);
-               mHdmiDualScreenList.setEnabled(false);
-            SystemProperties.set("persist.orientation.vhshow", "false");
-            SystemProperties.set("persist.orientation.vhinit", "0");
-            mHdmiDualScreenVH.setChecked(false);
         } else {
             new Handler().postDelayed(new Runnable() {
                 public void run() {
                 public void run() {
@@ -309,8 +291,6 @@ public class HdmiSettings extends SettingsPreferenceFragment
                         if(getActivity() != null && getActivity().getContentResolver() != null) {
                                        if (android.provider.Settings.System.getInt(getActivity().getContentResolver(),DOUBLE_SCREEN_ST
                                 mHdmiDualScreen.setEnabled(true);
-                                mHdmiDualScreenVH.setEnabled(android.provider.Settings.System.getInt(getActivity().getContentResolver(
-                                mHdmiDualScreenList.setEnabled(SystemProperties.getBoolean("persist.orientation.vhshow", false));
                            }
                         }
                     }
@@ -355,7 +335,7 @@ public class HdmiSettings extends SettingsPreferenceFragment
         } else if (preference == mHdmiResolution) {
             updateHDMIState();
         } else if (preference == mHdmiDualScreenList) {
-            String value = SystemProperties.get("persist.orientation.vhinit","0");
+            String value = SystemProperties.get("persist.sys.rotation.einit","0");
             mHdmiDualScreenList.setValue(value);
         }
         return true;
        @@ -401,28 +381,35 @@ public class HdmiSettings extends SettingsPreferenceFragment
             }
            } else if (preference == mHdmiDualScreen) {
             android.provider.Settings.System.putInt(getActivity().getContentResolver(),DOUBLE_SCREEN_CONFIG,(Boolean)obj?1:0);
-            SystemProperties.set("persist.orientation.vhinit", "0");
-            SystemProperties.set("persist.orientation.vhshow", "false");
-            mHdmiDualScreenVH.setEnabled((Boolean)obj);
-            mHdmiDualScreenVH.setChecked(false);
-            mHdmiDualScreenList.setEnabled(false);
             this.finish();
            } else if (preference == mHdmiDualScreenVH) {
             if((Boolean)obj) {
-                SystemProperties.set("persist.orientation.vhshow", "true");   
-                mHdmiDualScreenList.setEnabled(true);
+                SystemProperties.set("persist.sys.rotation.efull", "true");
             } else {
-                SystemProperties.set("persist.orientation.vhshow", "false");   
-                mHdmiDualScreenList.setEnabled(false);
-                SystemProperties.set("persist.orientation.vhinit", "0");
+                SystemProperties.set("persist.sys.rotation.efull", "false");
             }
-            SystemProperties.set("persist.orientation.vhinit", "0");
+            SystemProperties.set("sys.hdmi_status.aux", "off");
+            mSwitchBar.setEnabled(false);
+            new Handler().postDelayed(new Runnable() {
+                @Override
+                public void run() {
+                    SystemProperties.set("sys.hdmi_status.aux", "on");
+                    mSwitchBar.setEnabled(true);
+                }
+            },500);
+             } else if (preference == mHdmiDualScreenList) {
-            if("0".equals(obj.toString())) {
-                SystemProperties.set("persist.orientation.vhinit", "0");
-            } else if ("1".equals(obj.toString())) {
-                SystemProperties.set("persist.orientation.vhinit", "1");
-            }
+                SystemProperties.set("persist.sys.rotation.einit", obj.toString());
+                //mDisplayManager.forceScheduleTraversalLocked();
+                SystemProperties.set("sys.hdmi_status.aux", "off");
+                mSwitchBar.setEnabled(false);
+                new Handler().postDelayed(new Runnable() {
+                    @Override
+                    public void run() {
+                        SystemProperties.set("sys.hdmi_status.aux", "on");
+                        mSwitchBar.setEnabled(true);
+                    }
+                },500);
+
         }
         return true;

同时在\device\rockchip\rk3288\system.prop文件中配置旋转方向的属性

dongsy@build-server-100:~/work/dsy/rk3288-Android-7.0/device/rockchip/rk3288((f3c5a0a...))$ git diff system.prop
diff --git a/system.prop b/system.prop
old mode 100644
new mode 100755
index be3f161..440597e
--- a/system.prop
+++ b/system.prop
@@ -36,12 +38,42 @@ ro.rk.LowBatteryBrightness=false
 ro.tether.denied=false
 sys.resolution.changed=false
 ro.default.size=100
 ro.product.usbfactory=rockchip_usb
 wifi.supplicant_scan_interval=15
 ro.factory.tool=0
 ro.kernel.android.checkjni=0
 #set default lcd density to Rockchip tablet
 ro.adb.secure=0
 ro.rk.displayd.enable=false
#set default lcd density to Rockchip tablet
ro.sf.lcd_density=160
ro.adb.secure=0
ro.rk.displayd.enable=false
# Dual - display configuration 
# 主屏 eDP
sys.hwc.device.primary=eDP
# 副屏
sys.hwc.device.extend=LVDS 
#persist.sys.framebuffer.main=800x1280
persist.sys.resolution.main=1920x1080
persist.sys.resolution.aux=800x1280

#  副屏是否全屏显示
persist.sys.rotation.efull = true


# 主屏的旋转方向(0 90 180 270)
ro.sf.hwrotation=0

# 副屏输出旋转方向对应 0 / 90 / 180 / 270(0 1 2 3)
+persist.sys.rotation.einit =1



#副屏也随着 g-sensor 旋转(只关注方向,黑边不关注)
ro.sys.rotation.sensor =false

// 主副屏orientaion是否相同
ro.same.orientation=false

// 副屏是否随主屏旋转
ro.rotation.external=false

你可能感兴趣的:(调试笔记,RK)