Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6676e5a8 authored by Josep del Río's avatar Josep del Río Committed by Android (Google) Code Review
Browse files

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

parents d40861be 4b3c4620
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -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()));
                                                                       map));
    if (!kcmObj.get()) {
        return NULL;
    }