Fix issue #2561067: Screen Display half faded...

Also a little tweak to the activity manager to behave better when
an application crash, to hopefully mostly avoid situations where
you get into a crash loop.

Change-Id: I627cc1da3a0f16a180957f02bfbe5c81ecd31758
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index 0e4b38d..a1a8bf2 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -11269,6 +11269,8 @@
         float mDimTargetAlpha;
         float mDimDeltaPerMs;
         long mLastDimAnimTime;
+        
+        int mLastDimWidth, mLastDimHeight;
 
         DimAnimator (SurfaceSession session) {
             if (mDimSurface == null) {
@@ -11294,12 +11296,18 @@
                         dw + "x" + dh + ")");
                 mDimShown = true;
                 try {
+                    mLastDimWidth = dw;
+                    mLastDimHeight = dh;
                     mDimSurface.setPosition(0, 0);
                     mDimSurface.setSize(dw, dh);
                     mDimSurface.show();
                 } catch (RuntimeException e) {
                     Slog.w(TAG, "Failure showing dim surface", e);
                 }
+            } else if (mLastDimWidth != dw || mLastDimHeight != dh) {
+                mLastDimWidth = dw;
+                mLastDimHeight = dh;
+                mDimSurface.setSize(dw, dh);
             }
         }