Prevent IME from showing when AOD shown or windows not drawn.

There's always been a possibility for IME to be visible even after the
screen was turned off. This was normally harmless because the IME was
placed behind the lock screen. The lock screen was opaque so it would
cover the IME, even in the case with AOD. However, with AOD live
wallpaper, the lock screen can now be transparent. This causes the IME
to be shown in between the wallpaper and lock screen.

To prevent IME from showing, several things needed to change.
1. The flag that was sent from sysui to AM is now propagated to WM. If
AOD is showing, IME should be hidden.
2. That flag sometimes is not a guarantee because AOD could be exiting,
but still shown on screen. Instead, also rely on the
mWindowManagerDrawComplete since that's only true when the windows have
completed drawing. The IME only needs to be shown if the other windows
on screen have drawn.

Test: Open IME and allow screen to timeout. When AOD turns on with
live wallpaper, IME is hidden.
Test: Within 5 seconds after AOD is turned on, turn screen on. Screen
turns on without IME flicker.
Fixes: 79658086

Change-Id: Ife93bdfde8ba2914930497356c0e16ebd629c507
diff --git a/services/core/java/com/android/server/am/KeyguardController.java b/services/core/java/com/android/server/am/KeyguardController.java
index ddf9552..30fa72f 100644
--- a/services/core/java/com/android/server/am/KeyguardController.java
+++ b/services/core/java/com/android/server/am/KeyguardController.java
@@ -129,6 +129,7 @@
         mKeyguardShowing = keyguardShowing;
         mAodShowing = aodShowing;
         mSecondaryDisplayShowing = secondaryDisplayShowing;
+        mWindowManager.setAodShowing(aodShowing);
         if (showingChanged) {
             dismissDockedStackIfNeeded();
             setKeyguardGoingAway(false);