Native input event dispatching.

Target identification is now fully native.
Fixed a couple of minor issues related to input injection.
Native input enabled by default, can be disabled by setting
WindowManagerPolicy.ENABLE_NATIVE_INPUT_DISPATCH to false.

Change-Id: I7edf66ed3e987cc9306ad4743ac57a116af452ff
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java
index 4854190..1dc82e8 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/ViewRoot.java
@@ -1762,6 +1762,15 @@
             sWindowSession.remove(mWindow);
         } catch (RemoteException e) {
         }
+        
+        if (WindowManagerPolicy.ENABLE_NATIVE_INPUT_DISPATCH) {
+            // Dispose the input channel after removing the window so the Window Manager
+            // doesn't interpret the input channel being closed as an abnormal termination.
+            if (mInputChannel != null) {
+                mInputChannel.dispose();
+                mInputChannel = null;
+            }
+        }
     }
 
     void updateConfiguration(Configuration config, boolean force) {