summaryrefslogtreecommitdiffstats
path: root/core/jni/android_view_KeyCharacterMap.cpp
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-11-15 17:48:10 -0800
committerJeff Brown <jeffbrown@google.com>2011-11-15 18:00:10 -0800
commit1e08fe90df18930691b0c2ec22e5db25d7fcb4cf (patch)
tree772ffaafe6917d37ee65f5ed3d653230557bdc80 /core/jni/android_view_KeyCharacterMap.cpp
parent9058435dc1a741030c042c4d6f2512f5d1605e5d (diff)
downloadframeworks_base-1e08fe90df18930691b0c2ec22e5db25d7fcb4cf.zip
frameworks_base-1e08fe90df18930691b0c2ec22e5db25d7fcb4cf.tar.gz
frameworks_base-1e08fe90df18930691b0c2ec22e5db25d7fcb4cf.tar.bz2
Eliminate hw.keyboards system properties.
Stop using system properties to publish information about the key character map path. Instead, we can retrieve it on demand by asking the window manager. It was possible to exhaust the supply of system properties when repeatedly adding and removing input devices. Bug: 5532806 Change-Id: Idd361a24ad7db2edc185c8546db7fb05f9c28669
Diffstat (limited to 'core/jni/android_view_KeyCharacterMap.cpp')
-rw-r--r--core/jni/android_view_KeyCharacterMap.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/core/jni/android_view_KeyCharacterMap.cpp b/core/jni/android_view_KeyCharacterMap.cpp
index aba3a72..b9f3738 100644
--- a/core/jni/android_view_KeyCharacterMap.cpp
+++ b/core/jni/android_view_KeyCharacterMap.cpp
@@ -35,18 +35,25 @@ static struct {
} gFallbackActionClassInfo;
-static jint nativeLoad(JNIEnv *env, jobject clazz, jint deviceId) {
+static jint nativeLoad(JNIEnv *env, jobject clazz, jstring fileStr) {
+ const char* file = env->GetStringUTFChars(fileStr, NULL);
+
KeyCharacterMap* map;
- status_t status = KeyCharacterMap::loadByDeviceId(deviceId, &map);
+ status_t status = KeyCharacterMap::load(String8(file), &map);
+ jint result;
if (status) {
String8 msg;
- msg.appendFormat("Could not load key character map for device %d due to error %d. "
- "Refer to the log for details.", deviceId, status);
+ msg.appendFormat("Could not load key character map '%s' due to error %d. "
+ "Refer to the log for details.", file, status);
jniThrowException(env, "android/view/KeyCharacterMap$KeyCharacterMapUnavailableException",
msg.string());
- return 0;
+ result = 0;
+ } else {
+ result = reinterpret_cast<jint>(map);
}
- return reinterpret_cast<jint>(map);
+
+ env->ReleaseStringUTFChars(fileStr, file);
+ return result;
}
static void nativeDispose(JNIEnv *env, jobject clazz, jint ptr) {
@@ -141,7 +148,7 @@ static jobjectArray nativeGetEvents(JNIEnv *env, jobject clazz, jint ptr, jint d
static JNINativeMethod g_methods[] = {
/* name, signature, funcPtr */
- { "nativeLoad", "(I)I",
+ { "nativeLoad", "(Ljava/lang/String;)I",
(void*)nativeLoad },
{ "nativeDispose", "(I)V",
(void*)nativeDispose },