Merge "Do not share key mappings with JNI object" into sc-dev am: 4a45e9c435 am: 77cbfcd9a8 am: c6952e05d1 am: b3bb4cfe8a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23785419 Change-Id: I6eac151f9bb2db94adb1620a5e8cd4b577f54d4c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -42,6 +42,13 @@ jobject android_view_InputDevice_create(JNIEnv* env, const InputDeviceInfo& devi
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// b/274058082: Pass a copy of the key character map to avoid concurrent
|
||||
// access
|
||||
std::shared_ptr<KeyCharacterMap> map = deviceInfo.getKeyCharacterMap();
|
||||
if (map != nullptr) {
|
||||
map = std::make_shared<KeyCharacterMap>(*map);
|
||||
}
|
||||
|
||||
ScopedLocalRef<jstring> descriptorObj(env,
|
||||
env->NewStringUTF(deviceInfo.getIdentifier().descriptor.c_str()));
|
||||
if (!descriptorObj.get()) {
|
||||
@@ -49,8 +56,8 @@ jobject android_view_InputDevice_create(JNIEnv* env, const InputDeviceInfo& devi
|
||||
}
|
||||
|
||||
ScopedLocalRef<jobject> kcmObj(env,
|
||||
android_view_KeyCharacterMap_create(env, deviceInfo.getId(),
|
||||
deviceInfo.getKeyCharacterMap()));
|
||||
android_view_KeyCharacterMap_create(env, deviceInfo.getId(),
|
||||
map));
|
||||
if (!kcmObj.get()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user