android4.0.3校准屏幕和隐藏statusbar

news/2024/11/30 7:15:42/

frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java修改:(svn chages as unified diff)

Index: PhoneWindowManager.java
===================================================================
--- PhoneWindowManager.java	(revision 2175)
+++ PhoneWindowManager.java	(revision 2176)
@@ -54,8 +54,9 @@import android.os.SystemProperties;import android.os.UEventObserver;import android.os.Vibrator;
+import android.os.Build;import android.provider.Settings;
-
+import android.media.MediaPlayer;import com.android.internal.R;import com.android.internal.app.ShutdownThread;import com.android.internal.policy.PolicyManager;
@@ -89,6 +90,7 @@import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW;import static android.view.WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN;import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN;
+import static android.view.WindowManager.LayoutParams.FLAG_AW_HIDESTATUS;import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR;import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
@@ -163,6 +165,7 @@// No longer recommended for desk docks; still useful in car docks.static final boolean ENABLE_CAR_DOCK_HOME_CAPTURE = true;static final boolean ENABLE_DESK_DOCK_HOME_CAPTURE = false;
+	static       boolean mFullScreenIsEnable = true;static final int LONG_PRESS_POWER_NOTHING = 0;static final int LONG_PRESS_POWER_GLOBAL_ACTIONS = 1;
@@ -283,11 +286,14 @@/** If true, hitting shift & menu will broadcast Intent.ACTION_BUG_REPORT */boolean mEnableShiftMenuBugReports = false;
-    
+    boolean mStatusBarShow = true;
+	boolean mStatusBarWillHide = true;
+	boolean mStatusBarReqShow = false;boolean mSafeMode;WindowState mStatusBar = null;boolean mStatusBarCanHide;
-    int mStatusBarHeight;
+    int mStatusBarHeightReserved;
+	int mStatusBarHeight;final ArrayList<WindowState> mStatusBarPanels = new ArrayList<WindowState>();WindowState mNavigationBar = null;boolean mHasNavigationBar = false;
@@ -411,6 +417,7 @@WindowState mTopFullscreenOpaqueWindowState;boolean mTopIsFullscreen;
+	boolean mTopIsHideStatusbar;boolean mForceStatusBar;boolean mHideLockScreen;boolean mDismissKeyguard;
@@ -874,11 +881,11 @@* DisplayMetrics.DENSITY_DEFAULT/ DisplayMetrics.DENSITY_DEVICE;mStatusBarCanHide = shortSizeDp < 600;
-        mStatusBarHeight = mContext.getResources().getDimensionPixelSize(
+        mStatusBarHeightReserved = mContext.getResources().getDimensionPixelSize(mStatusBarCanHide? com.android.internal.R.dimen.status_bar_height: com.android.internal.R.dimen.system_bar_height);
-
+		mStatusBarHeight = mStatusBarHeightReserved;mHasNavigationBar = mContext.getResources().getBoolean(com.android.internal.R.bool.config_showNavigationBar);// Allow a system property to override this. Used by the emulator.
@@ -1225,8 +1232,7 @@public int getNonDecorDisplayHeight(int fullWidth, int fullHeight, int rotation) {// Assumes the navigation bar appears on the bottom of the display in portrait.return fullHeight
-            - (mStatusBarCanHide ? 0 : mStatusBarHeight)
-            - ((fullWidth > fullHeight) ? 0 : mNavigationBarHeight);
+               - ((fullWidth > fullHeight) ? 0 : mNavigationBarHeight) - ((mStatusBarCanHide ||mFullScreenIsEnable) ? 0 : mStatusBarHeight);}public int getConfigDisplayWidth(int fullWidth, int fullHeight, int rotation) {
@@ -1239,8 +1245,7 @@// of the decor; however for purposes of configurations, we do want to// exclude it since applications can't generally use that part of the// screen.
-        return getNonDecorDisplayHeight(fullWidth, fullHeight, rotation)
-                - (mStatusBarCanHide ? mStatusBarHeight : 0);
+        return getNonDecorDisplayHeight(fullWidth, fullHeight, rotation) - ((mStatusBarCanHide ||mFullScreenIsEnable) ? mStatusBarHeight : 0);}public boolean doesForceHide(WindowState win, WindowManager.LayoutParams attrs) {
@@ -1914,7 +1919,6 @@mDockRight = mContentRight = mCurRight = displayWidth;mDockBottom = mContentBottom = mCurBottom = displayHeight;mDockLayer = 0x10000000;
-// start with the current dock rect, which will be (0,0,displayWidth,displayHeight)final Rect pf = mTmpParentFrame;final Rect df = mTmpDisplayFrame;
@@ -1923,7 +1927,6 @@pf.top = df.top = vf.top = mDockTop;pf.right = df.right = vf.right = mDockRight;pf.bottom = df.bottom = vf.bottom = mDockBottom;
-final boolean navVisible = (mNavigationBar == null || mNavigationBar.isVisibleLw()) &&(mLastSystemUiFlags&View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;@@ -1977,6 +1980,12 @@mTmpNavigationFrame.offset(mNavigationBarWidth, 0);}}
+                // Make sure the content and current rectangles are updated to
+                // account for the restrictions from the navigation bar.
+                mContentTop = mCurTop = mDockTop;
+                mContentBottom = mCurBottom = mDockBottom;
+                mContentLeft = mCurLeft = mDockLeft;
+                mContentRight = mCurRight = mDockRight;// And compute the final frame.mNavigationBar.computeFrameLw(mTmpNavigationFrame, mTmpNavigationFrame,mTmpNavigationFrame, mTmpNavigationFrame);
@@ -2104,7 +2113,7 @@final boolean hasNavBar = (mHasNavigationBar && mNavigationBar != null && mNavigationBar.isVisibleLw());
-
+		if (attrs.type == TYPE_INPUT_METHOD) {pf.left = df.left = cf.left = vf.left = mDockLeft;pf.top = df.top = cf.top = vf.top = mDockTop;
@@ -2116,7 +2125,14 @@} else {final int adjust = sim & SOFT_INPUT_MASK_ADJUST;-            if ((fl & (FLAG_LAYOUT_IN_SCREEN | FLAG_FULLSCREEN | FLAG_LAYOUT_INSET_DECOR))
+			if((fl & FLAG_AW_HIDESTATUS) == FLAG_AW_HIDESTATUS)
+			{
+				pf.left = df.left = mUnrestrictedScreenLeft;
+                pf.top = df.top = mUnrestrictedScreenTop;
+                pf.right = df.right = mUnrestrictedScreenLeft+mUnrestrictedScreenWidth;
+                pf.bottom = df.bottom = mUnrestrictedScreenTop+mUnrestrictedScreenHeight;
+			}
+		    else if ((fl & (FLAG_LAYOUT_IN_SCREEN | FLAG_FULLSCREEN | FLAG_LAYOUT_INSET_DECOR))== (FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR)) {if (DEBUG_LAYOUT)Log.v(TAG, "layoutWindowLw(" + attrs.getTitle() 
@@ -2211,19 +2227,37 @@"Laying out navigation bar window: (%d,%d - %d,%d)",pf.left, pf.top, pf.right, pf.bottom));}
-                } else if (attrs.type == TYPE_SECURE_SYSTEM_OVERLAY
+                } else if ((attrs.type == TYPE_SECURE_SYSTEM_OVERLAY
+                                || attrs.type == TYPE_BOOT_PROGRESS)&& ((fl & FLAG_FULLSCREEN) != 0)) {// Fullscreen secure system overlays get what they ask for.pf.left = df.left = mUnrestrictedScreenLeft;pf.top = df.top = mUnrestrictedScreenTop;pf.right = df.right = mUnrestrictedScreenLeft+mUnrestrictedScreenWidth;pf.bottom = df.bottom = mUnrestrictedScreenTop+mUnrestrictedScreenHeight;
+                } else if (attrs.type == TYPE_BOOT_PROGRESS) {
+                    // Boot progress screen always covers entire display.
+                    pf.left = df.left = cf.left = mUnrestrictedScreenLeft;
+                    pf.top = df.top = cf.top = mUnrestrictedScreenTop;
+                    pf.right = df.right = cf.right = mUnrestrictedScreenLeft+mUnrestrictedScreenWidth;
+                    pf.bottom = df.bottom = cf.bottom
+                            = mUnrestrictedScreenTop+mUnrestrictedScreenHeight;} else {
-                    pf.left = df.left = cf.left = mRestrictedScreenLeft;
-                    pf.top = df.top = cf.top = mRestrictedScreenTop;
-                    pf.right = df.right = cf.right = mRestrictedScreenLeft+mRestrictedScreenWidth;
-                    pf.bottom = df.bottom = cf.bottom
-                            = mRestrictedScreenTop+mRestrictedScreenHeight;
+                	if(mFullScreenIsEnable)  //mFullScreenIsEnable && mStatusBarWillHide && (mStatusBarReqShow == false)
+                	{
+	                	pf.left = df.left = cf.left = mUnrestrictedScreenLeft;
+	                    pf.top = df.top = cf.top = mUnrestrictedScreenTop;
+	                    pf.right = df.right = cf.right = mUnrestrictedScreenLeft+mUnrestrictedScreenWidth;
+	                    pf.bottom = df.bottom = cf.bottom = mUnrestrictedScreenTop+mUnrestrictedScreenHeight;
+                	}
+					else
+					{
+	                    pf.left = df.left = cf.left = mRestrictedScreenLeft;
+	                    pf.top = df.top = cf.top = mRestrictedScreenTop;
+	                    pf.right = df.right = cf.right = mRestrictedScreenLeft+mRestrictedScreenWidth;
+	                    pf.bottom = df.bottom = cf.bottom
+	                            = mRestrictedScreenTop+mRestrictedScreenHeight;
+					}}if (adjust != SOFT_INPUT_ADJUST_NOTHING) {vf.left = mCurLeft;
@@ -2336,7 +2370,7 @@if (DEBUG_LAYOUT) Slog.i(TAG, "Win " + win + ": isVisibleOrBehindKeyguardLw="+ win.isVisibleOrBehindKeyguardLw());if (mTopFullscreenOpaqueWindowState == null &&
-                win.isVisibleOrBehindKeyguardLw()) {
+                win.isVisibleOrBehindKeyguardLw() && !win.isGoneForLayoutLw()) {if ((attrs.flags & FLAG_FORCE_NOT_FULLSCREEN) != 0) {mForceStatusBar = true;}
@@ -2366,6 +2400,7 @@public int finishAnimationLw() {int changes = 0;boolean topIsFullscreen = false;
+		boolean topIsHideStatusbar =false;final WindowManager.LayoutParams lp = (mTopFullscreenOpaqueWindowState != null)? mTopFullscreenOpaqueWindowState.getAttrs()
@@ -2373,7 +2408,7 @@if (mStatusBar != null) {if (DEBUG_LAYOUT) Log.i(TAG, "force=" + mForceStatusBar
-                    + " top=" + mTopFullscreenOpaqueWindowState);
+                    + " top=" + mTopFullscreenOpaqueWindowState);        if (mForceStatusBar) {if (DEBUG_LAYOUT) Log.v(TAG, "Showing status bar: forced");if (mStatusBar.showLw(true)) changes |= FINISH_LAYOUT_REDO_LAYOUT;
@@ -2385,15 +2420,27 @@+ " lp.flags=0x" + Integer.toHexString(lp.flags));}topIsFullscreen = (lp.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0;
+				topIsHideStatusbar = (lp.flags & WindowManager.LayoutParams.FLAG_AW_HIDESTATUS) != 0;
+				// The subtle difference between the window for mTopFullscreenOpaqueWindowState// and mTopIsFullscreen is that that mTopIsFullscreen is set only if the window// has the FLAG_FULLSCREEN set.  Not sure if there is another way that to be the// case though.
-                if (topIsFullscreen) {
+                if(topIsHideStatusbar)
+				{
+					if (mStatusBar.hideLw(true)) 
+					{
+                        changes |= FINISH_LAYOUT_REDO_LAYOUT;      
+
+						mStatusBarShow = false;
+                    }
+				}
+                else if (topIsFullscreen) {if (mStatusBarCanHide) {if (DEBUG_LAYOUT) Log.v(TAG, "Hiding status bar");if (mStatusBar.hideLw(true)) {changes |= FINISH_LAYOUT_REDO_LAYOUT;
+							mStatusBarShow = false;mHandler.post(new Runnable() { public void run() {if (mStatusBarService != null) {
@@ -2403,17 +2450,50 @@}}});}
-                    } else if (DEBUG_LAYOUT) {
-                        Log.v(TAG, "Preventing status bar from hiding by policy");
+                    } 
+					else
+					{
+						if (DEBUG_LAYOUT) 
+						{
+                        	Log.v(TAG, "Preventing status bar from hiding by policy");
+                    	}
+						if(mFullScreenIsEnable)
+						{
+						    if (mStatusBar.hideLw(true)) 
+							{										    
+	                            changes |= FINISH_LAYOUT_REDO_LAYOUT;
+								mStatusBarShow = false;
+	                        } 	
+						}
+						else
+						{
+							if(mStatusBarShow == false)
+							{
+								if (mStatusBar.showLw(true)) 
+								{
+									changes |= FINISH_LAYOUT_REDO_LAYOUT;
+									mStatusBarShow = true;
+								}
+								
+							}
+						}
+					}
+						
+                } 
+				else 
+				{
+                    if (DEBUG_LAYOUT)
+                    {
+						Log.v(TAG, "** SHOWING status bar: top is not fullscreen");}
-                } else {
-                    if (DEBUG_LAYOUT) Log.v(TAG, "Showing status bar: top is not fullscreen");
-                    if (mStatusBar.showLw(true)) changes |= FINISH_LAYOUT_REDO_LAYOUT;
+                    if (mStatusBar.showLw(true)) 
+						changes |= FINISH_LAYOUT_REDO_LAYOUT;}}}mTopIsFullscreen = topIsFullscreen;
+		mTopIsHideStatusbar = topIsHideStatusbar;// Hide the key guard if a visible window explicitly specifies that it wants to be displayed// when the screen is locked
@@ -3488,6 +3568,27 @@}};+	Runnable mStatusBarHide = new Runnable() {
+        public void run() {
+				mStatusBarWillHide = true;
+				try {
+					Log.d(TAG, "mStatusBarHide mStatusBarWillHide = " + mStatusBarWillHide);
+		            //set orientation on WindowManager
+		            mWindowManager.invokePerformWindow();
+		        } catch (RemoteException e) {
+		            // Ignore
+		        }
+                
+        }
+    };
+
+    public void lockNow() {
+        mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null);
+        mHandler.removeCallbacks(mScreenLockTimeout);
+        mHandler.post(mScreenLockTimeout);
+    }
+
+private void updateLockScreenTimeout() {synchronized (mScreenLockTimeout) {boolean enable = (mAllowLockscreenWhenOn && mScreenOnEarly && mKeyguardMediator.isSecure());
@@ -3741,6 +3842,34 @@return mHasNavigationBar;}+	public boolean statusbarShow()
+	{
+		synchronized (this) 
+		{
+			mStatusBarReqShow = true;
+			if(mStatusBarShow == false)
+			{
+				return true;
+			}
+
+			return false;
+		}
+	}
+
+	public boolean statusbarHide()
+	{
+		synchronized (this) 
+		{
+			mStatusBarReqShow = false;
+			if(mStatusBarShow == true)
+			{
+				return true;
+			}
+
+			return false;
+		}
+	}
+public void dump(String prefix, FileDescriptor fd, PrintWriter pw, String[] args) {pw.print(prefix); pw.print("mSafeMode="); pw.print(mSafeMode);pw.print(" mSystemReady="); pw.print(mSystemReady);

frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindow.java修改:(svn chages as unified diff)

Index: PhoneWindow.java
===================================================================
--- PhoneWindow.java	(revision 2175)
+++ PhoneWindow.java	(revision 2176)
@@ -20,6 +20,7 @@import static android.view.View.MeasureSpec.getMode;import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
+import static android.view.WindowManager.LayoutParams.FLAG_AW_HIDESTATUS;import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN;import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR;import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
@@ -2559,6 +2560,10 @@setFlags(FLAG_FULLSCREEN, FLAG_FULLSCREEN&(~getForcedWindowFlags()));}+		if (a.getBoolean(com.android.internal.R.styleable.Window_windowHideStatusbar, false)) {
+            setFlags(FLAG_AW_HIDESTATUS, FLAG_AW_HIDESTATUS&(~getForcedWindowFlags()));
+		}
+if (a.getBoolean(com.android.internal.R.styleable.Window_windowShowWallpaper, false)) {setFlags(FLAG_SHOW_WALLPAPER, FLAG_SHOW_WALLPAPER&(~getForcedWindowFlags()));}

frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java

Index: BridgeWindowManager.java
===================================================================
--- BridgeWindowManager.java	(revision 2175)
+++ BridgeWindowManager.java	(revision 2176)
@@ -471,4 +471,28 @@public boolean hasNavigationBar() {return false; // should this return something else?}
+
+	public void resetInputCalibration() 
+	{
+		
+	}
+
+	public void statusbarShow()
+	{
+	
+	}
+	
+    public void statusbarHide()
+    {
+    
+    }
+	
+    public void invokePerformWindow()
+    {
+    
+    }
+    public void lockNow() {
+        // TODO Auto-generated method stub
+
+    }}

frameworks/base/services/input/InputReader.cpp

Index: InputReader.cpp
===================================================================
--- InputReader.cpp	(revision 2175)
+++ InputReader.cpp	(revision 2176)
@@ -50,6 +50,7 @@#include <math.h>#include <cutils/properties.h>+#define INDENT "  "#define INDENT2 "    "#define INDENT3 "      "
@@ -118,6 +119,7 @@{ AKEYCODE_DPAD_UP,     AKEYCODE_DPAD_LEFT,   AKEYCODE_DPAD_DOWN,   AKEYCODE_DPAD_RIGHT },{ AKEYCODE_DPAD_LEFT,   AKEYCODE_DPAD_DOWN,   AKEYCODE_DPAD_RIGHT,  AKEYCODE_DPAD_UP },};
+static bool resetTouch = false;static const size_t keyCodeRotationMapSize =sizeof(keyCodeRotationMap) / sizeof(keyCodeRotationMap[0]);@@ -701,6 +703,10 @@}}+void InputReader::resetTouchCalibration()
+{    
+     resetTouch = true;
+}void InputReader::dump(String8& dump) {AutoMutex _l(mLock);@@ -940,7 +946,6 @@rawEvent->deviceId, rawEvent->type, rawEvent->scanCode, rawEvent->keyCode,rawEvent->value, rawEvent->flags);#endif
-if (mDropUntilNextSync) {if (rawEvent->type == EV_SYN && rawEvent->scanCode == SYN_REPORT) {mDropUntilNextSync = false;
@@ -1041,6 +1046,15 @@}}+void InputDevice::unfadePointer() {
+    size_t numMappers = mMappers.size();
+    for (size_t i = 0; i < numMappers; i++) {
+        InputMapper* mapper = mMappers[i];
+        mapper->unfadePointer();
+    }
+}
+
+void InputDevice::notifyReset(nsecs_t when) {NotifyDeviceResetArgs args(when, mId);mContext->getListener()->notifyDeviceReset(&args);
@@ -1711,6 +1725,10 @@void InputMapper::fadePointer() {}+void InputMapper::unfadePointer() {
+}
+
+status_t InputMapper::getAbsoluteAxisInfo(int32_t axis, RawAbsoluteAxisInfo* axisInfo) {return getEventHub()->getAbsoluteAxisInfo(getDeviceId(), axis, axisInfo);}
@@ -2323,13 +2341,21 @@}}+void CursorInputMapper::unfadePointer() {
+    if (mPointerController != NULL) {
+        mPointerController->unfade(PointerControllerInterface::TRANSITION_GRADUAL);
+    }
+}+
+// --- TouchInputMapper ---TouchInputMapper::TouchInputMapper(InputDevice* device) :InputMapper(device),mSource(0), mDeviceMode(DEVICE_MODE_DISABLED),mSurfaceOrientation(-1), mSurfaceWidth(-1), mSurfaceHeight(-1) {
+	mNeedCorrect = false;}TouchInputMapper::~TouchInputMapper() {
@@ -2463,6 +2489,296 @@}}+//get tp correct params
+int TouchInputMapper:: _get_str2int(char *saddr, int *flag)
+{
+    char            *src;
+    char            off;
+    unsigned int    value = 0;
+
+    src = saddr;
+    off = 0;         //0\u017d?0\u0153疲?\u017d?6\u0153? 2\u017d?0\u0153频腬u017e菏?
+    if((src[0] == '0') && ((src[1] == 'x') || (src[1] == 'X')))
+    {
+        src += 2;
+        off  = 1;
+    }
+    else if((src[0] == '-'))  {
+        src += 1;
+        off = 2;
+    }
+    if((!off) || (off == 2))
+    {
+        while(*src != '\0')
+        {
+            if((*src >= '0') && (*src <= '9'))
+            {
+                value = value * 10 + (*src - '0');
+                src ++;
+            }
+            else
+            {
+                return -1;
+            }
+        }
+        if(off == 2)
+        {
+            value = -value;
+        }
+    }
+    else if(off == 1)
+    {
+        while(*src != '\0')
+        {
+            if((*src >= '0') && (*src <= '9'))
+            {
+                value = value * 16 + (*src - '0');
+                src ++;
+            }
+            else if((*src >= 'A') && (*src <= 'F'))
+            {
+                value = value * 16 + (*src - 'A' + 10);
+                src ++;
+            }
+            else if((*src >= 'a') && (*src <= 'f'))
+            {
+                value = value * 16 + (*src - 'a' + 10);
+                src ++;;
+            }
+            else
+            {
+                return -1;
+            }
+        }
+    }
+
+    return value;
+}
+//\u017d撕袢eyname, itemname, 以\u0152癷temvalue,返回 0表蔦u0178失败,否则表蔦u0178当前\u017d\u0160理的砛u20ac度
+int TouchInputMapper::_get_item(char *saddr, char *name, char *value, unsigned int line_len)
+{
+    char            *src;
+    char            *dstname;
+    char            *dstvalue;
+    unsigned int    len;
+
+    src = saddr;
+    dstname = name;
+    dstvalue = value;
+
+    len = 0;
+    while(*src != '=')
+    {
+        if(*src != ' ')
+        {
+            *dstname++ = *src;
+            len ++;
+        }
+        src ++;
+        line_len --;
+        if(len > 256)
+        {
+            LOGD("key name too long\n");
+            return -1;
+        }
+    }
+    *dstname = '\0';
+    src ++;      //跳过 '='
+    line_len --;
+
+    len = 0;
+    while((*src != 0x0A) && (line_len--))
+    {
+        if(*src != ' ')
+        {
+            *dstvalue++ = *src;
+            len ++;
+        }
+        src ++;
+        if(len > 256)
+        {
+            LOGD("key name too long\n");
+            return -1;
+        }
+    }
+    *dstvalue = '\0';
+
+    return 0;
+}
+//\u017d撕祷氐鼻靶械某\u20ac度,用謀u017e针返回当前的意义
+/********************************************
+* flag = 0      //当前是注释行,或空行
+*      = 1      //当前是字段行
+*      = 2      //当前是子项行,属于字段的下一项
+*      = -1     //当前行不符合规范,出\u017d?*********************************************/
+int  TouchInputMapper::_get_line(char *daddr, int  *flag, unsigned int total_len)
+{
+    char            *src;
+    unsigned int    len = 0;
+
+    src = daddr;
+    if(*src == ';')          //注释行
+    {
+        *flag = 0;
+    }
+    else if((*src == 0x0A))     //回车行
+    {
+        *flag = 0;
+        len = 1;
+
+        return len;
+    }
+    else                     //子字段行
+    {
+        *flag = 1;
+    }
+
+    src ++;
+    len = 1;
+    while(--total_len)
+    {
+        //LOGD("*src = %x\n",*src);
+        if((*src == 0x0A))     
+        {
+            len += 1;
+            break;
+        }
+
+        src ++;
+        
+        len ++;
+        if(len >= 512)
+        {
+            *flag = -1;
+
+            return 0;
+        }
+    }
+
+    return len;
+}
+
+int TouchInputMapper::tp_getpara(int  *tp_para)
+{
+    FILE*           pfd = 0;
+    char            *data = 0;
+    char            *src = 0;
+    unsigned int   len, line_len, check_sum;
+    int             flag, value;
+    char    itemname[128], itemvalue[128];
+
+    pfd = fopen("/data/pointercal", "r+");            //只读
+    if(!pfd)                                                  
+    {
+        //LOGD("para data file not exist\n");
+        
+        goto _err_out;
+    }
+    fseek(pfd, 0, 2);
+    len = ftell(pfd);
+    fseek(pfd, 0, 0);
+
+    data = NULL;
+    if(!len)
+    {
+        LOGD("bad tp cfg\n");
+        goto _err_out;
+    }
+    data = (char *)malloc(len);
+    if(!data)
+    {
+        //LOGD("fail to malloc memory to store data\n");
+        goto _err_out;
+    }
+    fread(data, 1, len, pfd);
+    fclose(pfd);
+    pfd = NULL;
+    src  = data;
+
+    while(len)
+    {
+        line_len = _get_line(src, &flag, len);
+        LOGD("line_len = %d\n",line_len);
+        len -= line_len;
+        switch(flag)
+        {
+            case 0:              //注释行,回车行
+                src += line_len;
+                break;
+            case 1:
+                if(_get_item(src, itemname, itemvalue, line_len))
+                {
+                    LOGD("get item fail\n");
+
+                    goto _err_out;
+                }
+                src += line_len;
+                value = _get_str2int(itemvalue, 0);
+
+                if(!strcmp(itemname, "TP_PARA1"))
+                {
+                    tp_para[0] = value;
+                    //LOGD("value0 = %d\n",value);
+                }
+                else if(!strcmp(itemname, "TP_PARA2"))
+                {
+                    tp_para[1] = value;
+                    //LOGD("value1 = %d\n",value);
+                }
+                else if(!strcmp(itemname, "TP_PARA3"))
+                {
+                    tp_para[2] = value;
+                    //LOGD("value2 = %d\n",value);
+                }
+                else if(!strcmp(itemname, "TP_PARA4"))
+                {
+                    tp_para[3] = value;
+                    //LOGD("value3 = %d\n",value);
+                }
+                else if(!strcmp(itemname, "TP_PARA5"))
+                {
+                    tp_para[4] = value;
+                    //LOGD("value4 = %d\n",value);
+                }
+                else if(!strcmp(itemname, "TP_PARA6"))
+                {
+                    tp_para[5] = value;
+                    //LOGD("value5 = %d\n",value);
+                }
+                else if(!strcmp(itemname, "TP_PARA7"))
+                {
+                    tp_para[6] = value;
+                    //LOGD("value6 = %d\n",value);
+                }
+                break;
+            default:
+                goto _err_out;
+        }
+    }
+    free(data);
+
+    return 1;
+_err_out:
+    tp_para[0] = -28238;
+    tp_para[1] = 125;
+    tp_para[2] = 54543608;
+    tp_para[3] = 89;
+    tp_para[4] = -19020;
+    tp_para[5] = 34218656;
+    tp_para[6] = 65536;
+
+    if(data)
+    {
+        free(data);
+    }
+    if(pfd)
+    {
+        fclose(pfd);
+    }
+
+    return 0;
+}
+void TouchInputMapper::configure(nsecs_t when,const InputReaderConfiguration* config, uint32_t changes) {InputMapper::configure(when, config, changes);
@@ -2512,65 +2828,76 @@// Use the pointer presentation mode for devices that do not support distinct// multitouch.  The spot-based presentation relies on being able to accurately// locate two or more fingers on the touch pad.
-    mParameters.gestureMode = getEventHub()->hasInputProperty(getDeviceId(), INPUT_PROP_SEMI_MT)
+	if(getDeviceId() != 0x0fff0ffe)
+	{
+		mParameters.gestureMode = getEventHub()->hasInputProperty(getDeviceId(), INPUT_PROP_SEMI_MT)? Parameters::GESTURE_MODE_POINTER : Parameters::GESTURE_MODE_SPOTS;-    String8 gestureModeString;
-    if (getDevice()->getConfiguration().tryGetProperty(String8("touch.gestureMode"),
-            gestureModeString)) {
-        if (gestureModeString == "pointer") {
-            mParameters.gestureMode = Parameters::GESTURE_MODE_POINTER;
-        } else if (gestureModeString == "spots") {
-            mParameters.gestureMode = Parameters::GESTURE_MODE_SPOTS;
-        } else if (gestureModeString != "default") {
-            LOGW("Invalid value for touch.gestureMode: '%s'", gestureModeString.string());
-        }
-    }
+	    String8 gestureModeString;
+	    if (getDevice()->getConfiguration().tryGetProperty(String8("touch.gestureMode"),
+	            gestureModeString)) {
+	        if (gestureModeString == "pointer") {
+	            mParameters.gestureMode = Parameters::GESTURE_MODE_POINTER;
+	        } else if (gestureModeString == "spots") {
+	            mParameters.gestureMode = Parameters::GESTURE_MODE_SPOTS;
+	        } else if (gestureModeString != "default") {
+	            LOGV("Invalid value for touch.gestureMode: '%s'", gestureModeString.string());
+	        }
+	    }-    if (getEventHub()->hasInputProperty(getDeviceId(), INPUT_PROP_DIRECT)) {
-        // The device is a touch screen.
-        mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_SCREEN;
-    } else if (getEventHub()->hasInputProperty(getDeviceId(), INPUT_PROP_POINTER)) {
-        // The device is a pointing device like a track pad.
-        mParameters.deviceType = Parameters::DEVICE_TYPE_POINTER;
-    } else if (getEventHub()->hasRelativeAxis(getDeviceId(), REL_X)
-            || getEventHub()->hasRelativeAxis(getDeviceId(), REL_Y)) {
-        // The device is a cursor device with a touch pad attached.
-        // By default don't use the touch pad to move the pointer.
-        mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_PAD;
-    } else {
-        // The device is a touch pad of unknown purpose.
-        mParameters.deviceType = Parameters::DEVICE_TYPE_POINTER;
-    }
+	    if (getEventHub()->hasInputProperty(getDeviceId(), INPUT_PROP_DIRECT)) {
+	        // The device is a touch screen.
+	        mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_SCREEN;
+	    } else if (getEventHub()->hasInputProperty(getDeviceId(), INPUT_PROP_POINTER)) {
+	        // The device is a pointing device like a track pad.
+	        mParameters.deviceType = Parameters::DEVICE_TYPE_POINTER;
+	    } else if (getEventHub()->hasRelativeAxis(getDeviceId(), REL_X)
+	            || getEventHub()->hasRelativeAxis(getDeviceId(), REL_Y)) {
+	        // The device is a cursor device with a touch pad attached.
+	        // By default don't use the touch pad to move the pointer.
+	        mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_PAD;
+	    } else {
+	        // The device is a touch pad of unknown purpose.
+	        mParameters.deviceType = Parameters::DEVICE_TYPE_POINTER;
+	    }-    String8 deviceTypeString;
-    if (getDevice()->getConfiguration().tryGetProperty(String8("touch.deviceType"),
-            deviceTypeString)) {
-        if (deviceTypeString == "touchScreen") {
-            mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_SCREEN;
-        } else if (deviceTypeString == "touchPad") {
-            mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_PAD;
-        } else if (deviceTypeString == "pointer") {
-            mParameters.deviceType = Parameters::DEVICE_TYPE_POINTER;
-        } else if (deviceTypeString != "default") {
-            LOGW("Invalid value for touch.deviceType: '%s'", deviceTypeString.string());
-        }
-    }
+	    String8 deviceTypeString;
+	    if (getDevice()->getConfiguration().tryGetProperty(String8("touch.deviceType"),
+	            deviceTypeString)) {
+	        if (deviceTypeString == "touchScreen") {
+	            mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_SCREEN;
+	        } else if (deviceTypeString == "touchPad") {
+	            mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_PAD;
+	        } else if (deviceTypeString == "pointer") {
+	            mParameters.deviceType = Parameters::DEVICE_TYPE_POINTER;
+	        } else if (deviceTypeString != "default") {
+	            LOGV("touch.deviceType: '%s'", deviceTypeString.string());
+	        }
+	    }-    mParameters.orientationAware = mParameters.deviceType == Parameters::DEVICE_TYPE_TOUCH_SCREEN;
-    getDevice()->getConfiguration().tryGetProperty(String8("touch.orientationAware"),
-            mParameters.orientationAware);
+	    mParameters.orientationAware = mParameters.deviceType == Parameters::DEVICE_TYPE_TOUCH_SCREEN;
+	    getDevice()->getConfiguration().tryGetProperty(String8("touch.orientationAware"),
+	            mParameters.orientationAware);-    mParameters.associatedDisplayId = -1;
-    mParameters.associatedDisplayIsExternal = false;
-    if (mParameters.orientationAware
-            || mParameters.deviceType == Parameters::DEVICE_TYPE_TOUCH_SCREEN
-            || mParameters.deviceType == Parameters::DEVICE_TYPE_POINTER) {
-        mParameters.associatedDisplayIsExternal =
-                mParameters.deviceType == Parameters::DEVICE_TYPE_TOUCH_SCREEN
-                        && getDevice()->isExternal();
-        mParameters.associatedDisplayId = 0;
-    }
+	    mParameters.associatedDisplayId = -1;
+	    mParameters.associatedDisplayIsExternal = false;
+	    if (mParameters.orientationAware
+	            || mParameters.deviceType == Parameters::DEVICE_TYPE_TOUCH_SCREEN
+	            || mParameters.deviceType == Parameters::DEVICE_TYPE_POINTER) {
+	        mParameters.associatedDisplayIsExternal =
+	                mParameters.deviceType == Parameters::DEVICE_TYPE_TOUCH_SCREEN
+	                        && getDevice()->isExternal();
+	        mParameters.associatedDisplayId = 0;
+	    }
+	}
+	else
+	{
+		mParameters.gestureMode = Parameters::GESTURE_MODE_SPOTS;
+		mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_SCREEN;
+		mParameters.orientationAware = true;
+		mParameters.associatedDisplayId = 0;
+	}	
+	}void TouchInputMapper::dumpParameters(String8& dump) {
@@ -2646,11 +2973,16 @@}// Ensure we have valid X and Y axes.
-    if (!mRawPointerAxes.x.valid || !mRawPointerAxes.y.valid) {
-        LOGW(INDENT "Touch device '%s' did not report support for X or Y axis!  "
-                "The device will be inoperable.", getDeviceName().string());
-        mDeviceMode = DEVICE_MODE_DISABLED;
-        return;
+    if (!mRawPointerAxes.x.valid || !mRawPointerAxes.y.valid)
+    {
+        //LOGW(INDENT "Touch device '%s' did not report support for X or Y axis!  "
+         //       "The device will be inoperable.", getDeviceName().string());
+        //mDeviceMode = DEVICE_MODE_DISABLED;
+        //return;
+        mRawPointerAxes.x.maxValue = 4095;
+		mRawPointerAxes.x.minValue = 0;
+		mRawPointerAxes.y.maxValue = 4095;
+		mRawPointerAxes.y.minValue = 0;}// Get associated display dimensions.
@@ -3878,34 +4210,62 @@default:distance = 0;}
-
+		//correct the one touch data here	
+		float adjust_x,adjust_y;
+		adjust_x = float(in.x - mRawPointerAxes.x.minValue) * mXScale;
+        adjust_y = float(in.y - mRawPointerAxes.y.minValue) * mYScale;		
+		if(mNeedCorrect == false)
+		{
+			int ret = tp_getpara(tp_para);
+			if(ret == 1)
+			{
+				adjust_x= ( tp_para[2] + tp_para[0]*adjust_x + tp_para[1]*adjust_x ) / tp_para[6];			
+			    adjust_y = ( tp_para[5] + tp_para[3]*adjust_y + tp_para[4]*adjust_y ) / tp_para[6];	
+				mNeedCorrect = true;
+			}
+			
+		}
+		else
+		{
+			if(resetTouch == true)
+			{
+				int ret = tp_getpara(tp_para);
+				if(ret == 1)
+				{
+					mNeedCorrect = true;
+					resetTouch = false;
+				}				
+			}
+			adjust_x = ( tp_para[2] + tp_para[0]*adjust_x + tp_para[1]*adjust_x ) / tp_para[6];			
+			adjust_y = ( tp_para[5] + tp_para[3]*adjust_y + tp_para[4]*adjust_y ) / tp_para[6];	
+		}// X and Y// Adjust coords for surface orientation.float x, y;switch (mSurfaceOrientation) {case DISPLAY_ORIENTATION_90:
-            x = float(in.y - mRawPointerAxes.y.minValue) * mYScale;
-            y = float(mRawPointerAxes.x.maxValue - in.x) * mXScale;
+            x = adjust_y;
+            y = mSurfaceWidth-adjust_x;orientation -= M_PI_2;if (orientation < - M_PI_2) {orientation += M_PI;}break;case DISPLAY_ORIENTATION_180:
-            x = float(mRawPointerAxes.x.maxValue - in.x) * mXScale;
-            y = float(mRawPointerAxes.y.maxValue - in.y) * mYScale;
+            x = mSurfaceWidth - adjust_x;
+            y = mSurfaceHeight - adjust_y;break;case DISPLAY_ORIENTATION_270:
-            x = float(mRawPointerAxes.y.maxValue - in.y) * mYScale;
-            y = float(in.x - mRawPointerAxes.x.minValue) * mXScale;
+            x = mSurfaceHeight - adjust_y;
+            y = adjust_x;orientation += M_PI_2;if (orientation > M_PI_2) {orientation -= M_PI;}break;default:
-            x = float(in.x - mRawPointerAxes.x.minValue) * mXScale;
-            y = float(in.y - mRawPointerAxes.y.minValue) * mYScale;
+            x = adjust_x;
+            y = adjust_y;break;}@@ -5609,6 +5969,11 @@if (!inSlot->isInUse()) {continue;}
+        
+        if((inSlot->getX() == 0) && (inSlot->getY() == 0))
+        {
+        	continue;
+        }if (outCount >= MAX_POINTERS) {#if DEBUG_POINTERS
@@ -5643,7 +6008,8 @@bool isHovering = mTouchButtonAccumulator.getToolType() != AMOTION_EVENT_TOOL_TYPE_MOUSE&& (mTouchButtonAccumulator.isHovering()|| (mRawPointerAxes.pressure.valid && inSlot->getPressure() <= 0));
-        outPointer.isHovering = isHovering;
+        //outPointer.isHovering = isHovering;
+        outPointer.isHovering = false;// Assign pointer id using tracking id if available.if (*outHavePointerIds) {
@@ -5669,7 +6035,8 @@} else {outPointer.id = id;mCurrentRawPointerData.idToIndex[id] = outCount;
-                mCurrentRawPointerData.markIdBit(id, isHovering);
+                //mCurrentRawPointerData.markIdBit(id, isHovering);
+                mCurrentRawPointerData.markIdBit(id, outPointer.isHovering);newPointerIdBits.markBit(id);}}

frameworks/base/services/input/PointerController.cpp

Index: PointerController.cpp
===================================================================
--- PointerController.cpp	(revision 2175)
+++ PointerController.cpp	(revision 2176)
@@ -30,6 +30,7 @@#include <SkColor.h>#include <SkPaint.h>#include <SkXfermode.h>
+#include <cutils/properties.h>namespace android {@@ -121,6 +122,19 @@*outMaxY = mLocked.displayHeight - 1;break;}
+    char property[PROPERTY_VALUE_MAX];
+    if (property_get("ro.sf.hwrotation", property, NULL) > 0) {
+		float temp ;
+        //displayOrientation
+        switch (atoi(property)) {
+        case 270:
+			temp =*outMaxX ;
+			*outMaxX =*outMaxY;
+			*outMaxY =temp;
+            break;
+        }
+    }
+return true;}

frameworks/base/services/input/InputReader.h

Index: InputReader.h
===================================================================
--- InputReader.h	(revision 2175)
+++ InputReader.h	(revision 2176)
@@ -267,6 +267,7 @@* The changes flag is a bitfield that indicates what has changed and whether* the input devices must all be reopened. */virtual void requestRefreshConfiguration(uint32_t changes) = 0;
+    virtual void resetTouchCalibration() = 0;};@@ -335,6 +336,7 @@virtual void requestRefreshConfiguration(uint32_t changes);+	virtual void resetTouchCalibration();protected:// These members are protected so they can be instrumented by test cases.virtual InputDevice* createDeviceLocked(int32_t deviceId,
@@ -372,6 +374,7 @@// The event queue.static const int EVENT_BUFFER_SIZE = 256;RawEvent mEventBuffer[EVENT_BUFFER_SIZE];
+	RawEvent mConvertEventBuffer[EVENT_BUFFER_SIZE];KeyedVector<int32_t, InputDevice*> mDevices;@@ -386,6 +389,19 @@void handleConfigurationChangedLocked(nsecs_t when);int32_t mGlobalMetaState;
+	bool        mKeyInMouseMode;    
+	bool        mKeySynced;		
+	bool		mVirtualTouchCreated;    
+	bool        mVirtualMouseCreated;    
+	int32_t     mDistance;    
+	int         mKeyDeviceId;    
+	int         mMouseDeviceId;  
+	static const int MAX_MOUSE_SIZE = 10;
+	int         mRealMouseDeviceId[MAX_MOUSE_SIZE];	
+	int 		mTouchDeviceId;		
+	int 		mRealTouchDeviceId;    
+	int         mLeft,mRight,mTop,mBottom;    
+	int         mLeftBtn,mRightBtn,mMidBtn;void updateGlobalMetaStateLocked();int32_t getGlobalMetaStateLocked();@@ -461,6 +477,7 @@int32_t getMetaState();void fadePointer();
+	void unfadePointer();void notifyReset(nsecs_t when);@@ -840,6 +857,7 @@virtual int32_t getMetaState();virtual void fadePointer();
+	virtual void unfadePointer();protected:InputDevice* mDevice;
@@ -944,10 +962,10 @@virtual void configure(nsecs_t when, const InputReaderConfiguration* config, uint32_t changes);virtual void reset(nsecs_t when);virtual void process(const RawEvent* rawEvent);
-virtual int32_t getScanCodeState(uint32_t sourceMask, int32_t scanCode);virtual void fadePointer();
+	virtual void unfadePointer();private:// Amount that trackball needs to move in order to generate a key event.
@@ -1006,6 +1024,11 @@virtual uint32_t getSources();virtual void populateDeviceInfo(InputDeviceInfo* deviceInfo);virtual void dump(String8& dump);
+    //get tp correct params
+    int _get_str2int(char *saddr, int *flag);    
+	int _get_item(char *saddr, char *name, char *value, unsigned int line_len);    
+	int _get_line(char *daddr, int  *flag, unsigned int total_len);
+	virtual int tp_getpara(int  *tp_para);virtual void configure(nsecs_t when, const InputReaderConfiguration* config, uint32_t changes);virtual void reset(nsecs_t when);virtual void process(const RawEvent* rawEvent);
@@ -1018,6 +1041,7 @@virtual void fadePointer();virtual void timeoutExpired(nsecs_t when);+    int tp_para[7];protected:CursorButtonAccumulator mCursorButtonAccumulator;CursorScrollAccumulator mCursorScrollAccumulator;
@@ -1188,6 +1212,7 @@virtual void syncTouch(nsecs_t when, bool* outHavePointerIds) = 0;+    bool mNeedCorrect;private:// The surface orientation and width and height set by configureSurface().int32_t mSurfaceOrientation;

frameworks/base/services/jni/com_android_server_InputManager.cpp

Index: com_android_server_InputManager.cpp
===================================================================
--- com_android_server_InputManager.cpp	(revision 2175)
+++ com_android_server_InputManager.cpp	(revision 2176)
@@ -201,6 +201,7 @@virtual nsecs_t notifyANR(const sp<InputApplicationHandle>& inputApplicationHandle,const sp<InputWindowHandle>& inputWindowHandle);virtual void notifyInputChannelBroken(const sp<InputWindowHandle>& inputWindowHandle);
+	virtual void resetTouchCalibration();virtual bool filterInputEvent(const InputEvent* inputEvent, uint32_t policyFlags);virtual void getDispatcherConfiguration(InputDispatcherConfiguration* outConfig);virtual bool isKeyRepeatEnabled();
@@ -750,6 +751,10 @@return pass;}+void NativeInputManager::resetTouchCalibration() 
+{
+    mInputManager->getReader()->resetTouchCalibration();
+}void NativeInputManager::interceptKeyBeforeQueueing(const KeyEvent* keyEvent,uint32_t& policyFlags) {// Policy:
@@ -1307,6 +1312,14 @@transferTouchFocus(fromChannel, toChannel);}+static void android_server_InputManager_nativeResetTouchCalibration(JNIEnv* env, jclass clazz) 
+{
+    if (checkInputManagerUnitialized(env)) {
+        return;
+    }
+
+    gNativeInputManager->resetTouchCalibration();
+}static void android_server_InputManager_nativeSetPointerSpeed(JNIEnv* env,jclass clazz, jint speed) {if (checkInputManagerUnitialized(env)) {
@@ -1398,6 +1411,8 @@(void*) android_server_InputManager_nativeDump },{ "nativeMonitor", "()V",(void*) android_server_InputManager_nativeMonitor },
+	{ "nativeResetTouchCalibration", "()V",
+		 (void*) android_server_InputManager_nativeResetTouchCalibration },};#define FIND_CLASS(var, className) \

frameworks/base/services/java/com/android/server/wm/WindowState.java

Index: WindowState.java
===================================================================
--- WindowState.java	(revision 2175)
+++ WindowState.java	(revision 2176)
@@ -238,6 +238,12 @@// we can give the window focus before waiting for the relayout.boolean mRelayoutCalled;+    // If the application has called relayout() with changes that can
+    // impact its window's size, we need to perform a layout pass on it
+    // even if it is not currently visible for layout.  This is set
+    // when in that case until the layout is done.
+    boolean mLayoutNeeded;
+// This is set after the Surface has been created but before the// window has been drawn.  During this time the surface is hidden.boolean mDrawPending;
@@ -1444,6 +1450,16 @@|| mAnimating);}+    public boolean isGoneForLayoutLw() {
+        final AppWindowToken atoken = mAppToken;
+        return mViewVisibility == View.GONE
+                || !mRelayoutCalled
+                || (atoken == null && mRootToken.hidden)
+                || (atoken != null && (atoken.hiddenRequested || atoken.hidden))
+                || mAttachedHidden
+                || mExiting || mDestroying;
+    }
+/*** Returns true if the window has a surface that it has drawn a* complete UI in to.
@@ -1718,8 +1734,9 @@pw.print(mPolicyVisibilityAfterAnim);pw.print(" mAttachedHidden="); pw.println(mAttachedHidden);}
-        if (!mRelayoutCalled) {
-            pw.print(prefix); pw.print("mRelayoutCalled="); pw.println(mRelayoutCalled);
+        if (!mRelayoutCalled || mLayoutNeeded) {
+            pw.print(prefix); pw.print("mRelayoutCalled="); pw.print(mRelayoutCalled);
+                    pw.print(" mLayoutNeeded="); pw.println(mLayoutNeeded);}if (mSurfaceResized || mSurfaceDestroyDeferred) {pw.print(prefix); pw.print("mSurfaceResized="); pw.print(mSurfaceResized);

frameworks/base/services/java/com/android/server/wm/WindowManagerService.java

Index: WindowManagerService.java
===================================================================
--- WindowManagerService.java	(revision 2175)
+++ WindowManagerService.java	(revision 2176)
@@ -2538,8 +2538,12 @@if (win == null) {return 0;}
-            win.mRequestedWidth = requestedWidth;
-            win.mRequestedHeight = requestedHeight;
+            if (win.mRequestedWidth != requestedWidth
+                    || win.mRequestedHeight != requestedHeight) {
+                win.mLayoutNeeded = true;
+                win.mRequestedWidth = requestedWidth;
+                win.mRequestedHeight = requestedHeight;
+            }if (attrs != null && seq == win.mSeq) {win.mSystemUiVisibility = systemUiVisibility;}
@@ -2560,6 +2564,9 @@}flagChanges = win.mAttrs.flags ^= attrs.flags;attrChanges = win.mAttrs.copyFrom(attrs);
+                if ((attrChanges&WindowManager.LayoutParams.LAYOUT_CHANGED) != 0) {
+                    win.mLayoutNeeded = true;
+                }}if (DEBUG_LAYOUT) Slog.v(TAG, "Relayout " + win + ": " + win.mAttrs);
@@ -3495,6 +3502,8 @@if (req == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {req = getOrientationFromAppTokensLocked();}
+
+		req = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;return req;}@@ -5133,6 +5142,11 @@// The screenshot API does not apply the current screen rotation.rot = mDisplay.getRotation();
+			if(SystemProperties.getInt("ro.sf.hwrotation",0)==270)
+			{			
+				 rot =( rot+3)%4;
+			}
+int fw = frame.width();int fh = frame.height();@@ -7391,8 +7405,11 @@final int N = mWindows.size();int i;-        if (DEBUG_LAYOUT) Slog.v(TAG, "performLayout: needed="
-                + mLayoutNeeded + " dw=" + dw + " dh=" + dh);
+        if (DEBUG_LAYOUT) {
+            Slog.v(TAG, "-------------------------------------");
+            Slog.v(TAG, "performLayout: needed="
+                    + mLayoutNeeded + " dw=" + dw + " dh=" + dh);
+        }mPolicy.beginLayoutLw(dw, dh, mRotation);@@ -7434,16 +7451,17 @@// if they want.  (We do the normal layout for INVISIBLE// windows, since that means "perform layout as normal,// just don't display").
-            if (!gone || !win.mHaveFrame) {
+            if (!gone || !win.mHaveFrame || win.mLayoutNeeded) {if (!win.mLayoutAttached) {if (initial) {//Slog.i(TAG, "Window " + this + " clearing mContentChanged - initial");win.mContentChanged = false;}
+                    win.mLayoutNeeded = false;win.prelayout();mPolicy.layoutWindowLw(win, win.mAttrs, null);win.mLayoutSeq = seq;
-                    if (DEBUG_LAYOUT) Slog.v(TAG, "-> mFrame="
+                    if (DEBUG_LAYOUT) Slog.v(TAG, "  LAYOUT: mFrame="+ win.mFrame + " mContainingFrame="+ win.mContainingFrame + " mDisplayFrame="+ win.mDisplayFrame);
@@ -7471,15 +7489,16 @@// windows, since that means "perform layout as normal,// just don't display").if ((win.mViewVisibility != View.GONE && win.mRelayoutCalled)
-                        || !win.mHaveFrame) {
+                        || !win.mHaveFrame || win.mLayoutNeeded) {if (initial) {//Slog.i(TAG, "Window " + this + " clearing mContentChanged - initial");win.mContentChanged = false;}
+                    win.mLayoutNeeded = false;win.prelayout();mPolicy.layoutWindowLw(win, win.mAttrs, win.mAttachedWindow);win.mLayoutSeq = seq;
-                    if (DEBUG_LAYOUT) Slog.v(TAG, "-> mFrame="
+                    if (DEBUG_LAYOUT) Slog.v(TAG, "  LAYOUT: mFrame="+ win.mFrame + " mContainingFrame="+ win.mContainingFrame + " mDisplayFrame="+ win.mDisplayFrame);
@@ -8580,7 +8599,11 @@if (mDimAnimator == null) {mDimAnimator = new DimAnimator(mFxSession);}
-                                mDimAnimator.show(innerDw, innerDh);
+                                if (attrs.type == WindowManager.LayoutParams.TYPE_BOOT_PROGRESS) {
+                                    mDimAnimator.show(dw, dh);
+                                } else {
+                                    mDimAnimator.show(innerDw, innerDh);
+                                }mDimAnimator.updateParameters(mContext.getResources(),w, currentTime);}
@@ -9411,6 +9434,49 @@return mPolicy.hasNavigationBar();}+	public void resetInputCalibration() 
+	{
+		mInputManager.resetTouchCalibration();
+	}
+	public void statusbarShow()
+	{
+		if(mPolicy.statusbarShow())
+		{
+			final long origId = Binder.clearCallingIdentity();
+			synchronized (mWindowMap) {
+	            performLayoutAndPlaceSurfacesLocked();
+	        }
+			Binder.restoreCallingIdentity(origId);
+		}
+	}
+	
+    public void statusbarHide()
+    {
+    	if(mPolicy.statusbarHide())
+    	{
+    		final long origId = Binder.clearCallingIdentity();
+			synchronized (mWindowMap) {
+	            performLayoutAndPlaceSurfacesLocked();
+	        }
+			Binder.restoreCallingIdentity(origId);
+    	}		
+    }
+
+	public void invokePerformWindow()
+	{
+		final long origId = Binder.clearCallingIdentity();
+		synchronized (mWindowMap) {
+            performLayoutAndPlaceSurfacesLocked();
+        }
+		Binder.restoreCallingIdentity(origId);
+	}
+	
+
+    public void lockNow() {
+        mPolicy.lockNow();
+    }
+
+void dumpInput(FileDescriptor fd, PrintWriter pw, boolean dumpAll) {pw.println("WINDOW MANAGER INPUT (dumpsys window input)");mInputManager.dump(pw);

frameworks/base/services/java/com/android/server/wm/InputManager.java

Index: InputManager.java
===================================================================
--- InputManager.java	(revision 2175)
+++ InputManager.java	(revision 2176)
@@ -95,6 +95,8 @@InputChannel toChannel);private static native void nativeSetPointerSpeed(int speed);private static native void nativeSetShowTouches(boolean enabled);
+	//reset tp correct params
+	private static native void nativeResetTouchCalibration();private static native String nativeDump();private static native void nativeMonitor();@@ -175,6 +177,11 @@if (DEBUG) {Slog.d(TAG, "Setting display #" + displayId + " orientation to " + rotation);}
+		if(SystemProperties.getInt("ro.sf.hwrotation",0)==270)
+		{			
+			rotation =(rotation+3)%4;
+		}
+nativeSetDisplayOrientation(displayId, rotation);}@@ -249,6 +256,13 @@return nativeHasKeys(deviceId, sourceMask, keyCodes, keyExists);}+	/**
+	 *reset the tp correct params
+	 */
+	public void resetTouchCalibration()
+	{
+		nativeResetTouchCalibration();
+	}/*** Creates an input channel that will receive all input from the input dispatcher.* @param inputChannelName The input channel name.

frameworks/base/core/java/android/view/WindowManager.java

Index: WindowManager.java
===================================================================
--- WindowManager.java	(revision 2175)
+++ WindowManager.java	(revision 2176)
@@ -699,6 +699,8 @@* {@hide} */public static final int FLAG_SYSTEM_ERROR = 0x40000000;+		public static final int FLAG_AW_HIDESTATUS = 0x80000000;
+/*** Various behavioral options/flags.  Default is none.* 
@@ -777,7 +779,9 @@@ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,name = "FLAG_SPLIT_TOUCH"),@ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
-                    name = "FLAG_HARDWARE_ACCELERATED")
+                    name = "FLAG_HARDWARE_ACCELERATED"),
+            @ViewDebug.FlagToString(mask = FLAG_AW_HIDESTATUS, equals = FLAG_AW_HIDESTATUS,
+                    name = "FLAG_AW_HIDESTATUS")})public int flags;

frameworks/base/core/java/android/view/WindowManagerPolicy.java

Index: WindowManagerPolicy.java
===================================================================
--- WindowManagerPolicy.java	(revision 2175)
+++ WindowManagerPolicy.java	(revision 2176)
@@ -298,6 +298,11 @@boolean isDisplayedLw();/**
+         * Is this window considered to be gone for purposes of layout?
+         */
+        boolean isGoneForLayoutLw();
+
+        /*** Returns true if this window has been shown on screen at some time in * the past.  Must be called with the window manager lock held.* 
@@ -946,6 +951,10 @@*/public void systemReady();+	public boolean statusbarShow();
+
+	public boolean statusbarHide();
+/*** Called when the system is done booting to the point where the* user can start interacting with it.
@@ -1023,6 +1032,11 @@public boolean hasNavigationBar();/**
+     * Lock the device now.
+     */
+    public void lockNow();
+
+    /*** Print the WindowManagerPolicy's state into the given stream.** @param prefix Text to print at the front of each line.

frameworks/base/core/java/android/view/IWindowManager.aidl

Index: IWindowManager.aidl
===================================================================
--- IWindowManager.aidl	(revision 2175)
+++ IWindowManager.aidl	(revision 2176)
@@ -229,4 +229,14 @@* Device has a software navigation bar (separate from the status bar).*/boolean hasNavigationBar();
+
+    /**
+     * Lock the device immediately.
+     */
+    void lockNow();
+    
+    void resetInputCalibration();
+    void statusbarShow();
+    void statusbarHide();
+    void invokePerformWindow();}

frameworks/base/core/res/res/values/attrs.xml

Index: attrs.xml
===================================================================
--- attrs.xml	(revision 2175)
+++ attrs.xml	(revision 2176)
@@ -307,6 +307,8 @@<attr name="windowNoTitle" format="boolean" /><!-- Flag indicating whether this window should fill the entire screen. --><attr name="windowFullscreen" format="boolean" />
+		<!-- Flag indicating whether this window should hide the statusbar for tablet. -->
+        <attr name="windowHideStatusbar" format="boolean" /><!-- Flag indicating whether this is a floating window. --><attr name="windowIsFloating" format="boolean" /><!-- Flag indicating whether this is a translucent window. -->
@@ -1515,6 +1517,7 @@<attr name="windowFrame" /><attr name="windowNoTitle" /><attr name="windowFullscreen" />
+        <attr name="windowHideStatusbar" /><attr name="windowIsFloating" /><attr name="windowIsTranslucent" /><attr name="windowShowWallpaper" />
@@ -5285,6 +5288,10 @@<!-- Used to shift center of pattern horizontally. --><attr name="horizontalOffset" format="dimension" />
+		<!-- The max application icon number -->
+		<attr name="maxAppIconNum" format="integer" />
+		<!-- The  icon size -->
+		<attr name="iconSize" format="integer" /></declare-styleable><!-- =============================== -->

frameworks/base/core/res/res/values/public.xml

Index: public.xml
===================================================================
--- public.xml	(revision 2175)
+++ public.xml	(revision 2176)
@@ -572,6 +572,7 @@<public type="attr" name="listChoiceIndicatorMultiple" id="0x0101021a" /><public type="attr" name="versionCode" id="0x0101021b" /><public type="attr" name="versionName" id="0x0101021c" />
+  <public type="attr" name="windowHideStatusbar" id="0x0101040e" /><public type="id" name="background" id="0x01020000" /><public type="id" name="checkbox" id="0x01020001" />



http://www.ppmy.cn/news/430958.html

相关文章

触摸屏幕校准的原理(一)

用过Windows Mobile手机&#xff08;例如HTC Diamond&#xff09;的用户都会做过手机触摸屏幕的校正&#xff0c;具体为什么要做&#xff0c;理所当然的认为是因为手机识别的触点位置与实际触点位置的偏差需要修正。本文搜集了一些资料用来说明原由。 [Baidu百科] 从技术原理来…

项目需求 | 真实LED屏幕箱体物理空间校准(项目经费5W)

点击进入—>3D视觉工坊学习交流群 项目需求&#xff1a;真实LED屏幕箱体物理空间校准 需求内容&#xff1a;通过图像识别方式&#xff0c;通过在屏幕上变换不同的标定图案或结构光扫描来反求摄像机的参数和两者的相对参数 精度要求&#xff1a;亚像素级 工作环境&#xff1a…

Ubuntu 屏幕颜色校准

大家都知道在windows里面可以通过显卡驱动对屏幕显示颜色进行调整&#xff0c;并且可以用系统自带的颜色校准工具进行伽马值调节。 那么问题来了&#xff0c;在Ubuntu中要怎么调节呢。 经过在网上曲折的搜索&#xff0c;暂时找到了两种调节方案 一&#xff1a;使用Ubuntu系统…

定制WinCE系统的屏幕校准界面

在实际应用中&#xff0c;经常需要定制WinCE系统的屏幕校准界面。最常见的需求就是根据系统的语言设置校准界面。要实现这个功能&#xff0c;大概有两种方法&#xff0c;一是自己实现校准程序&#xff0c;完全取代WinCE系统的校准界面&#xff0c;第二种是修改WinCE系统自带的校…

科学计算机怎么调颜色,Win7旗舰版如何进行屏幕颜色校准

屏幕上看到的颜色将会取决于计算机显屏幕、显卡设置以及外部照明等因素&#xff0c;大多数用户都使用相同的默认Win7旗舰版 颜色配置文件。而现在Win7旗舰版提供了一个显示颜色校准向导&#xff0c;可以帮助您正确设置您的亮度、对比度和色彩设置。 通过此工具你可以调整伽马、…

wm屏幕校准

wince的cordll提供了屏幕校准的函数&#xff0c;使用方法与钩子函数类似&#xff0c;强制加载dll&#xff0c;获取地址&#xff0c;然后用函数指针调用。 typedef BOOL (WINAPI *_TouchCalibrate)(); HINSTANCE hinstance LoadLibrary(_T("coredll.dll")); if (hins…

wince下屏幕校准和修改介绍

以6410开发板为例。 一、确定X&#xff0c;Y是否镜像&#xff1a;在屏幕上任意拖动出一个矩形虚线框&#xff0c;然后随意上下左右拖动&#xff0c;这时看虚框是否根随触摸笔移动&#xff0c;如果虚线框能跟随触摸笔动&#xff0c;说明X&#xff0c;X-&#xff0c;Y&#xff0c…

Android屏幕校准的apk应用实现

紧跟着上一篇博文&#xff0c;在android内核中实现屏幕校准&#xff0c;这一篇博文主要做的便是将可执行文件ts_calibrate移植成android的apk应用。现在我们已经知道&#xff0c;ts_calibrate就是取了触摸屏 5个点的坐标&#xff0c;然后与对应的显示屏的点坐标联立方程&#x…