rk3288 android 7.1 双屏异显

 1 找到 在要编译的rk3288-evb-android-rk808-edp-lvds.dts
调试思路先将edp和lvds屏配置其dts分别点亮后,最后将两个屏的dts合在一起
在rk3288-evb-android-rk808-edp-lvds.dts中加上最终的edp屏和lvds屏的dts配置如下:
注:引脚enable-gpios lvds与edp的不能复用,否则内核崩溃;

// added for edp start <<<
&edp {
	status = "okay";
};

&edp_phy {
	status = "okay";
};
 &route_edp {
	status = "okay";
};
//rk3288 有两路通道vopb(4K) vopl(2K) ,这里异显设vopb通道是edp,vopl通道是lvds
&edp_in_vopb {
	status = "okay";
};
&edp_in_vopl {
	status = "disabled";
};
&edp_panel {
//	compatible = "simple-panel";
    compatible ="lg,lp079qx1-sp0v";
//	backlight = <&backlight>;  //这里异显如果共用背光,只需要配置一个背光
	power-supply = <&vcc_lcd>;
	status = "okay";

	disp_timings: display-timings {
		native-mode = <&edp_panel_name>;

		edp_panel_name: timing0 {
			clock-frequency = <158000000>;
			hactive = <1920>;
			vactive = <1080>;
			hfront-porch = <48>;
			hsync-len = <4>;
			hback-porch = <310>;
			vfront-porch = <3>;
			vsync-len = <4>;
			vback-porch = <60>;
			hsync-active = <0>;
			vsync-active = <0>;
			de-active = <0>;
			pixelclk-active = <0>;
		};
	};
};

// added edp end >>>

// added  for lvds start <<<



&route_lvds {
	status = "okay";
};

&lvds {
	status = "okay";
};
//rk3288 有两路通道vopb(4K) vopl(2K) ,这里异显设vopb通道是edp,vopl通道是lvds
&lvds_in_vopl {
	status = "okay";
};

&lvds_in_vopb {
	status = "disabled";
};

&lvds_panel {
	status = "okay";
	compatible ="simple-panel";
	backlight = <&backlight>;   //这里异显如果共用背光,只需要配置一个背光
//	bus-format = ; ;
//	bus-format = ;
	enable-gpios = <&gpio7 3 GPIO_ACTIVE_HIGH>;
//	enable = <&gpio7 3 GPIO_ACTIVE_HIGH>;
	enable-delay-ms = <10>;
//	power-supply = <&vcc_lcd>;
	rockchip,data-mapping = "vesa";
//	rockchip,data-mapping = "jeida";
	rockchip,data-width = <24>;
	rockchip,output = "duallvds";

	display-timings {
		native-mode = <&lvds_panel_name>;
		lvds_panel_name: timing0 {
			creen-type = ;
			lvds-format = ;
			out-face    = ;
			clock-frequency = <148000000>;
			hactive = <1920>;
			vactive = <1080>;
			hback-porch = <100>;
			hfront-porch = <160>;
			vback-porch = <25>;
			vfront-porch = <10>;
			hsync-len = <1>;
			vsync-len = <1>;
			hsync-active = <20>;
			vsync-active = <10>;
			de-active = <0>;
			pixelclk-active = <0>;
		};
	};
};

// added lvds end <<<

注意:如果需要配置 VOPL(2K)通道是eDP或者DSI(mipi屏),上层还需要关掉 AFBC,打上以下补丁

rk3288-Android-7.0/hardware/rockchip/libgralloc((3bb0f11...))$ git diff Android.mk
diff --git a/Android.mk b/Android.mk
index 52387b9..00863f8 100755
--- a/Android.mk
+++ b/Android.mk
@@ -153,16 +153,19 @@ endif
 ifeq ($(strip $(TARGET_BOARD_PLATFORM_GPU)), mali-t860)
 MALI_AFBC_GRALLOC := 1
-USE_AFBC_LAYER = 1
+USE_AFBC_LAYER = 0
 LOCAL_CFLAGS += -DMALI_PRODUCT_ID_T86X=1
 endif

 2 同时在/device/rockchip/rk3288/system.prop文件中配置好主副屏的属性

diff --git a/system.prop b/system.prop
old mode 100644
new mode 100755
index be3f161..ce6c558
--- a/system.prop
+++ b/system.prop
@@ -28,7 +28,8 @@ sys.wallpaper.rgb565=0
 sf.power.control=2073600
 sys.rkadb.root=0
 ro.sf.fakerotation=false
 ro.rk.MassStorage=false
 ro.rk.systembar.voiceicon=true
 ro.rk.systembar.tabletUI=false
@@ -42,6 +43,36 @@ wifi.supplicant_scan_interval=15
 ro.factory.tool=0
 ro.kernel.android.checkjni=0
ro.sf.lcd_density=160
 ro.adb.secure=0
 ro.rk.displayd.enable=false
+ # 主屏是eDP
+ sys.hwc.device.primary=eDP 
+ # 副屏是LVDS 
+ sys.hwc.device.extend=LVDS 
+ # 主分辨率一般设置与主屏分辨率一致
+ persist.sys.framebuffer.main=1920x1080
+ # 主屏edp分辨率
+ persist.sys.resolution.main=1920x1080
+ # 副屏lvds分辨率
+ persist.sys.resolution.aux=1920x1080
 +#  副屏是否全屏显示
+ 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 =0
+ #副屏是否随着 g-sensor 旋转(只关注方向,黑边不关注)
+ ro.sys.rotation.sensor = true
+#主副屏的方向是否相同
+ ro.same.orientation=false
+ #副屏是否随主屏旋转
+ro.rotation.external=true
+#设置 sys.dual_screen.keycodes 属性的方式来修改相应的触发按键
+ sys.dual_screen.keycodes=24,25

3.修改framework

diff --git a/frameworks/base/core/java/android/view/IWindowManager.aidl b/frameworks/base/core/java/android/view/IWindowManager.aidl
index 86b9d4f..406fa75 100644
--- a/frameworks/base/core/java/android/view/IWindowManager.aidl
+++ b/frameworks/base/core/java/android/view/IWindowManager.aidl
@@ -444,4 +444,5 @@ interface IWindowManager
     boolean isDualConfig();
     boolean getDualScreenFlag();
     int getSecondDisplayTaskId();
+    boolean isUseSecondDisplayInfo();
 }
diff --git a/frameworks/base/core/java/android/view/WindowManagerPolicy.java b/frameworks/base/core/java/android/view/WindowManagerPolicy.java
index 5317b59..514e145 100644
--- a/frameworks/base/core/java/android/view/WindowManagerPolicy.java
+++ b/frameworks/base/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 width,int height);
+    public void layoutWindowLw(WindowState win, WindowState attached,DisplayInfo info);
 
 
     /**
diff --git a/frameworks/base/services/core/java/com/android/server/display/DisplayManagerService.java b/frameworks/base/services/core/java/com/android/server/display/DisplayManagerService.java
index 39f9d20..d09a288 100755
--- a/frameworks/base/services/core/java/com/android/server/display/DisplayManagerService.java
+++ b/frameworks/base/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.getDisplayDeviceInfoLocked().height)?1:0;
-                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
@@ -1599,6 +1605,7 @@ public final class DisplayManagerService extends SystemService {
                     android.Manifest.permission.CAPTURE_SECURE_VIDEO_OUTPUT)
                     == PackageManager.PERMISSION_GRANTED;
         }
+
     }
 
     private final class LocalService extends DisplayManagerInternal {
diff --git a/frameworks/base/services/core/java/com/android/server/display/LocalDisplayAdapter.java b/frameworks/base/services/core/java/com/android/server/display/LocalDisplayAdapter.java
index bd718e1..16092fe 100755
--- a/frameworks/base/services/core/java/com/android/server/display/LocalDisplayAdapter.java
+++ b/frameworks/base/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_HDMI){
-                            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);
diff --git a/frameworks/base/services/core/java/com/android/server/display/LogicalDisplay.java b/frameworks/base/services/core/java/com/android/server/display/LogicalDisplay.java
old mode 100644
new mode 100755
index b02f8a7..6f2c920
--- a/frameworks/base/services/core/java/com/android/server/display/LogicalDisplay.java
+++ b/frameworks/base/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_SERVICE));
         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);
     }
 }
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
index a55fee6..c0a9b31 100755
--- a/frameworks/base/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/frameworks/base/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;
diff --git a/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java b/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
index f4ba143..c6545d1 100755
--- a/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/frameworks/base/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
diff --git a/frameworks/base/services/core/java/com/android/server/wm/WindowStateAnimator.java b/frameworks/base/services/core/java/com/android/server/wm/WindowStateAnimator.java
index 86ff7eb..bb93d4e 100644
--- a/frameworks/base/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/frameworks/base/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()); 
                     }
diff --git a/frameworks/base/services/core/java/com/android/server/wm/WindowSurfacePlacer.java b/frameworks/base/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
old mode 100644
new mode 100755
index 2ffcd83..a9ef9d2
--- a/frameworks/base/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
+++ b/frameworks/base/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,
diff --git a/frameworks/native/services/surfaceflinger/DisplayDevice.cpp b/frameworks/native/services/surfaceflinger/DisplayDevice.cpp
index 3b16130..7da6c31 100755
--- a/frameworks/native/services/surfaceflinger/DisplayDevice.cpp
+++ b/frameworks/native/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;
diff --git a/packages/apps/Settings/res/values-zh-rCN/arrays.xml b/packages/apps/Settings/res/values-zh-rCN/arrays.xml
index 2ef6881..e127220 100755
--- a/packages/apps/Settings/res/values-zh-rCN/arrays.xml
+++ b/packages/apps/Settings/res/values-zh-rCN/arrays.xml
@@ -29,10 +29,6 @@
     "太平洋"
     "全部"
   
-  
-    横向显示
-    纵向显示
-  
   
     "永不休眠"
     "15秒"
diff --git a/packages/apps/Settings/res/values-zh-rCN/strings.xml b/packages/apps/Settings/res/values-zh-rCN/strings.xml
index a602128..27c25dd 100755
--- a/packages/apps/Settings/res/values-zh-rCN/strings.xml
+++ b/packages/apps/Settings/res/values-zh-rCN/strings.xml
@@ -3273,8 +3273,8 @@
    "屏幕缩放"
    屏幕旋转
    双屏异显
-   副屏旋转开关
-   横向或纵向显示
+   副屏满屏显示
+   副屏显示方向
    
    
     屏幕设置
diff --git a/packages/apps/Settings/res/values/arrays.xml b/packages/apps/Settings/res/values/arrays.xml
index 012fae9..9c2bbc6 100755
--- a/packages/apps/Settings/res/values/arrays.xml
+++ b/packages/apps/Settings/res/values/arrays.xml
@@ -1100,12 +1100,16 @@
     
 
     
-        Landscape
-        Portrait
+        0
+        90
+        180
+        270
     
     
         0
         1
+        2
+        3
     
 
     
diff --git a/packages/apps/Settings/res/values/strings.xml b/packages/apps/Settings/res/values/strings.xml
index f051ccf..563ea0e 100755
--- a/packages/apps/Settings/res/values/strings.xml
+++ b/packages/apps/Settings/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
diff --git a/packages/apps/Settings/src/com/android/settings/HdmiSettings.java b/packages/apps/Settings/src/com/android/settings/HdmiSettings.java
index f21085c..9fe6a92 100755
--- a/packages/apps/Settings/src/com/android/settings/HdmiSettings.java
+++ b/packages/apps/Settings/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() {
@@ -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_STATE,0) == 0) {
                                 mHdmiDualScreen.setEnabled(true);
-                                mHdmiDualScreenVH.setEnabled(android.provider.Settings.System.getInt(getActivity().getContentResolver(),DOUBLE_SCREEN_CONFIG,0) == 1);
-                                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;
     }

4.测试双屏异显

mmm -B development/samples/ApiDemos/ -j32

依次选择App->Activity->Presentation

你可能感兴趣的:(rockchip,kernel,android,framework)