Merge "Do not share key mappings with JNI object" into rvc-dev

This commit is contained in:
Josep del Río
2023-07-10 13:10:54 +00:00
committed by Android (Google) Code Review

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
#include <binder/Parcel.h>
#include <input/Input.h>
#include <android_runtime/AndroidRuntime.h>
@@ -48,9 +49,16 @@ jobject android_view_InputDevice_create(JNIEnv* env, const InputDeviceInfo& devi
return NULL;
}
sp<KeyCharacterMap> map = deviceInfo.getKeyCharacterMap();
if (map != nullptr) {
Parcel parcel;
map->writeToParcel(&parcel);
map = map->readFromParcel(&parcel);
}
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;
}