Recalculate input method top edge.

The bottom edge of an input method target window is set using the top
edge of the input method window. A switch from using the input
method's content frame's top edge to its display frame's top edge
(ag/634725) caused the underlying window to be obscured. This fix uses
the lower of the two frames to set the bottom edge of the target
window.

Fixes bug 19434816.

Change-Id: I5fe73fbe8a432b24a12c030f029cdfcd55e23274
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index cdd6c7f..a185e52 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -3991,7 +3991,7 @@
     }
 
     private void offsetInputMethodWindowLw(WindowState win) {
-        int top = win.getDisplayFrameLw().top;
+        int top = Math.max(win.getDisplayFrameLw().top, win.getContentFrameLw().top);
         top += win.getGivenContentInsetsLw().top;
         if (mContentBottom > top) {
             mContentBottom = top;
@@ -4010,7 +4010,7 @@
     }
 
     private void offsetVoiceInputWindowLw(WindowState win) {
-        int top = win.getDisplayFrameLw().top;
+        int top = Math.max(win.getDisplayFrameLw().top, win.getContentFrameLw().top);
         top += win.getGivenContentInsetsLw().top;
         if (mVoiceContentBottom > top) {
             mVoiceContentBottom = top;