OSDN Git Service

AI 143899: am: CL 143896 Fix issue #1748954 and #1737952:
authorDianne Hackborn <>
Wed, 1 Apr 2009 01:00:37 +0000 (18:00 -0700)
committerThe Android Open Source Project <initial-contribution@android.com>
Wed, 1 Apr 2009 01:00:37 +0000 (18:00 -0700)
  #1748954 (New status bar fades into all white background): FrameLayout wasn't updating its foreground drawable when its padding changed, which would happen as the status bar is shown and hidden.  To fix this I also ended up fixing a problem in the view debug stuff where we couldn't get a bitmap for a view that is the full screen size because it is too big...  actually I just went ahead and added another function to snapshot the view hierarchy which works a lot better for us anyway.
  #1737952 (Home screen icons overlap with the notification bar after exiting any camera app): Originally I punted this because it only happened in rare situations, but now that home is always portrait it happens a lot more so it is more important to fix.  This involved a few things to clean up hiding/showing the status bar:
  - We now determine when to hide and show it during layout, which allows us to do this at the time it is actually needed rather than during animation after we can actually catch it for the initial display of a window.  This required tweaking the layout API so the policy can request a second layout pass if needed.
  - When doing layout, we are now much more aggressive about skipping the layout of windows.  Basically anything that we know will be hidden in the near future is ignored for layout, so that it doesn't glitch as it is transfered out of the screen.  The theory being that it is better to leave it as it was originally placed while we are transitioning it out, than to switch it to something slightly more correct.
  Original author: hackbod
  Merged from: //branches/cupcake/...

Automated import of CL 143899

mid/com/android/internal/policy/impl/MidWindowManager.java
phone/com/android/internal/policy/impl/PhoneWindowManager.java

index f301533..c443332 100644 (file)
@@ -754,7 +754,8 @@ public class MidWindowManager implements WindowManagerPolicy {
     }
 
     /** {@inheritDoc} */
-    public void finishLayoutLw() {
+    public boolean finishLayoutLw() {
+        return false;
     }
 
     /** {@inheritDoc} */
index cc0588d..95dda57 100644 (file)
@@ -985,6 +985,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
         mDockBottom = mContentBottom = mCurBottom = displayHeight;
         mDockLayer = 0x10000000;
 
+        mTopFullscreenOpaqueWindowState = null;
+        mForceStatusBar = false;
+        
         // decide where the status bar goes ahead of time
         if (mStatusBar != null) {
             final Rect pf = mTmpParentFrame;
@@ -1056,7 +1059,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
     }
     
     /** {@inheritDoc} */
-    public void layoutWindowLw(WindowState win, WindowManager.LayoutParams attrs, WindowState attached) {
+    public void layoutWindowLw(WindowState win, WindowManager.LayoutParams attrs,
+            WindowState attached) {
         // we've already done the status bar
         if (win == mStatusBar) {
             return;
@@ -1180,6 +1184,18 @@ public class PhoneWindowManager implements WindowManagerPolicy {
         
         win.computeFrameLw(pf, df, cf, vf);
         
+        if (win.isVisibleLw()) {
+            if ((attrs.flags & FLAG_FORCE_NOT_FULLSCREEN) != 0) {
+                mForceStatusBar = true;
+            } else if (mTopFullscreenOpaqueWindowState == null
+                    && attrs.type >= FIRST_APPLICATION_WINDOW
+                    && attrs.type <= LAST_APPLICATION_WINDOW
+                    && win.fillsScreenLw(mW, mH, false, false)) {
+                if (DEBUG_LAYOUT) Log.v(TAG, "Fullscreen window: " + win);
+                mTopFullscreenOpaqueWindowState = win;
+            }
+        }
+        
         // Dock windows carve out the bottom of the screen, so normal windows
         // can't appear underneath them.
         if (attrs.type == TYPE_INPUT_METHOD && !win.getGivenInsetsPendingLw()) {
@@ -1200,39 +1216,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
     }
 
     /** {@inheritDoc} */
-    public void finishLayoutLw() {
-    }
-
-    /** {@inheritDoc} */
-    public void beginAnimationLw(int displayWidth, int displayHeight) {
-        mTopFullscreenOpaqueWindowState = null;
-        mForceStatusBar = false;
-    }
-
-    /** {@inheritDoc} */
-    public void animatingWindowLw(WindowState win,
-                                WindowManager.LayoutParams attrs) {
-        if (win.isVisibleLw()) {
-            if ((attrs.flags & FLAG_FORCE_NOT_FULLSCREEN) != 0) {
-                mForceStatusBar = true;
-            } else if (mTopFullscreenOpaqueWindowState == null
-                    && attrs.type >= FIRST_APPLICATION_WINDOW
-                    && attrs.type <= LAST_APPLICATION_WINDOW
-                    && win.fillsScreenLw(mW, mH, true, false)
-                    && win.isVisibleLw()) {
-                mTopFullscreenOpaqueWindowState = win;
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    public boolean finishAnimationLw() {
+    public boolean finishLayoutLw() {
         boolean changed = false;
         boolean hiding = false;
         if (mStatusBar != null) {
             //Log.i(TAG, "force=" + mForceStatusBar
             //        + " top=" + mTopFullscreenOpaqueWindowState);
             if (mForceStatusBar) {
+                if (DEBUG_LAYOUT) Log.v(TAG, "Showing status bar");
                 changed |= mStatusBar.showLw(true);
             } else if (mTopFullscreenOpaqueWindowState != null) {
                 //Log.i(TAG, "frame: " + mTopFullscreenOpaqueWindowState.getFrameLw()
@@ -1243,9 +1234,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                 boolean hideStatusBar =
                     (lp.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0;
                 if (hideStatusBar) {
+                    if (DEBUG_LAYOUT) Log.v(TAG, "Hiding status bar");
                     changed |= mStatusBar.hideLw(true);
                     hiding = true;
                 } else {
+                    if (DEBUG_LAYOUT) Log.v(TAG, "Showing status bar");
                     changed |= mStatusBar.showLw(true);
                 }
             }
@@ -1266,6 +1259,20 @@ public class PhoneWindowManager implements WindowManagerPolicy {
     }
 
     /** {@inheritDoc} */
+    public void beginAnimationLw(int displayWidth, int displayHeight) {
+    }
+
+    /** {@inheritDoc} */
+    public void animatingWindowLw(WindowState win,
+                                WindowManager.LayoutParams attrs) {
+    }
+
+    /** {@inheritDoc} */
+    public boolean finishAnimationLw() {
+        return false;
+    }
+
+    /** {@inheritDoc} */
     public boolean preprocessInputEventTq(RawInputEvent event) {
         switch (event.type) {
             case RawInputEvent.EV_SW: