Add support for new input sources.

Added several new coordinate values to MotionEvents to capture
touch major/minor area, tool major/minor area and orientation.

Renamed NDK input constants per convention.

Added InputDevice class in Java which will eventually provide
useful information about available input devices.

Added APIs for manufacturing new MotionEvent objects with multiple
pointers and all necessary coordinate data.

Fixed a bug in the input dispatcher where it could get stuck with
a pointer down forever.

Fixed a bug in the WindowManager where the input window list could
end up containing stale removed windows.

Fixed a bug in the WindowManager where the input channel was being
removed only after the final animation transition had taken place
which caused spurious WINDOW DIED log messages to be printed.

Change-Id: Ie55084da319b20aad29b28a0499b8dd98bb5da68
diff --git a/libs/ui/EventHub.cpp b/libs/ui/EventHub.cpp
index 768b04e..33dd373 100644
--- a/libs/ui/EventHub.cpp
+++ b/libs/ui/EventHub.cpp
@@ -168,12 +168,12 @@
                 device_t* device = mDevicesById[i].device;
                 if (device != NULL && (device->classes & deviceClasses) != 0) {
                     int32_t result = getScanCodeStateLocked(device, scanCode);
-                    if (result >= KEY_STATE_DOWN) {
+                    if (result >= AKEY_STATE_DOWN) {
                         return result;
                     }
                 }
             }
-            return KEY_STATE_UP;
+            return AKEY_STATE_UP;
         } else {
             device_t* device = getDevice(deviceId);
             if (device != NULL) {
@@ -181,7 +181,7 @@
             }
         }
     }
-    return KEY_STATE_UNKNOWN;
+    return AKEY_STATE_UNKNOWN;
 }
 
 int32_t EventHub::getScanCodeStateLocked(device_t* device, int32_t scanCode) const {
@@ -189,9 +189,9 @@
     memset(key_bitmask, 0, sizeof(key_bitmask));
     if (ioctl(mFDs[id_to_index(device->id)].fd,
                EVIOCGKEY(sizeof(key_bitmask)), key_bitmask) >= 0) {
-        return test_bit(scanCode, key_bitmask) ? KEY_STATE_DOWN : KEY_STATE_UP;
+        return test_bit(scanCode, key_bitmask) ? AKEY_STATE_DOWN : AKEY_STATE_UP;
     }
-    return KEY_STATE_UNKNOWN;
+    return AKEY_STATE_UNKNOWN;
 }
 
 int32_t EventHub::getKeyCodeState(int32_t deviceId, int32_t deviceClasses,
@@ -202,19 +202,19 @@
             device_t* device = mDevicesById[i].device;
             if (device != NULL && (device->classes & deviceClasses) != 0) {
                 int32_t result = getKeyCodeStateLocked(device, keyCode);
-                if (result >= KEY_STATE_DOWN) {
+                if (result >= AKEY_STATE_DOWN) {
                     return result;
                 }
             }
         }
-        return KEY_STATE_UP;
+        return AKEY_STATE_UP;
     } else {
         device_t* device = getDevice(deviceId);
         if (device != NULL) {
             return getKeyCodeStateLocked(device, keyCode);
         }
     }
-    return KEY_STATE_UNKNOWN;
+    return AKEY_STATE_UNKNOWN;
 }
 
 int32_t EventHub::getKeyCodeStateLocked(device_t* device, int32_t keyCode) const {
@@ -235,12 +235,12 @@
             int32_t sc = scanCodes.itemAt(i);
             //LOGI("Code %d: down=%d", sc, test_bit(sc, key_bitmask));
             if (sc >= 0 && sc <= KEY_MAX && test_bit(sc, key_bitmask)) {
-                return KEY_STATE_DOWN;
+                return AKEY_STATE_DOWN;
             }
         }
-        return KEY_STATE_UP;
+        return AKEY_STATE_UP;
     }
-    return KEY_STATE_UNKNOWN;
+    return AKEY_STATE_UNKNOWN;
 }
 
 int32_t EventHub::getSwitchState(int32_t deviceId, int32_t deviceClasses, int32_t sw) const {
@@ -251,19 +251,19 @@
         if (deviceId == -1) {
             deviceId = mSwitches[sw];
             if (deviceId == 0) {
-                return KEY_STATE_UNKNOWN;
+                return AKEY_STATE_UNKNOWN;
             }
         }
 
         device_t* device = getDevice(deviceId);
         if (device == NULL) {
-            return KEY_STATE_UNKNOWN;
+            return AKEY_STATE_UNKNOWN;
         }
 
         return getSwitchStateLocked(device, sw);
     }
 #endif
-    return KEY_STATE_UNKNOWN;
+    return AKEY_STATE_UNKNOWN;
 }
 
 int32_t EventHub::getSwitchStateLocked(device_t* device, int32_t sw) const {
@@ -271,9 +271,9 @@
     memset(sw_bitmask, 0, sizeof(sw_bitmask));
     if (ioctl(mFDs[id_to_index(device->id)].fd,
                EVIOCGSW(sizeof(sw_bitmask)), sw_bitmask) >= 0) {
-        return test_bit(sw, sw_bitmask) ? KEY_STATE_DOWN : KEY_STATE_UP;
+        return test_bit(sw, sw_bitmask) ? AKEY_STATE_DOWN : AKEY_STATE_UP;
     }
-    return KEY_STATE_UNKNOWN;
+    return AKEY_STATE_UNKNOWN;
 }
 
 status_t EventHub::scancodeToKeycode(int32_t deviceId, int scancode,