Fix Password keyboard failing to pop up in LockScreen

Commit 970d9d2 instroduced IME focus controller which
added a new method View#hasImeFocus to restrict the IME keyboard
is focusble only when the focused window won't have either FLAG_NOT_FOCUSABLE
or FLAG_ALT_FOCUSABLE_IM flags.

That unexpected hit a regression that StatusBarWindowController will set
FLAG_ALT_FOCUSABLE_IM when keyguard shows up.

Since FLAG_ALT_FOCUSABLE_IM means the window should not access input
methed, but that conflicts that Password entry needs to interact with keyboard,
hence, it would be make sense remove this flag when keyboardNeedsInput
for correcting behavior.

Fix: 147879741
Test: manual test as below steps:
1) In Settings -> Security -> Screen lock, choose "Password"
2) setup Password and pressing power button to turn-off screen.
3) Turn on screen again and swipe up lock screen.
4) Check if soft-keyboard will shwon when entering Password entry.

Change-Id: I7acd387941b8ef022d636d2da804edb13c4d3ed7
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowController.java
index d346d39..fe4879b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowController.java
@@ -256,7 +256,12 @@
             mLpChanged.flags &= ~LayoutParams.FLAG_ALT_FOCUSABLE_IM;
         } else if (state.isKeyguardShowingAndNotOccluded() || panelFocusable) {
             mLpChanged.flags &= ~LayoutParams.FLAG_NOT_FOCUSABLE;
-            mLpChanged.flags |= LayoutParams.FLAG_ALT_FOCUSABLE_IM;
+            // Make sure to remove FLAG_ALT_FOCUSABLE_IM when keyguard needs input.
+            if (state.mKeyguardNeedsInput) {
+                mLpChanged.flags &= ~LayoutParams.FLAG_ALT_FOCUSABLE_IM;
+            } else {
+                mLpChanged.flags |= LayoutParams.FLAG_ALT_FOCUSABLE_IM;
+            }
         } else {
             mLpChanged.flags |= LayoutParams.FLAG_NOT_FOCUSABLE;
             mLpChanged.flags &= ~LayoutParams.FLAG_ALT_FOCUSABLE_IM;