Fixed that touches where incorrectly consumed when fullscreen

The fake window that was added when View.SYSTEM_UI_FULL_SCREEN was
set consumed all touches, even those going to the SystemUI and not
just those of windows below. The input consumer is now correctly
positioned in the window order to only capture the right touches.
Clicks to the volume panel and the heads up now correctly go to the
right place instead of just unhiding the SystemUI bars.

Bug: 21089476
Change-Id: Ib53dfc0b33b70084ca607d0f044db30b6e6c91d6
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index 7976ca4..f0c86e5 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -218,7 +218,7 @@
             @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR, to = "TYPE_NAVIGATION_BAR"),
             @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY, to = "TYPE_VOLUME_OVERLAY"),
             @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS, to = "TYPE_BOOT_PROGRESS"),
-            @ViewDebug.IntToString(from = TYPE_HIDDEN_NAV_CONSUMER, to = "TYPE_HIDDEN_NAV_CONSUMER"),
+            @ViewDebug.IntToString(from = TYPE_INPUT_CONSUMER, to = "TYPE_INPUT_CONSUMER"),
             @ViewDebug.IntToString(from = TYPE_DREAM, to = "TYPE_DREAM"),
             @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL, to = "TYPE_NAVIGATION_BAR_PANEL"),
             @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY, to = "TYPE_DISPLAY_OVERLAY"),
@@ -490,12 +490,11 @@
         public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21;
 
         /**
-         * Window type: Fake window to consume touch events when the navigation
-         * bar is hidden.
+         * Window type to consume input events when the systemUI bars are hidden.
          * In multiuser systems shows on all users' windows.
          * @hide
          */
-        public static final int TYPE_HIDDEN_NAV_CONSUMER = FIRST_SYSTEM_WINDOW+22;
+        public static final int TYPE_INPUT_CONSUMER = FIRST_SYSTEM_WINDOW+22;
 
         /**
          * Window type: Dreams (screen saver) window, just above keyguard.
diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java
index 9199af1..1b759a3 100644
--- a/core/java/android/view/WindowManagerPolicy.java
+++ b/core/java/android/view/WindowManagerPolicy.java
@@ -373,12 +373,12 @@
     }
 
     /**
-     * Representation of a "fake window" that the policy has added to the
-     * window manager to consume events.
+     * Representation of a input consumer that the policy has added to the
+     * window manager to consume input events going to windows below it.
      */
-    public interface FakeWindow {
+    public interface InputConsumer {
         /**
-         * Remove the fake window from the window manager.
+         * Remove the input consumer from the window manager.
          */
         void dismiss();
     }
@@ -402,13 +402,10 @@
         public void reevaluateStatusBarVisibility();
 
         /**
-         * Add a fake window to the window manager.  This window sits
-         * at the top of the other windows and consumes events.
+         * Add a input consumer which will consume all input events going to any window below it.
          */
-        public FakeWindow addFakeWindow(Looper looper,
-                InputEventReceiver.Factory inputEventReceiverFactory,
-                String name, int windowType, int layoutParamsFlags, int layoutParamsPrivateFlags,
-                boolean canReceiveKeys, boolean hasFocus, boolean touchFullscreen);
+        public InputConsumer addInputConsumer(Looper looper,
+                InputEventReceiver.Factory inputEventReceiverFactory);
 
         /**
          * Returns a code that describes the current state of the lid switch.