Move key attribute information into KeyEvent.

This consolidates all of the information that was in the native
KeyEvent and the KeyLayout files into the managed KeyEvent class.

It also moves the definition for all of the key names to the native
side, rather than having them in both places.

Change-Id: I172e3b554e7eb52c79ae2ec406ef4332e8b25ffa
diff --git a/core/jni/android_view_KeyEvent.cpp b/core/jni/android_view_KeyEvent.cpp
index c83541d..7ae21a7 100644
--- a/core/jni/android_view_KeyEvent.cpp
+++ b/core/jni/android_view_KeyEvent.cpp
@@ -22,6 +22,7 @@
 #include <android_runtime/Log.h>
 #include <utils/Log.h>
 #include <input/Input.h>
+#include <ScopedUtfChars.h>
 #include "android_view_KeyEvent.h"
 
 namespace android {
@@ -102,20 +103,25 @@
     return OK;
 }
 
-static jboolean native_isSystemKey(JNIEnv* env, jobject clazz, jint keyCode) {
-    return KeyEvent::isSystemKey(keyCode);
+static jstring android_view_KeyEvent_nativeKeyCodeToString(JNIEnv* env, jobject clazz,
+        jint keyCode) {
+    return env->NewStringUTF(KeyEvent::getLabel(keyCode));
 }
 
-static jboolean native_hasDefaultAction(JNIEnv* env, jobject clazz, jint keyCode) {
-    return KeyEvent::hasDefaultAction(keyCode);
+static jint android_view_KeyEvent_nativeKeyCodeFromString(JNIEnv* env, jobject clazz,
+        jstring label) {
+    ScopedUtfChars keyLabel(env, label);
+    return KeyEvent::getKeyCodeFromLabel(keyLabel.c_str());
 }
 
 
 // ----------------------------------------------------------------------------
 
 static const JNINativeMethod g_methods[] = {
-    { "native_isSystemKey", "(I)Z", (void*)native_isSystemKey },
-    { "native_hasDefaultAction", "(I)Z", (void*)native_hasDefaultAction },
+    { "nativeKeyCodeToString", "(I)Ljava/lang/String;",
+        (void*)android_view_KeyEvent_nativeKeyCodeToString},
+    { "nativeKeyCodeFromString", "(Ljava/lang/String;)I",
+        (void*)android_view_KeyEvent_nativeKeyCodeFromString},
 };
 
 #define FIND_CLASS(var, className) \