Update voice interaction layer for new UI design.

Can switch from a pure overlay at the top of the screen,
to interactive mode with the voice UI drawing at the bottom
and pushing its target activity up like an IME.

Add mechanism to get assist data to the voice interaction UI.

Add some basic visualization of the assist data, outlining
where on the screen we have text.

Add a test ACTION_ASSIST handler, which can propagate the
assist data it gets to the voice interaction session so
you can see what kind of data we are getting from different
apps.

Change-Id: I18312fe1601d7926d1fb96a817638d60f6263771
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 5bb193a..ff274b6 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -3554,7 +3554,7 @@
                 pf.bottom = df.bottom = of.bottom = cf.bottom
                         = mOverscanScreenTop + mOverscanScreenHeight;
             }
-        } else  if (attrs.type == TYPE_INPUT_METHOD) {
+        } else  if (attrs.type == TYPE_INPUT_METHOD || attrs.type == TYPE_VOICE_INTERACTION) {
             pf.left = df.left = of.left = cf.left = vf.left = mDockLeft;
             pf.top = df.top = of.top = cf.top = vf.top = mDockTop;
             pf.right = df.right = of.right = cf.right = vf.right = mDockRight;
@@ -3936,7 +3936,7 @@
     }
 
     private void offsetInputMethodWindowLw(WindowState win) {
-        int top = win.getContentFrameLw().top;
+        int top = win.getDisplayFrameLw().top;
         top += win.getGivenContentInsetsLw().top;
         if (mContentBottom > top) {
             mContentBottom = top;
@@ -3955,36 +3955,10 @@
     }
 
     private void offsetVoiceInputWindowLw(WindowState win) {
-        final int gravity = win.getAttrs().gravity;
-        switch (gravity&((Gravity.AXIS_PULL_BEFORE|Gravity.AXIS_PULL_AFTER)
-                << Gravity.AXIS_X_SHIFT)) {
-            case Gravity.AXIS_PULL_BEFORE<<Gravity.AXIS_X_SHIFT: {
-                int right = win.getContentFrameLw().right - win.getGivenContentInsetsLw().right;
-                if (mVoiceContentLeft < right) {
-                    mVoiceContentLeft = right;
-                }
-            } break;
-            case Gravity.AXIS_PULL_AFTER<<Gravity.AXIS_X_SHIFT: {
-                int left = win.getContentFrameLw().left - win.getGivenContentInsetsLw().left;
-                if (mVoiceContentRight < left) {
-                    mVoiceContentRight = left;
-                }
-            } break;
-        }
-        switch (gravity&((Gravity.AXIS_PULL_BEFORE|Gravity.AXIS_PULL_AFTER)
-                << Gravity.AXIS_Y_SHIFT)) {
-            case Gravity.AXIS_PULL_BEFORE<<Gravity.AXIS_Y_SHIFT: {
-                int bottom = win.getContentFrameLw().bottom - win.getGivenContentInsetsLw().bottom;
-                if (mVoiceContentTop < bottom) {
-                    mVoiceContentTop = bottom;
-                }
-            } break;
-            case Gravity.AXIS_PULL_AFTER<<Gravity.AXIS_Y_SHIFT: {
-                int top = win.getContentFrameLw().top - win.getGivenContentInsetsLw().top;
-                if (mVoiceContentBottom < top) {
-                    mVoiceContentBottom = top;
-                }
-            } break;
+        int top = win.getDisplayFrameLw().top;
+        top += win.getGivenContentInsetsLw().top;
+        if (mVoiceContentBottom > top) {
+            mVoiceContentBottom = top;
         }
     }
 
@@ -6385,9 +6359,8 @@
         }
         if (mStatusBar != null) {
             pw.print(prefix); pw.print("mStatusBar=");
-                    pw.println(mStatusBar);
-            pw.print(prefix); pw.print("isStatusBarKeyguard=");
-                    pw.print(isStatusBarKeyguard());
+                    pw.print(mStatusBar); pw.print(" isStatusBarKeyguard=");
+                    pw.println(isStatusBarKeyguard());
         }
         if (mNavigationBar != null) {
             pw.print(prefix); pw.print("mNavigationBar=");