OSDN Git Service

Fix status bar window IME flags & layout
authorJorim Jaggi <jjaggi@google.com>
Thu, 21 May 2015 01:04:16 +0000 (18:04 -0700)
committerJorim Jaggi <jjaggi@google.com>
Wed, 27 May 2015 18:35:46 +0000 (11:35 -0700)
When bouncer was showing, but keyguard was occluded, staus bar
window couldn't receive input, and thus the IME window was placed
below the status bar window. In addition to that, fix the layout when
IME is showing up on the bouncer screen.

Bug: 19969474
Change-Id: I38d21647801b57608d49c3f525d4840e6ba58296

packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
services/core/java/com/android/server/policy/PhoneWindowManager.java

index 4f1c652..de42643 100644 (file)
@@ -115,8 +115,8 @@ public class StatusBarWindowManager {
 
     private void applyFocusableFlag(State state) {
         boolean panelFocusable = state.statusBarFocusable && state.panelExpanded;
-        if (state.isKeyguardShowingAndNotOccluded() && state.keyguardNeedsInput
-                && state.bouncerShowing || BaseStatusBar.ENABLE_REMOTE_INPUT && panelFocusable) {
+        if (state.keyguardShowing && state.keyguardNeedsInput && state.bouncerShowing
+                || BaseStatusBar.ENABLE_REMOTE_INPUT && panelFocusable) {
             mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
             mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
         } else if (state.isKeyguardShowingAndNotOccluded() || panelFocusable) {
index a96f4e9..3b91751 100644 (file)
@@ -67,8 +67,10 @@ public class StatusBarWindowView extends FrameLayout {
                     || insets.top != getPaddingTop()
                     || insets.right != getPaddingRight()
                     || insets.bottom != getPaddingBottom();
+
+            // Drop top inset, apply right and left inset and pass through bottom inset.
             if (changed) {
-                setPadding(insets.left, insets.top, insets.right, 0);
+                setPadding(insets.left, 0, insets.right, 0);
             }
             insets.left = 0;
             insets.top = 0;
@@ -81,6 +83,7 @@ public class StatusBarWindowView extends FrameLayout {
             if (changed) {
                 setPadding(0, 0, 0, 0);
             }
+            insets.top = 0;
         }
         return false;
     }
index 17368aa..06b30b6 100644 (file)
@@ -3642,15 +3642,24 @@ public class PhoneWindowManager implements WindowManagerPolicy {
         }
     }
 
+    private boolean canReceiveInput(WindowState win) {
+        boolean notFocusable =
+                (win.getAttrs().flags & WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) != 0;
+        boolean altFocusableIm =
+                (win.getAttrs().flags & WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM) != 0;
+        boolean notFocusableForIm = notFocusable ^ altFocusableIm;
+        return !notFocusableForIm;
+    }
+
     /** {@inheritDoc} */
     @Override
     public void layoutWindowLw(WindowState win, WindowState attached) {
-        // we've already done the status bar
-        final WindowManager.LayoutParams attrs = win.getAttrs();
-        if ((win == mStatusBar && (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) == 0) ||
-                win == mNavigationBar) {
+        // 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) {
             return;
         }
+        final WindowManager.LayoutParams attrs = win.getAttrs();
         final boolean isDefaultDisplay = win.isDefaultDisplay();
         final boolean needsToOffsetInputMethodTarget = isDefaultDisplay &&
                 (win == mLastInputMethodTargetWindow && mLastInputMethodWindow != null);
@@ -3717,7 +3726,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                     + mUnrestrictedScreenHeight;
             cf.bottom = vf.bottom = mStableBottom;
             cf.top = vf.top = mStableTop;
-        } else if (win == mStatusBar && (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) {
+        } else if (win == mStatusBar) {
             pf.left = df.left = of.left = mUnrestrictedScreenLeft;
             pf.top = df.top = of.top = mUnrestrictedScreenTop;
             pf.right = df.right = of.right = mUnrestrictedScreenWidth + mUnrestrictedScreenLeft;